本文整理汇总了Java中org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4类的典型用法代码示例。如果您正苦于以下问题:Java BgpNodeLSNlriVer4类的具体用法?Java BgpNodeLSNlriVer4怎么用?Java BgpNodeLSNlriVer4使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BgpNodeLSNlriVer4类属于org.onosproject.bgpio.protocol.linkstate包,在下文中一共展示了BgpNodeLSNlriVer4类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Update vpn nlri identifier into the tree if nlri identifier exists in tree otherwise add this to the tree.
*
* @param nlri NLRI info
* @param details has pathattribute , protocolID and identifier
*/
public void add(BgpLSNlri nlri, PathAttrNlriDetails details) {
if (nlri instanceof BgpNodeLSNlriVer4) {
BgpNodeLSIdentifier nodeLSIdentifier = ((BgpNodeLSNlriVer4) nlri).getLocalNodeDescriptors();
if (nodeTree.containsKey(nodeLSIdentifier)) {
nodeTree.replace(nodeLSIdentifier, details);
} else {
nodeTree.put(nodeLSIdentifier, details);
}
} else if (nlri instanceof BgpLinkLsNlriVer4) {
BgpLinkLSIdentifier linkLSIdentifier = ((BgpLinkLsNlriVer4) nlri).getLinkIdentifier();
if (linkTree.containsKey(linkLSIdentifier)) {
linkTree.replace(linkLSIdentifier, details);
} else {
linkTree.put(linkLSIdentifier, details);
}
} else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) {
BgpPrefixLSIdentifier prefixIdentifier = ((BgpPrefixIPv4LSNlriVer4) nlri).getPrefixIdentifier();
if (prefixTree.containsKey(prefixIdentifier)) {
prefixTree.replace(prefixIdentifier, details);
} else {
prefixTree.put(prefixIdentifier, details);
}
}
}
示例2: addVpn
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Update nlri identifier mapped with route distinguisher if it exists in tree otherwise add nlri infomation mapped
* to respective route distinguisher in tree.
*
* @param nlri NLRI info
* @param details has pathattribute , protocolID and identifier
* @param routeDistinguisher unique for for each vpn
*/
public void addVpn(BgpLSNlri nlri, PathAttrNlriDetails details, RouteDistinguisher routeDistinguisher) {
add(nlri, details);
if (nlri instanceof BgpNodeLSNlriVer4) {
if (!vpnNodeTree.containsKey(routeDistinguisher)) {
vpnNodeTree.put(routeDistinguisher, nodeTree);
}
} else if (nlri instanceof BgpLinkLsNlriVer4) {
if (!vpnLinkTree.containsKey(routeDistinguisher)) {
vpnLinkTree.put(routeDistinguisher, linkTree);
}
} else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) {
if (!vpnPrefixTree.containsKey(routeDistinguisher)) {
vpnPrefixTree.put(routeDistinguisher, prefixTree);
}
}
}
示例3: add
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Update nlri identifier into the tree if nlri identifier exists in tree otherwise add this to the tree.
*
* @param nlri NLRI Info
* @param details has pathattribute , protocolID and identifier
*/
public void add(BgpLSNlri nlri, PathAttrNlriDetails details) {
if (nlri instanceof BgpNodeLSNlriVer4) {
BgpNodeLSIdentifier nodeLSIdentifier = ((BgpNodeLSNlriVer4) nlri).getLocalNodeDescriptors();
if (nodeTree.containsKey(nodeLSIdentifier)) {
nodeTree.replace(nodeLSIdentifier, details);
} else {
nodeTree.put(nodeLSIdentifier, details);
}
} else if (nlri instanceof BgpLinkLsNlriVer4) {
BgpLinkLSIdentifier linkLSIdentifier = ((BgpLinkLsNlriVer4) nlri).getLinkIdentifier();
if (linkTree.containsKey(linkLSIdentifier)) {
linkTree.replace(linkLSIdentifier, details);
} else {
linkTree.put(linkLSIdentifier, details);
}
} else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) {
BgpPrefixLSIdentifier prefixIdentifier = ((BgpPrefixIPv4LSNlriVer4) nlri).getPrefixIdentifier();
if (prefixTree.containsKey(prefixIdentifier)) {
prefixTree.replace(prefixIdentifier, details);
} else {
prefixTree.put(prefixIdentifier, details);
}
}
}
示例4: remove
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Removes nlri identifier if it exists in the adjacency tree.
*
* @param nlri NLRI Info
*/
public void remove(BgpLSNlri nlri) {
if (nlri instanceof BgpNodeLSNlriVer4) {
BgpNodeLSIdentifier nodeLSIdentifier = ((BgpNodeLSNlriVer4) nlri).getLocalNodeDescriptors();
if (nodeTree.containsKey(nodeLSIdentifier)) {
nodeTree.remove(nodeLSIdentifier);
}
} else if (nlri instanceof BgpLinkLsNlriVer4) {
BgpLinkLSIdentifier linkLSIdentifier = ((BgpLinkLsNlriVer4) nlri).getLinkIdentifier();
if (linkTree.containsKey(linkLSIdentifier)) {
linkTree.remove(linkLSIdentifier);
}
} else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) {
BgpPrefixLSIdentifier prefixIdentifier = ((BgpPrefixIPv4LSNlriVer4) nlri).getPrefixIdentifier();
if (prefixTree.containsKey(prefixIdentifier)) {
prefixTree.remove(prefixIdentifier);
}
}
}
示例5: decisionProcess
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Update VPN local RIB .
*
* @param nlri NLRI to update
* @param routeDistinguisher VPN id to update
* @throws BgpParseException BGP parse exception
*/
public void decisionProcess(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher) throws BgpParseException {
checkNotNull(nlri);
if (nlri instanceof BgpNodeLSNlriVer4) {
if (vpnNodeTree.containsKey(routeDistinguisher)) {
selectionProcessNode(nlri, true);
if (nodeTree.size() == 0) {
vpnNodeTree.remove(routeDistinguisher);
}
}
} else if (nlri instanceof BgpLinkLsNlriVer4) {
if (vpnLinkTree.containsKey(routeDistinguisher)) {
selectionProcessLink(nlri, true);
if (linkTree.size() == 0) {
vpnLinkTree.remove(routeDistinguisher);
}
}
} else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) {
if (vpnPrefixTree.containsKey(routeDistinguisher)) {
selectionProcessPrefix(nlri, true);
if (prefixTree.size() == 0) {
vpnPrefixTree.remove(routeDistinguisher);
}
}
}
}
示例6: add
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
@Override
public void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details,
RouteDistinguisher routeDistinguisher) throws BgpParseException {
add(sessionInfo, nlri, details);
if (nlri instanceof BgpNodeLSNlriVer4) {
if (!vpnNodeTree.containsKey(routeDistinguisher)) {
vpnNodeTree.put(routeDistinguisher, nodeTree);
}
} else if (nlri instanceof BgpLinkLsNlriVer4) {
if (!vpnLinkTree.containsKey(routeDistinguisher)) {
vpnLinkTree.put(routeDistinguisher, linkTree);
}
} else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) {
if (!vpnPrefixTree.containsKey(routeDistinguisher)) {
vpnPrefixTree.put(routeDistinguisher, prefixTree);
}
}
}
示例7: deleteNode
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
@Override
public void deleteNode(BgpNodeLSNlriVer4 nodeNlri) {
log.debug("Delete node {}", nodeNlri.toString());
if (deviceProviderService == null) {
return;
}
BgpDpid deviceUri = new BgpDpid(nodeNlri);
DeviceId deviceId = deviceId(uri(deviceUri.toString()));
if (labelResourceAdminService != null) {
//Destroy local device label pool reserved for that device
labelResourceAdminService.destroyDevicePool(deviceId);
}
deviceProviderService.deviceDisconnected(deviceId);
}
示例8: bgpTopologyProviderTestAddDevice3
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Delete node when node does not exist, RIB count should be zero.
*/
@Test
public void bgpTopologyProviderTestAddDevice3() {
LinkedList<BgpValueType> subTlvs;
BgpValueType tlv = new AutonomousSystemTlv(10);
short deslength = AutonomousSystemTlv.LENGTH;
short desType = AutonomousSystemTlv.TYPE;
subTlvs = new LinkedList<>();
subTlvs.add(tlv);
BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength,
desType));
BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false,
new RouteDistinguisher());
for (BgpNodeListener l : controller.nodeListener) {
l.deleteNode(nodeNlri);
assertThat(nodeRegistry.connected.size(), is(0));
}
}
示例9: addVpn
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Update nlri identifier mapped with route distinguisher if it exists in tree otherwise add nlri information mapped
* to respective route distinguisher in tree.
*
* @param nlri NLRI info
* @param details has pathattribute , protocolID and identifier
* @param routeDistinguisher unique for for each vpn
*/
public void addVpn(BgpLSNlri nlri, PathAttrNlriDetails details, RouteDistinguisher routeDistinguisher) {
add(nlri, details);
if (nlri instanceof BgpNodeLSNlriVer4) {
if (!vpnNodeTree.containsKey(routeDistinguisher)) {
vpnNodeTree.put(routeDistinguisher, nodeTree);
}
} else if (nlri instanceof BgpLinkLsNlriVer4) {
if (!vpnLinkTree.containsKey(routeDistinguisher)) {
vpnLinkTree.put(routeDistinguisher, linkTree);
}
} else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) {
if (!vpnPrefixTree.containsKey(routeDistinguisher)) {
vpnPrefixTree.put(routeDistinguisher, prefixTree);
}
}
}
示例10: BgpDpid
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Initialize BGP id to generate URI.
*
* @param nlri node NLRI.
*/
public BgpDpid(final BgpNodeLSNlriVer4 nlri) {
this.stringBuilder = new StringBuilder("");
if (((BgpNodeLSNlriVer4) nlri).getRouteDistinguisher() != null) {
this.stringBuilder.append("RD=")
.append(((BgpNodeLSNlriVer4) nlri).getRouteDistinguisher().getRouteDistinguisher()).append(":");
}
this.stringBuilder.append(":ROUTINGUNIVERSE=").append(((BgpNodeLSNlriVer4) nlri).getIdentifier());
add(((BgpNodeLSNlriVer4) nlri).getLocalNodeDescriptors().getNodedescriptors());
log.info("BgpDpid :: add");
}
示例11: callRemove
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* 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());
}
}
}
}
示例12: removeVpn
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Removes vpn nlri identifier mapped to route distinguisher if it exists in tree.
*
* @param nlri NLRI Info
* @param routeDistinguisher unique for for each vpn
*/
public void removeVpn(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher) {
if (nlri instanceof BgpNodeLSNlriVer4) {
if (vpnNodeTree.containsKey(routeDistinguisher)) {
BgpNodeLSIdentifier nodeLSIdentifier = ((BgpNodeLSNlriVer4) nlri).getLocalNodeDescriptors();
if (nodeTree.containsKey(nodeLSIdentifier)) {
nodeTree.remove(nodeLSIdentifier);
}
if ((vpnNodeTree.get(routeDistinguisher)).isEmpty()) {
vpnNodeTree.remove(routeDistinguisher);
}
}
} else if (nlri instanceof BgpLinkLsNlriVer4) {
if (vpnLinkTree.containsKey(routeDistinguisher)) {
BgpLinkLSIdentifier linkLSIdentifier = ((BgpLinkLsNlriVer4) nlri).getLinkIdentifier();
if (linkTree.containsKey(linkLSIdentifier)) {
linkTree.remove(linkLSIdentifier);
}
if ((vpnLinkTree.get(routeDistinguisher)).isEmpty()) {
vpnLinkTree.remove(routeDistinguisher);
}
}
} else if (nlri instanceof BgpPrefixIPv4LSNlriVer4) {
if (vpnPrefixTree.containsKey(routeDistinguisher)) {
BgpPrefixLSIdentifier prefixIdentifier = ((BgpPrefixIPv4LSNlriVer4) nlri).getPrefixIdentifier();
if (prefixTree.containsKey(prefixIdentifier)) {
prefixTree.remove(prefixIdentifier);
}
if ((vpnPrefixTree.get(routeDistinguisher)).isEmpty()) {
vpnPrefixTree.remove(routeDistinguisher);
}
}
}
}
示例13: bgpTopologyProviderTestAddDevice1
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Validate node is added to the device validating URI, RIB should get updated properly.
*/
@Test
public void bgpTopologyProviderTestAddDevice1() {
LinkedList<BgpValueType> subTlvs = new LinkedList<>();
BgpValueType tlv = new AutonomousSystemTlv(100);
short deslength = AutonomousSystemTlv.LENGTH;
short desType = AutonomousSystemTlv.TYPE;
subTlvs.add(tlv);
BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength,
desType));
BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false,
new RouteDistinguisher());
PathAttrNlriDetails details = new PathAttrNlriDetails();
details.setIdentifier(0);
details.setProtocolID(ProtocolType.DIRECT);
List<BgpValueType> pathAttributes = new LinkedList<>();
details.setPathAttribute(pathAttributes);
for (BgpNodeListener l : controller.nodeListener) {
l.addNode(nodeNlri, details);
assertThat(nodeRegistry.connected.size(), is(1));
l.deleteNode(nodeNlri);
assertThat(nodeRegistry.connected.size(), is(0));
}
}
示例14: bgpTopologyProviderTestAddDevice2
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Validate node is not added to the device for invalid URI, RIB count should be zero.
*/
@Test
public void bgpTopologyProviderTestAddDevice2() {
LinkedList<BgpValueType> subTlvs;
BgpValueType tlv = new AutonomousSystemTlv(10);
short deslength = AutonomousSystemTlv.LENGTH;
short desType = AutonomousSystemTlv.TYPE;
PathAttrNlriDetails details = new PathAttrNlriDetails();
details.setIdentifier(0);
details.setProtocolID(ProtocolType.DIRECT);
List<BgpValueType> pathAttributes = new LinkedList<>();
details.setPathAttribute(pathAttributes);
subTlvs = new LinkedList<>();
subTlvs.add(tlv);
BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength,
desType));
BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false,
new RouteDistinguisher());
for (BgpNodeListener l : controller.nodeListener) {
l.addNode(nodeNlri, details);
assertThat(nodeRegistry.connected.size(), is(0));
}
}
示例15: bgpTopologyProviderDeviceTestLabel1
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; //导入依赖的package包/类
/**
* Add device check label registration is done.
*
* @throws BgpParseException while adding a device
*/
@Test
public void bgpTopologyProviderDeviceTestLabel1() throws BgpParseException {
LinkedList<BgpValueType> subTlvs = new LinkedList<>();
BgpValueType tlv = new AutonomousSystemTlv(100);
short deslength = AutonomousSystemTlv.LENGTH;
short desType = AutonomousSystemTlv.TYPE;
subTlvs.add(tlv);
BgpNodeLSIdentifier localNodeDescriptors = new BgpNodeLSIdentifier(new NodeDescriptors(subTlvs, deslength,
desType));
BgpNodeLSNlriVer4 nodeNlri = new BgpNodeLSNlriVer4(0, (byte) Constants.DIRECT, localNodeDescriptors, false,
new RouteDistinguisher());
PathAttrNlriDetails details = new PathAttrNlriDetails();
details.setIdentifier(0);
details.setProtocolID(ProtocolType.DIRECT);
List<BgpValueType> pathAttributes = new LinkedList<>();
List<BgpValueType> linkStateAttributes = new LinkedList<>();
tlv = BgpAttrRouterIdV4.of(Ip4Address.valueOf("1.1.1.1"), LinkStateAttributes.ATTR_NODE_IPV4_LOCAL_ROUTER_ID);
linkStateAttributes.add(tlv);
pathAttributes.add(new LinkStateAttributes(linkStateAttributes));
details.setPathAttribute(pathAttributes);
for (BgpNodeListener l : controller.nodeListener) {
l.addNode(nodeNlri, details);
assertThat(nodeRegistry.connected.size(), is(1));
}
MastershipEvent event = new MastershipEvent(Type.MASTER_CHANGED, nodeRegistry.connected.iterator().next(),
new RoleInfo(NodeId.nodeId("Node1"), new LinkedList<>()));
listener.event(event);
assertThat(labelResourceAdminService.resourcePool.keySet().size(), is(1));
}