Merge "Added canceling subsription to pnf-pnp workflow"
[so.git] / bpmn / MSOInfrastructureBPMN / src / main / groovy / org / openecomp / mso / bpmn / infrastructure / scripts / DoCreateResources.groovy
index d9080b8..ae75d54 100644 (file)
@@ -20,6 +20,7 @@
  
 package org.openecomp.mso.bpmn.infrastructure.scripts
 
+import org.codehaus.jackson.map.ObjectMapper
 import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties
 
 import java.util.ArrayList
@@ -146,7 +147,28 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
         execution.setVariable("sequencedResourceList", sequencedResourceList)
         utils.log("INFO", "sequencedResourceList: " + sequencedResourceList, isDebugEnabled) 
         utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled)
-    }   
+    }
+
+    public prepareServiceTopologyRequest(DelegateExecution execution) {
+
+        def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+        utils.log("INFO", "======== Start prepareServiceTopologyRequest Process ======== ", isDebugEnabled)
+
+        String serviceDecompose = execution.getVariable("serviceDecomposition")
+
+        execution.setVariable("operationType", "create")
+        execution.setVariable("resourceType", "")
+
+        String serviceInvariantUuid = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelInvariantUuid")
+        String serviceUuid = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelUuid")
+        String serviceModelName = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelName")
+
+        execution.setVariable("modelInvariantUuid", serviceInvariantUuid)
+        execution.setVariable("modelUuid", serviceUuid)
+        execution.setVariable("serviceModelName", serviceModelName)
+
+        utils.log("INFO", "======== End prepareServiceTopologyRequest Process ======== ", isDebugEnabled)
+    }
    
     public void getCurrentResoure(DelegateExecution execution){
            def isDebugEnabled=execution.getVariable("isDebugLogEnabled")   
@@ -187,7 +209,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
                 String serviceType = execution.getVariable("serviceType")
                 String serviceInstanceId = execution.getVariable("serviceInstanceId")
                 String operationId = execution.getVariable("operationId")
-                String operationType = execution.getVariable("operationType")
+                String operationType = "createInstance"
                 resourceInput.setGlobalSubscriberId(globalSubscriberId)
                 resourceInput.setServiceType(serviceType)
                 resourceInput.setServiceInstanceId(serviceInstanceId)
@@ -218,7 +240,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
                 String serviceInstanceId = execution.getVariable("serviceInstanceId")
                 String serviceType = execution.getVariable("serviceType")
                 ResourceInput resourceInput = execution.getVariable("resourceInput")
-                String requestAction = resourceInput.getOperationType()
+                
+                // requestAction is action, not opertiontype
+                //String requestAction = resourceInput.getOperationType()
+                String requestAction = "createInstance"
                 JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction)
          String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri")
                 int recipeTimeOut = resourceRecipe.getInt("recipeTimeout")