blob: aee7b4de4ff7a0b219ebe5bb87fd88b594389061 [file] [log] [blame]
Jonathan Hartfd6c1b32016-03-08 14:09:09 -08001/*
Brian O'Connord4fbd352016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Jonathan Hartfd6c1b32016-03-08 14:09:09 -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
17package org.onosproject.olt.cli;
18
19import org.apache.karaf.shell.commands.Command;
20import org.onlab.packet.VlanId;
21import org.onosproject.cli.AbstractShellCommand;
22import org.onosproject.net.ConnectPoint;
23import org.onosproject.olt.AccessDeviceService;
24
25import java.util.Map;
26
27/**
28 * Shows provisioned subscribers.
29 */
30@Command(scope = "onos", name = "subscribers",
31 description = "Shows provisioned subscribers")
32public class ShowSubscribersCommand extends AbstractShellCommand {
33
34 private static final String FORMAT = "port=%s, cvlan=%s";
35
36 @Override
37 protected void execute() {
38 AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
39 service.getSubscribers().forEach(this::display);
40 }
41
42 private void display(Map.Entry<ConnectPoint, VlanId> subscriber) {
43 print(FORMAT, subscriber.getKey(), subscriber.getValue());
44 }
45}