blob: be2b6dd44e7182993860a41af63fed3107c99556 [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;
Gamze Abaka1b7816e2019-11-25 06:38:41 +000020import java.util.Set;
Saurav Das82b8e6d2018-10-04 15:25:12 -070021
22import org.apache.karaf.shell.commands.Command;
23import org.onosproject.cli.AbstractShellCommand;
24import org.onosproject.net.ConnectPoint;
25import org.opencord.olt.AccessDeviceService;
Gamze Abaka1b7816e2019-11-25 06:38:41 +000026import org.opencord.sadis.UniTagInformation;
Saurav Das82b8e6d2018-10-04 15:25:12 -070027
28/**
29 * Shows subscriber information for those subscriber which have been programmed
30 * in the data-plane.
31 */
32@Command(scope = "onos", name = "volt-programmed-subscribers",
33 description = "Shows subscribers programmed in the dataplane")
34public class ShowProgrammedSubscribersCommand extends AbstractShellCommand {
35
36 @Override
37 protected void execute() {
38 AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
Gamze Abaka1b7816e2019-11-25 06:38:41 +000039 Map<ConnectPoint, Set<UniTagInformation>> info = service.getProgSubs();
Saurav Das82b8e6d2018-10-04 15:25:12 -070040 info.forEach(this::display);
41 }
42
Gamze Abaka1b7816e2019-11-25 06:38:41 +000043 private void display(ConnectPoint cp, Set<UniTagInformation> uniTagInformation) {
44 uniTagInformation.forEach(uniTag ->
45 print("location=%s tagInformation=%s", cp, uniTag));
Saurav Das82b8e6d2018-10-04 15:25:12 -070046 }
47}