blob: 993dd49ca9d30da16a75fd2eb791b4d97ed24f9d [file] [log] [blame]
samuel7a5691a2015-05-23 00:36:32 +08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
samuel7a5691a2015-05-23 00:36:32 +08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
jccde3e92e2015-03-28 01:40:44 -070016package org.onosproject.cli.net;
17
18import org.apache.karaf.shell.commands.Argument;
19import org.apache.karaf.shell.commands.Command;
20import org.onosproject.cli.AbstractShellCommand;
Brian O'Connor6de2e202015-05-21 14:30:41 -070021import org.onosproject.incubator.net.resource.label.LabelResourceAdminService;
22import org.onosproject.incubator.net.resource.label.LabelResourceId;
jccde3e92e2015-03-28 01:40:44 -070023
24/**
25 * create label resource pool by specific device id.
26 */
samuel7a5691a2015-05-23 00:36:32 +080027@Command(scope = "onos", name = "global-label-pool-create",
jccde3e92e2015-03-28 01:40:44 -070028description = "Creates global label resource pool.")
samuel7a5691a2015-05-23 00:36:32 +080029public class GlobalLabelPoolCreateCommand extends AbstractShellCommand {
jccde3e92e2015-03-28 01:40:44 -070030 @Argument(index = 0, name = "beginLabel",
31 description = "The first label of global label resource pool.",
32 required = true, multiValued = false)
33 String beginLabel = null;
34 @Argument(index = 1, name = "endLabel",
35 description = "The last label of global label resource pool.",
36 required = true, multiValued = false)
37 String endLabel = null;
38
39 @Override
40 protected void execute() {
41 LabelResourceAdminService lrs = get(LabelResourceAdminService.class);
42 lrs.createGlobalPool(LabelResourceId.labelResourceId(Long
43 .parseLong(beginLabel)), LabelResourceId.labelResourceId(Long
44 .parseLong(endLabel)));
45 }
46
47}