use of org.onosproject.incubator.net.virtual.VirtualNetworkService in project onos by opennetworkinglab.
the class VirtualPortCreateCommand method getVirtualDevice.
/**
* Returns the virtual device matching the device identifier.
*
* @param aDeviceId device identifier
* @return matching virtual device, or null.
*/
private VirtualDevice getVirtualDevice(DeviceId aDeviceId) {
VirtualNetworkService service = get(VirtualNetworkService.class);
Set<VirtualDevice> virtualDevices = service.getVirtualDevices(NetworkId.networkId(networkId));
for (VirtualDevice virtualDevice : virtualDevices) {
if (virtualDevice.id().equals(aDeviceId)) {
return virtualDevice;
}
}
return null;
}
use of org.onosproject.incubator.net.virtual.VirtualNetworkService in project onos by opennetworkinglab.
the class VirtualPortStateCommand method getVirtualPort.
/**
* Returns the virtual port matching the device and port identifier.
*
* @param aPortNumber port identifier
* @return matching virtual port, or null.
*/
private VirtualPort getVirtualPort(PortNumber aPortNumber) {
VirtualNetworkService service = get(VirtualNetworkService.class);
Set<VirtualPort> ports = service.getVirtualPorts(NetworkId.networkId(networkId), DeviceId.deviceId(deviceId));
return ports.stream().filter(p -> p.number().equals(aPortNumber)).findFirst().get();
}
use of org.onosproject.incubator.net.virtual.VirtualNetworkService in project onos by opennetworkinglab.
the class VirtualDeviceListCommand method getSortedVirtualDevices.
/**
* Returns the list of virtual devices sorted using the device identifier.
*
* @return sorted virtual device list
*/
private List<VirtualDevice> getSortedVirtualDevices() {
VirtualNetworkService service = get(VirtualNetworkService.class);
List<VirtualDevice> virtualDevices = new ArrayList<>();
virtualDevices.addAll(service.getVirtualDevices(NetworkId.networkId(networkId)));
Collections.sort(virtualDevices, Comparators.VIRTUAL_DEVICE_COMPARATOR);
return virtualDevices;
}
use of org.onosproject.incubator.net.virtual.VirtualNetworkService in project onos by opennetworkinglab.
the class VirtualHostCompleter method getSortedVirtualHosts.
/**
* Returns the list of virtual hosts sorted using the host identifier.
*
* @param networkId network id
* @return virtual host list
*/
private List<VirtualHost> getSortedVirtualHosts(long networkId) {
VirtualNetworkService service = getService(VirtualNetworkService.class);
List<VirtualHost> virtualHosts = new ArrayList<>();
virtualHosts.addAll(service.getVirtualHosts(NetworkId.networkId(networkId)));
return virtualHosts;
}
use of org.onosproject.incubator.net.virtual.VirtualNetworkService in project onos by opennetworkinglab.
the class VirtualNetworkBalanceMastersCommand method doExecute.
@Override
protected void doExecute() {
VirtualNetworkService vnetService = get(VirtualNetworkService.class);
MastershipAdminService mastershipAdminService = vnetService.get(NetworkId.networkId(networkId), MastershipAdminService.class);
mastershipAdminService.balanceRoles();
}
Aggregations