blob: ea13441fb2608c905579e680bc76d3121ce5f695 [file] [log] [blame]
pierventre3849e562016-05-11 11:47:32 +02001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
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 */
16
17package org.onosproject.sdxl2.cli;
18
19
20import org.apache.karaf.shell.commands.Argument;
21import org.apache.karaf.shell.commands.Command;
22import org.apache.karaf.shell.commands.Option;
23import org.onosproject.cli.AbstractShellCommand;
24import org.onosproject.sdxl2.SdxL2ConnectionPoint;
25import org.onosproject.sdxl2.SdxL2Service;
26
27/**
28 * CLI to create a named SDX-L2 connection point.
29 */
Carolina Fernandezad893432016-07-18 11:11:34 +020030@Command(scope = "sdxl2", name = "sdxl2cp-add", description = "Creates a named SDX-L2 Connection Point")
pierventre3849e562016-05-11 11:47:32 +020031public class SdxL2AddCPCommand extends AbstractShellCommand {
32
Carolina Fernandezad893432016-07-18 11:11:34 +020033 @Argument(index = 0, name = "sdxl2name", description = "Name of SDX-L2",
pierventre3849e562016-05-11 11:47:32 +020034 required = true, multiValued = false)
Carolina Fernandezad893432016-07-18 11:11:34 +020035 private String sdxl2name = null;
pierventre3849e562016-05-11 11:47:32 +020036
Carolina Fernandezad893432016-07-18 11:11:34 +020037 @Argument(index = 1, name = "connectionpoint", description = "Identifier of SDX-L2 Connection point",
pierventre3849e562016-05-11 11:47:32 +020038 required = true, multiValued = false)
Carolina Fernandezad893432016-07-18 11:11:34 +020039 private String cp = null;
pierventre3849e562016-05-11 11:47:32 +020040
Carolina Fernandezad893432016-07-18 11:11:34 +020041 @Argument(index = 2, name = "sdxl2cpname", description = "Name of SDX-L2 Connection Point",
pierventre3849e562016-05-11 11:47:32 +020042 required = true, multiValued = false)
Carolina Fernandezad893432016-07-18 11:11:34 +020043 private String sdxl2cpname = null;
pierventre3849e562016-05-11 11:47:32 +020044
Carolina Fernandezad893432016-07-18 11:11:34 +020045 @Argument(index = 3, name = "vlans", description = "Customer edge VLANs, separated by dash " +
46 "and comma", required = false, multiValued = false)
47 private String vlans = null;
pierventre3849e562016-05-11 11:47:32 +020048
Carolina Fernandezad893432016-07-18 11:11:34 +020049 @Option(name = "-ce_mac", description = "Customer edge MAC address",
pierventre3849e562016-05-11 11:47:32 +020050 required = false, multiValued = false)
Carolina Fernandezad893432016-07-18 11:11:34 +020051 private String mac = null;
pierventre3849e562016-05-11 11:47:32 +020052
53 @Override
54 protected void execute() {
55 SdxL2Service sdxl2Service = get(SdxL2Service.class);
Carolina Fernandezad893432016-07-18 11:11:34 +020056 SdxL2ConnectionPoint sdxl2cp = SdxL2ConnectionPoint.sdxl2ConnectionPoint(sdxl2cpname, cp, vlans, mac);
pierventre3849e562016-05-11 11:47:32 +020057 sdxl2Service.addSdxL2ConnectionPoint(sdxl2name, sdxl2cp);
58 }
59
60}
61