blob: 79a736994d11f44acebe56163fae955663b9e1fd [file] [log] [blame]
alshabibbf70b082016-02-03 10:25:49 -08001/*
Brian O'Connord6a135a2017-08-03 22:46:05 -07002 * Copyright 2016-present Open Networking Foundation
alshabibbf70b082016-02-03 10:25:49 -08003 *
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
alshabib36a4d732016-06-01 16:03:59 -070017package org.opencord.olt.cli;
alshabibbf70b082016-02-03 10:25:49 -080018
Carmelo Casconeca931162019-07-15 18:22:24 -070019import org.apache.karaf.shell.api.action.Argument;
20import org.apache.karaf.shell.api.action.Command;
21import org.apache.karaf.shell.api.action.Completion;
22import org.apache.karaf.shell.api.action.lifecycle.Service;
alshabibbf70b082016-02-03 10:25:49 -080023import org.onosproject.cli.AbstractShellCommand;
Carmelo Casconeca931162019-07-15 18:22:24 -070024import org.onosproject.cli.net.DeviceIdCompleter;
Matteo Scandoloaadf17a2020-04-17 14:34:01 -070025import org.onosproject.cli.net.PortNumberCompleter;
alshabibbf70b082016-02-03 10:25:49 -080026import org.onosproject.net.ConnectPoint;
27import org.onosproject.net.DeviceId;
28import org.onosproject.net.PortNumber;
alshabib36a4d732016-06-01 16:03:59 -070029import org.opencord.olt.AccessDeviceService;
alshabibbf70b082016-02-03 10:25:49 -080030
31/**
32 * Adds a subscriber to an access device.
33 */
Carmelo Casconeca931162019-07-15 18:22:24 -070034@Service
Saurav Das82b8e6d2018-10-04 15:25:12 -070035@Command(scope = "onos", name = "volt-remove-subscriber-access",
Saurav Daseae48de2019-06-19 13:26:15 -070036 description = "Removes a subscriber to an access device")
alshabibbf70b082016-02-03 10:25:49 -080037public class SubscriberRemoveCommand extends AbstractShellCommand {
38
39 @Argument(index = 0, name = "deviceId", description = "Access device ID",
40 required = true, multiValued = false)
Carmelo Casconeca931162019-07-15 18:22:24 -070041 @Completion(DeviceIdCompleter.class)
alshabibbf70b082016-02-03 10:25:49 -080042 private String strDeviceId = null;
43
44 @Argument(index = 1, name = "port", description = "Subscriber port number",
45 required = true, multiValued = false)
Matteo Scandoloaadf17a2020-04-17 14:34:01 -070046 @Completion(PortNumberCompleter.class)
alshabibbf70b082016-02-03 10:25:49 -080047 private String strPort = null;
48
49 @Override
Carmelo Casconeca931162019-07-15 18:22:24 -070050 protected void doExecute() {
alshabibbf70b082016-02-03 10:25:49 -080051 AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
52
53 DeviceId deviceId = DeviceId.deviceId(strDeviceId);
54 PortNumber port = PortNumber.portNumber(strPort);
55 ConnectPoint connectPoint = new ConnectPoint(deviceId, port);
56
57 service.removeSubscriber(connectPoint);
58
59 }
60}