Search in sources :

Example 6 with RouteDistinguisher

use of org.onosproject.bgpio.types.RouteDistinguisher 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)

Example 7 with RouteDistinguisher

use of org.onosproject.bgpio.types.RouteDistinguisher in project onos by opennetworkinglab.

the class BgpLocalRibImpl method localRibUpdateNode.

/**
 * Update local RIB node based on available peer adjacency RIB.
 *
 * @param o adjacency-in/VPN adjacency-in
 * @throws BgpParseException BGP parse exception
 */
public void localRibUpdateNode(Object o) throws BgpParseException {
    if (o instanceof AdjRibIn) {
        AdjRibIn adjRib = (AdjRibIn) o;
        log.debug("Update local RIB node.");
        Set<BgpNodeLSIdentifier> nodeKeys = adjRib.nodeTree().keySet();
        for (BgpNodeLSIdentifier key : nodeKeys) {
            PathAttrNlriDetails pathAttrNlri = adjRib.nodeTree().get(key);
            BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(pathAttrNlri.identifier(), pathAttrNlri.protocolID().getType(), key, false, null);
            decisionProcess(nodeNlri);
        }
    }
    if (o instanceof VpnAdjRibIn) {
        VpnAdjRibIn vpnAdjRib = (VpnAdjRibIn) o;
        log.debug("Update local RIB VPN node.");
        Set<RouteDistinguisher> nodeKeysVpn = vpnAdjRib.vpnNodeTree().keySet();
        Map<BgpNodeLSIdentifier, PathAttrNlriDetails> node;
        for (RouteDistinguisher keyVpnNode : nodeKeysVpn) {
            node = vpnAdjRib.vpnNodeTree().get(keyVpnNode);
            Set<BgpNodeLSIdentifier> vpnNodeKeys = node.keySet();
            for (BgpNodeLSIdentifier key : vpnNodeKeys) {
                PathAttrNlriDetails pathAttrNlri = vpnAdjRib.nodeTree().get(key);
                BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(pathAttrNlri.identifier(), pathAttrNlri.protocolID().getType(), key, true, keyVpnNode);
                decisionProcess(nodeNlri, keyVpnNode);
            }
        }
    }
}
Also used : BgpNodeLSNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4) PathAttrNlriDetails(org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails) RouteDistinguisher(org.onosproject.bgpio.types.RouteDistinguisher) BgpNodeLSIdentifier(org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier)

Example 8 with RouteDistinguisher

use of org.onosproject.bgpio.types.RouteDistinguisher in project onos by opennetworkinglab.

the class BgpLinkLsNlriVer4 method read.

/**
 * Reads from channelBuffer and parses Link LS Nlri.
 *
 * @param cb ChannelBuffer
 * @param afi Address Family Identifier
 * @param safi Subsequent Address Family Identifier
 * @return object of this class
 * @throws BgpParseException while parsing Link LS NLRI
 */
public static BgpLinkLsNlriVer4 read(ChannelBuffer cb, short afi, byte safi) throws BgpParseException {
    boolean isVpn = false;
    RouteDistinguisher routeDistinguisher = null;
    if ((afi == Constants.AFI_VALUE) && (safi == Constants.VPN_SAFI_VALUE)) {
        routeDistinguisher = new RouteDistinguisher();
        routeDistinguisher = RouteDistinguisher.read(cb);
        isVpn = true;
    } else {
        isVpn = false;
    }
    byte protocolId = cb.readByte();
    long identifier = cb.readLong();
    BgpLinkLSIdentifier linkLSIdentifier = new BgpLinkLSIdentifier();
    linkLSIdentifier = BgpLinkLSIdentifier.parseLinkIdendifier(cb, protocolId);
    return new BgpLinkLsNlriVer4(protocolId, identifier, linkLSIdentifier, routeDistinguisher, isVpn);
}
Also used : RouteDistinguisher(org.onosproject.bgpio.types.RouteDistinguisher)

Example 9 with RouteDistinguisher

