blob: cf3da93db28895ce5cd7feaa686908078152ea64 [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;
alshabibbf70b082016-02-03 10:25:49 -080025import org.onosproject.net.ConnectPoint;
26import org.onosproject.net.DeviceId;
27import org.onosproject.net.PortNumber;
alshabib36a4d732016-06-01 16:03:59 -070028import org.opencord.olt.AccessDeviceService;
alshabibbf70b082016-02-03 10:25:49 -080029
30/**
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070031 * Removes a subscriber to an access device.
alshabibbf70b082016-02-03 10:25:49 -080032 */
Carmelo Casconeca931162019-07-15 18:22:24 -070033@Service
Saurav Das82b8e6d2018-10-04 15:25:12 -070034@Command(scope = "onos", name = "volt-remove-subscriber-access",
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070035 description = "Remove a subscriber from an access device")
alshabibbf70b082016-02-03 10:25:49 -080036public class SubscriberRemoveCommand extends AbstractShellCommand {
37
38 @Argument(index = 0, name = "deviceId", description = "Access device ID",
39 required = true, multiValued = false)
Carmelo Casconeca931162019-07-15 18:22:24 -070040 @Completion(DeviceIdCompleter.class)
alshabibbf70b082016-02-03 10:25:49 -080041 private String strDeviceId = null;
42
43 @Argument(index = 1, name = "port", description = "Subscriber port number",
44 required = true, multiValued = false)
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070045 @Completion(OltUniPortCompleter.class)
alshabibbf70b082016-02-03 10:25:49 -080046 private String strPort = null;
47
48 @Override
Carmelo Casconeca931162019-07-15 18:22:24 -070049 protected void doExecute() {
alshabibbf70b082016-02-03 10:25:49 -080050 AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
alshabibbf70b082016-02-03 10:25:49 -080051 DeviceId deviceId = DeviceId.deviceId(strDeviceId);
52 PortNumber port = PortNumber.portNumber(strPort);
53 ConnectPoint connectPoint = new ConnectPoint(deviceId, port);
54
55 service.removeSubscriber(connectPoint);
alshabibbf70b082016-02-03 10:25:49 -080056 }
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070057}