jcc | de3e92e | 2015-03-28 01:40:44 -0700 | [diff] [blame^] | 1 | package org.onosproject.cli.net; |
| 2 | |
| 3 | import org.apache.karaf.shell.commands.Argument; |
| 4 | import org.apache.karaf.shell.commands.Command; |
| 5 | import org.onosproject.cli.AbstractShellCommand; |
| 6 | import org.onosproject.net.DeviceId; |
| 7 | import org.onosproject.net.resource.LabelResourceAdminService; |
| 8 | import org.onosproject.net.resource.LabelResourceId; |
| 9 | |
| 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") |
| 15 | public 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 | } |