Search in sources :

Example 6 with VirtualNetworkAdminService

use of org.onosproject.incubator.net.virtual.VirtualNetworkAdminService in project onos by opennetworkinglab.

the class VirtualNetworkRemoveCommand method doExecute.

@Override
protected void doExecute() {
    VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
    service.removeVirtualNetwork(NetworkId.networkId(id));
    print("Virtual network successfully removed.");
}
Also used : VirtualNetworkAdminService(org.onosproject.incubator.net.virtual.VirtualNetworkAdminService)

Example 7 with VirtualNetworkAdminService

use of org.onosproject.incubator.net.virtual.VirtualNetworkAdminService in project onos by opennetworkinglab.

the class VirtualPortStateCommand method doExecute.

@Override
protected void doExecute() {
    VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
    VirtualPort vPort = getVirtualPort(PortNumber.portNumber(portNum));
    checkNotNull(vPort, "The virtual Port does not exist");
    boolean isEnabled;
    if ("enable".equals(portState)) {
        isEnabled = true;
    } else if ("disable".equals(portState)) {
        isEnabled = false;
    } else {
        print("State must be enable or disable");
        return;
    }
    service.updatePortState(NetworkId.networkId(networkId), DeviceId.deviceId(deviceId), vPort.number(), isEnabled);
    print("Virtual port state updated.");
}
Also used : VirtualPort(org.onosproject.incubator.net.virtual.VirtualPort) VirtualNetworkAdminService(org.onosproject.incubator.net.virtual.VirtualNetworkAdminService)

Example 8 with VirtualNetworkAdminService

use of org.onosproject.incubator.net.virtual.VirtualNetworkAdminService in project onos by opennetworkinglab.

the class TenantCompleter 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);
    SortedSet<String> strings = delegate.getStrings();
    for (TenantId tenantId : service.getTenantIds()) {
        strings.add(tenantId.id());
    }
    // Now let the completer do the work for figuring out what to offer.
    return delegate.complete(session, commandLine, candidates);
}
Also used : TenantId(org.onosproject.net.TenantId) StringsCompleter(org.apache.karaf.shell.support.completers.StringsCompleter) VirtualNetworkAdminService(org.onosproject.incubator.net.virtual.VirtualNetworkAdminService)

Example 9 with VirtualNetworkAdminService

use of org.onosproject.incubator.net.virtual.VirtualNetworkAdminService in project onos by opennetworkinglab.

the class TenantRemoveCommand method doExecute.

@Override
protected void doExecute() {
    VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
    service.unregisterTenantId(TenantId.tenantId(id));
    print("Tenant successfully removed.");
}
Also used : VirtualNetworkAdminService(org.onosproject.incubator.net.virtual.VirtualNetworkAdminService)

Example 10 with VirtualNetworkAdminService

use of org.onosproject.incubator.net.virtual.VirtualNetworkAdminService in project onos by opennetworkinglab.

the class TenantListCommand method doExecute.

@Override
protected void doExecute() {
    VirtualNetworkAdminService service = get(VirtualNetworkAdminService.class);
    List<TenantId> tenants = new ArrayList<>();
    tenants.addAll(service.getTenantIds());
    Collections.sort(tenants, Comparators.TENANT_ID_COMPARATOR);
    tenants.forEach(this::printTenant);
}
Also used : TenantId(org.onosproject.net.TenantId) ArrayList(java.util.ArrayList) VirtualNetworkAdminService(org.onosproject.incubator.net.virtual.VirtualNetworkAdminService)

Aggregations

VirtualNetworkAdminService (org.onosproject.incubator.net.virtual.VirtualNetworkAdminService)18 ConnectPoint (org.onosproject.net.ConnectPoint)4 TenantId (org.onosproject.net.TenantId)4 ArrayList (java.util.ArrayList)3 StringsCompleter (org.apache.karaf.shell.support.completers.StringsCompleter)2 VirtualNetwork (org.onosproject.incubator.net.virtual.VirtualNetwork)2 VirtualPort (org.onosproject.incubator.net.virtual.VirtualPort)2 DeviceService (org.onosproject.net.device.DeviceService)2 HashSet (java.util.HashSet)1 IpAddress (org.onlab.packet.IpAddress)1 MacAddress (org.onlab.packet.MacAddress)1 VlanId (org.onlab.packet.VlanId)1 VirtualDevice (org.onosproject.incubator.net.virtual.VirtualDevice)1 VirtualNetworkService (org.onosproject.incubator.net.virtual.VirtualNetworkService)1 HostLocation (org.onosproject.net.HostLocation)1