Search in sources :

Example 1 with LabelResourceId

use of org.onosproject.incubator.net.resource.label.LabelResourceId in project onos by opennetworkinglab.

the class DistributedLabelResourceStore method releaseToGlobalPool.

@Override
public boolean releaseToGlobalPool(Set<LabelResourceId> release) {
    Set<LabelResource> set = new HashSet<>();
    DefaultLabelResource resource = null;
    for (LabelResourceId labelResource : release) {
        resource = new DefaultLabelResource(DeviceId.deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID), labelResource);
        set.add(resource);
    }
    LabelResourceRequest request = new LabelResourceRequest(DeviceId.deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID), LabelResourceRequest.Type.RELEASE, 0, ImmutableSet.copyOf(set));
    return this.internalRelease(request);
}
Also used : DefaultLabelResource(org.onosproject.incubator.net.resource.label.DefaultLabelResource) LabelResource(org.onosproject.incubator.net.resource.label.LabelResource) LabelResourceRequest(org.onosproject.incubator.net.resource.label.LabelResourceRequest) DefaultLabelResource(org.onosproject.incubator.net.resource.label.DefaultLabelResource) LabelResourceId(org.onosproject.incubator.net.resource.label.LabelResourceId) HashSet(java.util.HashSet)

Example 2 with LabelResourceId

use of org.onosproject.incubator.net.resource.label.LabelResourceId in project onos by opennetworkinglab.

the class GlobalLabelReleaseCommand method doExecute.

@Override
protected void doExecute() {
    LabelResourceService lrs = get(LabelResourceService.class);
    Set<LabelResourceId> release = new HashSet<LabelResourceId>();
    String[] labelIds = releaseLabelIds.split(",");
    LabelResourceId resource = null;
    for (int i = 0; i < labelIds.length; i++) {
        resource = LabelResourceId.labelResourceId(Long.parseLong(labelIds[i]));
        release.add(resource);
    }
    lrs.releaseToGlobalPool(release);
}
Also used : LabelResourceService(org.onosproject.incubator.net.resource.label.LabelResourceService) LabelResourceId(org.onosproject.incubator.net.resource.label.LabelResourceId) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)2 LabelResourceId (org.onosproject.incubator.net.resource.label.LabelResourceId)2 DefaultLabelResource (org.onosproject.incubator.net.resource.label.DefaultLabelResource)1 LabelResource (org.onosproject.incubator.net.resource.label.LabelResource)1 LabelResourceRequest (org.onosproject.incubator.net.resource.label.LabelResourceRequest)1 LabelResourceService (org.onosproject.incubator.net.resource.label.LabelResourceService)1