Search in sources :

Example 11 with VirtualNetworkService

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;
}
Also used : VirtualNetworkService(org.onosproject.incubator.net.virtual.VirtualNetworkService) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice)

Example 12 with VirtualNetworkService

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();
}
Also used : VirtualPort(org.onosproject.incubator.net.virtual.VirtualPort) VirtualNetworkService(org.onosproject.incubator.net.virtual.VirtualNetworkService)

Example 13 with VirtualNetworkService

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;
}
Also used : VirtualNetworkService(org.onosproject.incubator.net.virtual.VirtualNetworkService) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) ArrayList(java.util.ArrayList)

Example 14 with VirtualNetworkService

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;
}
Also used : VirtualNetworkService(org.onosproject.incubator.net.virtual.VirtualNetworkService) ArrayList(java.util.ArrayList) VirtualHost(org.onosproject.incubator.net.virtual.VirtualHost)

Example 15 with VirtualNetworkService

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();
}
Also used : VirtualNetworkService(org.onosproject.incubator.net.virtual.VirtualNetworkService) MastershipAdminService(org.onosproject.mastership.MastershipAdminService)

Aggregations

VirtualNetworkService (org.onosproject.incubator.net.virtual.VirtualNetworkService)18 ArrayList (java.util.ArrayList)9 VirtualDevice (org.onosproject.incubator.net.virtual.VirtualDevice)4 VirtualPort (org.onosproject.incubator.net.virtual.VirtualPort)4 CoreService (org.onosproject.core.CoreService)2 VirtualHost (org.onosproject.incubator.net.virtual.VirtualHost)2 ConnectPoint (org.onosproject.net.ConnectPoint)2 DeviceId (org.onosproject.net.DeviceId)2 TenantId (org.onosproject.net.TenantId)2 TrafficSelector (org.onosproject.net.flow.TrafficSelector)2 Intent (org.onosproject.net.intent.Intent)2 IntentService (org.onosproject.net.intent.IntentService)2 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 BigInteger (java.math.BigInteger)1 List (java.util.List)1 StringFilter (org.onlab.util.StringFilter)1 ApplicationId (org.onosproject.core.ApplicationId)1 DefaultVirtualPort (org.onosproject.incubator.net.virtual.DefaultVirtualPort)1 NetworkId (org.onosproject.incubator.net.virtual.NetworkId)1 VirtualLink (org.onosproject.incubator.net.virtual.VirtualLink)1