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