本文整理汇总了Java中org.onosproject.bgpio.types.IsIsNonPseudonode类的典型用法代码示例。如果您正苦于以下问题:Java IsIsNonPseudonode类的具体用法?Java IsIsNonPseudonode怎么用?Java IsIsNonPseudonode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IsIsNonPseudonode类属于org.onosproject.bgpio.types包,在下文中一共展示了IsIsNonPseudonode类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import org.onosproject.bgpio.types.IsIsNonPseudonode; //导入依赖的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;
}
示例2: add
import org.onosproject.bgpio.types.IsIsNonPseudonode; //导入依赖的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.debug("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;
}
示例3: testBgpUpdateMessage3
import org.onosproject.bgpio.types.IsIsNonPseudonode; //导入依赖的package包/类
/**
* Peer1 has Link NLRI (MpReach).
*/
@Test
public void testBgpUpdateMessage3() throws InterruptedException, TestUtilsException {
// 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.10", 0));
TimeUnit.MILLISECONDS.sleep(1000);
//Get peer1
BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.10"));
BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
LinkedList<BgpValueType> localNodeSubTlvs = new LinkedList<>();
LinkedList<BgpValueType> remoteNodeSubTlvs = new LinkedList<>();
BgpValueType tlv = AutonomousSystemTlv.of(2222);
localNodeSubTlvs.add(tlv);
remoteNodeSubTlvs.add(tlv);
tlv = BgpLSIdentifierTlv.of(33686018);
localNodeSubTlvs.add(tlv);
remoteNodeSubTlvs.add(tlv);
byte[] isoNodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21 };
tlv = IsIsPseudonode.of(isoNodeID, (byte) 0x03);
localNodeSubTlvs.add(tlv);
isoNodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21 };
tlv = IsIsNonPseudonode.of(isoNodeID);
remoteNodeSubTlvs.add(tlv);
NodeDescriptors localNodeDes = new NodeDescriptors(localNodeSubTlvs, (short) 0x1b, (short) 256);
NodeDescriptors remoteNodeDes = new NodeDescriptors(remoteNodeSubTlvs, (short) 0x1a, (short) 0x101);
LinkedList<BgpValueType> linkDescriptor = new LinkedList<>();
tlv = IPv4AddressTlv.of(Ip4Address.valueOf("2.2.2.2"), (short) 0x103);
linkDescriptor.add(tlv);
BgpLinkLSIdentifier key = new BgpLinkLSIdentifier(localNodeDes, remoteNodeDes, linkDescriptor);
TimeUnit.MILLISECONDS.sleep(200);
AdjRibIn adj = peer.adjRib();
//In Adj-RIB, linkTree should contain specified key
assertThat(adj.linkTree().containsKey(key), is(true));
BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
TimeUnit.MILLISECONDS.sleep(200);
//In Local-RIB, linkTree should contain specified key
assertThat(obj.linkTree().containsKey(key), is(true));
}
示例4: testBgpUpdateMessage8
import org.onosproject.bgpio.types.IsIsNonPseudonode; //导入依赖的package包/类
/**
* Peer1 has Prefix NLRI (MpReach).
*/
@Test
public void testBgpUpdateMessage8() throws InterruptedException {
// Initiate the connections
peer1.peerChannelHandler.asNumber = 200;
peer1.peerChannelHandler.version = 4;
peer1.peerChannelHandler.holdTime = 150;
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.20", 0));
TimeUnit.MILLISECONDS.sleep(1000);
//Get peer1
BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.20"));
BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
LinkedList<BgpValueType> subTlvs = new LinkedList<>();
BgpValueType tlv = AutonomousSystemTlv.of(2222);
subTlvs.add(tlv);
tlv = BgpLSIdentifierTlv.of(33686018);
subTlvs.add(tlv);
byte[] isoNodeID = new byte[] {0x19, 0x21, 0x68, 0x07, 0x70, 0x01};
tlv = IsIsNonPseudonode.of(isoNodeID);
subTlvs.add(tlv);
NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x1a, (short) 256);
LinkedList<BgpValueType> prefixDescriptor = new LinkedList<>();
byte[] prefix = new byte[] {0x20, (byte) 0xc0, (byte) 0xa8, 0x4d, 0x01};
ChannelBuffer tempCb = ChannelBuffers.dynamicBuffer();
tempCb.writeBytes(prefix);
tlv = IPReachabilityInformationTlv.read(tempCb, (short) 5);
prefixDescriptor.add(tlv);
BgpPrefixLSIdentifier key = new BgpPrefixLSIdentifier(nodeDes, prefixDescriptor);
AdjRibIn adj = peer.adjRib();
//In Adj-RIB, prefixTree should contain specified key
assertThat(adj.prefixTree().containsKey(key), is(true));
BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
//In Local-RIB, prefixTree should contain specified key
assertThat(obj.prefixTree().containsKey(key), is(true));
}
示例5: read
import org.onosproject.bgpio.types.IsIsNonPseudonode; //导入依赖的package包/类
/**
* Reads node descriptors Sub-TLVs.
*
* @param cb ChannelBuffer
* @param desLength node descriptor length
* @param desType local node descriptor or remote node descriptor type
* @param protocolId protocol ID
* @return object of NodeDescriptors
* @throws BgpParseException while parsing node descriptors
*/
public static NodeDescriptors read(ChannelBuffer cb, short desLength, short desType, byte protocolId)
throws BgpParseException {
log.debug("Read NodeDescriptor");
List<BgpValueType> subTlvs = new LinkedList<>();
BgpValueType tlv = null;
while (cb.readableBytes() > 0) {
ChannelBuffer tempBuf = cb.copy();
short type = cb.readShort();
short length = cb.readShort();
if (cb.readableBytes() < length) {
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.OPTIONAL_ATTRIBUTE_ERROR,
tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
}
ChannelBuffer tempCb = cb.readBytes(length);
switch (type) {
case AutonomousSystemTlv.TYPE:
tlv = AutonomousSystemTlv.read(tempCb);
break;
case BgpLSIdentifierTlv.TYPE:
tlv = BgpLSIdentifierTlv.read(tempCb);
break;
case AreaIDTlv.TYPE:
tlv = AreaIDTlv.read(tempCb);
break;
case IGP_ROUTERID_TYPE:
if (protocolId == IS_IS_LEVEL_1_PROTOCOL_ID || protocolId == IS_IS_LEVEL_2_PROTOCOL_ID) {
boolean isNonPseudoNode = true;
if ((length == ISISPSEUDONODE_LEN) && (tempCb.getByte(ISISPSEUDONODE_LEN - 1) != 0)) {
isNonPseudoNode = false;
}
if (isNonPseudoNode) {
tlv = IsIsNonPseudonode.read(tempCb);
} else {
tlv = IsIsPseudonode.read(tempCb);
}
} else if (protocolId == OSPF_V2_PROTOCOL_ID || protocolId == OSPF_V3_PROTOCOL_ID) {
if (length == OSPFNONPSEUDONODE_LEN) {
tlv = OspfNonPseudonode.read(tempCb);
} else if (length == OSPFPSEUDONODE_LEN) {
tlv = OspfPseudonode.read(tempCb);
}
}
break;
default:
UnSupportedAttribute.skipBytes(tempCb, length);
}
subTlvs.add(tlv);
}
return new NodeDescriptors(subTlvs, desLength, desType);
}
示例6: compareTo
import org.onosproject.bgpio.types.IsIsNonPseudonode; //导入依赖的package包/类
/**
* Compares this and o object.
*
* @param o object to be compared with this object
* @return which object is greater
*/
public int compareTo(Object o) {
if (this.equals(o)) {
return 0;
}
ListIterator<BgpValueType> listIterator = subTlvs.listIterator();
int countOtherSubTlv = ((NodeDescriptors) o).subTlvs.size();
int countObjSubTlv = subTlvs.size();
boolean tlvFound = false;
if (countOtherSubTlv != countObjSubTlv) {
if (countOtherSubTlv > countObjSubTlv) {
return 1;
} else {
return -1;
}
} else {
while (listIterator.hasNext()) {
BgpValueType tlv1 = listIterator.next();
log.debug("NodeDescriptor compare subtlv's");
for (BgpValueType tlv : ((NodeDescriptors) o).subTlvs) {
if (tlv.getType() == tlv1.getType()) {
if (tlv.getType() == IGP_ROUTERID_TYPE) {
if ((tlv1 instanceof IsIsNonPseudonode && tlv instanceof IsIsPseudonode)
|| (tlv1 instanceof IsIsPseudonode && tlv instanceof IsIsNonPseudonode)
|| (tlv1 instanceof OspfNonPseudonode && tlv instanceof OspfPseudonode)
|| (tlv1 instanceof OspfPseudonode && tlv instanceof OspfNonPseudonode)) {
continue;
}
}
int result = subTlvs.get(subTlvs.indexOf(tlv1)).compareTo(
((NodeDescriptors) o).subTlvs.get(((NodeDescriptors) o).subTlvs.indexOf(tlv)));
if (result != 0) {
return result;
}
tlvFound = true;
break;
}
}
if (!tlvFound) {
return 1;
}
}
}
return 0;
}
示例7: addNode
import org.onosproject.bgpio.types.IsIsNonPseudonode; //导入依赖的package包/类
@Override
public void addNode(BgpNodeLSNlriVer4 nodeNlri, PathAttrNlriDetails details) {
log.debug("Add node {}", nodeNlri.toString());
if (deviceProviderService == null || deviceService == null) {
return;
}
Device.Type deviceType = ROUTER;
BgpDpid nodeUri = new BgpDpid(nodeNlri);
DeviceId deviceId = deviceId(uri(nodeUri.toString()));
ChassisId cId = new ChassisId();
/*
* Check if device is already there (available) , if yes not updating to core.
*/
if (deviceService.isAvailable(deviceId)) {
return;
}
DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();
newBuilder.set(AnnotationKeys.DRIVER, "l3Device");
newBuilder.set(AnnotationKeys.TYPE, "L3");
newBuilder.set(ROUTING_UNIVERSE, Long.toString(nodeNlri.getIdentifier()));
List<BgpValueType> tlvs = nodeNlri.getLocalNodeDescriptors().getNodedescriptors().getSubTlvs();
for (BgpValueType tlv : tlvs) {
if (tlv instanceof AutonomousSystemTlv) {
newBuilder.set(AS_NUMBER, Integer.toString(((AutonomousSystemTlv) tlv).getAsNum()));
} else if (tlv instanceof BgpLSIdentifierTlv) {
newBuilder.set(DOMAIN_IDENTIFIER,
Integer.toString(((BgpLSIdentifierTlv) tlv).getBgpLsIdentifier()));
}
if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) {
if (tlv instanceof IsIsPseudonode) {
deviceType = VIRTUAL;
newBuilder.set(AnnotationKeys.ROUTER_ID, nodeUri.isoNodeIdString(((IsIsPseudonode) tlv)
.getIsoNodeId()));
} else if (tlv instanceof OspfPseudonode) {
deviceType = VIRTUAL;
newBuilder
.set(AnnotationKeys.ROUTER_ID, Integer.toString(((OspfPseudonode) tlv).getrouterID()));
} else if (tlv instanceof IsIsNonPseudonode) {
newBuilder.set(AnnotationKeys.ROUTER_ID, nodeUri.isoNodeIdString(((IsIsNonPseudonode) tlv)
.getIsoNodeId()));
} else if (tlv instanceof OspfNonPseudonode) {
newBuilder.set(AnnotationKeys.ROUTER_ID,
Integer.toString(((OspfNonPseudonode) tlv).getrouterID()));
}
}
}
DefaultAnnotations.Builder anntotations = DefaultAnnotations.builder();
anntotations = getAnnotations(newBuilder, true, details);
DeviceDescription description = new DefaultDeviceDescription(uri(nodeUri.toString()), deviceType, UNKNOWN,
UNKNOWN, UNKNOWN, UNKNOWN, cId, anntotations.build());
deviceProviderService.deviceConnected(deviceId, description);
}
示例8: displayNode
import org.onosproject.bgpio.types.IsIsNonPseudonode; //导入依赖的package包/类
private void displayNode() {
pathAttrNlriDetails = pathAttrNlriDetailsLocalRib.localRibNlridetails();
List<BgpValueType> bgpValueTypeList = pathAttrNlriDetails.pathAttributes();
protocolType = pathAttrNlriDetails.protocolID();
Iterator<BgpValueType> itrBgpValueType = bgpValueTypeList.iterator();
while (itrBgpValueType.hasNext()) {
BgpValueType bgpValueType = itrBgpValueType.next();
if (bgpValueType instanceof Origin) {
origin = (Origin) bgpValueType;
} else if (bgpValueType instanceof LocalPref) {
localPref = (LocalPref) bgpValueType;
} else if (bgpValueType instanceof LinkStateAttributes) {
LinkStateAttributes linkStateAttributes = (LinkStateAttributes) bgpValueType;
List linkStateAttribiuteList = linkStateAttributes.linkStateAttributes();
Iterator<BgpValueType> linkStateAttribiteIterator = linkStateAttribiuteList.iterator();
while (linkStateAttribiteIterator.hasNext()) {
BgpValueType bgpValueType1 = linkStateAttribiteIterator.next();
if (bgpValueType1 instanceof BgpAttrRouterIdV4) {
bgpAttrRouterIdV4 = (BgpAttrRouterIdV4) bgpValueType1;
}
}
} else if (bgpValueType instanceof MpReachNlri) {
mpReachNlri = (MpReachNlri) bgpValueType;
List<BgpLSNlri> bgpLSNlris = mpReachNlri.mpReachNlri();
Iterator<BgpLSNlri> bgpLsnlrisIterator = bgpLSNlris.iterator();
while (bgpLsnlrisIterator.hasNext()) {
BgpLSNlri bgpLSNlri = bgpLsnlrisIterator.next();
if (bgpLSNlri instanceof BgpNodeLSNlriVer4) {
BgpNodeLSNlriVer4 bgpNodeLSNlriVer4 = (BgpNodeLSNlriVer4) bgpLSNlri;
BgpNodeLSIdentifier bgpNodeLSIdentifier = bgpNodeLSNlriVer4.getLocalNodeDescriptors();
NodeDescriptors nodeDescriptors = bgpNodeLSIdentifier.getNodedescriptors();
List<BgpValueType> bgpvalueTypesList = nodeDescriptors.getSubTlvs();
Iterator<BgpValueType> bgpValueTypeIterator = bgpvalueTypesList.iterator();
while (bgpValueTypeIterator.hasNext()) {
BgpValueType valueType = bgpValueTypeIterator.next();
if (valueType instanceof IsIsNonPseudonode) {
isIsNonPseudonode = (IsIsNonPseudonode) valueType;
}
}
}
}
}
}
print("RibAsNumber = %s,PeerIdentifier = %s,RibIpAddress = %s,ProtocolType = %s,Origin = %s,LocalPref = %s," +
"RouterID = %s,IsoNodeID = %s,NextHop = %s", pathAttrNlriDetailsLocalRib.localRibAsNum(),
pathAttrNlriDetailsLocalRib.localRibIdentifier(), pathAttrNlriDetailsLocalRib.localRibIpAddress(),
protocolType.toString(), origin.origin(), localPref.localPref(), bgpAttrRouterIdV4.attrRouterId(),
Arrays.toString(isIsNonPseudonode.getIsoNodeId()), mpReachNlri.nexthop4());
}
示例9: addNode
import org.onosproject.bgpio.types.IsIsNonPseudonode; //导入依赖的package包/类
@Override
public void addNode(BgpNodeLSNlriVer4 nodeNlri, PathAttrNlriDetails details) {
log.debug("Add node {}", nodeNlri.toString());
if (deviceProviderService == null || deviceService == null) {
return;
}
Device.Type deviceType = ROUTER;
BgpDpid nodeUri = new BgpDpid(nodeNlri);
DeviceId deviceId = deviceId(uri(nodeUri.toString()));
ChassisId cId = new ChassisId();
/*
* Check if device is already there (available) , if yes not updating to core.
*/
if (deviceService.isAvailable(deviceId)) {
return;
}
DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();
newBuilder.set(AnnotationKeys.TYPE, "L3");
newBuilder.set(ROUTING_UNIVERSE, Long.toString(nodeNlri.getIdentifier()));
List<BgpValueType> tlvs = nodeNlri.getLocalNodeDescriptors().getNodedescriptors().getSubTlvs();
for (BgpValueType tlv : tlvs) {
if (tlv instanceof AutonomousSystemTlv) {
newBuilder.set(AS_NUMBER, Integer.toString(((AutonomousSystemTlv) tlv).getAsNum()));
} else if (tlv instanceof BgpLSIdentifierTlv) {
newBuilder.set(DOMAIN_IDENTIFIER,
Integer.toString(((BgpLSIdentifierTlv) tlv).getBgpLsIdentifier()));
}
if (tlv.getType() == NodeDescriptors.IGP_ROUTERID_TYPE) {
if (tlv instanceof IsIsPseudonode) {
deviceType = VIRTUAL;
newBuilder.set(AnnotationKeys.ROUTER_ID, nodeUri.isoNodeIdString(((IsIsPseudonode) tlv)
.getIsoNodeId()));
} else if (tlv instanceof OspfPseudonode) {
deviceType = VIRTUAL;
newBuilder
.set(AnnotationKeys.ROUTER_ID, Integer.toString(((OspfPseudonode) tlv).getrouterID()));
} else if (tlv instanceof IsIsNonPseudonode) {
newBuilder.set(AnnotationKeys.ROUTER_ID, nodeUri.isoNodeIdString(((IsIsNonPseudonode) tlv)
.getIsoNodeId()));
} else if (tlv instanceof OspfNonPseudonode) {
newBuilder.set(AnnotationKeys.ROUTER_ID,
Integer.toString(((OspfNonPseudonode) tlv).getrouterID()));
}
}
}
DefaultAnnotations.Builder anntotations = DefaultAnnotations.builder();
anntotations = getAnnotations(newBuilder, true, details);
DeviceDescription description = new DefaultDeviceDescription(uri(nodeUri.toString()), deviceType, UNKNOWN,
UNKNOWN, UNKNOWN, UNKNOWN, cId, anntotations.build());
deviceProviderService.deviceConnected(deviceId, description);
}