Search in sources :

Example 1 with BgpPrefixIPv4LSNlriVer4

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

the class BgpUpdateMsg2Test method bgpUpdateMessage2Test2.

/**
 * This test case checks the changes made in.
 * BgpPrefixLSIdentifier
 * MpReachNlri (read method AFI 16388/SAFI 71 if part)
 * BgpPrefixIPv4LSNlriVer4
 * LinkStateAttributes (ATTR_PREFIX_FLAGS check)
 * BgpAttrNodeMultiTopologyId
 * Validation
 * IPReachabilityInformationTlv
 * as bug fix for bug 8036
 */
@Test
public void bgpUpdateMessage2Test2() 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) 0x01, (byte) 0x08, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xf1, (byte) 0x90, (byte) 0x0e, (byte) 0x00, (byte) 0xcf, (byte) 0x40, (byte) 0x04, (byte) 0x47, (byte) 0x10, // ------------ MpReachNlri Nexthop --------------------------------------------------------------------
    (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) 0x04, (byte) 0x00, (byte) 0x3a, (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, // ------------ BgpAttrNodeMultiTopologyId for Prefix 1-------------------------------------------------
    (byte) 0x01, (byte) 0x07, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x02, // ------------ IPReachabilityInformationTlv for Prefix 1-----------------------------------------------
    (byte) 0x01, (byte) 0x09, (byte) 0x00, (byte) 0x09, (byte) 0x40, (byte) 0x20, (byte) 0x01, (byte) 0x05, (byte) 0xb0, (byte) 0x43, (byte) 0x21, (byte) 0x00, (byte) 0x00, // -----------------------------------------------------------------------------------------------------
    (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x3a, (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, // ------------ BgpAttrNodeMultiTopologyId for Prefix 2-------------------------------------------------
    (byte) 0x01, (byte) 0x07, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x02, // ------------ IPReachabilityInformationTlv for Prefix 2-----------------------------------------------
    (byte) 0x01, (byte) 0x09, (byte) 0x00, (byte) 0x09, (byte) 0x40, (byte) 0x20, (byte) 0x01, (byte) 0x05, (byte) 0xb0, (byte) 0x43, (byte) 0x21, (byte) 0x00, (byte) 0x00, // -----------------------------------------------------------------------------------------------------
    (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x3a, (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, // ------------ BgpAttrNodeMultiTopologyId for Prefix 3-------------------------------------------------
    (byte) 0x01, (byte) 0x07, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x02, // ------------ IPReachabilityInformationTlv for Prefix 3-----------------------------------------------
    (byte) 0x01, (byte) 0x09, (byte) 0x00, (byte) 0x09, (byte) 0x40, (byte) 0x20, (byte) 0x01, (byte) 0x05, (byte) 0xb0, (byte) 0x00, (byte) 0x08, (byte) 0x00, (byte) 0x00, // -----------------------------------------------------------------------------------------------------
    (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) 0x0d, (byte) 0x04, (byte) 0x83, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0a, // ------------ BGP-LS ATTR_PREFIX_FLAGS Attribute-----------------------------------------------
    (byte) 0x04, (byte) 0x92, (byte) 0x00, (byte) 0x01, (byte) 0x00 // -----------------------------------------------------------------------------------------------------
    };
    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();
    short count = 0;
    while (iterator.hasNext()) {
        BgpValueType attr = iterator.next();
        if (attr instanceof MpReachNlri) {
            List<BgpLSNlri> nlri = ((MpReachNlri) attr).mpReachNlri();
            assertThat(((MpReachNlri) attr).nexthop().toString(), is("2001:5b0:8:0:5054:ff:feb8:352b"));
            ListIterator<BgpLSNlri> listIterator = nlri.listIterator();
            while (listIterator.hasNext()) {
                BgpLSNlri nlriInfo = listIterator.next();
                assertThat(nlriInfo, instanceOf(BgpPrefixIPv4LSNlriVer4.class));
                if (nlriInfo instanceof BgpPrefixIPv4LSNlriVer4) {
                    List<BgpValueType> tlvs = ((BgpPrefixIPv4LSNlriVer4) nlriInfo).getPrefixIdentifier().getPrefixdescriptor();
                    for (BgpValueType tlv : tlvs) {
                        if (tlv instanceof BgpAttrNodeMultiTopologyId) {
                            assertThat(((BgpAttrNodeMultiTopologyId) tlv).attrMultiTopologyId().size(), is(1));
                            assertThat(((BgpAttrNodeMultiTopologyId) tlv).attrMultiTopologyId().get(0), is((short) 2));
                        } else if (tlv instanceof IPReachabilityInformationTlv) {
                            if (count == 0) {
                                assertThat(((IPReachabilityInformationTlv) tlv).getPrefixValue().toString(), is("2001:5b0:4321::/64"));
                            } else if (count == 1) {
                                assertThat(((IPReachabilityInformationTlv) tlv).getPrefixValue().toString(), is("2001:5b0:4321::/64"));
                            } else {
                                assertThat(((IPReachabilityInformationTlv) tlv).getPrefixValue().toString(), is("2001:5b0:8::/64"));
                            }
                            count++;
                        }
                    }
                }
            }
        } else if (attr instanceof LinkStateAttributes) {
            assertThat(((LinkStateAttributes) attr).linkStateAttributes().size(), is(2));
        }
    }
}
Also used : BgpValueType(org.onosproject.bgpio.types.BgpValueType) BgpHeader(org.onosproject.bgpio.types.BgpHeader) BgpAttrNodeMultiTopologyId(org.onosproject.bgpio.types.attr.BgpAttrNodeMultiTopologyId) IPReachabilityInformationTlv(org.onosproject.bgpio.types.IPReachabilityInformationTlv) ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer) LinkStateAttributes(org.onosproject.bgpio.types.LinkStateAttributes) BgpPrefixIPv4LSNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4) MpReachNlri(org.onosproject.bgpio.types.MpReachNlri) Test(org.junit.Test)

Example 2 with BgpPrefixIPv4LSNlriVer4

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

the class BgpLocalRibImpl method selectionProcessPrefix.

/**
 * Selection process for local RIB prefix.
 *
 * @param nlri NLRI to update
 * @param isVpnRib true if VPN local RIB, otherwise false
 * @throws BgpParseException BGP parse exception
 */
public void selectionProcessPrefix(BgpLSNlri nlri, boolean isVpnRib) throws BgpParseException {
    BgpPeerImpl peer;
    BgpSessionInfo sessionInfo;
    int decisionResult;
    boolean containsKey;
    BgpPrefixLSIdentifier prefixIdentifier = ((BgpPrefixIPv4LSNlriVer4) nlri).getPrefixIdentifier();
    /* Here, we are checking if the given prefix is contained in the AdjacencyRib of any peer
           or not. If none of the peer's AdjacencyRib has it, prefix can be marked for deletion.
         */
    boolean shouldDeletePrefix = false;
    if (prefixTree.containsKey(prefixIdentifier)) {
        shouldDeletePrefix = true;
    }
    for (BgpId bgpId : bgpController.connectedPeers().keySet()) {
        peer = (BgpPeerImpl) (bgpController.getPeer(bgpId));
        if (prefixTree.containsKey(prefixIdentifier)) {
            containsKey = (!isVpnRib) ? (peer.adjacencyRib().prefixTree().containsKey(prefixIdentifier)) : (peer.vpnAdjacencyRib().prefixTree().containsKey(prefixIdentifier));
            if (!containsKey) {
                continue;
            }
            sessionInfo = peer.sessionInfo();
            PathAttrNlriDetailsLocalRib detailsLocRib = new PathAttrNlriDetailsLocalRib(sessionInfo.remoteBgpId().ipAddress(), sessionInfo.remoteBgpIdentifier(), sessionInfo.remoteBgpASNum(), sessionInfo.isIbgpSession(), ((!isVpnRib) ? (peer.adjacencyRib().prefixTree().get(prefixIdentifier)) : (peer.vpnAdjacencyRib().prefixTree().get(prefixIdentifier))));
            BgpSelectionAlgo selectionAlgo = new BgpSelectionAlgo();
            decisionResult = selectionAlgo.compare(prefixTree.get(prefixIdentifier), detailsLocRib);
            if (decisionResult < 0) {
                prefixTree.replace(prefixIdentifier, detailsLocRib);
                log.debug("Local RIB prefix updated: {}", detailsLocRib.toString());
            }
            shouldDeletePrefix = false;
        }
        if (shouldDeletePrefix) {
            log.debug("Local RIB remove prefix: {}", prefixIdentifier.toString());
            for (BgpPrefixListener l : bgpController.prefixListener()) {
                l.deletePrefix((BgpPrefixIPv4LSNlriVer4) nlri);
            }
            prefixTree.remove(prefixIdentifier);
        }
    }
}
Also used : BgpPrefixListener(org.onosproject.bgp.controller.BgpPrefixListener) BgpPrefixLSIdentifier(org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier) PathAttrNlriDetailsLocalRib(org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib) BgpSessionInfo(org.onosproject.bgp.controller.BgpSessionInfo) BgpId(org.onosproject.bgp.controller.BgpId) BgpPrefixIPv4LSNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4)

