本文整理汇总了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());
}
}
示例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());
}
}
示例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());
}
}
示例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()));
}
示例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()));
}
示例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()));
}
示例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));
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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)));
}