blob: 5d6bf3d20f41d569e9a25a298a9589013ed4eac5 [file] [log] [blame]
Saurav Das2d3777a2020-08-07 18:48:51 -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 org.apache.karaf.shell.api.action.Command;
20import org.apache.karaf.shell.api.action.lifecycle.Service;
21import org.onosproject.cli.AbstractShellCommand;
22import org.onosproject.net.ConnectPoint;
23import org.opencord.olt.AccessDeviceService;
24import org.opencord.sadis.UniTagInformation;
25
26import java.util.Map;
27import java.util.Set;
28
29/**
30 * Shows subscriber information for those subscriber which have been programmed
31 * in the data-plane.
32 */
33@Service
34@Command(scope = "onos", name = "volt-failed-subscribers",
35 description = "Shows subscribers awaiting for programming in the dataplane")
36public class ShowFailedSubscribersCommand extends AbstractShellCommand {
37
38 @Override
39 protected void doExecute() {
40 AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
41 Map<ConnectPoint, Set<UniTagInformation>> info = service.getFailedSubs();
42 info.forEach(this::display);
43 }
44
45 private void display(ConnectPoint cp, Set<UniTagInformation> uniTagInformation) {
46 uniTagInformation.forEach(uniTag ->
47 print("location=%s tagInformation=%s", cp, uniTag));
48 }
49}