Fix for [ONOS-3590]

Compare two devices instead of one with itself
Add unit test for root node

Change-Id: If109dd8b05cd77825e182399b321c321865b9786
diff --git a/core/common/src/main/java/org/onosproject/common/DefaultTopology.java b/core/common/src/main/java/org/onosproject/common/DefaultTopology.java
index 5b161ff..a2bc4a5 100644
--- a/core/common/src/main/java/org/onosproject/common/DefaultTopology.java
+++ b/core/common/src/main/java/org/onosproject/common/DefaultTopology.java
@@ -519,7 +519,7 @@
     private TopologyVertex findRoot(Set<TopologyVertex> vertexSet) {
         TopologyVertex minVertex = null;
         for (TopologyVertex vertex : vertexSet) {
-            if ((minVertex == null) || (minVertex.deviceId()
+            if ((minVertex == null) || (vertex.deviceId()
                     .toString().compareTo(minVertex.deviceId().toString()) < 0)) {
                 minVertex = vertex;
             }