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


Java LabelResourceId类代码示例

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


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

示例1: installNodeLabelRule

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
/**
 * Install a rule for pushing unique global labels to the device.
 *
 * @param deviceId device to which flow should be pushed
 * @param labelId label for the device
 * @param type type of operation
 */
private void installNodeLabelRule(DeviceId deviceId, LabelResourceId labelId, Objective.Operation type) {
    checkNotNull(flowObjectiveService);
    checkNotNull(appId);
    TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();

    selectorBuilder.matchMplsLabel(MplsLabel.mplsLabel(labelId.id().intValue()));

    TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();

    ForwardingObjective.Builder forwardingObjective = DefaultForwardingObjective.builder()
            .withSelector(selectorBuilder.build()).withTreatment(treatment)
            .withFlag(ForwardingObjective.Flag.VERSATILE).fromApp(appId).makePermanent();

    if (type.equals(Objective.Operation.ADD)) {

        flowObjectiveService.forward(deviceId, forwardingObjective.add());
    } else {
        flowObjectiveService.forward(deviceId, forwardingObjective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:PceccSrTeBeHandler.java

示例2: advertiseNodeLabelRule

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
/**
 * Install a rule for pushing node labels to the device of other nodes.
 *
 * @param deviceId device to which flow should be pushed
 * @param labelId label for the device
 * @param ipPrefix device for which label is pushed
 * @param type type of operation
 * @param bBos is this the end of sync push
 */
public void advertiseNodeLabelRule(DeviceId deviceId, LabelResourceId labelId, IpPrefix ipPrefix,
                                   Objective.Operation type, boolean bBos) {
    checkNotNull(flowObjectiveService);
    checkNotNull(appId);
    TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();

    selectorBuilder.matchMplsLabel(MplsLabel.mplsLabel(labelId.id().intValue()));
    selectorBuilder.matchIPSrc(ipPrefix);

    if (bBos) {
        selectorBuilder.matchMplsBos(bBos);
    }

    TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();

    ForwardingObjective.Builder forwardingObjective = DefaultForwardingObjective.builder()
            .withSelector(selectorBuilder.build()).withTreatment(treatment)
            .withFlag(ForwardingObjective.Flag.VERSATILE).fromApp(appId).makePermanent();

    if (type.equals(Objective.Operation.ADD)) {
        flowObjectiveService.forward(deviceId, forwardingObjective.add());
    } else {
        flowObjectiveService.forward(deviceId, forwardingObjective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:35,代码来源:PceccSrTeBeHandler.java

示例3: installAdjLabelRule

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
/**
 * Install a rule for pushing Adjacency labels to the device.
 *
 * @param deviceId device to which flow should be pushed
 * @param labelId label for the adjacency
 * @param srcPortNum local port of the adjacency
 * @param dstPortNum remote port of the adjacency
 * @param type type of operation
 */
public void installAdjLabelRule(DeviceId deviceId, LabelResourceId labelId, PortNumber srcPortNum,
                                PortNumber dstPortNum, Objective.Operation type) {
    checkNotNull(flowObjectiveService);
    checkNotNull(appId);
    TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();

    selectorBuilder.matchMplsLabel(MplsLabel.mplsLabel(labelId.id().intValue()));
    selectorBuilder.matchIPSrc(IpPrefix.valueOf((int) srcPortNum.toLong(), 32));
    selectorBuilder.matchIPDst(IpPrefix.valueOf((int) dstPortNum.toLong(), 32));

    TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();

    ForwardingObjective.Builder forwardingObjective = DefaultForwardingObjective.builder()
            .withSelector(selectorBuilder.build()).withTreatment(treatment)
            .withFlag(ForwardingObjective.Flag.VERSATILE).fromApp(appId).makePermanent();

    if (type.equals(Objective.Operation.ADD)) {
        flowObjectiveService.forward(deviceId, forwardingObjective.add());
    } else {
        flowObjectiveService.forward(deviceId, forwardingObjective.remove());
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:32,代码来源:PceccSrTeBeHandler.java

示例4: testConstruction

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
/**
 * Checks the construction of a DefaultLspLocalLabelInfo object.
 */
@Test
public void testConstruction() {
    DeviceId deviceId = DeviceId.deviceId("foo");
    LabelResourceId inLabelId = LabelResourceId.labelResourceId(1);
    LabelResourceId outLabelId = LabelResourceId.labelResourceId(2);
    PortNumber inPort = PortNumber.portNumber(5122);
    PortNumber outPort = PortNumber.portNumber(5123);

    LspLocalLabelInfo lspLocalLabel = DefaultLspLocalLabelInfo.builder()
            .deviceId(deviceId)
            .inLabelId(inLabelId)
            .outLabelId(outLabelId)
            .inPort(inPort)
            .outPort(outPort)
            .build();

    assertThat(deviceId, is(lspLocalLabel.deviceId()));
    assertThat(inLabelId, is(lspLocalLabel.inLabelId()));
    assertThat(outLabelId, is(lspLocalLabel.outLabelId()));
    assertThat(inPort, is(lspLocalLabel.inPort()));
    assertThat(outPort, is(lspLocalLabel.outPort()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:DefaultLspLocalLabelInfoTest.java

示例5: testConstruction

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
/**
 * Checks the construction of a PceccTunnelInfo object.
 */
@Test
public void testConstruction() {
    List<LspLocalLabelInfo> lspLocalLabelInfoList = new LinkedList<>();
    ResourceConsumer tunnelConsumerId = TunnelConsumerId.valueOf(10);

    // create object of DefaultLspLocalLabelInfo
    DeviceId deviceId = DeviceId.deviceId("foo");
    LabelResourceId inLabelId = LabelResourceId.labelResourceId(1);
    LabelResourceId outLabelId = LabelResourceId.labelResourceId(2);
    PortNumber inPort = PortNumber.portNumber(5122);
    PortNumber outPort = PortNumber.portNumber(5123);

    LspLocalLabelInfo lspLocalLabelInfo = DefaultLspLocalLabelInfo.builder()
            .deviceId(deviceId)
            .inLabelId(inLabelId)
            .outLabelId(outLabelId)
            .inPort(inPort)
            .outPort(outPort)
            .build();
    lspLocalLabelInfoList.add(lspLocalLabelInfo);

    PceccTunnelInfo pceccTunnelInfo = new PceccTunnelInfo(lspLocalLabelInfoList, tunnelConsumerId);

    assertThat(lspLocalLabelInfoList, is(pceccTunnelInfo.lspLocalLabelInfoList()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:PceccTunnelInfoTest.java

示例6: testReleaseAdjacencyLabel

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
/**
 * Checks the operation of releaseAdjacencyLabel() method on adjacency label.
 */
@Test
public void testReleaseAdjacencyLabel() {
    // Test link1
    // Check whether adjacency label is released successfully.
    assertThat(srTeHandler.allocateAdjacencyLabel(link1), is(true));
    assertThat(srTeHandler.releaseAdjacencyLabel(link1), is(true));
    // Retrieve from store and check whether adjacency label is removed successfully for this device.
    LabelResourceId labelId = pceStore.getAdjLabel(link1);
    assertThat(labelId, is(nullValue()));

    // Test link2
    // Check whether adjacency label is released successfully.
    assertThat(srTeHandler.allocateAdjacencyLabel(link2), is(true));
    assertThat(srTeHandler.releaseAdjacencyLabel(link2), is(true));
    // Retrieve from store and check whether adjacency label is removed successfully for this device.
    labelId = pceStore.getAdjLabel(link2);
    assertThat(labelId, is(nullValue()));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:PceccSrTeBeHandlerTest.java

示例7: setupPathTest11

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
/**
 * Tests path setup without failure for LSP with signalling and with bandwidth reservation.
 */
@Test
public void setupPathTest11() {
    build4RouterTopo(false, true, true, true, 15);
    List<Constraint> constraints = new LinkedList<Constraint>();
    BandwidthConstraint bwConstraint = new BandwidthConstraint(Bandwidth.bps(10.0));
    CostConstraint costConstraint = new CostConstraint(TE_COST);

    constraints.add(costConstraint);
    constraints.add(bwConstraint);

    LabelResourceId node1Label = LabelResourceId.labelResourceId(5200);
    LabelResourceId node2Label = LabelResourceId.labelResourceId(5201);

    pceManager.pceStore.addGlobalNodeLabel(D1.deviceId(), node1Label);
    pceManager.pceStore.addGlobalNodeLabel(D2.deviceId(), node2Label);

    boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, SR_WITHOUT_SIGNALLING);
    assertThat(result, is(false));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:PceManagerTest.java

示例8: releaseLabel

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
/**
 * Release the label from the evpn route.
 *
 * @param vpnInstance vpn instance
 * @param host        host
 */
private Label releaseLabel(VpnInstance vpnInstance, Host host) {
    EvpnInstanceName instanceName = vpnInstance.vpnInstanceName();

    //Get all vpn-instance routes and check for label.
    Label label = null;
    for (EvpnInstanceRoute evpnInstanceRoute : evpnInstanceRoutes) {
        if (evpnInstanceRoute.evpnInstanceName().equals(instanceName)) {
            label = evpnInstanceRoute.getLabel();
            // delete private route and get label ,change to public route
            boolean isRelease
                    = labelService
                    .releaseToGlobalPool(
                            Sets.newHashSet(
                                    LabelResourceId
                                            .labelResourceId(label.getLabel())));
            if (!isRelease) {
                log.error(RELEASE_LABEL_FAILED, label.getLabel());
            }
            break;
        }
    }
    return label;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:30,代码来源:EvpnManager.java

示例9: createDevicePool

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
@Override
public boolean createDevicePool(DeviceId deviceId, LabelResourceId beginLabel, LabelResourceId endLabel) {
    LabelResourcePool labelResource = new LabelResourcePool(deviceId.toString(),
            beginLabel.labelId(),
            endLabel.labelId());
    if (resourcePool.containsValue(labelResource)) {
        return false;
    }

    resourcePool.put(deviceId, labelResource);
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:BgpTopologyProviderTest.java

示例10: createDevicePool

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
@Override
public boolean createDevicePool(DeviceId deviceId,
                                LabelResourceId beginLabel,
                                LabelResourceId endLabel) {
    checkNotNull(deviceId, "deviceId is not null");
    checkNotNull(beginLabel, "beginLabel is not null");
    checkNotNull(endLabel, "endLabel is not null");
    checkArgument(beginLabel.labelId() >= 0 || endLabel.labelId() >= 0,
                  "The value of beginLabel and the value of endLabel must be both positive number.");
    checkArgument(beginLabel.labelId() < endLabel.labelId(),
                  "The value of endLabel must be greater than the value of beginLabel.");
    return store.createDevicePool(deviceId, beginLabel, endLabel);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:LabelResourceManager.java

示例11: createGlobalPool

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
@Override
public boolean createGlobalPool(LabelResourceId beginLabel,
                                LabelResourceId endLabel) {
    checkNotNull(beginLabel, "beginLabel is not null");
    checkNotNull(endLabel, "endLabel is not null");
    checkArgument(beginLabel.labelId() >= 0 && endLabel.labelId() >= 0,
                  "The value of beginLabel and the value of endLabel must be both positive number.");
    checkArgument(beginLabel.labelId() < endLabel.labelId(),
                  "The value of endLabel must be greater than the value of beginLabel.");
    return store.createGlobalPool(beginLabel, endLabel);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:LabelResourceManager.java

示例12: deviceLabelResourcePoolDetected

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
@Override
public void deviceLabelResourcePoolDetected(DeviceId deviceId,
                                            LabelResourceId beginLabel,
                                            LabelResourceId endLabel) {
    checkNotNull(deviceId, "deviceId is not null");
    checkNotNull(beginLabel, "beginLabel is not null");
    checkNotNull(endLabel, "endLabel is not null");
    createDevicePool(deviceId, beginLabel, endLabel);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:LabelResourceManager.java

示例13: createDevicePool

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
@Override
public boolean createDevicePool(DeviceId deviceId,
                                LabelResourceId beginLabel,
                                LabelResourceId endLabel) {
    LabelResourcePool pool = new LabelResourcePool(deviceId.toString(),
                                                   beginLabel.labelId(),
                                                   endLabel.labelId());
    return this.create(pool);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:DistributedLabelResourceStore.java

示例14: createGlobalPool

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
@Override
public boolean createGlobalPool(LabelResourceId beginLabel,
                                LabelResourceId endLabel) {
    LabelResourcePool pool = new LabelResourcePool(GLOBAL_RESOURCE_POOL_DEVICE_ID,
                                                   beginLabel.labelId(),
                                                   endLabel.labelId());
    return this.internalCreate(pool);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:DistributedLabelResourceStore.java

示例15: execute

import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入依赖的package包/类
@Override
protected void execute() {
    LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
    lrs.createDevicePool(DeviceId.deviceId(deviceId), LabelResourceId
            .labelResourceId(Long.parseLong(beginLabel)), LabelResourceId
            .labelResourceId(Long.parseLong(endLabel)));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:LabelPoolCreateCommand.java


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