本文整理汇总了Java中org.onosproject.incubator.net.resource.label.LabelResourceId.labelResourceId方法的典型用法代码示例。如果您正苦于以下问题:Java LabelResourceId.labelResourceId方法的具体用法?Java LabelResourceId.labelResourceId怎么用?Java LabelResourceId.labelResourceId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.incubator.net.resource.label.LabelResourceId
的用法示例。
在下文中一共展示了LabelResourceId.labelResourceId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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()));
}
示例2: 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()));
}
示例3: 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));
}
示例4: execute
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
@Override
protected void execute() {
LabelResourceService lrs = get(LabelResourceService.class);
Set<LabelResourceId> release = new HashSet<LabelResourceId>();
String[] labelIds = releaseLabelIds.split(",");
LabelResourceId resource = null;
for (int i = 0; i < labelIds.length; i++) {
resource = LabelResourceId.labelResourceId(Long.parseLong(labelIds[i]));
release.add(resource);
}
lrs.releaseToGlobalPool(release);
}
示例5: setupPathTest12
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
/**
* Tests path setup without signalling and with bandwidth reservation.
*/
@Test
public void setupPathTest12() {
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);
LabelResourceId link1Label = LabelResourceId.labelResourceId(5202);
pceManager.pceStore.addAdjLabel(link1, link1Label);
LabelResourceId link2Label = LabelResourceId.labelResourceId(5203);
pceManager.pceStore.addAdjLabel(link2, link2Label);
LabelResourceId link3Label = LabelResourceId.labelResourceId(5204);
pceManager.pceStore.addAdjLabel(link3, link3Label);
LabelResourceId link4Label = LabelResourceId.labelResourceId(5205);
pceManager.pceStore.addAdjLabel(link4, link4Label);
boolean result = pceManager.setupPath(D1.deviceId(), D2.deviceId(), "T123", constraints, SR_WITHOUT_SIGNALLING);
assertThat(result, is(true));
}
示例6: packetProcessingTest1
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
/**
* Tests packet in to trigger label DB sync.
*/
@Test
public void packetProcessingTest1() throws URISyntaxException {
build4RouterTopo(false, true, true, true, 0); // This also initializes devices etc.
LabelResourceId node1Label = LabelResourceId.labelResourceId(5200);
LabelResourceId node2Label = LabelResourceId.labelResourceId(5201);
pceManager.pceStore.addLsrIdDevice(deviceD1.annotations().value(LSRID), deviceD1.id());
pceManager.pceStore.addGlobalNodeLabel(D1.deviceId(), node1Label);
pceManager.pceStore.addGlobalNodeLabel(D2.deviceId(), node2Label);
ConnectPoint src = new ConnectPoint(D1.deviceId(), PortNumber.portNumber(1));
ConnectPoint dst = new ConnectPoint(D2.deviceId(), PortNumber.portNumber(2));
Link link1 = DefaultLink.builder().src(src).dst(dst).state(ACTIVE).type(DIRECT)
.providerId(new ProviderId("eth", "1")).build();
LabelResourceId link1Label = LabelResourceId.labelResourceId(5204);
pceManager.pceStore.addAdjLabel(link1, link1Label);
TCP tcp = new TCP();
tcp.setDestinationPort(PCEP_PORT);
IPv4 ipv4 = new IPv4();
ipv4.setProtocol(IPv4.PROTOCOL_TCP);
ipv4.setPayload(tcp);
Ethernet eth = new Ethernet();
eth.setEtherType(Ethernet.TYPE_IPV4);
eth.setPayload(ipv4);
InboundPacket inPkt = new DefaultInboundPacket(new ConnectPoint(DeviceId.deviceId("1.1.1.1"),
PortNumber.portNumber(PCEP_PORT)),
eth, null);
pktProcessor.process(new MockPcepPacketContext(inPkt, null));
assertThat(flowsDownloaded, is(4));
}
示例7: packetProcessingTest2
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
/**
* Tests faulty packet in to trigger label DB sync.
*/
@Test
public void packetProcessingTest2() throws URISyntaxException {
build4RouterTopo(false, true, true, true, 0); // This also initializes devices etc.
LabelResourceId node1Label = LabelResourceId.labelResourceId(5200);
LabelResourceId node2Label = LabelResourceId.labelResourceId(5201);
pceManager.pceStore.addGlobalNodeLabel(D1.deviceId(), node1Label);
pceManager.pceStore.addGlobalNodeLabel(D2.deviceId(), node2Label);
ConnectPoint src = new ConnectPoint(D1.deviceId(), PortNumber.portNumber(1));
ConnectPoint dst = new ConnectPoint(D2.deviceId(), PortNumber.portNumber(2));
Link link1 = DefaultLink.builder().src(src).dst(dst).state(ACTIVE).type(DIRECT)
.providerId(new ProviderId("eth", "1")).build();
LabelResourceId link1Label = LabelResourceId.labelResourceId(5204);
pceManager.pceStore.addAdjLabel(link1, link1Label);
TCP tcp = new TCP(); // Not set the pcep port.
IPv4 ipv4 = new IPv4();
ipv4.setProtocol(IPv4.PROTOCOL_TCP);
ipv4.setPayload(tcp);
Ethernet eth = new Ethernet();
eth.setEtherType(Ethernet.TYPE_IPV4);
eth.setPayload(ipv4);
InboundPacket inPkt = new DefaultInboundPacket(new ConnectPoint(D1.deviceId(),
PortNumber.portNumber(PCEP_PORT)),
eth, null);
pktProcessor.process(new MockPcepPacketContext(inPkt, null));
assertThat(flowsDownloaded, is(0));
}
示例8: applyFromDevicePool
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
public Collection<LabelResource> applyFromDevicePool(DeviceId deviceId,
long applyNum) {
Collection<LabelResource> labelList = new LinkedList<>();
LabelResource label = new DefaultLabelResource(deviceId,
LabelResourceId.labelResourceId(
getLabelId(LOCAL_LABEL_SPACE_MIN, LOCAL_LABEL_SPACE_MAX)));
labelList.add(label);
return labelList;
}
示例9: applyFromGlobalPool
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
public Collection<LabelResource> applyFromGlobalPool(long applyNum) {
Collection<LabelResource> labelList = new LinkedList<>();
LabelResource label = new DefaultLabelResource(DeviceId.deviceId("foo"),
LabelResourceId.labelResourceId(
getLabelId(GLOBAL_LABEL_SPACE_MIN, GLOBAL_LABEL_SPACE_MAX)));
labelList.add(label);
return labelList;
}
示例10: applyFromDevicePool
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
@Override
public Collection<LabelResource> applyFromDevicePool(DeviceId deviceId,
long applyNum) {
Collection<LabelResource> labelList = new LinkedList<>();
LabelResource label = new DefaultLabelResource(deviceId,
LabelResourceId.labelResourceId(
getLabelId(LOCAL_LABEL_SPACE_MIN, LOCAL_LABEL_SPACE_MAX)));
labelList.add(label);
return labelList;
}
示例11: applyFromGlobalPool
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
@Override
public Collection<LabelResource> applyFromGlobalPool(long applyNum) {
Collection<LabelResource> labelList = new LinkedList<>();
LabelResource label = new DefaultLabelResource(DeviceId.deviceId("foo"),
LabelResourceId.labelResourceId(
getLabelId(GLOBAL_LABEL_SPACE_MIN, GLOBAL_LABEL_SPACE_MAX)));
labelList.add(label);
return labelList;
}
示例12: testEquals
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
/**
* Checks the operation of equals() methods.
*/
@Test
public void testEquals() {
// create same two objects.
DeviceId deviceId1 = DeviceId.deviceId("foo");
LabelResourceId inLabelId1 = LabelResourceId.labelResourceId(1);
LabelResourceId outLabelId1 = LabelResourceId.labelResourceId(2);
PortNumber inPort1 = PortNumber.portNumber(5122);
PortNumber outPort1 = PortNumber.portNumber(5123);
LspLocalLabelInfo lspLocalLabel1 = DefaultLspLocalLabelInfo.builder()
.deviceId(deviceId1)
.inLabelId(inLabelId1)
.outLabelId(outLabelId1)
.inPort(inPort1)
.outPort(outPort1)
.build();
// create same object as above object
LspLocalLabelInfo sameLocalLabel1 = DefaultLspLocalLabelInfo.builder()
.deviceId(deviceId1)
.inLabelId(inLabelId1)
.outLabelId(outLabelId1)
.inPort(inPort1)
.outPort(outPort1)
.build();
// Create different object.
DeviceId deviceId2 = DeviceId.deviceId("goo");
LabelResourceId inLabelId2 = LabelResourceId.labelResourceId(3);
LabelResourceId outLabelId2 = LabelResourceId.labelResourceId(4);
PortNumber inPort2 = PortNumber.portNumber(5124);
PortNumber outPort2 = PortNumber.portNumber(5125);
LspLocalLabelInfo lspLocalLabel2 = DefaultLspLocalLabelInfo.builder()
.deviceId(deviceId2)
.inLabelId(inLabelId2)
.outLabelId(outLabelId2)
.inPort(inPort2)
.outPort(outPort2)
.build();
new EqualsTester().addEqualityGroup(lspLocalLabel1, sameLocalLabel1)
.addEqualityGroup(lspLocalLabel2)
.testEquals();
}
示例13: testEquals
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
/**
* Checks the operation of equals() methods.
*/
@Test
public void testEquals() {
// create same two objects.
List<LspLocalLabelInfo> lspLocalLabelList1 = new LinkedList<>();
ResourceConsumer tunnelConsumerId1 = TunnelConsumerId.valueOf(10);
// create object of DefaultLspLocalLabelInfo
DeviceId deviceId1 = DeviceId.deviceId("foo");
LabelResourceId inLabelId1 = LabelResourceId.labelResourceId(1);
LabelResourceId outLabelId1 = LabelResourceId.labelResourceId(2);
PortNumber inPort1 = PortNumber.portNumber(5122);
PortNumber outPort1 = PortNumber.portNumber(5123);
LspLocalLabelInfo lspLocalLabel1 = DefaultLspLocalLabelInfo.builder()
.deviceId(deviceId1)
.inLabelId(inLabelId1)
.outLabelId(outLabelId1)
.inPort(inPort1)
.outPort(outPort1)
.build();
lspLocalLabelList1.add(lspLocalLabel1);
PceccTunnelInfo pceccTunnelInfo1 = new PceccTunnelInfo(lspLocalLabelList1, tunnelConsumerId1);
// create same as above object
PceccTunnelInfo samePceccTunnelInfo1 = new PceccTunnelInfo(lspLocalLabelList1, tunnelConsumerId1);
// Create different object.
List<LspLocalLabelInfo> lspLocalLabelInfoList2 = new LinkedList<>();
ResourceConsumer tunnelConsumerId2 = TunnelConsumerId.valueOf(20);
// create object of DefaultLspLocalLabelInfo
DeviceId deviceId2 = DeviceId.deviceId("goo");
LabelResourceId inLabelId2 = LabelResourceId.labelResourceId(3);
LabelResourceId outLabelId2 = LabelResourceId.labelResourceId(4);
PortNumber inPort2 = PortNumber.portNumber(5124);
PortNumber outPort2 = PortNumber.portNumber(5125);
LspLocalLabelInfo lspLocalLabel2 = DefaultLspLocalLabelInfo.builder()
.deviceId(deviceId2)
.inLabelId(inLabelId2)
.outLabelId(outLabelId2)
.inPort(inPort2)
.outPort(outPort2)
.build();
lspLocalLabelInfoList2.add(lspLocalLabel2);
PceccTunnelInfo pceccTunnelInfo2 = new PceccTunnelInfo(lspLocalLabelInfoList2, tunnelConsumerId2);
new EqualsTester().addEqualityGroup(pceccTunnelInfo1, samePceccTunnelInfo1)
.addEqualityGroup(pceccTunnelInfo2)
.testEquals();
}
示例14: testUpdateTunnelInfo
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
/**
* Checks the operation of updateTunnelInfo() method.
*/
@Test
public void testUpdateTunnelInfo() {
// add tunnel info
testAddTunnelInfo();
// new updates
// Create pceccTunnelInfo3
List<LspLocalLabelInfo> lspLocalLabelInfoList3 = new LinkedList<>();
ResourceConsumer tunnelConsumerId3 = TunnelConsumerId.valueOf(30);
DeviceId deviceId3 = DeviceId.deviceId("goo");
LabelResourceId inLabelId3 = LabelResourceId.labelResourceId(3);
LabelResourceId outLabelId3 = LabelResourceId.labelResourceId(4);
LspLocalLabelInfo lspLocalLabel3 = DefaultLspLocalLabelInfo.builder()
.deviceId(deviceId3)
.inLabelId(inLabelId3)
.outLabelId(outLabelId3)
.build();
lspLocalLabelInfoList3.add(lspLocalLabel3);
PceccTunnelInfo pceccTunnelInfo3 = new PceccTunnelInfo(lspLocalLabelInfoList3, tunnelConsumerId3);
// Create pceccTunnelInfo4
List<LspLocalLabelInfo> lspLocalLabelInfoList4 = new LinkedList<>();
ResourceConsumer tunnelConsumerId4 = TunnelConsumerId.valueOf(40);
DeviceId deviceId4 = DeviceId.deviceId("goo");
LabelResourceId inLabelId4 = LabelResourceId.labelResourceId(4);
LabelResourceId outLabelId4 = LabelResourceId.labelResourceId(5);
LspLocalLabelInfo lspLocalLabel4 = DefaultLspLocalLabelInfo.builder()
.deviceId(deviceId4)
.inLabelId(inLabelId4)
.outLabelId(outLabelId4)
.build();
lspLocalLabelInfoList4.add(lspLocalLabel4);
PceccTunnelInfo pceccTunnelInfo4 = new PceccTunnelInfo(lspLocalLabelInfoList4, tunnelConsumerId4);
// update only lspLocalLabelInfoList
assertThat(distrPceStore.updateTunnelInfo(tunnelId1, lspLocalLabelInfoList3), is(true));
assertThat(distrPceStore.updateTunnelInfo(tunnelId2, lspLocalLabelInfoList4), is(true));
// update only tunnelConsumerId
assertThat(distrPceStore.updateTunnelInfo(tunnelId1, tunnelConsumerId3), is(true));
assertThat(distrPceStore.updateTunnelInfo(tunnelId2, tunnelConsumerId4), is(true));
assertThat(distrPceStore.getTunnelInfo(tunnelId1), is(pceccTunnelInfo3));
assertThat(distrPceStore.getTunnelInfo(tunnelId2), is(pceccTunnelInfo4));
}
示例15: testComputeLabelStack
import org.onosproject.incubator.net.resource.label.LabelResourceId; //导入方法依赖的package包/类
/**
* Checks the operation of computeLabelStack() method.
*/
@Test
public void testComputeLabelStack() {
// Allocate node labels to each devices
labelId = LabelResourceId.labelResourceId(4097);
pceStore.addGlobalNodeLabel(D1.deviceId(), labelId);
labelId = LabelResourceId.labelResourceId(4098);
pceStore.addGlobalNodeLabel(D2.deviceId(), labelId);
labelId = LabelResourceId.labelResourceId(4099);
pceStore.addGlobalNodeLabel(D3.deviceId(), labelId);
labelId = LabelResourceId.labelResourceId(4100);
pceStore.addGlobalNodeLabel(D4.deviceId(), labelId);
labelId = LabelResourceId.labelResourceId(4101);
pceStore.addGlobalNodeLabel(D5.deviceId(), labelId);
// Allocate adjacency labels to each devices
labelId = LabelResourceId.labelResourceId(5122);
pceStore.addAdjLabel(link1, labelId);
labelId = LabelResourceId.labelResourceId(5123);
pceStore.addAdjLabel(link2, labelId);
labelId = LabelResourceId.labelResourceId(5124);
pceStore.addAdjLabel(link3, labelId);
labelId = LabelResourceId.labelResourceId(5125);
pceStore.addAdjLabel(link4, labelId);
// Compute label stack
LabelStack labelStack = srTeHandler.computeLabelStack(path1);
List<LabelResourceId> labelList = labelStack.labelResources();
Iterator<LabelResourceId> iterator = labelList.iterator();
// check adjacency label of D1.deviceId()
labelId = iterator.next();
assertThat(labelId, is(LabelResourceId.labelResourceId(5122)));
// check node-label of D2.deviceId()
labelId = iterator.next();
assertThat(labelId, is(LabelResourceId.labelResourceId(4098)));
// check adjacency label of D2.deviceId()
labelId = iterator.next();
assertThat(labelId, is(LabelResourceId.labelResourceId(5123)));
// check node-label of D3.deviceId()
labelId = iterator.next();
assertThat(labelId, is(LabelResourceId.labelResourceId(4099)));
// check adjacency label of D3.deviceId()
labelId = iterator.next();
assertThat(labelId, is(LabelResourceId.labelResourceId(5124)));
// check node-label of D4.deviceId()
labelId = iterator.next();
assertThat(labelId, is(LabelResourceId.labelResourceId(4100)));
// check adjacency label of D4.deviceId()
labelId = iterator.next();
assertThat(labelId, is(LabelResourceId.labelResourceId(5125)));
// check node-label of D5.deviceId()
labelId = iterator.next();
assertThat(labelId, is(LabelResourceId.labelResourceId(4101)));
}