use of org.onosproject.net.device.DeviceService in project onos by opennetworkinglab.
the class VirtualPortBindCommand method doExecute.
@Override
protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
DeviceService deviceService = get(DeviceService.class);
VirtualPort vPort = getVirtualPort(PortNumber.portNumber(portNum));
checkNotNull(vPort, "The virtual Port does not exist");
ConnectPoint realizedBy = new ConnectPoint(DeviceId.deviceId(physDeviceId), PortNumber.portNumber(physPortNum));
service.bindVirtualPort(NetworkId.networkId(networkId), DeviceId.deviceId(deviceId), PortNumber.portNumber(portNum), realizedBy);
print("Virtual port is successfully bound.");
}
use of org.onosproject.net.device.DeviceService in project onos by opennetworkinglab.
the class VirtualPortCreateCommand method doExecute.
@Override
protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
DeviceService deviceService = get(DeviceService.class);
VirtualDevice virtualDevice = getVirtualDevice(DeviceId.deviceId(deviceId));
checkNotNull(virtualDevice, "The virtual device does not exist.");
ConnectPoint realizedBy = null;
if (physDeviceId != null && physPortNum != null) {
checkNotNull(physPortNum, "The physical port does not specified.");
realizedBy = new ConnectPoint(DeviceId.deviceId(physDeviceId), PortNumber.portNumber(physPortNum));
checkNotNull(realizedBy, "The physical port does not exist.");
}
service.createVirtualPort(NetworkId.networkId(networkId), DeviceId.deviceId(deviceId), PortNumber.portNumber(portNum), realizedBy);
print("Virtual port successfully created.");
}
use of org.onosproject.net.device.DeviceService in project onos by opennetworkinglab.
the class VirtualNetworkDeviceManagerTest method testGetDeviceByNullType.
/**
* Tests querying for a device using a null device type.
*/
@Test(expected = NullPointerException.class)
public void testGetDeviceByNullType() {
manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
DeviceService deviceService = manager.get(virtualNetwork.id(), DeviceService.class);
// test the getDevices() method with null type value.
deviceService.getDevices(null);
}
use of org.onosproject.net.device.DeviceService in project onos by opennetworkinglab.
the class VirtualNetworkDeviceManagerTest method testGetPortsDeltaStatisticsByNullId.
/**
* Tests querying the port delta statistics of a device by null device identifier.
*/
@Test(expected = NullPointerException.class)
public void testGetPortsDeltaStatisticsByNullId() {
manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
DeviceService deviceService = manager.get(virtualNetwork.id(), DeviceService.class);
// test the getPortDeltaStatistics() method using a null device identifier
deviceService.getPortDeltaStatistics(null);
}
use of org.onosproject.net.device.DeviceService in project onos by opennetworkinglab.
the class VirtualNetworkDeviceManagerTest method testGetRole.
/**
* Tests querying the role of a device by device identifier.
*/
@Test
public void testGetRole() {
manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
DeviceService deviceService = manager.get(virtualNetwork.id(), DeviceService.class);
// test the getRole() method
assertEquals("The expect device role did not match.", MastershipRole.MASTER, deviceService.getRole(DID1));
}
Aggregations