use of org.onosproject.net.region.RegionService 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);
}
use of org.onosproject.net.region.RegionService in project onos by opennetworkinglab.
the class LayoutAddCommand method doExecute.
@Override
protected void doExecute() {
UiTopoLayoutService service = get(UiTopoLayoutService.class);
RegionService regionService = get(RegionService.class);
UiTopoLayout layout;
if (ROOT.equals(id)) {
layout = service.getRootLayout();
setAppropriateBackground(layout);
setZoomParameters(layout);
return;
}
// Otherwise, it is a user-defined layout...
Region region = nullToken(regionId) ? null : regionService.getRegion(regionId(regionId));
UiTopoLayoutId pid = nullToken(parentId) ? UiTopoLayoutId.DEFAULT_ID : layoutId(parentId);
layout = new UiTopoLayout(layoutId(id)).region(region).parent(pid);
setAppropriateBackground(layout);
setZoomParameters(layout);
service.addLayout(layout);
}
Aggregations