Move EdgeService back to Link/Device services rather than TopologyService.

I think the EdgeService has to use one or the other, because the
TopologyService is not in sync with the Link/Device services. The problem
with using the TopologyService is that it does not handle Port events,
only Device and Link, so it is not suitable for building an inventory of
edge ports.

Change-Id: If31d6d7013985da3e03f8c83f2f2eb2957deffe1
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 6a9a23b..2b03637 100644
--- a/cli/src/main/java/org/onosproject/cli/net/EdgePortsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/EdgePortsListCommand.java
@@ -18,8 +18,14 @@
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.edge.EdgePortService;
+import org.onosproject.utils.Comparators;
 
+import java.util.Collections;
+import java.util.List;
+
+import static com.google.common.collect.Lists.newArrayList;
 import static org.onosproject.net.DeviceId.deviceId;
 
 /**
@@ -35,16 +41,24 @@
             required = false, multiValued = false)
     String uri = null;
 
-
-
     @Override
     protected void execute() {
         EdgePortService service = get(EdgePortService.class);
         if (uri == null) {
-            service.getEdgePoints().forEach(e -> print(FMT, e.deviceId(), e.port()));
+            printEdgePoints(service.getEdgePoints());
         } else {
-            service.getEdgePoints(deviceId(uri)).forEach(e -> print(FMT, e.deviceId(), e.port()));
+            printEdgePoints(service.getEdgePoints(deviceId(uri)));
         }
     }
 
+    private void printEdgePoints(Iterable<ConnectPoint> edgePoints) {
+        sort(edgePoints).forEach(e -> print(FMT, e.deviceId(), e.port()));
+    }
+
+    private static List<ConnectPoint> sort(Iterable<ConnectPoint> connectPoints) {
+        List<ConnectPoint> edgePoints = newArrayList(connectPoints);
+        Collections.sort(edgePoints, Comparators.CONNECT_POINT_COMPARATOR);
+        return edgePoints;
+    }
+
 }
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 4fbae87..5664cc3 100644
--- a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -229,6 +229,7 @@
             <action class="org.onosproject.cli.net.EdgePortsListCommand"/>
             <completers>
                 <ref component-id="deviceIdCompleter"/>
+                <null/>
             </completers>
         </command>