alshabib | bf70b08 | 2016-02-03 10:25:49 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | d6a135a | 2017-08-03 22:46:05 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
alshabib | bf70b08 | 2016-02-03 10:25:49 -0800 | [diff] [blame] | 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 | |
alshabib | 36a4d73 | 2016-06-01 16:03:59 -0700 | [diff] [blame] | 17 | package org.opencord.olt.cli; |
alshabib | bf70b08 | 2016-02-03 10:25:49 -0800 | [diff] [blame] | 18 | |
| 19 | import org.apache.karaf.shell.commands.Argument; |
| 20 | import org.apache.karaf.shell.commands.Command; |
| 21 | import org.onosproject.cli.AbstractShellCommand; |
| 22 | import org.onosproject.net.ConnectPoint; |
| 23 | import org.onosproject.net.DeviceId; |
| 24 | import org.onosproject.net.PortNumber; |
alshabib | 36a4d73 | 2016-06-01 16:03:59 -0700 | [diff] [blame] | 25 | import org.opencord.olt.AccessDeviceService; |
alshabib | bf70b08 | 2016-02-03 10:25:49 -0800 | [diff] [blame] | 26 | |
| 27 | /** |
| 28 | * Adds a subscriber to an access device. |
| 29 | */ |
| 30 | @Command(scope = "onos", name = "remove-subscriber-access", |
| 31 | description = "Adds a subscriber to an access device") |
| 32 | public class SubscriberRemoveCommand extends AbstractShellCommand { |
| 33 | |
| 34 | @Argument(index = 0, name = "deviceId", description = "Access device ID", |
| 35 | required = true, multiValued = false) |
| 36 | private String strDeviceId = null; |
| 37 | |
| 38 | @Argument(index = 1, name = "port", description = "Subscriber port number", |
| 39 | required = true, multiValued = false) |
| 40 | private String strPort = null; |
| 41 | |
| 42 | @Override |
| 43 | protected void execute() { |
| 44 | AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class); |
| 45 | |
| 46 | DeviceId deviceId = DeviceId.deviceId(strDeviceId); |
| 47 | PortNumber port = PortNumber.portNumber(strPort); |
| 48 | ConnectPoint connectPoint = new ConnectPoint(deviceId, port); |
| 49 | |
| 50 | service.removeSubscriber(connectPoint); |
| 51 | |
| 52 | } |
| 53 | } |