Search in sources :

Example 6 with RegionId

use of org.onosproject.net.region.RegionId in project onos by opennetworkinglab.

the class RegionsWebResource method getRegionById.

/**
 * Returns the region with the specified identifier.
 *
 * @param regionId region identifier
 * @return 200 OK with a region, 404 not found
 * @onos.rsModel Region
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{regionId}")
public Response getRegionById(@PathParam("regionId") String regionId) {
    final RegionId rid = RegionId.regionId(regionId);
    final Region region = nullIsNotFound(regionService.getRegion(rid), REGION_NOT_FOUND + rid.toString());
    return ok(codec(Region.class).encode(region, this)).build();
}
Also used : Region(org.onosproject.net.region.Region) RegionId(org.onosproject.net.region.RegionId) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 7 with RegionId

use of org.onosproject.net.region.RegionId 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);
}
Also used : RegionAdminService(org.onosproject.net.region.RegionAdminService) RegionId(org.onosproject.net.region.RegionId)

Example 8 with RegionId

use of org.onosproject.net.region.RegionId 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);
}
Also used : RegionAdminService(org.onosproject.net.region.RegionAdminService) AbstractShellCommand(org.onosproject.cli.AbstractShellCommand) List(java.util.List) Service(org.apache.karaf.shell.api.action.lifecycle.Service) Argument(org.apache.karaf.shell.api.action.Argument) Completion(org.apache.karaf.shell.api.action.Completion) RegionAdminService(org.onosproject.net.region.RegionAdminService) DeviceId(org.onosproject.net.DeviceId) RegionId(org.onosproject.net.region.RegionId) Collectors(java.util.stream.Collectors) Command(org.apache.karaf.shell.api.action.Command) DeviceId(org.onosproject.net.DeviceId) RegionId(org.onosproject.net.region.RegionId)

Example 9 with RegionId

use of org.onosproject.net.region.RegionId in project onos by opennetworkinglab.

the class RegionAddPeerLocCommand method doExecute.

@Override
protected void doExecute() {
    RegionId regionId = RegionId.regionId(id);
    NetworkConfigService cfgService = get(NetworkConfigService.class);
    BasicRegionConfig cfg = cfgService.getConfig(regionId, BasicRegionConfig.class);
    cfg.addPeerLocMapping(peerId, locType, latOrY, longOrX).apply();
}
Also used : NetworkConfigService(org.onosproject.net.config.NetworkConfigService) RegionId(org.onosproject.net.region.RegionId) BasicRegionConfig(org.onosproject.net.config.basics.BasicRegionConfig)

Example 10 with RegionId

use of org.onosproject.net.region.RegionId in project onos by opennetworkinglab.

the class ModelCache method addOrUpdateRegion.

// invoked from UiSharedTopologyModel region listener
void addOrUpdateRegion(Region region) {
    RegionId id = region.id();
    String memo = MEMO_UPDATED;
    UiRegion uiRegion = uiTopology.findRegion(id);
    if (uiRegion == null) {
        uiRegion = addNewRegion(region);
        memo = MEMO_ADDED;
    }
    updateRegion(uiRegion);
    postEvent(REGION_ADDED_OR_UPDATED, uiRegion, memo);
}
Also used : UiRegion(org.onosproject.ui.model.topo.UiRegion) RegionId(org.onosproject.net.region.RegionId)

Aggregations

RegionId (org.onosproject.net.region.RegionId)25 DeviceId (org.onosproject.net.DeviceId)7 Region (org.onosproject.net.region.Region)7 Set (java.util.Set)5 Path (javax.ws.rs.Path)5 RegionAdminService (org.onosproject.net.region.RegionAdminService)5 HashSet (java.util.HashSet)4 NodeId (org.onosproject.cluster.NodeId)4 UiRegion (org.onosproject.ui.model.topo.UiRegion)4 Produces (javax.ws.rs.Produces)3 Annotations (org.onosproject.net.Annotations)3 DefaultRegion (org.onosproject.net.region.DefaultRegion)3 UiTopoLayout (org.onosproject.ui.model.topo.UiTopoLayout)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Consumes (javax.ws.rs.Consumes)2 DELETE (javax.ws.rs.DELETE)2