Fix the SIP uuid generation in TAPI topology 86/94986/2
authorGilles Thouenon <gilles.thouenon@orange.com>
Fri, 22 Jan 2021 09:54:41 +0000 (10:54 +0100)
committerGilles Thouenon <gilles.thouenon@orange.com>
Thu, 18 Feb 2021 12:56:40 +0000 (12:56 +0000)
Avoid randomly generation of UUID for the ServiceInterfacePoint in TAPI
topology since it is used in the create-connectivity-service input RPC

JIRA: TRNSPRTPCE-389
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: Ieabeb3e8594af2cd1cc4f56396d07d8ab0b164a5
(cherry picked from commit f07576835c256e0475043bc4d22fbc2a8c13e0fe)

tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopo.java

index 81bf27e4cee92c5fa008fee0c5176bbd62610b8f..a0d87ae122af50af2d3a05f123abf38d5a9b990e 100644 (file)
@@ -484,7 +484,7 @@ public class ConvertORTopoToTapiTopo {
             .setLayerProtocolName(nepProtocol)
             .setName(nepNames);
         if (withSip) {
-            onepBldr.setMappedServiceInterfacePoint(createSIP(1));
+            onepBldr.setMappedServiceInterfacePoint(createSIP(this.uuidMap.get(key), 1));
         }
         onepBldr.setSupportedCepLayerProtocolQualifier(createSupportedCepLayerProtocolQualifier(oorTp, nodeProtocol));
         onepBldr.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
@@ -551,11 +551,13 @@ public class ConvertORTopoToTapiTopo {
         return nodeRuleGroupMap;
     }
 
-    private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createSIP(int nb) {
+    private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createSIP(Uuid nepUuid, int nb) {
         Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
         for (int i = 0; i < nb; i++) {
             MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
-                .setServiceInterfacePointUuid(new Uuid(UUID.randomUUID().toString())).build();
+                .setServiceInterfacePointUuid(new Uuid(UUID.nameUUIDFromBytes(nepUuid.getValue()
+                    .getBytes(Charset.forName("UTF-8"))).toString()))
+                .build();
             msipl.put(msip.key(), msip);
         }
         return msipl;