use of org.onosproject.net.region.RegionAdminService in project onos by opennetworkinglab.
the class RegionRemoveDevicesCommand method doExecute.
@Override
protected void doExecute() {
RegionAdminService service = get(RegionAdminService.class);
RegionId regionId = RegionId.regionId(id);
List<DeviceId> dids = devIds.stream().map(s -> DeviceId.deviceId(s)).collect(Collectors.toList());
service.removeDevices(regionId, dids);
}
use of org.onosproject.net.region.RegionAdminService in project onos by opennetworkinglab.
the class WipeOutCommand method wipeOutRegions.
private void wipeOutRegions() {
print("Wiping regions");
RegionAdminService service = get(RegionAdminService.class);
service.getRegions().forEach(r -> service.removeRegion(r.id()));
}
use of org.onosproject.net.region.RegionAdminService in project onos by opennetworkinglab.
the class RegionRemoveCommand method doExecute.
@Override
protected void doExecute() {
RegionAdminService service = get(RegionAdminService.class);
RegionId regionId = RegionId.regionId(id);
service.removeRegion(regionId);
print("Region with id %s is successfully removed.", regionId);
}
use of org.onosproject.net.region.RegionAdminService in project onos by opennetworkinglab.
the class RegionAddCommand method doExecute.
@Override
protected void doExecute() {
RegionAdminService service = get(RegionAdminService.class);
RegionId regionId = RegionId.regionId(id);
NetworkConfigService cfgService = get(NetworkConfigService.class);
BasicRegionConfig cfg = cfgService.addConfig(regionId, BasicRegionConfig.class);
setConfigurationData(cfg);
List<Set<NodeId>> masters = parseMasterArgs();
service.createRegion(regionId, name, REGION_TYPE_MAP.get(type), masters);
print("Region successfully added.");
}
use of org.onosproject.net.region.RegionAdminService in project onos by opennetworkinglab.
the class RegionUpdateCommand method doExecute.
@Override
protected void doExecute() {
RegionService regionService = get(RegionService.class);
RegionAdminService regionAdminService = get(RegionAdminService.class);
RegionId regionId = RegionId.regionId(id);
if (regionService.getRegion(regionId) == null) {
print("The region with id %s does not exist.", regionId);
return;
}
List<Set<NodeId>> masters = Lists.newArrayList();
Set<NodeId> nodeIds = Sets.newHashSet();
for (String masterArg : masterArgs) {
if ("/".equals(masterArg)) {
masters.add(nodeIds);
nodeIds = Sets.newHashSet();
} else {
nodeIds.add(NodeId.nodeId(masterArg));
}
}
masters.add(nodeIds);
regionAdminService.updateRegion(regionId, name, REGION_TYPE_MAP.get(type), masters);
print("Region with id %s is successfully updated.", regionId);
}
Aggregations