aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy70
1 files changed, 57 insertions, 13 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 8eea0f5b9c..6f41879e7d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -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
@@ -100,25 +101,44 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
String serviceModelUUID = execution.getVariable("modelUuid")
- List<Resource> addResourceList = execution.getVariable("addResourceList")
-
+ List<Resource> addResourceList = execution.getVariable("addResourceList")
List<NetworkResource> networkResourceList = new ArrayList<NetworkResource>()
- //define sequenced resource list, we deploy vf first and then network and then ar
- //this is defaule sequence
List<Resource> sequencedResourceList = new ArrayList<Resource>()
def resourceSequence = BPMNProperties.getResourceSequenceProp()
- for (resourceType in resourceSequence) {
- for (resource in addResourceList) {
- if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
- sequencedResourceList.add(resource)
+ if(resourceSequence != null) {
+ // sequence is defined in config file
+ for (resourceType in resourceSequence) {
+ for (resource in addResourceList) {
+ if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
+ sequencedResourceList.add(resource)
- if (resource instanceof NetworkResource) {
- networkResourceList.add(resource)
+ if (resource instanceof NetworkResource) {
+ networkResourceList.add(resource)
+ }
}
}
}
+ } else {
+
+ //define sequenced resource list, we deploy vf first and then network and then ar
+ //this is defaule sequence
+ List<VnfResource> vnfResourceList = new ArrayList<VnfResource>()
+ List<AllottedResource> arResourceList = new ArrayList<AllottedResource>()
+
+ for (Resource rc : addResourceList){
+ if (rc instanceof VnfResource) {
+ vnfResourceList.add(rc)
+ } else if (rc instanceof NetworkResource) {
+ networkResourceList.add(rc)
+ } else if (rc instanceof AllottedResource) {
+ arResourceList.add(rc)
+ }
+ }
+ sequencedResourceList.addAll(vnfResourceList)
+ sequencedResourceList.addAll(networkResourceList)
+ sequencedResourceList.addAll(arResourceList)
}
String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true"
@@ -127,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")
@@ -156,7 +197,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
}
public void prepareResourceRecipeRequest(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
ResourceInput resourceInput = new ResourceInput()
String serviceInstanceName = execution.getVariable("serviceInstanceName")
@@ -199,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")