pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.sdxl2.cli; |
| 18 | |
| 19 | |
| 20 | import org.apache.karaf.shell.commands.Argument; |
| 21 | import org.apache.karaf.shell.commands.Command; |
| 22 | import org.apache.karaf.shell.commands.Option; |
| 23 | import org.onosproject.cli.AbstractShellCommand; |
| 24 | import org.onosproject.sdxl2.SdxL2ConnectionPoint; |
| 25 | import org.onosproject.sdxl2.SdxL2Service; |
| 26 | |
| 27 | /** |
| 28 | * CLI to create a named SDX-L2 connection point. |
| 29 | */ |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 30 | @Command(scope = "sdxl2", name = "sdxl2cp-add", description = "Creates a named SDX-L2 Connection Point") |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 31 | public class SdxL2AddCPCommand extends AbstractShellCommand { |
| 32 | |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 33 | @Argument(index = 0, name = "sdxl2name", description = "Name of SDX-L2", |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 34 | required = true, multiValued = false) |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 35 | private String sdxl2name = null; |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 36 | |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 37 | @Argument(index = 1, name = "connectionpoint", description = "Identifier of SDX-L2 Connection point", |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 38 | required = true, multiValued = false) |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 39 | private String cp = null; |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 40 | |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 41 | @Argument(index = 2, name = "sdxl2cpname", description = "Name of SDX-L2 Connection Point", |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 42 | required = true, multiValued = false) |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 43 | private String sdxl2cpname = null; |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 44 | |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 45 | @Argument(index = 3, name = "vlans", description = "Customer edge VLANs, separated by dash " + |
| 46 | "and comma", required = false, multiValued = false) |
| 47 | private String vlans = null; |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 48 | |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 49 | @Option(name = "-ce_mac", description = "Customer edge MAC address", |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 50 | required = false, multiValued = false) |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 51 | private String mac = null; |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 52 | |
| 53 | @Override |
| 54 | protected void execute() { |
| 55 | SdxL2Service sdxl2Service = get(SdxL2Service.class); |
Carolina Fernandez | ad89343 | 2016-07-18 11:11:34 +0200 | [diff] [blame^] | 56 | SdxL2ConnectionPoint sdxl2cp = SdxL2ConnectionPoint.sdxl2ConnectionPoint(sdxl2cpname, cp, vlans, mac); |
pierventre | 3849e56 | 2016-05-11 11:47:32 +0200 | [diff] [blame] | 57 | sdxl2Service.addSdxL2ConnectionPoint(sdxl2name, sdxl2cp); |
| 58 | } |
| 59 | |
| 60 | } |
| 61 | |