Transport Slicing Fixes
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / groovy / org / onap / so / bpmn / infrastructure / scripts / DoDeallocateTnNssi.groovy
index a715e77..b09161d 100644 (file)
@@ -38,6 +38,9 @@ import org.onap.so.db.request.beans.ResourceOperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
+import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isEmpty
+
 class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
     String Prefix = "TNDEALLOC_"
 
@@ -68,10 +71,11 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
         String sliceServiceInstanceName = execution.getVariable("servicename")
         execution.setVariable("sliceServiceInstanceName", sliceServiceInstanceName)
 
-
         String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
         String modelUuid = execution.getVariable("modelUuid")
-        //here modelVersion is not set, we use modelUuid to decompose the service.
+        if (isEmpty(modelUuid)) {
+            modelUuid = tnNssmfUtils.getModelUuidFromServiceInstance(execution.getVariable("serviceInstanceID"))
+        }
         def isDebugLogEnabled = true
         execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
         String serviceModelInfo = """{
@@ -81,7 +85,13 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
              }"""
         execution.setVariable("serviceModelInfo", serviceModelInfo)
 
-        tnNssmfUtils.setEnableSdncConfig(execution)
+        String additionalPropJsonStr = execution.getVariable("sliceParams")
+        if (isBlank(additionalPropJsonStr) ||
+                isBlank(tnNssmfUtils.setExecVarFromJsonIfExists(execution,
+                        additionalPropJsonStr,
+                        "enableSdnc", "enableSdnc"))) {
+            tnNssmfUtils.setEnableSdncConfig(execution)
+        }
 
         logger.debug("Finish preProcessRequest")
     }