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


Java PathAttrNlriDetails类代码示例

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


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

示例1: add

import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; //导入依赖的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: addVpn

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

示例3: add

import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; //导入依赖的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

示例4: add

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

示例5: addVpn

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

示例6: addLink

import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; //导入依赖的package包/类
@Override
public void addLink(BgpLinkLsNlriVer4 linkNlri, PathAttrNlriDetails details) throws BgpParseException {
    log.debug("Addlink {}", linkNlri.toString());

    LinkDescription linkDes = buildLinkDes(linkNlri, details, true);



    /*
     * Update link ports and configure bandwidth on source and destination port using networkConfig service
     * Only master of source link registers for bandwidth
     */
    if (mastershipService.isLocalMaster(linkDes.src().deviceId())) {
        registerBandwidthAndTeMetric(linkDes, details);
    }

    //Updating ports of the link
    deviceProviderService.updatePorts(linkDes.src().deviceId(), buildPortDescriptions(linkDes.src().deviceId(),
            linkDes.src().port()));

    deviceProviderService.updatePorts(linkDes.dst().deviceId(), buildPortDescriptions(linkDes.dst().deviceId(),
            linkDes.dst().port()));

    linkProviderService.linkDetected(linkDes);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:26,代码来源:BgpTopologyProvider.java

示例7: setPathAttrDetails

import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; //导入依赖的package包/类
/**
 * Sets BGP path attribute and NLRI details.
 *
 * @param nlriInfo MpReachNlri path attribute
 * @param pathAttr list of BGP path attributes
 * @return details object of PathAttrNlriDetails
 * @throws BgpParseException throw exception
 */
public PathAttrNlriDetails setPathAttrDetails(BgpLSNlri nlriInfo, List<BgpValueType> pathAttr)
        throws BgpParseException {
    PathAttrNlriDetails details = new PathAttrNlriDetails();
    details.setProtocolID(nlriInfo.getProtocolId());
    details.setIdentifier(nlriInfo.getIdentifier());
    details.setPathAttribute(pathAttr);
    return details;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:BgpPeerImpl.java

示例8: addLink

import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; //导入依赖的package包/类
@Override
public void addLink(BgpLinkLsNlriVer4 linkNlri, PathAttrNlriDetails details) throws BgpParseException {
    log.debug("Addlink {}", linkNlri.toString());

    LinkDescription linkDes = buildLinkDes(linkNlri, details, true);

    //If already link exists, return
    if (linkService.getLink(linkDes.src(), linkDes.dst()) != null || linkProviderService == null) {
        return;
    }

    /*
     * Update link ports and configure bandwidth on source and destination port using networkConfig service
     * Only master of source link registers for bandwidth
     */
    if (mastershipService.isLocalMaster(linkDes.src().deviceId())) {
        registerBandwidth(linkDes, details);
    }

    //Updating ports of the link
    deviceProviderService.updatePorts(linkDes.src().deviceId(), buildPortDescriptions(linkDes.src().deviceId(),
            linkDes.src().port()));

    deviceProviderService.updatePorts(linkDes.dst().deviceId(), buildPortDescriptions(linkDes.dst().deviceId(),
            linkDes.dst().port()));

    linkProviderService.linkDetected(linkDes);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:BgpTopologyProvider.java

示例9: registerBandwidth

import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; //导入依赖的package包/类
private void registerBandwidth(LinkDescription linkDes, PathAttrNlriDetails details) {
    if (details ==  null) {
        log.error("Couldnot able to register bandwidth ");
        return;
    }

    List<BgpValueType> attribute = details.pathAttributes().stream()
            .filter(attr -> attr instanceof LinkStateAttributes).collect(toList());
    if (attribute.isEmpty()) {
        return;
    }

    List<BgpValueType> tlvs = ((LinkStateAttributes) attribute.iterator().next()).linkStateAttributes();
    float maxReservableBw = 0;

    for (BgpValueType tlv : tlvs) {
        switch (tlv.getType()) {
        case LinkStateAttributes.ATTR_LINK_MAX_RES_BANDWIDTH:
            maxReservableBw = ((BgpLinkAttrMaxLinkBandwidth) tlv).linkAttrMaxLinkBandwidth();
            //will get in bits/second , convert to MBPS to store in network config service
            maxReservableBw = maxReservableBw / 1000000;
            break;
        default: // do nothing
        }
    }

    if (maxReservableBw == 0.0) {
        return;
    }

    //Configure bandwidth for src and dst port
    BandwidthCapacity config = networkConfigService.addConfig(linkDes.src(), BandwidthCapacity.class);
    config.capacity(Bandwidth.bps(maxReservableBw)).apply();

    config = networkConfigService.addConfig(linkDes.dst(), BandwidthCapacity.class);
    config.capacity(Bandwidth.bps(maxReservableBw)).apply();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:38,代码来源:BgpTopologyProvider.java

示例10: bgpTopologyProviderTestAddDevice1

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

示例11: bgpTopologyProviderTestAddDevice2

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

示例12: bgpTopologyProviderDeviceTestLabel1

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

示例13: bgpTopologyProviderDeviceTestLabel2

import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; //导入依赖的package包/类
/**
 * Add device check label registration is done and delete node destroy label pool.
 *
 * @throws BgpParseException while adding a device
 */
@Test
public void bgpTopologyProviderDeviceTestLabel2() 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));
        // Check label resource reserved for that device
        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));

        l.deleteNode(nodeNlri);
        assertThat(nodeRegistry.connected.size(), is(0));
        assertThat(labelResourceAdminService.resourcePool.keySet().size(), is(0));
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:43,代码来源:BgpTopologyProviderTest.java

