use of org.onosproject.bgpio.types.IsIsNonPseudonode in project onos by opennetworkinglab.
the class BgpDpid method add.
/**
* 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;
}
use of org.onosproject.bgpio.types.IsIsNonPseudonode in project onos by opennetworkinglab.
the class BgpUpdateMsgTest method bgpUpdateMessageTest19.
/**
* This test case checks update message with prefix NLRI.
*/
@Test
public void bgpUpdateMessageTest19() throws BgpParseException {
byte[] updateMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, (byte) 0xd6, 0x02, 0x00, 0x04, // withdrawn routes
0x18, // withdrawn routes
0x0a, // withdrawn routes
0x01, // withdrawn routes
0x01, // path attribute len
0x00, // path attribute len
(byte) 0xbb, // origin
0x04, // origin
0x01, // origin
0x01, // origin
0x00, // as_path
0x40, // as_path
0x02, // as_path
0x04, // as_path
0x02, // as_path
0x01, // as_path
(byte) 0xfd, // as_path
(byte) 0xe9, // med
(byte) 0x80, // med
0x04, // med
0x04, // med
0x00, // med
0x00, // med
0x00, // med
0x00, // mpreach
(byte) 0x90, // mpreach
0x0e, // mpreach
0x00, // mpreach
(byte) 0xa5, // mpreach
0x40, // mpreach
0x04, // mpreach
0x47, // nexthop
0x04, // nexthop
0x04, // nexthop
0x00, // nexthop
0x00, // nexthop
0x01, // reserved
0x00, 0x00, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x06, 0x19, 0x21, 0x68, 0x07, 0x70, 0x01, 0x01, 0x09, 0x00, 0x05, 0x20, (byte) 0xc0, (byte) 0xa8, 0x4d, 0x01, 0x00, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21, 0x01, 0x09, 0x00, 0x05, 0x20, 0x15, 0x15, 0x15, 0x15, 0x00, 0x03, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x06, 0x02, 0x20, 0x22, 0x02, 0x20, 0x22, 0x01, 0x09, 0x00, 0x05, 0x20, 0x16, 0x16, 0x16, // prefix nlri
0x16 };
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(updateMsg);
BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
BgpMessage message;
BgpHeader bgpHeader = new BgpHeader();
message = reader.readFrom(buffer, bgpHeader);
assertThat(message, instanceOf(BgpUpdateMsg.class));
BgpUpdateMsg other = (BgpUpdateMsg) message;
assertThat(other.getHeader().getMarker(), is(MARKER));
assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
assertThat(other.getHeader().getLength(), is((short) 214));
ListIterator<IpPrefix> listIterator1 = other.withdrawnRoutes().listIterator();
byte[] prefix = new byte[] { 0x0a, 0x01, 0x01, 0x00 };
IpPrefix testPrefixValue = listIterator1.next();
assertThat(testPrefixValue.prefixLength(), is((int) 24));
assertThat(testPrefixValue.address().toOctets(), is(prefix));
BgpValueType testPathAttribute;
Origin origin;
AsPath asPath;
Med med;
MpReachNlri mpReach;
List<BgpValueType> pathAttributes = new LinkedList<>();
BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
pathAttributes = actualpathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
assertThat(origin.origin(), is(originValue));
testPathAttribute = listIterator.next();
asPath = (AsPath) testPathAttribute;
ListIterator<Short> listIterator2 = asPath.asPathSeq().listIterator();
assertThat(listIterator2.next(), is((short) 65001));
testPathAttribute = listIterator.next();
med = (Med) testPathAttribute;
assertThat(med.med(), is(0));
testPathAttribute = listIterator.next();
mpReach = (MpReachNlri) testPathAttribute;
assertThat(mpReach.mpReachNlriLen(), is((int) 165));
assertThat(mpReach.getType(), is((short) 14));
List<BgpLSNlri> testMpReachNlri = new LinkedList<>();
testMpReachNlri = mpReach.mpReachNlri();
ListIterator<BgpLSNlri> list1 = testMpReachNlri.listIterator();
BgpLSNlri testnlri = list1.next();
NlriType nlriType = org.onosproject.bgpio.protocol.NlriType.PREFIX_IPV4;
ProtocolType protocolId = org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_TWO;
assertThat(testnlri.getIdentifier(), is((long) 0));
assertThat(testnlri.getNlriType(), is(nlriType));
assertThat(testnlri.getProtocolId(), is(protocolId));
BgpPrefixLSNlri testprefixnlri = (BgpPrefixLSNlri) testnlri;
NodeDescriptors testLocalNodeDescriptors = testprefixnlri.getLocalNodeDescriptors();
List<BgpValueType> testSubTlvs = new LinkedList<>();
testSubTlvs = testLocalNodeDescriptors.getSubTlvs();
ListIterator<BgpValueType> subtlvlist1 = testSubTlvs.listIterator();
AutonomousSystemTlv testAutonomousSystemTlv = (AutonomousSystemTlv) subtlvlist1.next();
assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
BgpLSIdentifierTlv testBgpLsIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBgpLsIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBgpLsIdentifierTlv.getType(), is((short) 513));
IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist1.next();
byte[] expIsoNodeId = new byte[] { 0x19, 0x21, 0x68, 0x07, 0x70, 0x01 };
assertThat(testIsIsNonPseudonode.getIsoNodeId(), is(expIsoNodeId));
assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
List<BgpValueType> testPrefixDescriptors = new LinkedList<>();
testPrefixDescriptors = testprefixnlri.getPrefixdescriptor();
ListIterator<BgpValueType> subtlvlist2 = testPrefixDescriptors.listIterator();
IPReachabilityInformationTlv testIPReachabilityInformationTlv = (IPReachabilityInformationTlv) subtlvlist2.next();
byte[] address = new byte[] { (byte) 0xc0, (byte) 0xa8, 0x4d, 0x01 };
IpPrefix prefix1 = IpPrefix.valueOf(IpAddress.Version.INET, address, 32);
assertThat(testIPReachabilityInformationTlv.getPrefixValue(), is(prefix1));
assertThat(testIPReachabilityInformationTlv.getPrefixLen(), is((byte) 32));
}
use of org.onosproject.bgpio.types.IsIsNonPseudonode in project onos by opennetworkinglab.
the class BgpUpdateMsgTest method bgpUpdateMessageTest31.
/**
* This test case checks update message with MPUnreach.
*/
@Test
public void bgpUpdateMessageTest31() throws BgpParseException {
byte[] updateMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, // withdrawn routes
(byte) 0xff, // withdrawn routes
(byte) 0xff, // withdrawn routes
0x00, // withdrawn routes
0x5e, // withdrawn routes
0x02, // withdrawn routes
0x00, // withdrawn routes
0x04, // withdrawn routes
0x18, // withdrawn routes
0x0a, // withdrawn routes
0x01, // withdrawn routes
0x01, // path attribute len
0x00, // path attribute len
0x43, // origin
0x04, // origin
0x01, // origin
0x01, // origin
0x00, // as_path
0x40, // as_path
0x02, // as_path
0x04, // as_path
0x02, // as_path
0x01, // as_path
(byte) 0xfd, // as_path
(byte) 0xe9, // med
(byte) 0x80, // med
0x04, // med
0x04, // med
0x00, // med
0x00, // med
0x00, // med
0x00, // mpunreach with safi = 71
(byte) 0x80, // mpunreach with safi = 71
0x0f, // mpunreach with safi = 71
0x2e, // mpunreach with safi = 71
0x40, // mpunreach with safi = 71
0x04, // mpunreach with safi = 71
0x47, 0x00, 0x01, 0x00, 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, // node nlri
0x58 };
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(updateMsg);
BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
BgpMessage message;
BgpHeader bgpHeader = new BgpHeader();
message = reader.readFrom(buffer, bgpHeader);
assertThat(message, instanceOf(BgpUpdateMsg.class));
BgpUpdateMsg other = (BgpUpdateMsg) message;
assertThat(other.getHeader().getMarker(), is(MARKER));
assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
assertThat(other.getHeader().getLength(), is((short) 94));
ListIterator<IpPrefix> listIterator1 = other.withdrawnRoutes().listIterator();
byte[] prefix = new byte[] { 0x0a, 0x01, 0x01, 0x00 };
IpPrefix testPrefixValue = listIterator1.next();
assertThat(testPrefixValue.prefixLength(), is((int) 24));
assertThat(testPrefixValue.address().toOctets(), is(prefix));
BgpValueType testPathAttribute;
Origin origin;
AsPath asPath;
Med med;
MpUnReachNlri mpUnReach;
List<BgpValueType> pathAttributes = new LinkedList<>();
BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
pathAttributes = actualpathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
assertThat(origin.origin(), is(originValue));
testPathAttribute = listIterator.next();
asPath = (AsPath) testPathAttribute;
ListIterator<Short> listIterator2 = asPath.asPathSeq().listIterator();
assertThat(listIterator2.next(), is((short) 65001));
testPathAttribute = listIterator.next();
med = (Med) testPathAttribute;
assertThat(med.med(), is(0));
testPathAttribute = listIterator.next();
mpUnReach = (MpUnReachNlri) testPathAttribute;
assertThat(mpUnReach.mpUnReachNlriLen(), is((int) 46));
assertThat(mpUnReach.getType(), is((short) 15));
List<BgpLSNlri> testMpUnReachNlri = new LinkedList<>();
testMpUnReachNlri = mpUnReach.mpUnReachNlri();
ListIterator<BgpLSNlri> list1 = testMpUnReachNlri.listIterator();
BgpLSNlri testnlri = list1.next();
NlriType nlriType = org.onosproject.bgpio.protocol.NlriType.NODE;
ProtocolType protocolId = org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_TWO;
assertThat(testnlri.getIdentifier(), is((long) 0));
assertThat(testnlri.getNlriType(), is(nlriType));
assertThat(testnlri.getProtocolId(), is(protocolId));
BgpNodeLSNlriVer4 testNodenlri = (BgpNodeLSNlriVer4) testnlri;
BgpNodeLSIdentifier testLocalNodeDescriptors = testNodenlri.getLocalNodeDescriptors();
List<BgpValueType> testSubTlvs = new LinkedList<>();
NodeDescriptors localNodeDescriptors = testLocalNodeDescriptors.getNodedescriptors();
testSubTlvs = localNodeDescriptors.getSubTlvs();
ListIterator<BgpValueType> subtlvlist1 = testSubTlvs.listIterator();
AutonomousSystemTlv testAutonomousSystemTlv = (AutonomousSystemTlv) subtlvlist1.next();
assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
BgpLSIdentifierTlv testBgpLsIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBgpLsIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBgpLsIdentifierTlv.getType(), is((short) 513));
IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist1.next();
byte[] expIsoNodeId = new byte[] { 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58 };
assertThat(testIsIsNonPseudonode.getIsoNodeId(), is(expIsoNodeId));
assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
}
use of org.onosproject.bgpio.types.IsIsNonPseudonode in project onos by opennetworkinglab.
the class BgpUpdateMsgTest method bgpUpdateMessageTest20.
/**
* This test case checks update message with link NLRI.
*/
@Test
public void bgpUpdateMessageTest20() throws BgpParseException {
byte[] updateMsg = new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, (byte) 0x83, 0x02, 0x00, 0x04, // withdrawn routes
0x18, // withdrawn routes
0x0a, // withdrawn routes
0x01, // withdrawn routes
0x01, // path attribute len
0x00, // path attribute len
0x68, // origin
0x04, // origin
0x01, // origin
0x01, // origin
0x00, // as_path
0x40, // as_path
0x02, // as_path
0x04, // as_path
0x02, // as_path
0x01, // as_path
(byte) 0xfd, // as_path
(byte) 0xe9, // med
(byte) 0x80, // med
0x04, // med
0x04, // med
0x00, // med
0x00, // med
0x00, // med
0x00, // mpreach
(byte) 0x80, // mpreach
0x0e, // mpreach
0x53, // mpreach
0x40, // mpreach
0x04, // mpreach
0x47, // nexthop
0x04, // nexthop
0x04, // nexthop
0x00, // nexthop
0x00, // nexthop
0x01, // reserved
0x00, 0x00, 0x02, 0x00, 0x46, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1b, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x07, 0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21, 0x03, 0x01, 0x01, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae, 0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x06, 0x19, // link nlri
0x00, // link nlri
(byte) 0x95, // link nlri
0x02, // link nlri
0x50, // link nlri
0x21 };
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(updateMsg);
BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
BgpMessage message = null;
BgpHeader bgpHeader = new BgpHeader();
message = reader.readFrom(buffer, bgpHeader);
assertThat(message, instanceOf(BgpUpdateMsg.class));
BgpUpdateMsg other = (BgpUpdateMsg) message;
assertThat(other.getHeader().getMarker(), is(MARKER));
assertThat(other.getHeader().getType(), is(UPDATE_MSG_TYPE));
assertThat(other.getHeader().getLength(), is((short) 131));
ListIterator<IpPrefix> listIterator1 = other.withdrawnRoutes().listIterator();
byte[] prefix = new byte[] { 0x0a, 0x01, 0x01, 0x00 };
IpPrefix testPrefixValue = listIterator1.next();
assertThat(testPrefixValue.prefixLength(), is((int) 24));
assertThat(testPrefixValue.address().toOctets(), is(prefix));
BgpValueType testPathAttribute;
Origin origin;
AsPath asPath;
Med med;
MpReachNlri mpReach;
List<BgpValueType> pathAttributes = new LinkedList<>();
BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
pathAttributes = actualpathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
assertThat(origin.origin(), is(originValue));
testPathAttribute = listIterator.next();
asPath = (AsPath) testPathAttribute;
ListIterator<Short> listIterator2 = asPath.asPathSeq().listIterator();
assertThat(listIterator2.next(), is((short) 65001));
testPathAttribute = listIterator.next();
med = (Med) testPathAttribute;
assertThat(med.med(), is(0));
testPathAttribute = listIterator.next();
mpReach = (MpReachNlri) testPathAttribute;
assertThat(mpReach.mpReachNlriLen(), is((int) 83));
assertThat(mpReach.getType(), is((short) 14));
List<BgpLSNlri> testMpReachNlri = new LinkedList<>();
testMpReachNlri = mpReach.mpReachNlri();
ListIterator<BgpLSNlri> list1 = testMpReachNlri.listIterator();
BgpLSNlri testnlri = list1.next();
NlriType nlriType = org.onosproject.bgpio.protocol.NlriType.LINK;
ProtocolType protocolId = org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType.ISIS_LEVEL_TWO;
assertThat(testnlri.getIdentifier(), is((long) 0));
assertThat(testnlri.getNlriType(), is(nlriType));
assertThat(testnlri.getProtocolId(), is(protocolId));
BgpLinkLsNlriVer4 testlinknlri = (BgpLinkLsNlriVer4) testnlri;
NodeDescriptors testLocalNodeDescriptors = testlinknlri.localNodeDescriptors();
List<BgpValueType> testSubTlvs = new LinkedList<>();
testSubTlvs = testLocalNodeDescriptors.getSubTlvs();
ListIterator<BgpValueType> subtlvlist1 = testSubTlvs.listIterator();
AutonomousSystemTlv testAutonomousSystemTlv = (AutonomousSystemTlv) subtlvlist1.next();
assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
BgpLSIdentifierTlv testBgpLsIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBgpLsIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBgpLsIdentifierTlv.getType(), is((short) 513));
IsIsPseudonode testIsIsPseudonode = (IsIsPseudonode) subtlvlist1.next();
assertThat(testIsIsPseudonode.getPsnIdentifier(), is((byte) 3));
assertThat(testIsIsPseudonode.getType(), is((short) 515));
NodeDescriptors testRemoteNodeDescriptors = testlinknlri.remoteNodeDescriptors();
testSubTlvs = testRemoteNodeDescriptors.getSubTlvs();
ListIterator<BgpValueType> subtlvlist2 = testSubTlvs.listIterator();
testAutonomousSystemTlv = (AutonomousSystemTlv) subtlvlist2.next();
assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
testBgpLsIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist2.next();
assertThat(testBgpLsIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBgpLsIdentifierTlv.getType(), is((short) 513));
IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist2.next();
byte[] expIsoNodeId = new byte[] { 0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21 };
assertThat(testIsIsNonPseudonode.getIsoNodeId(), is(expIsoNodeId));
assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
}
use of org.onosproject.bgpio.types.IsIsNonPseudonode in project onos by opennetworkinglab.
the class NodeDescriptors method compareTo.
/**
* 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;
}
Aggregations