Search in sources :

Example 1 with BgpLinkLsNlriVer4

use of org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4 in project onos by opennetworkinglab.

the class BgpUpdateMsg2Test method bgpUpdateMessage2Test1.

/**
 * This test case checks the changes made in.
 * BgpLinkLSIdentifier
 * BgpAttrNodeMultiTopologyId
 * as bug fix for bug 8036
 */
@Test
public void bgpUpdateMessage2Test1() 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, (byte) 0x00, (byte) 0xe6, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xcf, (byte) 0x90, (byte) 0x0e, (byte) 0x00, (byte) 0xb3, (byte) 0x40, (byte) 0x04, (byte) 0x47, (byte) 0x10, (byte) 0x20, (byte) 0x01, (byte) 0x05, (byte) 0xb0, (byte) 0x00, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x50, (byte) 0x54, (byte) 0x00, (byte) 0xff, (byte) 0xfe, (byte) 0xb8, (byte) 0x35, (byte) 0x2b, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x4b, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0xe9, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x1a, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x64, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1b, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x1a, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x64, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x2b, // ---------- BgpAttrNodeMultiTopologyId for Link 1-----------------------------------------------------
    (byte) 0x01, (byte) 0x07, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x02, // -----------------------------------------------------------------------------------------------------
    (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x4b, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0xe9, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x1a, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x64, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x2b, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x1a, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x64, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1b, // ------------ BgpAttrNodeMultiTopologyId for Link 2 --------------------------------------------------
    (byte) 0x01, (byte) 0x07, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x02, // -----------------------------------------------------------------------------------------------------
    (byte) 0x40, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x40, (byte) 0x02, (byte) 0x00, (byte) 0x40, (byte) 0x05, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x64, (byte) 0x80, (byte) 0x1d, (byte) 0x07, (byte) 0x04, (byte) 0x47, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x0a };
    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 receivedMsg = (BgpUpdateMsg) message;
    List<BgpValueType> pathAttr = receivedMsg.bgpPathAttributes().pathAttributes();
    ListIterator<BgpValueType> iterator = pathAttr.listIterator();
    while (iterator.hasNext()) {
        BgpValueType attr = iterator.next();
        if (attr instanceof MpReachNlri) {
            List<BgpLSNlri> nlri = ((MpReachNlri) attr).mpReachNlri();
            ListIterator<BgpLSNlri> listIterator = nlri.listIterator();
            while (listIterator.hasNext()) {
                BgpLSNlri nlriInfo = listIterator.next();
                if (nlriInfo instanceof BgpLinkLsNlriVer4) {
                    List<BgpValueType> tlvs = ((BgpLinkLsNlriVer4) nlriInfo).getLinkIdentifier().linkDescriptors();
                    for (BgpValueType tlv : tlvs) {
                        if (tlv instanceof BgpAttrNodeMultiTopologyId) {
                            assertThat(((BgpAttrNodeMultiTopologyId) tlv).attrMultiTopologyId().size(), is(1));
                            assertThat(((BgpAttrNodeMultiTopologyId) tlv).attrMultiTopologyId().get(0), is((short) 2));
                        }
                    }
                }
            }
        }
    }
}
Also used : BgpValueType(org.onosproject.bgpio.types.BgpValueType) BgpHeader(org.onosproject.bgpio.types.BgpHeader) BgpAttrNodeMultiTopologyId(org.onosproject.bgpio.types.attr.BgpAttrNodeMultiTopologyId) BgpLinkLsNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4) ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer) MpReachNlri(org.onosproject.bgpio.types.MpReachNlri) Test(org.junit.Test)

Example 2 with BgpLinkLsNlriVer4

use of org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4 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));
}
Also used : Origin(org.onosproject.bgpio.types.Origin) IsIsPseudonode(org.onosproject.bgpio.types.IsIsPseudonode) BgpHeader(org.onosproject.bgpio.types.BgpHeader) NodeDescriptors(org.onosproject.bgpio.protocol.linkstate.NodeDescriptors) ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer) IpPrefix(org.onlab.packet.IpPrefix) BgpValueType(org.onosproject.bgpio.types.BgpValueType) OriginType(org.onosproject.bgpio.types.Origin.OriginType) BgpLSIdentifierTlv(org.onosproject.bgpio.types.BgpLSIdentifierTlv) Med(org.onosproject.bgpio.types.Med) LinkedList(java.util.LinkedList) BgpLinkLsNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4) IsIsNonPseudonode(org.onosproject.bgpio.types.IsIsNonPseudonode) AsPath(org.onosproject.bgpio.types.AsPath) BgpPathAttributes(org.onosproject.bgpio.protocol.ver4.BgpPathAttributes) AutonomousSystemTlv(org.onosproject.bgpio.types.AutonomousSystemTlv) ProtocolType(org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType) MpReachNlri(org.onosproject.bgpio.types.MpReachNlri) Test(org.junit.Test)

