Fix bug in TAPI for transitional links 48/92948/1
authorGilles Thouenon <gilles.thouenon@orange.com>
Tue, 6 Oct 2020 08:58:09 +0000 (10:58 +0200)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Wed, 7 Oct 2020 11:02:13 +0000 (11:02 +0000)
UUID of transitional links were identical for SPDR-SA1 and SPDR-SC1.
To solve it, we can consider the node id to create a per-device unique
UUID.

JIRA: TRNSPRTPCE-333
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Co-authored-by: Christophe Betoule <christophe.betoule@orange.com>
Change-Id: I00943607bdc553bfdaef045cb8fad03a8a80efd8
(cherry picked from commit 92025c52874815268743b848ea79e2fbe2a39ab7)

tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoObjectToTapiTopoObject.java
tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImplTest.java

index 5762fea75e62335ecb4b2e7676b7d3e80f73d6c0..7203fa12434cf910e548a2a3ed1f51fb0bb1fa3d 100644 (file)
@@ -390,10 +390,15 @@ public class ConvertORTopoObjectToTapiTopoObject {
                 .setNodeEdgePointUuid(destUuidTp)
                 .build();
             nepList.put(destNep.key(), destNep);
+            Name linkName = new NameBuilder().setValueName("transitional link name")
+                .setValue(this.ietfNodeId + "-" + sourceKey + "--" + destKey)
+                .build();
             Link transiLink = new LinkBuilder()
                 .setUuid(new Uuid(
-                        UUID.nameUUIDFromBytes((sourceKey + "--" + destKey).getBytes(Charset.forName("UTF-8")))
+                        UUID.nameUUIDFromBytes((this.ietfNodeId + "-" + sourceKey + "--" + destKey)
+                            .getBytes(Charset.forName("UTF-8")))
                     .toString()))
+                .setName(Map.of(linkName.key(), linkName))
                 .setTransitionedLayerProtocolName(Arrays.asList(LayerProtocolName.ODU.getName(),
                     LayerProtocolName.PHOTONICMEDIA.getName()))
                 .setNodeEdgePoint(nepList)
index 4c2781405d0aafb4c65b59a284918c42227023b8..72770195aea29b425a7e34a5d4c058d6755e0056 100644 (file)
@@ -165,10 +165,10 @@ public class TapiTopologyImplTest extends AbstractTest {
         List<Link> links = topology.nonnullLink().values().stream()
             .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue()))
             .collect(Collectors.toList());
-        checkTransitionalLink(links.get(0), topoUuid, node1Uuid, node3Uuid, "DSR+XPDR1-NETWORK1",
-            "iOTSi+XPDR1-NETWORK1");
-        checkTransitionalLink(links.get(1), topoUuid, node2Uuid, node4Uuid, "DSR+XPDR2-NETWORK1",
-            "iOTSi+XPDR2-NETWORK1");
+        checkTransitionalLink(links.get(1), topoUuid, node1Uuid, node3Uuid, "DSR+XPDR1-NETWORK1",
+            "iOTSi+XPDR1-NETWORK1", "SPDR-SA1-XPDR1");
+        checkTransitionalLink(links.get(4), topoUuid, node2Uuid, node4Uuid, "DSR+XPDR2-NETWORK1",
+            "iOTSi+XPDR2-NETWORK1", "SPDR-SA1-XPDR2");
     }
 
     private void checkDsrNode(Node node, Uuid nodeUuid, boolean isSwitch) {
@@ -459,9 +459,9 @@ public class TapiTopologyImplTest extends AbstractTest {
     }
 
     private void checkTransitionalLink(Link link, Uuid topoUuid, Uuid node1Uuid, Uuid node2Uuid, String tp1,
-        String tp2) {
-        Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((tp1 + "--" + tp2).getBytes(Charset.forName("UTF-8")))
-            .toString());
+        String tp2, String ietfNodeId) {
+        Uuid linkUuid = new Uuid(UUID.nameUUIDFromBytes((ietfNodeId + "-" + tp1 + "--" + tp2)
+            .getBytes(Charset.forName("UTF-8"))).toString());
         assertEquals("bad uuid for link between DSR node " + tp1 + " and iOTSI port " + tp2, linkUuid, link.getUuid());
         assertEquals("Available capacity unit should be GBPS",
             CapacityUnit.GBPS, link.getAvailableCapacity().getTotalSize().getUnit());