Example 3 with BgpPrefixIPv4LSNlriVer4

use of org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4 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 BgpPrefixIPv4LSNlriVer4

use of org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4 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 BgpPrefixIPv4LSNlriVer4

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

the class BgpLocalRibImpl method add.

@Override
public void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details) throws BgpParseException {
    int decisionResult;
    log.debug("Add to local RIB {}", details.toString());
    PathAttrNlriDetailsLocalRib detailsLocRib = new PathAttrNlriDetailsLocalRib(sessionInfo.remoteBgpId().ipAddress(), sessionInfo.remoteBgpIdentifier(), sessionInfo.remoteBgpASNum(), sessionInfo.isIbgpSession(), details);
    if (nlri instanceof BgpNodeLSNlriVer4) {
        BgpNodeLSIdentifier nodeLsIdentifier = ((BgpNodeLSNlriVer4) nlri).getLocalNodeDescriptors();
        if (nodeTree.containsKey(nodeLsIdentifier)) {
            BgpSelectionAlgo selectionAlgo = new BgpSelectionAlgo();
            // Compare local RIB entry with the current attribute
            decisionResult = selectionAlgo.compare(nodeTree.get(nodeLsIdentifier), detailsLocRib);
            if (decisionResult <= 0) {
                for (BgpNodeListener l : bgpController.listener()) {
                    l.addNode((BgpNodeLSNlriVer4) nlri, details);
                }
                nodeTree.replace(nodeLsIdentifier, detailsLocRib);
                log.debug("Local RIB update node: {}", detailsLocRib.toString());
            }
        } else {
            nodeTree.put(nodeLsIdentifier, detailsLocRib);
            for (BgpNodeListener l : bgpController.listener()) {
                l.addNode((BgpNodeLSNlriVer4) nlri, details);
            }
            bgpController.notifyTopologyChange();
            log.debug("Local RIB add node: {}", detailsLocRib.toString());
        }
    } else if (nlri instanceof BgpLinkLsNlriVer4) {
        BgpLinkLSIdentifier linkLsIdentifier = ((BgpLinkLsNlriVer4) nlri).getLinkIdentifier();
        if (linkTree.containsKey(linkLsIdentifier)) {
            BgpSelectionAlgo selectionAlgo = new BgpSelectionAlgo();
            // Compare local RIB entry with the current attribute
            decisionResult = selectionAlgo.compare(linkTree.get(linkLsIdentifier), detailsLocRib);
            if (decisionResult <= 0) {
                linkTree.replace(linkLsIdentifier, detailsLocRib);
                for (BgpLinkListener l : bgpController.linkListener()) {
                    l.addLink((BgpLinkLsNlriVer4) nlri, details);
                }
                log.debug("Local RIB update link: {}", detailsLocRib.toString());
            }
        } else {
            linkTree.put(linkLsIdentifier, detailsLocRib);
            for (BgpLinkListener l : bgpController.linkListener()) {
                l.addLink((BgpLinkLsNlriVer4) nlri, details);
            }
            bgpController.notifyTopologyChange();
            log.debug("Local RIB add link: {}", detailsLocRib.toString());
        }
    } else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) {
        BgpPrefixLSIdentifier prefixIdentifier = ((BgpPrefixIPv4LSNlriVer4) nlri).getPrefixIdentifier();
        if (prefixTree.containsKey(prefixIdentifier)) {
            BgpSelectionAlgo selectionAlgo = new BgpSelectionAlgo();
            // Compare local RIB entry with the current attribute
            decisionResult = selectionAlgo.compare(prefixTree.get(prefixIdentifier), detailsLocRib);
            if (decisionResult <= 0) {
                prefixTree.replace(prefixIdentifier, detailsLocRib);
                for (BgpPrefixListener l : bgpController.prefixListener()) {
                    l.addPrefix((BgpPrefixIPv4LSNlriVer4) nlri, details);
                }
                log.debug("Local RIB update prefix: {}", detailsLocRib.toString());
            }
        } else {
            prefixTree.put(prefixIdentifier, detailsLocRib);
            for (BgpPrefixListener l : bgpController.prefixListener()) {
                l.addPrefix((BgpPrefixIPv4LSNlriVer4) nlri, details);
            }
            log.debug("Local RIB add prefix: {}", detailsLocRib.toString());
        }
    }
}
Also used : BgpNodeListener(org.onosproject.bgp.controller.BgpNodeListener) BgpPrefixListener(org.onosproject.bgp.controller.BgpPrefixListener) PathAttrNlriDetailsLocalRib(org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib) BgpPrefixLSIdentifier(org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier) BgpLinkListener(org.onosproject.bgp.controller.BgpLinkListener) BgpNodeLSNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4) BgpPrefixIPv4LSNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4) BgpNodeLSIdentifier(org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier) BgpLinkLsNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4) BgpLinkLSIdentifier(org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier)

