[AETHER-76] Impelentation of a new Trellis Troubleshoot Tool (T3) for offline mode

- For the performance improvement, T3 offline mode uses snapshots of the network states
called Network Information Base (NIB) instead of runtime interactions with ONOS core
during troubleshooting a Trellis system.
- Partially tested with some mininet topos for trellis
(https://github.com/opennetworkinglab/routing/tree/master/trellis).
- Usage instruction docs (https://docs.trellisfabric.org/troubleshooting.html).

Change-Id: Ice608f77aa96bfbcadfff34991c4a1b6d93125b6
(cherry picked from commit eaa6329aba67c2577fdca7d3ddf230611e82f9f7)
diff --git a/cli/src/main/java/org/onosproject/cli/net/EdgePortsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/EdgePortsListCommand.java
index 6f7ae26..2f24ceb 100644
--- a/cli/src/main/java/org/onosproject/cli/net/EdgePortsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/EdgePortsListCommand.java
@@ -15,6 +15,7 @@
  */
 package org.onosproject.cli.net;
 
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import org.apache.karaf.shell.api.action.Argument;
 import org.apache.karaf.shell.api.action.Command;
 import org.apache.karaf.shell.api.action.Completion;
@@ -56,7 +57,17 @@
     }
 
     private void printEdgePoints(Iterable<ConnectPoint> edgePoints) {
-        sort(edgePoints).forEach(e -> print(FMT, e.deviceId(), e.port()));
+        List<ConnectPoint> sorted = sort(edgePoints);
+        if (outputJson()) {
+            ArrayNode result = mapper().createObjectNode().putArray(null);
+            sorted.forEach(e -> {
+                result.add(mapper().createObjectNode()
+                        .put(e.deviceId().toString(), e.port().toString()));
+            });
+            print("%s", result.toString());
+        } else {
+            sorted.forEach(e -> print(FMT, e.deviceId(), e.port()));
+        }
     }
 
     private static List<ConnectPoint> sort(Iterable<ConnectPoint> connectPoints) {