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);
}
}
}
}
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);
}
}
}
}
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);
}
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);
}
}
}
}
Aggregations