本文整理汇总了Java中org.onosproject.net.provider.ProviderId.NONE属性的典型用法代码示例。如果您正苦于以下问题:Java ProviderId.NONE属性的具体用法?Java ProviderId.NONE怎么用?Java ProviderId.NONE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.onosproject.net.provider.ProviderId
的用法示例。
在下文中一共展示了ProviderId.NONE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHost
/**
* Creates a default host connected at the given edge device and port. Note
* that an identifying hex character ("a" - "f") should be supplied. This
* will be included in the MAC address of the host (and equivalent value
* as last byte in IP address).
*
* @param device edge device
* @param port port number
* @param hexChar identifying hex character
* @return host connected at that location
*/
protected static Host createHost(Device device, int port, String hexChar) {
DeviceId deviceId = device.id();
String devNum = deviceId.toString().substring(1);
MacAddress mac = MacAddress.valueOf(HOST_MAC_PREFIX + devNum + hexChar);
HostId hostId = hostId(String.format("%s/-1", mac));
int ipByte = Integer.valueOf(hexChar, 16);
if (ipByte < 10 || ipByte > 15) {
throw new IllegalArgumentException("hexChar must be a-f");
}
HostLocation loc = new HostLocation(deviceId, portNumber(port), 0);
IpAddress ip = ip("10." + devNum + ".0." + ipByte);
return new DefaultHost(ProviderId.NONE, hostId, mac, VlanId.NONE,
loc, ImmutableSet.of(ip));
}
示例2: TestDeviceService
public TestDeviceService() {
Device d1 = new DefaultDevice(ProviderId.NONE, DID1, Device.Type.SWITCH,
"TESTMF", "TESTHW", "TESTSW", "TESTSN", new ChassisId());
Device d2 = new DefaultDevice(ProviderId.NONE, DID2, Device.Type.SWITCH,
"TESTMF", "TESTHW", "TESTSW", "TESTSN", new ChassisId());
devices.put(DID1, d1);
devices.put(DID2, d2);
pd1 = new DefaultPort(d1, PortNumber.portNumber(1), true);
pd2 = new DefaultPort(d1, PortNumber.portNumber(2), true);
pd3 = new DefaultPort(d2, PortNumber.portNumber(1), true);
pd4 = new DefaultPort(d2, PortNumber.portNumber(2), true);
ports.putAll(DID1, Lists.newArrayList(pd1, pd2));
ports.putAll(DID2, Lists.newArrayList(pd3, pd4));
}
示例3: tunnelAdded
@Override
public TunnelId tunnelAdded(TunnelDescription tunnel) {
TunnelId id = TunnelId.valueOf(String.valueOf(++tunnelIdCounter));
Tunnel storedTunnel = new DefaultTunnel(ProviderId.NONE,
tunnel.src(), tunnel.dst(),
tunnel.type(),
tunnel.groupId(),
id,
tunnel.tunnelName(),
tunnel.path(),
tunnel.resource(),
tunnel.annotations());
tunnelService.tunnelIdAsKeyStore.put(id, storedTunnel);
return id;
}
示例4: deviceConnected
@Override
public void deviceConnected(DeviceId deviceId, DeviceDescription deviceDescription) {
connected.add(deviceId);
Device device = new DefaultDevice(ProviderId.NONE, deviceId, Device.Type.ROUTER, UNKNOWN, UNKNOWN,
UNKNOWN, UNKNOWN, new ChassisId(), deviceDescription.annotations());
deviceMap.put(deviceId, device);
}
示例5: createEdgeLink
/**
* Creates a phantom edge link, to an unspecified end-station. This link
* does not represent any actually discovered link stored in the system.
*
* @param edgePort network edge port
* @param isIngress true to indicate host-to-network direction; false
* for network-to-host direction
* @return new phantom edge link
*/
public static DefaultEdgeLink createEdgeLink(ConnectPoint edgePort,
boolean isIngress) {
checkNotNull(edgePort, "Edge port cannot be null");
HostLocation location = (edgePort instanceof HostLocation) ?
(HostLocation) edgePort : new HostLocation(edgePort, 0);
return new DefaultEdgeLink(ProviderId.NONE,
new ConnectPoint(HostId.NONE, PortNumber.P0),
location, isIngress);
}
示例6: getHost
@Override
public Host getHost(HostId hostId) {
ProviderId providerId = ProviderId.NONE;
MacAddress mac = MacAddress.valueOf("fa:12:3e:56:ee:a2");
VlanId vlan = VlanId.NONE;
HostLocation location = HostLocation.NONE;
Set<IpAddress> ips = Sets.newHashSet();
Annotations annotations = null;
return new DefaultHost(providerId, hostId, mac, vlan, location, ips, annotations);
}
示例7: providerId
@Override
public ProviderId providerId() {
return ProviderId.NONE;
}
示例8: device
private DefaultDevice device(DeviceId did) {
return new DefaultDevice(ProviderId.NONE, did, Device.Type.SWITCH,
"TESTMF", "TESTHW", "TESTSW", "TESTSN", new ChassisId());
}
示例9: tunnelProviderAddedTest1
/**
* Tests PCRpt msg with sync flag set.
*/
@Test
public void tunnelProviderAddedTest1() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x84,
0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
0x00, 0x1c, 0x00, 0x04, // PATH-SETUP-TYPE TLV
0x00, 0x00, 0x00, 0x02,
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv
0x00, 0x12, 0x00, 0x10, // IPv4-LSP-IDENTIFIER-TLV
0x01, 0x01, 0x01, 0x01,
0x00, 0x01, 0x00, 0x01,
0x01, 0x01, 0x01, 0x01,
0x05, 0x05, 0x05, 0x05,
0x07, 0x10, 0x00, 0x14, //ERO object
0x01, 0x08, (byte) 0x01, 0x01, 0x01, 0x01, 0x04, 0x00, // ERO IPv4 sub objects
0x01, 0x08, (byte) 0x05, 0x05, 0x05, 0x05, 0x04, 0x00,
0x08, 0x10, 0x00, 0x34, //RRO object
0x01, 0x08, 0x11, 0x01, 0x01, 0x01, 0x04, 0x00, // RRO IPv4 sub objects
0x01, 0x08, 0x11, 0x01, 0x01, 0x02, 0x04, 0x00,
0x01, 0x08, 0x06, 0x06, 0x06, 0x06, 0x04, 0x00,
0x01, 0x08, 0x12, 0x01, 0x01, 0x02, 0x04, 0x00,
0x01, 0x08, 0x12, 0x01, 0x01, 0x01, 0x04, 0x00,
0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = reader.readFrom(buffer);
DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();
newBuilder.set(PcepTunnelProvider.LSRID, "1.1.1.1");
newBuilder.set(AnnotationKeys.TYPE, "L3");
Device device = new DefaultDevice(ProviderId.NONE, DeviceId.deviceId("1.1.1.1"), ROUTER,
UNKOWN, UNKOWN, UNKOWN,
UNKOWN, new ChassisId(),
newBuilder.build());
deviceService.addDevice(device);
controller.getClient(PccId.pccId(IpAddress.valueOf("1.1.1.1"))).setCapability(
new ClientCapability(true, true, true, true, true));
masterShipService.setMaster(true);
Link link = DefaultLink.builder()
.src(new ConnectPoint(device.id(), PortNumber.portNumber(16843009)))
.dst(new ConnectPoint(device.id(), PortNumber.portNumber(84215045)))
.state(ACTIVE)
.type(Link.Type.DIRECT)
.providerId(ProviderId.NONE)
.build();
linkService.addLink(link);
controller.processClientMessage(PccId.pccId(IpAddress.valueOf("1.1.1.1")), message);
assertThat(registry.tunnelIdCounter, is((long) 1));
}
示例10: tunnelProviderAddedTest3
/**
* Tests adding a new tunnel on receiving asynchronous PCRpt msg,
* i.e. without any SRP id.
*/
@Test
public void tunnelProviderAddedTest3() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x84,
0x21, 0x10, 0x00, 0x14, //SRP object
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x00, 0x04, // PATH-SETUP-TYPE TLV
0x00, 0x00, 0x00, 0x02,
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x1B, // LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, // symbolic path TLV
0x00, 0x12, 0x00, 0x10, // IPv4-LSP-IDENTIFIER-TLV
0x01, 0x01, 0x01, 0x01,
0x00, 0x01, 0x00, 0x01,
0x01, 0x01, 0x01, 0x01,
0x05, 0x05, 0x05, 0x05,
0x07, 0x10, 0x00, 0x14, //ERO object
0x01, 0x08, (byte) 0x01, 0x01, 0x01, 0x01, 0x04, 0x00, // ERO IPv4 sub objects
0x01, 0x08, (byte) 0x05, 0x05, 0x05, 0x05, 0x04, 0x00,
0x08, 0x10, 0x00, 0x34, //RRO object
0x01, 0x08, 0x11, 0x01, 0x01, 0x01, 0x04, 0x00, // RRO IPv4 sub objects
0x01, 0x08, 0x11, 0x01, 0x01, 0x02, 0x04, 0x00,
0x01, 0x08, 0x06, 0x06, 0x06, 0x06, 0x04, 0x00,
0x01, 0x08, 0x12, 0x01, 0x01, 0x02, 0x04, 0x00,
0x01, 0x08, 0x12, 0x01, 0x01, 0x01, 0x04, 0x00,
0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = reader.readFrom(buffer);
DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();
newBuilder.set(PcepTunnelProvider.LSRID, "1.1.1.1");
newBuilder.set(AnnotationKeys.TYPE, "L3");
Device device = new DefaultDevice(ProviderId.NONE, DeviceId.deviceId("1.1.1.1"), ROUTER,
UNKOWN, UNKOWN, UNKOWN,
UNKOWN, new ChassisId(),
newBuilder.build());
deviceService.addDevice(device);
PccId pccId = PccId.pccId(IpAddress.valueOf("1.1.1.1"));
controller.getClient(pccId).setLspDbSyncStatus(SYNCED);
controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true));
Link link = DefaultLink.builder()
.src(new ConnectPoint(device.id(), PortNumber.portNumber(16843009)))
.dst(new ConnectPoint(device.id(), PortNumber.portNumber(84215045)))
.state(ACTIVE)
.type(Link.Type.DIRECT)
.providerId(ProviderId.NONE)
.build();
linkService.addLink(link);
PcepClientAdapter pc = new PcepClientAdapter();
pc.init(pccId, PcepVersion.PCEP_1);
controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true);
masterShipService.setMaster(true);
controller.processClientMessage(pccId, message);
assertThat(registry.tunnelIdCounter, is((long) 1));
}
示例11: tunnelProviderAddedTest5
/**
* Tests adding PCC Init LSP after LSP DB sync is over.
*/
@Test
public void tunnelProviderAddedTest5() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x84,
0x21, 0x10, 0x00, 0x14, //SRP object
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x00, 0x04, // PATH-SETUP-TYPE TLV
0x00, 0x00, 0x00, 0x02,
0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x19, // LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, // symbolic path TLV
0x00, 0x12, 0x00, 0x10, // IPv4-LSP-IDENTIFIER-TLV
0x01, 0x01, 0x01, 0x01,
0x00, 0x01, 0x00, 0x01,
0x01, 0x01, 0x01, 0x01,
0x05, 0x05, 0x05, 0x05,
0x07, 0x10, 0x00, 0x14, //ERO object
0x01, 0x08, (byte) 0x01, 0x01, 0x01, 0x01, 0x04, 0x00, // ERO IPv4 sub objects
0x01, 0x08, (byte) 0x05, 0x05, 0x05, 0x05, 0x04, 0x00,
0x08, 0x10, 0x00, 0x34, //RRO object
0x01, 0x08, 0x11, 0x01, 0x01, 0x01, 0x04, 0x00, // RRO IPv4 sub objects
0x01, 0x08, 0x11, 0x01, 0x01, 0x02, 0x04, 0x00,
0x01, 0x08, 0x06, 0x06, 0x06, 0x06, 0x04, 0x00,
0x01, 0x08, 0x12, 0x01, 0x01, 0x02, 0x04, 0x00,
0x01, 0x08, 0x12, 0x01, 0x01, 0x01, 0x04, 0x00,
0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = reader.readFrom(buffer);
DefaultAnnotations.Builder newBuilder = DefaultAnnotations.builder();
newBuilder.set(PcepTunnelProvider.LSRID, "1.1.1.1");
newBuilder.set(AnnotationKeys.TYPE, "L3");
Device device = new DefaultDevice(ProviderId.NONE, DeviceId.deviceId("1.1.1.1"), ROUTER,
UNKOWN, UNKOWN, UNKOWN,
UNKOWN, new ChassisId(),
newBuilder.build());
deviceService.addDevice(device);
PccId pccId = PccId.pccId(IpAddress.valueOf("1.1.1.1"));
controller.getClient(pccId).setLspDbSyncStatus(SYNCED);
controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true));
PcepClientAdapter pc = new PcepClientAdapter();
pc.init(pccId, PcepVersion.PCEP_1);
controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true);
masterShipService.setMaster(true);
controller.processClientMessage(pccId, message);
assertThat(registry.tunnelIdCounter, is((long) 0));
}
示例12: testRouteAdd
/**
* Tests adding a route entry with asynchronous HostService replies.
*/
@Test
public void testRouteAdd() {
// Construct a route entry
IpPrefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
IpAddress nextHopIp = Ip4Address.valueOf("192.168.10.1");
RouteEntry routeEntry = new RouteEntry(prefix, nextHopIp);
// Host service will reply with no hosts when asked
reset(hostService);
expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
Collections.emptySet()).anyTimes();
hostService.startMonitoringIp(IpAddress.valueOf("192.168.10.1"));
replay(hostService);
reset(routingConfigurationService);
expect(routingConfigurationService.isIpPrefixLocal(
anyObject(IpPrefix.class))).andReturn(false);
replay(routingConfigurationService);
// Initially when we add the route, no FIB update will be sent
replay(fibListener);
router.processRouteUpdates(Collections.singletonList(
new RouteUpdate(RouteUpdate.Type.UPDATE, routeEntry)));
verify(fibListener);
// Now when we send the event, we expect the FIB update to be sent
reset(fibListener);
FibEntry fibEntry = new FibEntry(prefix, nextHopIp,
MacAddress.valueOf("00:00:00:00:00:01"));
fibListener.update(Collections.singletonList(new FibUpdate(
FibUpdate.Type.UPDATE, fibEntry)), Collections.emptyList());
replay(fibListener);
Host host = new DefaultHost(ProviderId.NONE, HostId.NONE,
MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE,
new HostLocation(
SW1_ETH1.deviceId(),
SW1_ETH1.port(), 1),
Sets.newHashSet(IpAddress.valueOf("192.168.10.1")));
// Send in the host event
internalHostListener.event(
new HostEvent(HostEvent.Type.HOST_ADDED, host));
verify(fibListener);
}
示例13: testRouteUpdate
/**
* Tests updating a route entry with asynchronous HostService replies.
*/
@Test
public void testRouteUpdate() {
// Add a route
testRouteAdd();
// Construct a route entry
IpPrefix prefix = Ip4Prefix.valueOf("1.1.1.0/24");
IpAddress nextHopIp = Ip4Address.valueOf("192.168.20.1");
RouteEntry routeEntry = new RouteEntry(prefix, nextHopIp);
// Host service will reply with no hosts when asked
reset(hostService);
expect(hostService.getHostsByIp(anyObject(IpAddress.class))).andReturn(
Collections.emptySet()).anyTimes();
hostService.startMonitoringIp(IpAddress.valueOf("192.168.20.1"));
replay(hostService);
reset(routingConfigurationService);
expect(routingConfigurationService.isIpPrefixLocal(
anyObject(IpPrefix.class))).andReturn(false);
replay(routingConfigurationService);
// Initially when we add the route, the DELETE FIB update will be sent
// but the UPDATE FIB update will come later when the MAC is resolved
reset(fibListener);
fibListener.update(Collections.emptyList(), Collections.singletonList(new FibUpdate(
FibUpdate.Type.DELETE, new FibEntry(prefix, null, null))));
replay(fibListener);
router.processRouteUpdates(Collections.singletonList(
new RouteUpdate(RouteUpdate.Type.UPDATE, routeEntry)));
verify(fibListener);
// Now when we send the event, we expect the FIB update to be sent
reset(fibListener);
FibEntry fibEntry = new FibEntry(prefix, nextHopIp,
MacAddress.valueOf("00:00:00:00:00:02"));
fibListener.update(Collections.singletonList(new FibUpdate(
FibUpdate.Type.UPDATE, fibEntry)), Collections.emptyList());
replay(fibListener);
Host host = new DefaultHost(ProviderId.NONE, HostId.NONE,
MacAddress.valueOf("00:00:00:00:00:02"), VlanId.NONE,
new HostLocation(
SW1_ETH1.deviceId(),
SW1_ETH1.port(), 1),
Sets.newHashSet(IpAddress.valueOf("192.168.20.1")));
// Send in the host event
internalHostListener.event(
new HostEvent(HostEvent.Type.HOST_ADDED, host));
verify(fibListener);
}
示例14: device
/**
* Returns device with given ID.
*
* @param id device ID
* @return device instance
*/
protected static Device device(String id) {
return new DefaultDevice(ProviderId.NONE, deviceId(id),
Device.Type.SWITCH, MFR, HW, SW, SERIAL, null);
}
示例15: createHost
/**
* Creates a host with the given parameters.
*
* @param macAddress MAC address
* @param ipAddress IP address
* @return new host
*/
private Host createHost(MacAddress macAddress, IpAddress ipAddress) {
return new DefaultHost(ProviderId.NONE, HostId.NONE, macAddress,
VlanId.NONE, new HostLocation(CP1, 1),
Sets.newHashSet(ipAddress));
}