use of org.onosproject.incubator.net.virtual.VirtualNetworkAdminService in project onos by opennetworkinglab.
the class VirtualNetworkCreateCommand method doExecute.
@Override
protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
service.createVirtualNetwork(TenantId.tenantId(id));
print("Virtual network successfully created.");
}
use of org.onosproject.incubator.net.virtual.VirtualNetworkAdminService in project onos by opennetworkinglab.
the class VirtualHostCreateCommand method doExecute.
@Override
protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
Set<IpAddress> hostIps = new HashSet<>();
if (hostIpStrings != null) {
Arrays.stream(hostIpStrings).forEach(s -> hostIps.add(IpAddress.valueOf(s)));
}
HostLocation hostLocation = new HostLocation(DeviceId.deviceId(hostLocationDeviceId), PortNumber.portNumber(hostLocationPortNumber), System.currentTimeMillis());
MacAddress macAddress = MacAddress.valueOf(mac);
VlanId vlanId = VlanId.vlanId(vlan);
service.createVirtualHost(NetworkId.networkId(networkId), HostId.hostId(macAddress, vlanId), macAddress, vlanId, hostLocation, hostIps);
print("Virtual host successfully created.");
}
use of org.onosproject.incubator.net.virtual.VirtualNetworkAdminService in project onos by opennetworkinglab.
the class VirtualLinkRemoveCommand method doExecute.
@Override
protected void doExecute() {
VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
ConnectPoint src = new ConnectPoint(DeviceId.deviceId(srcDeviceId), PortNumber.portNumber(srcPortNum));
ConnectPoint dst = new ConnectPoint(DeviceId.deviceId(dstDeviceId), PortNumber.portNumber(dstPortNum));
service.removeVirtualLink(NetworkId.networkId(networkId), src, dst);
if (bidirectional) {
service.removeVirtualLink(NetworkId.networkId(networkId), dst, src);
}
print("Virtual link successfully removed.");
}
use of org.onosproject.incubator.net.virtual.VirtualNetworkAdminService in project onos by opennetworkinglab.
the class VirtualNetworkCompleter method complete.
@Override
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
// Delegate string completer
StringsCompleter delegate = new StringsCompleter();
// Fetch our service and feed it's offerings to the string completer
VirtualNetworkAdminService service = AbstractShellCommand.get(VirtualNetworkAdminService.class);
List<VirtualNetwork> virtualNetworks = new ArrayList<>();
Set<TenantId> tenantSet = service.getTenantIds();
tenantSet.forEach(tenantId -> virtualNetworks.addAll(service.getVirtualNetworks(tenantId)));
Collections.sort(virtualNetworks, Comparators.VIRTUAL_NETWORK_COMPARATOR);
SortedSet<String> strings = delegate.getStrings();
virtualNetworks.forEach(virtualNetwork -> strings.add(virtualNetwork.id().toString()));
// Now let the completer do the work for figuring out what to offer.
return delegate.complete(session, commandLine, candidates);
}
use of org.onosproject.incubator.net.virtual.VirtualNetworkAdminService in project onos by opennetworkinglab.
the class VirtualNetworkListCommand method getSortedVirtualNetworks.
/**
* Returns the list of virtual networks sorted using the tenant identifier.
*
* @return sorted virtual network list
*/
private List<VirtualNetwork> getSortedVirtualNetworks() {
VirtualNetworkService service = get(VirtualNetworkService.class);
VirtualNetworkAdminService adminService = get(VirtualNetworkAdminService.class);
List<VirtualNetwork> virtualNetworks = new ArrayList<>();
Set<TenantId> tenantSet = adminService.getTenantIds();
tenantSet.forEach(tenantId -> virtualNetworks.addAll(service.getVirtualNetworks(tenantId)));
Collections.sort(virtualNetworks, Comparators.VIRTUAL_NETWORK_COMPARATOR);
return virtualNetworks;
}
Aggregations