当前位置: 首页>>代码示例>>Java>>正文


Java BgpPrefixLSIdentifier类代码示例

本文整理汇总了Java中org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier的典型用法代码示例。如果您正苦于以下问题:Java BgpPrefixLSIdentifier类的具体用法?Java BgpPrefixLSIdentifier怎么用?Java BgpPrefixLSIdentifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BgpPrefixLSIdentifier类属于org.onosproject.bgpio.protocol.linkstate包,在下文中一共展示了BgpPrefixLSIdentifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: add

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的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);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:VpnAdjRibIn.java

示例2: add

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的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);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:AdjRibIn.java

示例3: remove

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的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);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:AdjRibIn.java

示例4: displayPrefix

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
private void displayPrefix() {
    try {
        this.bgpController = get(BgpController.class);
        bgpLocalRib = bgpController.bgpLocalRib();
        Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib> prefixmap = bgpLocalRib.prefixTree();
        Set<BgpPrefixLSIdentifier> prefixkeySet = prefixmap.keySet();
        for (BgpPrefixLSIdentifier prefix : prefixkeySet) {
            pathAttrNlriDetailsLocalRib = prefixmap.get(prefix);
            pathAttrNlriDetails = pathAttrNlriDetailsLocalRib.localRibNlridetails();
            print("No of entries = %d", prefixmap.size());
            System.out.print(pathAttrNlriDetailsLocalRib.toString());

        }


    } catch (Exception e) {
        log.debug("Error occurred while displaying BGP prefixes: {}", e.getMessage());

    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:21,代码来源:BgpLocalRibDisplay.java

示例5: displayVpnPrefix

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
private void displayVpnPrefix() {
    try {
        this.bgpController = get(BgpController.class);
        bgpLocalRib = bgpController.bgpLocalRib();
        Map<RouteDistinguisher, Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnPrefix =
                bgpLocalRib.vpnPrefixTree();
        Set<RouteDistinguisher> vpnPrefixkeySet = vpnPrefix.keySet();
        for (RouteDistinguisher vpnprefixId : vpnPrefixkeySet) {
            boolean invalidProcess = true;
            if (vpnId != null && Integer.parseInt(vpnId.trim()) == vpnprefixId.hashCode()) {
                invalidProcess = false;
                displayPrefix();
            }
            if (invalidProcess) {
                print("%s\n", "Id " + vpnId + "does not exist...!!!");
            }
        }
    } catch (Exception e) {
        log.debug("Error occurred while displaying BGP prefixes based on VPN : {}", e.getMessage());
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:22,代码来源:BgpLocalRibDisplay.java

示例6: removeVpn

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的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);
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:40,代码来源:VpnAdjRibIn.java

示例7: selectionProcessPrefix

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
/**
 * 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();
    if (prefixTree.containsKey(prefixIdentifier)) {
        log.debug("Local RIB remove prefix: {}", prefixIdentifier.toString());
        prefixTree.remove(prefixIdentifier);
    }

    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());
            }
        } else {
                if (!isVpnRib) {
                    if (peer.adjacencyRib().prefixTree().containsKey(prefixIdentifier)) {
                        add(peer.sessionInfo(), nlri, peer.adjacencyRib().prefixTree().get(prefixIdentifier));
                } else {
                    if (peer.vpnAdjacencyRib().prefixTree().containsKey(prefixIdentifier)) {
                        add(peer.sessionInfo(), nlri, peer.vpnAdjacencyRib().prefixTree().get(prefixIdentifier));
                    }
                }
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:62,代码来源:BgpLocalRibImpl.java

示例8: testBgpUpdateMessage8

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
/**
 * Peer1 has Prefix NLRI (MpReach).
 */
@Test
public void testBgpUpdateMessage8() throws InterruptedException {
    // Initiate the connections
    peer1.peerChannelHandler.asNumber = 200;
    peer1.peerChannelHandler.version = 4;
    peer1.peerChannelHandler.holdTime = 150;

    short afi = 16388;
    byte res = 0;
    byte safi = 71;

    bgpControllerImpl.getConfig().setLsCapability(true);
    BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
    peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
    peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.20", 0));
    TimeUnit.MILLISECONDS.sleep(1000);

    //Get peer1
    BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.20"));
    BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);

    LinkedList<BgpValueType> subTlvs = new LinkedList<>();
    BgpValueType tlv = AutonomousSystemTlv.of(2222);
    subTlvs.add(tlv);
    tlv = BgpLSIdentifierTlv.of(33686018);
    subTlvs.add(tlv);
    byte[] isoNodeID = new byte[] {0x19, 0x21, 0x68, 0x07, 0x70, 0x01};
    tlv = IsIsNonPseudonode.of(isoNodeID);
    subTlvs.add(tlv);
    NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x1a, (short) 256);
    LinkedList<BgpValueType> prefixDescriptor = new LinkedList<>();
    byte[] prefix = new byte[] {0x20, (byte) 0xc0, (byte) 0xa8, 0x4d, 0x01};
    ChannelBuffer tempCb = ChannelBuffers.dynamicBuffer();
    tempCb.writeBytes(prefix);
    tlv = IPReachabilityInformationTlv.read(tempCb, (short) 5);
    prefixDescriptor.add(tlv);
    BgpPrefixLSIdentifier key = new BgpPrefixLSIdentifier(nodeDes, prefixDescriptor);

    AdjRibIn adj = peer.adjRib();

    //In Adj-RIB, prefixTree should contain specified key
    assertThat(adj.prefixTree().containsKey(key), is(true));

    BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
    //In Local-RIB, prefixTree should contain specified key
    assertThat(obj.prefixTree().containsKey(key), is(true));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:51,代码来源:BgpControllerImplTest.java

示例9: selectionProcessPrefix

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
/**
 * 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();
    if (prefixTree.containsKey(prefixIdentifier)) {
        log.debug("Local RIB remove prefix: {}", prefixIdentifier.toString());
        prefixTree.remove(prefixIdentifier);
    }

    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());
            }
        } else {
                if (!isVpnRib) {
                    if (peer.adjacencyRib().prefixTree().containsKey(prefixIdentifier)) {
                        add(peer.sessionInfo(), nlri, peer.adjacencyRib().prefixTree().get(prefixIdentifier));
                } else {
                    if (peer.vpnAdjacencyRib().prefixTree().containsKey(prefixIdentifier)) {
                        add(peer.sessionInfo(), nlri, peer.vpnAdjacencyRib().prefixTree().get(prefixIdentifier));
                    }
                }
            }
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:62,代码来源:BgpLocalRibImpl.java

示例10: prefixTree

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
/**
 * Returns the adjacency prefix.
 *
 * @return prefix adjacency RIB node
 */
public Map<BgpPrefixLSIdentifier, PathAttrNlriDetails> prefixTree() {
    return prefixTree;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:VpnAdjRibIn.java

示例11: vpnPrefixTree

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
/**
 * Returns the adjacency vpnPrefix.
 *
 * @return vpnPrefix adjacency RIB node
 */
public Map<RouteDistinguisher, Map<BgpPrefixLSIdentifier, PathAttrNlriDetails>> vpnPrefixTree() {
    return vpnPrefixTree;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:VpnAdjRibIn.java

示例12: prefixTree

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
/**
 * Gets prefix NLRI tree.
 *
 * @return prefix tree
 */
public Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib> prefixTree() {
    return prefixTree;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:BgpLocalRibImpl.java

示例13: vpnPrefixTree

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
/**
 * Gets VPN prefix NLRI tree.
 *
 * @return vpn prefix NLRI Tree
 */
public Map<RouteDistinguisher, Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnPrefixTree() {
    return vpnPrefixTree;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:BgpLocalRibImpl.java

示例14: prefixTree

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
/**
 * Returns prefix NLRI tree.
 *
 * @return prefix tree
 */
Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib> prefixTree();
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:7,代码来源:BgpLocalRib.java

示例15: vpnPrefixTree

import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; //导入依赖的package包/类
/**
 * Returns VPN prefix NLRI tree.
 *
 * @return vpn prefix NLRI Tree
 */
Map<RouteDistinguisher, Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnPrefixTree();
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:7,代码来源:BgpLocalRib.java


注:本文中的org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。