blob: 941a65dbb22d219cc1fa3735426d43345ba6c3b8 [file] [log] [blame]
Jonathan Hart0bdf8372015-10-08 14:30:36 -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 */
16
17package org.onosproject.cli.net;
18
19import org.apache.karaf.shell.commands.Argument;
20import org.apache.karaf.shell.commands.Command;
21import org.onlab.packet.VlanId;
22import org.onosproject.cli.AbstractShellCommand;
23import org.onosproject.incubator.net.intf.InterfaceAdminService;
24import org.onosproject.net.ConnectPoint;
25
26/**
27 * Removes an interface configuration.
28 */
29@Command(scope = "onos", name = "remove-interface",
30 description = "Removes a configured interface")
31public class InterfaceRemoveCommand extends AbstractShellCommand {
32
33 @Argument(index = 0, name = "connectPoint",
34 description = "Connect point of the interface",
35 required = true, multiValued = false)
36 private String connectPoint = null;
37
38 @Argument(index = 1, name = "vlan",
39 description = "Interface vlan",
40 required = true, multiValued = false)
41 private String vlan = null;
42
43 @Override
44 protected void execute() {
45 InterfaceAdminService interfaceService = get(InterfaceAdminService.class);
46
47 interfaceService.remove(ConnectPoint.deviceConnectPoint(connectPoint),
48 VlanId.vlanId(Short.parseShort(vlan)));
49 }
50
51}