In this commit:
   Bug fix when optimized SR re-routing fails, do full re-route
   Bug fix filtering objectives should be called for new device even if there is an existing grouphandler
   Bug fix NPE in ofdpa driver due to null check on the wrong variable
   New cli command for debugging flow-objectives for pending next-objectives
   Flow objective cli commands now start with "obj-"

Change-Id: I819f82d1d67769cb9fbbde60f099d29b8e7f7c9e
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveNextListCommand.java b/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveNextListCommand.java
index 4fcc271..b30584f 100644
--- a/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveNextListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowObjectiveNextListCommand.java
@@ -16,30 +16,30 @@
 package org.onosproject.cli.net;
 
 import java.util.List;
+import org.onlab.osgi.ServiceNotFoundException;
 
-//import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.net.flowobjective.FlowObjectiveService;
 
 /**
  * Returns a mapping of FlowObjective next-ids to the groups that get created
- * by a device driver.
+ * by a device driver. These mappings are controller instance specific.
  */
-@Command(scope = "onos", name = "next-ids",
-        description = "flow-objective next-ids to group-ids mapping")
+@Command(scope = "onos", name = "obj-next-ids",
+        description = "flow-objectives next-ids to group-ids mapping")
 public class FlowObjectiveNextListCommand extends AbstractShellCommand {
 
-    /*@Argument(index = 1, name = "uri", description = "Device ID",
-            required = false, multiValued = false)
-    String uri = null;
-     */
-    private static final String FORMAT_MAPPING =
-            "  %s";
+    private static final String FORMAT_MAPPING = "  %s";
+
     @Override
     protected void execute() {
-        FlowObjectiveService service = get(FlowObjectiveService.class);
-        printNexts(service.getNextMappings());
+        try {
+            FlowObjectiveService service = get(FlowObjectiveService.class);
+            printNexts(service.getNextMappings());
+        } catch (ServiceNotFoundException e) {
+            print(FORMAT_MAPPING, "FlowObjectiveService unavailable");
+        }
     }
 
     private void printNexts(List<String> nextGroupMappings) {
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowObjectivePendingNextCommand.java b/cli/src/main/java/org/onosproject/cli/net/FlowObjectivePendingNextCommand.java
new file mode 100644
index 0000000..7350a6f
--- /dev/null
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowObjectivePendingNextCommand.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * 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.onosproject.cli.net;
+
+import java.util.List;
+
+import org.apache.karaf.shell.commands.Command;
+import org.onlab.osgi.ServiceNotFoundException;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.flowobjective.FlowObjectiveService;
+
+/**
+ * Returns a list of FlowObjective next-ids waiting to get created by device-drivers.
+ * Also returns the forwarding objectives waiting on the pending next-objectives.
+ * These lists are controller instance specific.
+ */
+@Command(scope = "onos", name = "obj-pending-nexts",
+        description = "flow-objectives pending next-objectives")
+public class FlowObjectivePendingNextCommand extends AbstractShellCommand {
+
+    private static final String FORMAT_MAPPING = "  %s";
+
+    @Override
+    protected void execute() {
+        try {
+            FlowObjectiveService service = get(FlowObjectiveService.class);
+            printNexts(service.getPendingNexts());
+        } catch (ServiceNotFoundException e) {
+            print(FORMAT_MAPPING, "FlowObjectiveService unavailable");
+        }
+    }
+
+    private void printNexts(List<String> pendingNexts) {
+        pendingNexts.forEach(str -> print(FORMAT_MAPPING, str));
+    }
+
+}
diff --git a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index db6da4f..9f02c60 100644
--- a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -31,6 +31,10 @@
         </command>
 
         <command>
+            <action class="org.onosproject.cli.net.FlowObjectivePendingNextCommand"/>
+        </command>
+
+        <command>
             <action class="org.onosproject.cli.net.FlowObjectiveCompositionCommand"/>
         </command>