blob: 1be3e33aeab5303293fcfe3a93e709003bd82516 [file] [log] [blame]
jccde3e92e2015-03-28 01:40:44 -07001package org.onosproject.cli.net;
2
3import org.apache.karaf.shell.commands.Argument;
4import org.apache.karaf.shell.commands.Command;
5import org.onosproject.cli.AbstractShellCommand;
6import org.onosproject.net.DeviceId;
Brian O'Connor6de2e202015-05-21 14:30:41 -07007import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
8import org.onosproject.incubator.net.resource.label.LabelResourceId;
jccde3e92e2015-03-28 01:40:44 -07009
10/**
11 * create label resource pool by specific device id.
12 */
13@Command(scope = "onos", name = "create-label-resource-pool",
14 description = "Creates label resource pool by a specific device id")
15public class CreateLabelResourcePoolCommand extends AbstractShellCommand {
16 @Argument(index = 0, name = "deviceId", description = "Device identity", required = true, multiValued = false)
17 String deviceId = null;
18 @Argument(index = 1, name = "beginLabel",
19 description = "The first label of global label resource pool.", required = true, multiValued = false)
20 String beginLabel = null;
21 @Argument(index = 2, name = "endLabel",
22 description = "The last label of global label resource pool.", required = true, multiValued = false)
23 String endLabel = null;
24
25 @Override
26 protected void execute() {
27 LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
28 lrs.createDevicePool(DeviceId.deviceId(deviceId), LabelResourceId
29 .labelResourceId(Long.parseLong(beginLabel)), LabelResourceId
30 .labelResourceId(Long.parseLong(endLabel)));
31 }
32
33}