Aggregations

BgpPrefixIPv4LSNlriVer4 (org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4)6 BgpLinkLsNlriVer4 (org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4)3 BgpNodeLSNlriVer4 (org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4)3 BgpPrefixLSIdentifier (org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier)3 BgpPrefixListener (org.onosproject.bgp.controller.BgpPrefixListener)2 BgpLSNlri (org.onosproject.bgpio.protocol.BgpLSNlri)2 PathAttrNlriDetails (org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails)2 PathAttrNlriDetailsLocalRib (org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib)2 ChannelBuffer (org.jboss.netty.buffer.ChannelBuffer)1 Test (org.junit.Test)1 BgpId (org.onosproject.bgp.controller.BgpId)1 BgpLinkListener (org.onosproject.bgp.controller.BgpLinkListener)1 BgpNodeListener (org.onosproject.bgp.controller.BgpNodeListener)1 BgpSessionInfo (org.onosproject.bgp.controller.BgpSessionInfo)1 BgpLinkLSIdentifier (org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier)1 BgpNodeLSIdentifier (org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier)1 BgpHeader (org.onosproject.bgpio.types.BgpHeader)1 BgpValueType (org.onosproject.bgpio.types.BgpValueType)1 IPReachabilityInformationTlv (org.onosproject.bgpio.types.IPReachabilityInformationTlv)1 LinkStateAttributes (org.onosproject.bgpio.types.LinkStateAttributes)1