Example 3 with BgpLinkLsNlriVer4

use of org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4 in project onos by opennetworkinglab.

the class BgpPeerImpl method callRemove.

/**
 * Removes NLRI identifier node in a tree separately based on afi and safi.
 *
 * @param peerImpl BGP peer instance
 * @param nlri NLRI information
 * @throws BgpParseException BGP parse exception
 */
public void callRemove(BgpPeerImpl peerImpl, List<BgpLSNlri> nlri) throws BgpParseException {
    ListIterator<BgpLSNlri> listIterator = nlri.listIterator();
    while (listIterator.hasNext()) {
        BgpLSNlri nlriInfo = listIterator.next();
        if (nlriInfo instanceof BgpNodeLSNlriVer4) {
            if (!((BgpNodeLSNlriVer4) nlriInfo).isVpnPresent()) {
                adjRib.remove(nlriInfo);
                bgplocalRib.delete(nlriInfo);
            } else {
                vpnAdjRib.removeVpn(nlriInfo, ((BgpNodeLSNlriVer4) nlriInfo).getRouteDistinguisher());
                bgplocalRibVpn.delete(nlriInfo, ((BgpNodeLSNlriVer4) nlriInfo).getRouteDistinguisher());
            }
        } else if (nlriInfo instanceof BgpLinkLsNlriVer4) {
            if (!((BgpLinkLsNlriVer4) nlriInfo).isVpnPresent()) {
                adjRib.remove(nlriInfo);
                bgplocalRib.delete(nlriInfo);
            } else {
                vpnAdjRib.removeVpn(nlriInfo, ((BgpLinkLsNlriVer4) nlriInfo).getRouteDistinguisher());
                bgplocalRibVpn.delete(nlriInfo, ((BgpLinkLsNlriVer4) nlriInfo).getRouteDistinguisher());
            }
        } else if (nlriInfo instanceof BgpPrefixIPv4LSNlriVer4) {
            if (!((BgpPrefixIPv4LSNlriVer4) nlriInfo).isVpnPresent()) {
                adjRib.remove(nlriInfo);
                bgplocalRib.delete(nlriInfo);
            } else {
                vpnAdjRib.removeVpn(nlriInfo, ((BgpPrefixIPv4LSNlriVer4) nlriInfo).getRouteDistinguisher());
                bgplocalRibVpn.delete(nlriInfo, ((BgpPrefixIPv4LSNlriVer4) nlriInfo).getRouteDistinguisher());
            }
        }
    }
}
Also used : BgpNodeLSNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4) BgpPrefixIPv4LSNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4) BgpLSNlri(org.onosproject.bgpio.protocol.BgpLSNlri) BgpLinkLsNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4)

Example 4 with BgpLinkLsNlriVer4

use of org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4 in project onos by opennetworkinglab.

the class BgpPeerImpl method callAdd.

/**
 * Updates NLRI identifier node in a tree separately based on afi and safi.
 *
 * @param peerImpl BGP peer instance
 * @param nlri MpReachNlri path attribute
 * @param pathAttr list of BGP path attributes
 * @throws BgpParseException throws exception
 */
public void callAdd(BgpPeerImpl peerImpl, List<BgpLSNlri> nlri, List<BgpValueType> pathAttr) throws BgpParseException {
    ListIterator<BgpLSNlri> listIterator = nlri.listIterator();
    while (listIterator.hasNext()) {
        BgpLSNlri nlriInfo = listIterator.next();
        if (nlriInfo instanceof BgpNodeLSNlriVer4) {
            PathAttrNlriDetails details = setPathAttrDetails(nlriInfo, pathAttr);
            if (!((BgpNodeLSNlriVer4) nlriInfo).isVpnPresent()) {
                adjRib.add(nlriInfo, details);
                bgplocalRib.add(sessionInfo(), nlriInfo, details);
            } else {
                vpnAdjRib.addVpn(nlriInfo, details, ((BgpNodeLSNlriVer4) nlriInfo).getRouteDistinguisher());
                bgplocalRibVpn.add(sessionInfo(), nlriInfo, details, ((BgpNodeLSNlriVer4) nlriInfo).getRouteDistinguisher());
            }
        } else if (nlriInfo instanceof BgpLinkLsNlriVer4) {
            PathAttrNlriDetails details = setPathAttrDetails(nlriInfo, pathAttr);
            if (!((BgpLinkLsNlriVer4) nlriInfo).isVpnPresent()) {
                adjRib.add(nlriInfo, details);
                bgplocalRib.add(sessionInfo(), nlriInfo, details);
            } else {
                vpnAdjRib.addVpn(nlriInfo, details, ((BgpLinkLsNlriVer4) nlriInfo).getRouteDistinguisher());
                bgplocalRibVpn.add(sessionInfo(), nlriInfo, details, ((BgpLinkLsNlriVer4) nlriInfo).getRouteDistinguisher());
            }
        } else if (nlriInfo instanceof BgpPrefixIPv4LSNlriVer4) {
            PathAttrNlriDetails details = setPathAttrDetails(nlriInfo, pathAttr);
            if (!((BgpPrefixIPv4LSNlriVer4) nlriInfo).isVpnPresent()) {
                adjRib.add(nlriInfo, details);
                bgplocalRib.add(sessionInfo(), nlriInfo, details);
            } else {
                vpnAdjRib.addVpn(nlriInfo, details, ((BgpPrefixIPv4LSNlriVer4) nlriInfo).getRouteDistinguisher());
                bgplocalRibVpn.add(sessionInfo(), nlriInfo, details, ((BgpPrefixIPv4LSNlriVer4) nlriInfo).getRouteDistinguisher());
            }
        }
    }
}
Also used : BgpNodeLSNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4) BgpPrefixIPv4LSNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4) PathAttrNlriDetails(org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails) BgpLSNlri(org.onosproject.bgpio.protocol.BgpLSNlri) BgpLinkLsNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4)

