Fixed issue with canonicalization of link identifiers.
- added asId() to LinkKey
- BiLink.linkId() now returns LinkKey.asId()

Change-Id: Ie9069ca5302f09fca9e213ce33fa87bd8868e752
diff --git a/core/api/src/test/java/org/onosproject/ui/topo/BiLinkTest.java b/core/api/src/test/java/org/onosproject/ui/topo/BiLinkTest.java
index e7c5048..df6d3f7 100644
--- a/core/api/src/test/java/org/onosproject/ui/topo/BiLinkTest.java
+++ b/core/api/src/test/java/org/onosproject/ui/topo/BiLinkTest.java
@@ -57,5 +57,25 @@
         blink = new ConcreteLink(KEY_AB, LINK_AB);
         blink.setOther(null);
     }
+
+    @Test
+    public void canonIdentifiers() {
+        // FIRST: an assumption that the LinkKey used is canonicalized
+        //        ( See TopoUtils.canonicalLinkKey(Link) )
+        //  so in both the following cases, KEY_AB is used...
+        String expected = CP_A1 + "-" + CP_B2;
+
+        // let's assume that link [A -> B] was dealt with first...
+        blink = new ConcreteLink(KEY_AB, LINK_AB);
+        blink.setOther(LINK_BA);
+        print(blink);
+        assertEquals("non-canon AB", expected, blink.linkId());
+
+        // let's assume that link [B -> A] was dealt with first...
+        blink = new ConcreteLink(KEY_AB, LINK_BA);
+        blink.setOther(LINK_AB);
+        print(blink);
+        assertEquals("non-canon BA", expected, blink.linkId());
+    }
 }