Search in sources :

Example 6 with LabelResource

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

the class GlobalLabelApplyCommand method doExecute.

@Override
protected void doExecute() {
    LabelResourceService lrs = get(LabelResourceService.class);
    Collection<LabelResource> result = lrs.applyFromGlobalPool(Long.parseLong(applyNum));
    if (!result.isEmpty()) {
        for (Iterator<LabelResource> iterator = result.iterator(); iterator.hasNext(); ) {
            DefaultLabelResource defaultLabelResource = (DefaultLabelResource) iterator.next();
            print(FMT, defaultLabelResource.deviceId().toString(), defaultLabelResource.labelResourceId().toString());
        }
    }
}
Also used : DefaultLabelResource(org.onosproject.incubator.net.resource.label.DefaultLabelResource) LabelResource(org.onosproject.incubator.net.resource.label.LabelResource) LabelResourceService(org.onosproject.incubator.net.resource.label.LabelResourceService) DefaultLabelResource(org.onosproject.incubator.net.resource.label.DefaultLabelResource)

Example 7 with LabelResource

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

the class LabelApplyCommand method doExecute.

@Override
protected void doExecute() {
    LabelResourceService lrs = get(LabelResourceService.class);
    Collection<LabelResource> result = lrs.applyFromDevicePool(DeviceId.deviceId(deviceId), Long.parseLong(applyNum));
    if (!result.isEmpty()) {
        for (Iterator<LabelResource> iterator = result.iterator(); iterator.hasNext(); ) {
            DefaultLabelResource defaultLabelResource = (DefaultLabelResource) iterator.next();
            print(FMT, defaultLabelResource.deviceId().toString(), defaultLabelResource.labelResourceId().toString());
        }
    }
}
Also used : DefaultLabelResource(org.onosproject.incubator.net.resource.label.DefaultLabelResource) LabelResource(org.onosproject.incubator.net.resource.label.LabelResource) LabelResourceService(org.onosproject.incubator.net.resource.label.LabelResourceService) DefaultLabelResource(org.onosproject.incubator.net.resource.label.DefaultLabelResource)

Aggregations

DefaultLabelResource (org.onosproject.incubator.net.resource.label.DefaultLabelResource)7 LabelResource (org.onosproject.incubator.net.resource.label.LabelResource)7 DeviceId (org.onosproject.net.DeviceId)4 HashSet (java.util.HashSet)3 LabelResourceService (org.onosproject.incubator.net.resource.label.LabelResourceService)3 LabelResourcePool (org.onosproject.incubator.net.resource.label.LabelResourcePool)2 LabelResourceRequest (org.onosproject.incubator.net.resource.label.LabelResourceRequest)2 Collection (java.util.Collection)1 NodeId (org.onosproject.cluster.NodeId)1 LabelResourceId (org.onosproject.incubator.net.resource.label.LabelResourceId)1 Device (org.onosproject.net.Device)1