Example 5 with BgpLinkLsNlriVer4

use of org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4 in project onos by opennetworkinglab.

the class BgpLocalRibImpl method localRibUpdateLink.

/**
 * Update localRIB link based on available peer adjacency RIB.
 *
 * @param o adjacency-in/VPN adjacency-in
 * @throws BgpParseException BGP parse exceptions
 */
public void localRibUpdateLink(Object o) throws BgpParseException {
    if (o instanceof AdjRibIn) {
        AdjRibIn adjRib = (AdjRibIn) o;
        log.debug("Update local RIB link.");
        Set<BgpLinkLSIdentifier> linkKeys = adjRib.linkTree().keySet();
        for (BgpLinkLSIdentifier key : linkKeys) {
            PathAttrNlriDetails pathAttrNlri = adjRib.linkTree().get(key);
            BgpLinkLsNlriVer4 linkNlri = new BgpLinkLsNlriVer4(pathAttrNlri.protocolID().getType(), pathAttrNlri.identifier(), key, null, false);
            decisionProcess(linkNlri);
        }
    }
    if (o instanceof VpnAdjRibIn) {
        VpnAdjRibIn vpnAdjRib = (VpnAdjRibIn) o;
        log.debug("Update local RIB VPN link");
        Set<RouteDistinguisher> linkKeysVpn = vpnAdjRib.vpnLinkTree().keySet();
        Map<BgpLinkLSIdentifier, PathAttrNlriDetails> link;
        for (RouteDistinguisher keyVpnLink : linkKeysVpn) {
            link = vpnAdjRib.vpnLinkTree().get(keyVpnLink);
            Set<BgpLinkLSIdentifier> vpnLinkKeys = link.keySet();
            for (BgpLinkLSIdentifier key : vpnLinkKeys) {
                PathAttrNlriDetails pathAttrNlri = vpnAdjRib.linkTree().get(key);
                BgpLinkLsNlriVer4 linkNlri = new BgpLinkLsNlriVer4(pathAttrNlri.protocolID().getType(), pathAttrNlri.identifier(), key, keyVpnLink, true);
                decisionProcess(linkNlri, keyVpnLink);
            }
        }
    }
}
Also used : PathAttrNlriDetails(org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails) RouteDistinguisher(org.onosproject.bgpio.types.RouteDistinguisher) BgpLinkLsNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4) BgpLinkLSIdentifier(org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier)

Aggregations

BgpLinkLsNlriVer4 (org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4)7 BgpLinkLSIdentifier (org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier)3 BgpNodeLSNlriVer4 (org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4)3 BgpPrefixIPv4LSNlriVer4 (org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4)3 ChannelBuffer (org.jboss.netty.buffer.ChannelBuffer)2 Test (org.junit.Test)2 BgpLinkListener (org.onosproject.bgp.controller.BgpLinkListener)2 BgpLSNlri (org.onosproject.bgpio.protocol.BgpLSNlri)2 PathAttrNlriDetails (org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails)2 PathAttrNlriDetailsLocalRib (org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib)2 BgpHeader (org.onosproject.bgpio.types.BgpHeader)2 BgpValueType (org.onosproject.bgpio.types.BgpValueType)2 MpReachNlri (org.onosproject.bgpio.types.MpReachNlri)2 LinkedList (java.util.LinkedList)1 IpPrefix (org.onlab.packet.IpPrefix)1 BgpId (org.onosproject.bgp.controller.BgpId)1 BgpNodeListener (org.onosproject.bgp.controller.BgpNodeListener)1 BgpPrefixListener (org.onosproject.bgp.controller.BgpPrefixListener)1 BgpSessionInfo (org.onosproject.bgp.controller.BgpSessionInfo)1 BgpNodeLSIdentifier (org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier)1