Committed by
Gerrit Code Review
Added CLI to remove VLANs
Change-Id: I9eef51d7d5eecc6ddc9aeb0aba7369d953350448
Showing
2 changed files
with
47 additions
and
0 deletions
1 | +/* | ||
2 | + * Copyright 2015 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.cordfabric.cli; | ||
18 | + | ||
19 | +import org.apache.karaf.shell.commands.Argument; | ||
20 | +import org.apache.karaf.shell.commands.Command; | ||
21 | +import org.onlab.packet.VlanId; | ||
22 | +import org.onosproject.cli.AbstractShellCommand; | ||
23 | +import org.onosproject.cordfabric.FabricService; | ||
24 | + | ||
25 | +/** | ||
26 | + * Removes a vlan from the fabric. | ||
27 | + */ | ||
28 | +@Command(scope = "onos", name = "remove-fabric-vlan", | ||
29 | + description = "Removes a VLAN from the fabric") | ||
30 | +public class FabricRemoveCommand extends AbstractShellCommand { | ||
31 | + | ||
32 | + @Argument(index = 0, name = "vlanid", description = "VLAN ID", | ||
33 | + required = true, multiValued = false) | ||
34 | + private String vlanIdString = null; | ||
35 | + | ||
36 | + @Override | ||
37 | + protected void execute() { | ||
38 | + FabricService service = AbstractShellCommand.get(FabricService.class); | ||
39 | + | ||
40 | + VlanId vlan = VlanId.vlanId(Short.parseShort(vlanIdString)); | ||
41 | + | ||
42 | + service.removeVlan(vlan); | ||
43 | + } | ||
44 | +} |
... | @@ -26,6 +26,9 @@ | ... | @@ -26,6 +26,9 @@ |
26 | <ref component-id="connectPointCompleter"/> | 26 | <ref component-id="connectPointCompleter"/> |
27 | </completers> | 27 | </completers> |
28 | </command> | 28 | </command> |
29 | + <command> | ||
30 | + <action class="org.onosproject.cordfabric.cli.FabricRemoveCommand"/> | ||
31 | + </command> | ||
29 | </command-bundle> | 32 | </command-bundle> |
30 | 33 | ||
31 | <bean id="connectPointCompleter" class="org.onosproject.cli.net.ConnectPointCompleter"/> | 34 | <bean id="connectPointCompleter" class="org.onosproject.cli.net.ConnectPointCompleter"/> | ... | ... |
-
Please register or login to post a comment