Add nssiId for AllocateTNNSSI request
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / groovy / org / onap / so / bpmn / infrastructure / scripts / DoDeallocateTnNssi.groovy
index a8622b9..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 = """{
@@ -80,6 +84,15 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
             "modelVersion":""
              }"""
         execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+        String additionalPropJsonStr = execution.getVariable("sliceParams")
+        if (isBlank(additionalPropJsonStr) ||
+                isBlank(tnNssmfUtils.setExecVarFromJsonIfExists(execution,
+                        additionalPropJsonStr,
+                        "enableSdnc", "enableSdnc"))) {
+            tnNssmfUtils.setEnableSdncConfig(execution)
+        }
+
         logger.debug("Finish preProcessRequest")
     }
 
@@ -155,7 +168,7 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
         String nsiId = execution.getVariable("nsiId")
 
         ResourceOperationStatus roStatus = tnNssmfUtils.buildRoStatus(modelUuid, ssInstanceId,
-                jobId, nsiId, "deallocate", status, progress, statusDescription)
+                jobId, nsiId, "DEALLOCATE", status, progress, statusDescription)
 
         logger.debug("DoDeallocateTnNssi: roStatus={}", roStatus)
         requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)