Bug-fix: Remove flows from voltha for deleted subscriber, even if sadis cannot
fetch information about the deleted subscriber.
Other changes:
- Added a cli command that details subscribers that have actually been programmed in the data plane
- Changed all cli commands to start with volt-* as all app cli commands should
- removed DeviceIdCompleter from the 'olts' cli command as it is not needed
- removed unused method, renamed another one, fixed some logs
- S-tags are no longer 'DeviceVlans', so changed variable name
Change-Id: I7cfde850669ed5b581fbac3195f68da28c4514c3
diff --git a/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java b/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
new file mode 100644
index 0000000..2a4409e
--- /dev/null
+++ b/app/src/main/java/org/opencord/olt/cli/ShowProgrammedSubscribersCommand.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opencord.olt.cli;
+
+import java.util.Map;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.ConnectPoint;
+import org.opencord.olt.AccessDeviceService;
+import org.opencord.sadis.SubscriberAndDeviceInformation;
+
+/**
+ * Shows subscriber information for those subscriber which have been programmed
+ * in the data-plane.
+ */
+@Command(scope = "onos", name = "volt-programmed-subscribers",
+ description = "Shows subscribers programmed in the dataplane")
+public class ShowProgrammedSubscribersCommand extends AbstractShellCommand {
+
+ @Override
+ protected void execute() {
+ AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
+ Map<ConnectPoint, SubscriberAndDeviceInformation> info = service.getProgSubs();
+ info.forEach(this::display);
+ }
+
+ private void display(ConnectPoint cp, SubscriberAndDeviceInformation sub) {
+ print("location=%s subscriber=%s", cp, sub);
+ }
+}