blob: 2a4409ee42122755bc578a8525c4c30b369af3e7 [file] [log] [blame]
Saurav Das82b8e6d2018-10-04 15:25:12 -07001/*
2 * Copyright 2016-present Open Networking Foundation
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
17package org.opencord.olt.cli;
18
19import java.util.Map;
20
21import org.apache.karaf.shell.commands.Command;
22import org.onosproject.cli.AbstractShellCommand;
23import org.onosproject.net.ConnectPoint;
24import org.opencord.olt.AccessDeviceService;
25import org.opencord.sadis.SubscriberAndDeviceInformation;
26
27/**
28 * Shows subscriber information for those subscriber which have been programmed
29 * in the data-plane.
30 */
31@Command(scope = "onos", name = "volt-programmed-subscribers",
32 description = "Shows subscribers programmed in the dataplane")
33public class ShowProgrammedSubscribersCommand extends AbstractShellCommand {
34
35 @Override
36 protected void execute() {
37 AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
38 Map<ConnectPoint, SubscriberAndDeviceInformation> info = service.getProgSubs();
39 info.forEach(this::display);
40 }
41
42 private void display(ConnectPoint cp, SubscriberAndDeviceInformation sub) {
43 print("location=%s subscriber=%s", cp, sub);
44 }
45}