adding remove subscriber command
Change-Id: I43fdd296bd65df431d760530dc7290d271d6ba6d
Showing
1 changed file
with
53 additions
and
0 deletions
1 | +/* | ||
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 | + | ||
17 | +package org.onosproject.olt.cli; | ||
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; | ||
25 | +import org.onosproject.olt.AccessDeviceService; | ||
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 | +} |
-
Please register or login to post a comment