本文整理汇总了Java中org.onosproject.bgpio.types.BgpValueType类的典型用法代码示例。如果您正苦于以下问题:Java BgpValueType类的具体用法?Java BgpValueType怎么用?Java BgpValueType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BgpValueType类属于org.onosproject.bgpio.types包,在下文中一共展示了BgpValueType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bgpOpenMessageTest4
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
@Test
public void bgpOpenMessageTest4() throws InterruptedException {
// Open message with invalid as number
peer1.peerChannelHandler.asNumber = 200;
peer1.peerChannelHandler.version = 4;
peer1.peerChannelHandler.holdTime = 120;
peer1.peerChannelHandler.isLargeAsCapabilitySet = true;
BgpValueType tempTlv = new FourOctetAsNumCapabilityTlv(766545);
peer1.peerChannelHandler.capabilityTlv.add(tempTlv);
peer1.connect(connectToSocket);
boolean result;
result = peer1.peerFrameDecoder.receivedNotificationMessageLatch.await(
MESSAGE_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
assertThat(result, is(true));
}
示例2: bgpOpenMessageTest5
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
@Test
public void bgpOpenMessageTest5() throws InterruptedException {
// Open message with LS capability
short afi = 16388;
byte res = 0;
byte safi = 71;
peer1.peerChannelHandler.asNumber = 200;
peer1.peerChannelHandler.version = 4;
peer1.peerChannelHandler.holdTime = 120;
bgpControllerImpl.getConfig().setLsCapability(true);
BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
peer1.connect(connectToSocket);
boolean result;
result = peer1.peerFrameDecoder.receivedOpenMessageLatch.await(
MESSAGE_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
assertThat(result, is(true));
result = peer1.peerFrameDecoder.receivedKeepaliveMessageLatch.await(
MESSAGE_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
assertThat(result, is(true));
}
示例3: bgpOpenMessageTest7
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
@Test
public void bgpOpenMessageTest7() throws InterruptedException {
// Open message with both LS capability and as4 capability
short afi = 16388;
byte res = 0;
byte safi = 71;
peer1.peerChannelHandler.asNumber = 200;
peer1.peerChannelHandler.version = 4;
peer1.peerChannelHandler.holdTime = 120;
peer1.peerChannelHandler.isLargeAsCapabilitySet = true;
bgpControllerImpl.getConfig().setLargeASCapability(true);
BgpValueType tempTlv = new FourOctetAsNumCapabilityTlv(200);
peer1.peerChannelHandler.capabilityTlv.add(tempTlv);
bgpControllerImpl.getConfig().setLsCapability(true);
BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
peer1.connect(connectToSocket);
boolean result;
result = peer1.peerFrameDecoder.receivedOpenMessageLatch.await(
MESSAGE_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
assertThat(result, is(true));
}
示例4: bgpOpenMessageTest8
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
@Test
public void bgpOpenMessageTest8() throws InterruptedException {
// Open message with route policy distribution capability
short afi = Constants.AFI_FLOWSPEC_RPD_VALUE;
byte res = 0;
byte safi = Constants.SAFI_FLOWSPEC_RPD_VALUE;
peer1.peerChannelHandler.asNumber = 200;
peer1.peerChannelHandler.version = 4;
peer1.peerChannelHandler.holdTime = 120;
bgpControllerImpl.getConfig().setFlowSpecRpdCapability(true);
BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
peer1.connect(connectToSocket);
boolean result;
result = peer1.peerFrameDecoder.receivedOpenMessageLatch.await(
MESSAGE_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
assertThat(result, is(true));
}
示例5: bgpTopologyProviderTestAddDevice3
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
/**
* Delete node when node does not exist, RIB count should be zero.
*/
@Test
public void bgpTopologyProviderTestAddDevice3() {
LinkedList<BgpValueType> subTlvs;
BgpValueType tlv = new AutonomousSystemTlv(10);
short deslength = AutonomousSystemTlv.LENGTH;
short desType = AutonomousSystemTlv.TYPE;
subTlvs = new LinkedList<>();
subTlvs.add(tlv);
BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength,
desType));
BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false,
new RouteDistinguisher());
for (BgpNodeListener l : controller.nodeListener) {
l.deleteNode(nodeNlri);
assertThat(nodeRegistry.connected.size(), is(0));
}
}
示例6: processWideCommTarget
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
WideCommunityTarget processWideCommTarget(ExtTarget flow) {
ExtPrefix localSpeaker;
ExtPrefix remoteSpeaker;
ListIterator<IpPrefix> pfxItr = null;
ListIterator<IpPrefix> pfxItr1 = null;
List<BgpValueType> wcIpv4 = null;
ExtTarget target = flow;
WideCommunityIpV4Neighbour wcIpV4Neighbour = null;
WideCommunityTarget wcTarget = null;
localSpeaker = target.localSpeaker();
remoteSpeaker = target.remoteSpeaker();
wcIpV4Neighbour = new WideCommunityIpV4Neighbour();
pfxItr = localSpeaker.prefix().listIterator();
pfxItr1 = remoteSpeaker.prefix().listIterator();
while (pfxItr.hasNext()) {
wcIpV4Neighbour.add(pfxItr.next().address(), pfxItr1.next().address());
}
wcIpv4 = new ArrayList<>();
wcIpv4.add(wcIpV4Neighbour);
wcTarget = new WideCommunityTarget(wcIpv4);
return wcTarget;
}
示例7: processWideCommExcTarget
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
WideCommunityExcludeTarget processWideCommExcTarget(ExtTarget flow) {
ExtPrefix localSpeaker;
ExtPrefix remoteSpeaker;
ListIterator<IpPrefix> pfxItr = null;
ListIterator<IpPrefix> pfxItr1 = null;
List<BgpValueType> wcIpv4 = null;
ExtTarget target = flow;
localSpeaker = target.localSpeaker();
remoteSpeaker = target.remoteSpeaker();
WideCommunityIpV4Neighbour wcIpV4Neighbour = null;
wcIpV4Neighbour = new WideCommunityIpV4Neighbour();
WideCommunityExcludeTarget wcExcludeTarget = null;
pfxItr = localSpeaker.prefix().listIterator();
pfxItr1 = remoteSpeaker.prefix().listIterator();
while (pfxItr.hasNext()) {
wcIpV4Neighbour.add(pfxItr.next().address(), pfxItr1.next().address());
}
wcIpv4 = new ArrayList<>();
wcIpv4.add(wcIpV4Neighbour);
wcExcludeTarget = new WideCommunityExcludeTarget(wcIpv4);
return wcExcludeTarget;
}
示例8: add
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
/**
* Obtains instance of this class by appending stringBuilder with node descriptor value.
*
* @param value node descriptor
* @return instance of this class
*/
public BgpDpid add(final NodeDescriptors value) {
log.info("BgpDpid :: add function");
if (value != null) {
List<BgpValueType> subTlvs = value.getSubTlvs();
ListIterator<BgpValueType> listIterator = subTlvs.listIterator();
while (listIterator.hasNext()) {
BgpValueType tlv = listIterator.next();
if (tlv.getType() == AutonomousSystemTlv.TYPE) {
this.stringBuilder.append(":ASN=").append(((AutonomousSystemTlv) tlv).getAsNum());
} else if (tlv.getType() == BgpLSIdentifierTlv.TYPE) {
this.stringBuilder.append(":DOMAINID=").append(((BgpLSIdentifierTlv) tlv).getBgpLsIdentifier());
} else if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) {
if (tlv instanceof IsIsNonPseudonode) {
this.stringBuilder.append(":ISOID=").append(
isoNodeIdString(((IsIsNonPseudonode) tlv).getIsoNodeId()));
} else if (tlv instanceof IsIsPseudonode) {
IsIsPseudonode isisPseudonode = ((IsIsPseudonode) tlv);
this.stringBuilder.append(":ISOID=").append(
isoNodeIdString(((IsIsPseudonode) tlv).getIsoNodeId()));
this.stringBuilder.append(":PSN=").append(isisPseudonode.getPsnIdentifier());
} else if (tlv instanceof OspfNonPseudonode) {
this.stringBuilder.append(":RID=").append(((OspfNonPseudonode) tlv).getrouterID());
} else if (tlv instanceof OspfPseudonode) {
this.stringBuilder.append(":RID=").append(((OspfPseudonode) tlv).getrouterID());
}
}
}
}
return this;
}
示例9: setPathAttrDetails
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
/**
* Sets BGP path attribute and NLRI details.
*
* @param nlriInfo MpReachNlri path attribute
* @param pathAttr list of BGP path attributes
* @return details object of PathAttrNlriDetails
* @throws BgpParseException throw exception
*/
public PathAttrNlriDetails setPathAttrDetails(BgpLSNlri nlriInfo, List<BgpValueType> pathAttr)
throws BgpParseException {
PathAttrNlriDetails details = new PathAttrNlriDetails();
details.setProtocolID(nlriInfo.getProtocolId());
details.setIdentifier(nlriInfo.getIdentifier());
details.setPathAttribute(pathAttr);
return details;
}
示例10: BgpSessionInfoImpl
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
/**
* Initialize session info.
*
*@param remoteBgpId remote peer id
*@param remoteBgpVersion remote peer version
*@param remoteBgpASNum remote peer AS number
*@param remoteBgpholdTime remote peer hold time
*@param remoteBgpIdentifier remote peer identifier
*@param negotiatedholdTime negotiated hold time
*@param isIbgpSession session type ibgp/ebgp
*@param remoteBgpCapability remote peer capabilities
*/
public BgpSessionInfoImpl(BgpId remoteBgpId, BgpVersion remoteBgpVersion, long remoteBgpASNum,
short remoteBgpholdTime, int remoteBgpIdentifier, short negotiatedholdTime,
boolean isIbgpSession, List<BgpValueType> remoteBgpCapability) {
this.remoteBgpId = remoteBgpId;
this.remoteBgpVersion = remoteBgpVersion;
this.remoteBgpASNum = remoteBgpASNum;
this.remoteBgpholdTime = remoteBgpholdTime;
this.remoteBgpIdentifier = remoteBgpIdentifier;
this.negotiatedholdTime = negotiatedholdTime;
this.isIbgpSession = isIbgpSession;
this.remoteBgpCapability = remoteBgpCapability;
}
示例11: BgpPeerChannelHandlerTest
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
/**
* Constructor to initialize all variables of BGP Open message.
*
* @param version BGP version in open message
* @param asNumber AS number in open message
* @param holdTime hold time in open message
* @param bgpId BGP identifier in open message
* @param capabilityTlv capabilities in open message
*/
public BgpPeerChannelHandlerTest(byte version,
short asNumber,
short holdTime,
int bgpId,
boolean isLargeAsCapabilitySet,
LinkedList<BgpValueType> capabilityTlv) {
this.version = version;
this.asNumber = asNumber;
this.holdTime = holdTime;
this.bgpId = bgpId;
this.isLargeAsCapabilitySet = isLargeAsCapabilitySet;
this.capabilityTlv = capabilityTlv;
}
示例12: bgpOpenMessageTest6
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
@Test
public void bgpOpenMessageTest6() throws InterruptedException {
// Open message with as4 capability
peer1.peerChannelHandler.asNumber = 200;
peer1.peerChannelHandler.version = 4;
peer1.peerChannelHandler.holdTime = 120;
peer1.peerChannelHandler.isLargeAsCapabilitySet = true;
bgpControllerImpl.getConfig().setLargeASCapability(true);
BgpValueType tempTlv = new FourOctetAsNumCapabilityTlv(200);
peer1.peerChannelHandler.capabilityTlv.add(tempTlv);
peer1.connect(connectToSocket);
boolean result;
result = peer1.peerFrameDecoder.receivedOpenMessageLatch.await(
MESSAGE_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
assertThat(result, is(true));
result = peer1.peerFrameDecoder.receivedKeepaliveMessageLatch.await(
MESSAGE_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
assertThat(result, is(true));
result = peer1.peerFrameDecoder.receivedKeepaliveMessageLatch.await(
MESSAGE_TIMEOUT_MS,
TimeUnit.MILLISECONDS);
assertThat(result, is(true));
}
示例13: testBgpUpdateMessage1
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
/**
* Peer1 has Node NLRI (MpReach).
*/
@Test
public void testBgpUpdateMessage1() throws InterruptedException {
// Initiate the connections
peer1.peerChannelHandler.asNumber = 200;
peer1.peerChannelHandler.version = 4;
peer1.peerChannelHandler.holdTime = 120;
short afi = 16388;
byte res = 0;
byte safi = 71;
bgpControllerImpl.getConfig().setLsCapability(true);
BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.9", 0));
TimeUnit.MILLISECONDS.sleep(1000);
//Get peer1
BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.9"));
BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
LinkedList<BgpValueType> subTlvs = new LinkedList<>();
BgpValueType tlv = AutonomousSystemTlv.of(2478);
subTlvs.add(tlv);
tlv = BgpLSIdentifierTlv.of(33686018);
subTlvs.add(tlv);
NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x10, (short) 256);
BgpNodeLSIdentifier key = new BgpNodeLSIdentifier(nodeDes);
AdjRibIn adj = peer.adjRib();
//In Adj-RIB, nodeTree should contains specified key
assertThat(adj.nodeTree().containsKey(key), is(true));
BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
//In Local-RIB, nodeTree should contains specified key
assertThat(obj.nodeTree().containsKey(key), is(true));
}
示例14: equals
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof BgpFlowSpecNlri) {
int countObjSubTlv = 0;
int countOtherSubTlv = 0;
boolean isCommonSubTlv = true;
BgpFlowSpecNlri other = (BgpFlowSpecNlri) obj;
Iterator<BgpValueType> objListIterator = other.flowSpecComponents.iterator();
countOtherSubTlv = other.flowSpecComponents.size();
countObjSubTlv = flowSpecComponents.size();
if (countObjSubTlv != countOtherSubTlv) {
return false;
} else {
while (objListIterator.hasNext() && isCommonSubTlv) {
BgpValueType subTlv = objListIterator.next();
if (flowSpecComponents.contains(subTlv) && other.flowSpecComponents.contains(subTlv)) {
isCommonSubTlv = Objects.equals(flowSpecComponents.get(flowSpecComponents.indexOf(subTlv)),
other.flowSpecComponents.get(other.flowSpecComponents.indexOf(subTlv)));
} else {
isCommonSubTlv = false;
}
}
return isCommonSubTlv;
}
}
return false;
}
示例15: updateBufferIdenticalFlowTypes
import org.onosproject.bgpio.types.BgpValueType; //导入依赖的package包/类
/**
* Update buffer with identical flow types.
*
* @param cb channel buffer
*/
public static void updateBufferIdenticalFlowTypes(ChannelBuffer cb, BgpFlowSpecNlri bgpFlowSpecNlri) {
List<BgpValueType> flowSpec = bgpFlowSpecNlri.flowSpecComponents();
ListIterator<BgpValueType> listIterator = flowSpec.listIterator();
while (listIterator.hasNext()) {
ChannelBuffer flowSpecTmpBuff = ChannelBuffers.dynamicBuffer();
int tmpBuffStartIndx = flowSpecTmpBuff.writerIndex();
BgpValueType tlv = listIterator.next();
writeFlowType(tlv, flowSpecTmpBuff);
/* RFC 5575: section 4, If the NLRI length value is smaller than 240 (0xf0 hex), the length
field can be encoded as a single octet. Otherwise, it is encoded as
an extended-length 2-octet values */
int len = flowSpecTmpBuff.writerIndex() - tmpBuffStartIndx;
if (len >= FLOW_SPEC_LEN) {
cb.writeShort(len);
} else {
cb.writeByte(len);
}
//Copy from bynamic buffer to channel buffer
cb.writeBytes(flowSpecTmpBuff);
}
return;
}