use of org.onosproject.bgpio.types.RouteDistinguisher in project onos by opennetworkinglab.

the class BgpLocalRibImpl method localRibUpdatePrefix.

/**
 * Update localRIB prefix based on available peer adjacency RIB.
 *
 * @param o instance of adjacency-in/VPN adjacency-in
 * @throws BgpParseException BGP parse exception
 */
public void localRibUpdatePrefix(Object o) throws BgpParseException {
    if (o instanceof AdjRibIn) {
        AdjRibIn adjRib = (AdjRibIn) o;
        log.debug("Update local RIB prefix.");
        Set<BgpPrefixLSIdentifier> prefixKeys = adjRib.prefixTree().keySet();
        for (BgpPrefixLSIdentifier key : prefixKeys) {
            PathAttrNlriDetails pathAttrNlri = adjRib.prefixTree().get(key);
            BgpPrefixIPv4LSNlriVer4 prefixNlri = new BgpPrefixIPv4LSNlriVer4(pathAttrNlri.identifier(), pathAttrNlri.protocolID().getType(), key, null, false);
            decisionProcess(prefixNlri);
        }
    }
    if (o instanceof VpnAdjRibIn) {
        VpnAdjRibIn vpnAdjRib = (VpnAdjRibIn) o;
        log.debug("Update local RIB VPN prefix.");
        Set<RouteDistinguisher> prefixKeysVpn = vpnAdjRib.vpnPrefixTree().keySet();
        Map<BgpPrefixLSIdentifier, PathAttrNlriDetails> prefix;
        for (RouteDistinguisher keyVpnPrefix : prefixKeysVpn) {
            prefix = vpnAdjRib.vpnPrefixTree().get(keyVpnPrefix);
            Set<BgpPrefixLSIdentifier> vpnPrefixKeys = prefix.keySet();
            for (BgpPrefixLSIdentifier key : vpnPrefixKeys) {
                PathAttrNlriDetails pathAttrNlri = vpnAdjRib.prefixTree().get(key);
                BgpPrefixIPv4LSNlriVer4 prefixNlri = new BgpPrefixIPv4LSNlriVer4(pathAttrNlri.identifier(), pathAttrNlri.protocolID().getType(), key, keyVpnPrefix, true);
                decisionProcess(prefixNlri, keyVpnPrefix);
            }
        }
    }
}
Also used : BgpPrefixLSIdentifier(org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier) BgpPrefixIPv4LSNlriVer4(org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4) PathAttrNlriDetails(org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails) RouteDistinguisher(org.onosproject.bgpio.types.RouteDistinguisher)

Aggregations

RouteDistinguisher (org.onosproject.bgpio.types.RouteDistinguisher)9 PathAttrNlriDetails (org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails)5 BgpNodeLSIdentifier (org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier)3 InetSocketAddress (java.net.InetSocketAddress)2 LinkedList (java.util.LinkedList)2 Channel (org.jboss.netty.channel.Channel)2 Test (org.junit.Test)2 BgpId (org.onosproject.bgp.controller.BgpId)2 BgpLocalRibImpl (org.onosproject.bgp.controller.impl.BgpLocalRibImpl)2 BgpPeerImpl (org.onosproject.bgp.controller.impl.BgpPeerImpl)2 VpnAdjRibIn (org.onosproject.bgp.controller.impl.VpnAdjRibIn)2 NodeDescriptors (org.onosproject.bgpio.protocol.linkstate.NodeDescriptors)2 PathAttrNlriDetailsLocalRib (org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib)2 BgpValueType (org.onosproject.bgpio.types.BgpValueType)2 MultiProtocolExtnCapabilityTlv (org.onosproject.bgpio.types.MultiProtocolExtnCapabilityTlv)2 InetAddress (java.net.InetAddress)1 IpAddress (org.onlab.packet.IpAddress)1 MacAddress (org.onlab.packet.MacAddress)1 BgpLinkLSIdentifier (org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier)1 BgpLinkLsNlriVer4 (org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4)1