use of org.onosproject.incubator.net.resource.label.LabelResourceService in project onos by opennetworkinglab.
the class LabelReleaseCommand method doExecute.
@Override
protected void doExecute() {
LabelResourceService lrs = get(LabelResourceService.class);
Multimap<DeviceId, LabelResource> map = ArrayListMultimap.create();
String[] labelIds = releaseLabelIds.split(",");
DefaultLabelResource resource = null;
for (int i = 0; i < labelIds.length; i++) {
resource = new DefaultLabelResource(DeviceId.deviceId(deviceId), LabelResourceId.labelResourceId(Long.parseLong(labelIds[i])));
map.put(DeviceId.deviceId(deviceId), resource);
}
lrs.releaseToDevicePool(map);
}
use of org.onosproject.incubator.net.resource.label.LabelResourceService in project onos by opennetworkinglab.
the class LabelResourceCommand method doExecute.
@Override
protected void doExecute() {
LabelResourceService lrs = get(LabelResourceService.class);
LabelResourcePool pool = lrs.getDeviceLabelResourcePool(DeviceId.deviceId(deviceId));
if (pool != null) {
print(FMT, pool.deviceId().toString(), pool.beginLabel(), pool.endLabel(), pool.totalNum(), pool.usedNum(), pool.currentUsedMaxLabelId(), pool.releaseLabelId().toString());
} else {
print(FMT, deviceId, null, null, null, null, null, null);
}
}
use of org.onosproject.incubator.net.resource.label.LabelResourceService 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());
}
}
}
use of org.onosproject.incubator.net.resource.label.LabelResourceService in project onos by opennetworkinglab.
the class GlobalLabelCommand method doExecute.
@Override
protected void doExecute() {
LabelResourceService lrs = get(LabelResourceService.class);
LabelResourcePool pool = lrs.getGlobalLabelResourcePool();
if (pool != null) {
print(FMT, pool.deviceId().toString(), pool.beginLabel(), pool.endLabel(), pool.totalNum(), pool.usedNum(), pool.currentUsedMaxLabelId(), pool.releaseLabelId().toString());
}
}
use of org.onosproject.incubator.net.resource.label.LabelResourceService 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);
}
Aggregations