blob: b4f3b355cca113858d8efb434c2e355a52d70835 [file] [log] [blame]
sangho6703da22015-06-11 14:49:59 -07001/*
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 */
16package org.onosproject.segmentrouting.cli;
17
18
19import org.apache.karaf.shell.commands.Argument;
20import org.apache.karaf.shell.commands.Command;
21import org.onosproject.cli.AbstractShellCommand;
22import org.onosproject.segmentrouting.SegmentRoutingService;
23import org.onosproject.segmentrouting.TunnelPolicy;
24
25/**
sangho36c9d2c2015-06-24 09:37:40 -070026 * Command to remove a policy.
sangho6703da22015-06-11 14:49:59 -070027 */
28@Command(scope = "onos", name = "srpolicy-remove",
29 description = "Remove a policy")
30public class PolicyRemoveCommand extends AbstractShellCommand {
31
32 @Argument(index = 0, name = "policy ID",
33 description = "policy ID",
34 required = true, multiValued = false)
35 String policyId;
36
37 @Override
38 protected void execute() {
39
40 SegmentRoutingService srService =
41 AbstractShellCommand.get(SegmentRoutingService.class);
42
43 TunnelPolicy.Builder tpb = TunnelPolicy.builder().setPolicyId(policyId);
44 srService.removePolicy(tpb.build());
45 }
46}