Adds a Segment Routing CLI to remove a tunnel (srtunnel-remove).
Change-Id: Ie702a0cbe4c4ef7f9a956ca3a5335b2337a68c31
Showing
3 changed files
with
52 additions
and
1 deletions
... | @@ -23,7 +23,7 @@ import org.onosproject.segmentrouting.SegmentRoutingService; | ... | @@ -23,7 +23,7 @@ import org.onosproject.segmentrouting.SegmentRoutingService; |
23 | import org.onosproject.segmentrouting.TunnelPolicy; | 23 | import org.onosproject.segmentrouting.TunnelPolicy; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | - * Command to add a new policy. | 26 | + * Command to remove a policy. |
27 | */ | 27 | */ |
28 | @Command(scope = "onos", name = "srpolicy-remove", | 28 | @Command(scope = "onos", name = "srpolicy-remove", |
29 | description = "Remove a policy") | 29 | description = "Remove a policy") | ... | ... |
apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/cli/TunnelRemoveCommand.java
0 → 100644
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 | +package org.onosproject.segmentrouting.cli; | ||
17 | + | ||
18 | + | ||
19 | +import com.google.common.collect.Lists; | ||
20 | +import org.apache.karaf.shell.commands.Argument; | ||
21 | +import org.apache.karaf.shell.commands.Command; | ||
22 | +import org.onosproject.cli.AbstractShellCommand; | ||
23 | +import org.onosproject.segmentrouting.DefaultTunnel; | ||
24 | +import org.onosproject.segmentrouting.SegmentRoutingService; | ||
25 | +import org.onosproject.segmentrouting.Tunnel; | ||
26 | + | ||
27 | +/** | ||
28 | + * Command to remove a tunnel. | ||
29 | + */ | ||
30 | +@Command(scope = "onos", name = "srtunnel-remove", | ||
31 | + description = "Remove a tunnel") | ||
32 | +public class TunnelRemoveCommand extends AbstractShellCommand { | ||
33 | + | ||
34 | + @Argument(index = 0, name = "tunnel ID", | ||
35 | + description = "tunnel ID", | ||
36 | + required = true, multiValued = false) | ||
37 | + String tunnelId; | ||
38 | + | ||
39 | + @Override | ||
40 | + protected void execute() { | ||
41 | + | ||
42 | + SegmentRoutingService srService = | ||
43 | + AbstractShellCommand.get(SegmentRoutingService.class); | ||
44 | + | ||
45 | + Tunnel tunnel = new DefaultTunnel(tunnelId, Lists.newArrayList()); | ||
46 | + srService.removeTunnel(tunnel); | ||
47 | + } | ||
48 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -31,6 +31,9 @@ | ... | @@ -31,6 +31,9 @@ |
31 | <command> | 31 | <command> |
32 | <action class="org.onosproject.segmentrouting.cli.TunnelAddCommand"/> | 32 | <action class="org.onosproject.segmentrouting.cli.TunnelAddCommand"/> |
33 | </command> | 33 | </command> |
34 | + <command> | ||
35 | + <action class="org.onosproject.segmentrouting.cli.TunnelRemoveCommand"/> | ||
36 | + </command> | ||
34 | </command-bundle> | 37 | </command-bundle> |
35 | </blueprint> | 38 | </blueprint> |
36 | 39 | ... | ... |
-
Please register or login to post a comment