use of org.onosproject.net.TenantId 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);
}
use of org.onosproject.net.TenantId 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);
}
use of org.onosproject.net.TenantId 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.net.TenantId 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;
}
use of org.onosproject.net.TenantId in project onos by opennetworkinglab.
the class TenantWebResource method removeTenantId.
/**
* Removes the specified tenant with the specified tenant identifier.
*
* @param tenantId tenant identifier
* @return 204 NO CONTENT
*/
@DELETE
@Path("{tenantId}")
public Response removeTenantId(@PathParam("tenantId") String tenantId) {
final TenantId tid = TenantId.tenantId(tenantId);
final TenantId existingTid = getExistingTenantId(vnetAdminService, tid);
vnetAdminService.unregisterTenantId(existingTid);
return Response.noContent().build();
}
Aggregations