示例14: bgpTopologyProviderDeviceTestLabel1

import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; //导入依赖的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));
    }
    DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();

    newBuilder.set("lsrId", "1.1.1.1");

    Device device = new DefaultDevice(BgpTopologyProviderTest.providerId, nodeRegistry.connected.iterator().next(),
            Device.Type.ROUTER, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, new ChassisId(), newBuilder.build());

    DeviceEvent event = new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, device);
    listener.event(event);
    assertThat(labelResourceAdminService.resourcePool.keySet().size(), is(1));
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:44,代码来源:BgpTopologyProviderTest.java

示例15: selectionAlgoTest1

import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; //导入依赖的package包/类
/**
 * firstPathAttribute and secondPathAttribute has same AS count and firstPathAttribute
 * has shortest Origin value than secondPathAttribute.
 */
@Test
public void selectionAlgoTest1() throws BgpParseException {
    byte[] peerIp = new byte[] {0x0a, 0x0a, 0x0a, 0x0a };
    LinkedList<BgpValueType> pathAttributes1 = new LinkedList<>();
    BgpValueType pathAttribute1;
    //origin with IGP
    byte[] origin = new byte[] {0x40, 0x01, 0x01, 0x00 };
    ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
    buffer.writeBytes(origin);
    pathAttribute1 = Origin.read(buffer);
    pathAttributes1.add(pathAttribute1);
    //AsPath with AS_SEQ with one AS
    byte[] asPath = new byte[] {0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd,
            (byte) 0xea };
    buffer.writeBytes(asPath);
    pathAttribute1 = AsPath.read(buffer);
    pathAttributes1.add(pathAttribute1);

    IpAddress ipAddress = IpAddress.valueOf(Version.INET, peerIp);
    int bgpId = 168427777;
    short locRibAsNum = 100;
    boolean isIbgp = false;
    PathAttrNlriDetails attrList1 = new PathAttrNlriDetails();
    attrList1.setIdentifier(0);
    attrList1.setPathAttribute(pathAttributes1);
    attrList1.setProtocolID(ProtocolType.ISIS_LEVEL_ONE);
    PathAttrNlriDetailsLocalRib list1 = new PathAttrNlriDetailsLocalRib(
            ipAddress, bgpId, locRibAsNum, isIbgp, attrList1);

    peerIp = new byte[] {0x0b, 0x0b, 0x0b, 0x0b };
    LinkedList<BgpValueType> pathAttributes2 = new LinkedList<>();
    BgpValueType pathAttribute2;
    //origin with INCOMPLETE
    origin = new byte[] {0x40, 0x01, 0x01, 0x02 };
    buffer = ChannelBuffers.dynamicBuffer();
    buffer.writeBytes(origin);
    pathAttribute2 = Origin.read(buffer);
    pathAttributes2.add(pathAttribute2);
    //AsPath with AS_SEQ with one AS
    asPath = new byte[] {0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd,
            (byte) 0xe9 };
    buffer.writeBytes(asPath);
    pathAttribute2 = AsPath.read(buffer);
    pathAttributes2.add(pathAttribute2);

    ipAddress = IpAddress.valueOf(Version.INET, peerIp);
    bgpId = 536936448;
    locRibAsNum = 200;
    isIbgp = true;
    PathAttrNlriDetails attrList2 = new PathAttrNlriDetails();
    attrList2.setIdentifier(0);
    attrList2.setPathAttribute(pathAttributes2);
    attrList2.setProtocolID(ProtocolType.OSPF_V2);
    PathAttrNlriDetailsLocalRib list2 = new PathAttrNlriDetailsLocalRib(
            ipAddress, bgpId, locRibAsNum, isIbgp, attrList2);
    BgpSelectionAlgo algo = new BgpSelectionAlgo();
    int result = algo.compare(list1, list2);
    assertThat(result, is(1));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:64,代码来源:BgpSelectionAlgoTest.java


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