Enhanced the CLIs.
diff --git a/cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java b/cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
index 95f23af..58dba4b 100644
--- a/cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
+++ b/cli/src/main/java/org/onlab/onos/cli/net/DevicePortsListCommand.java
@@ -38,7 +38,7 @@
     protected Object doExecute() throws Exception {
         DeviceService service = getService(DeviceService.class);
         if (uri == null) {
-            for (Device device : service.getDevices()) {
+            for (Device device : getSortedDevices(service)) {
                 printDevicePorts(service, device);
             }
         } else {
diff --git a/cli/src/main/java/org/onlab/onos/cli/net/DevicesListCommand.java b/cli/src/main/java/org/onlab/onos/cli/net/DevicesListCommand.java
index 21bb892..650e6a0 100644
--- a/cli/src/main/java/org/onlab/onos/cli/net/DevicesListCommand.java
+++ b/cli/src/main/java/org/onlab/onos/cli/net/DevicesListCommand.java
@@ -5,6 +5,12 @@
 import org.onlab.onos.net.Device;
 import org.onlab.onos.net.device.DeviceService;
 
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import static com.google.common.collect.Lists.newArrayList;
+
 /**
  * Lists all infrastructure devices.
  */
@@ -15,16 +21,35 @@
     private static final String FMT =
             "id=%s, available=%s, type=%s, mfr=%s, hw=%s, sw=%s, serial=%s";
 
+    protected static final Comparator<Device> ID_COMPARATOR = new Comparator<Device>() {
+        @Override
+        public int compare(Device d1, Device d2) {
+            return d1.id().uri().toString().compareTo(d2.id().uri().toString());
+        }
+    };
+
     @Override
     protected Object doExecute() throws Exception {
         DeviceService service = getService(DeviceService.class);
-        for (Device device : service.getDevices()) {
+        for (Device device : getSortedDevices(service)) {
             printDevice(device, service.isAvailable(device.id()));
         }
         return null;
     }
 
     /**
+     * Returns the list of devices sorted using the device ID URIs.
+     *
+     * @param service device service
+     * @return sorted device list
+     */
+    protected List<Device> getSortedDevices(DeviceService service) {
+        List<Device> devices = newArrayList(service.getDevices());
+        Collections.sort(devices, ID_COMPARATOR);
+        return devices;
+    }
+
+    /**
      * Prints information about the specified device.
      *
      * @param device      infrastructure device