summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy30
1 files changed, 29 insertions, 1 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 98def612de..973d8a156c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -22,7 +22,9 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.bpmn.common.resource.InstanceResourceList
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+import org.onap.so.bpmn.core.domain.GroupResource
import org.onap.so.bpmn.infrastructure.properties.BPMNProperties
import org.apache.commons.lang3.StringUtils
import org.apache.http.HttpResponse
@@ -87,6 +89,16 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
logger.trace("Exit preProcessRequest ")
}
+ // this method will convert resource list to instance_resource_list
+ void prepareInstanceResourceList(DelegateExecution execution) {
+
+ String uuiRequest = execution.getVariable("uuiRequest")
+ List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(sequencedResourceList, uuiRequest)
+
+ execution.setVariable("instanceResourceList", instanceResourceList)
+ }
+
public void sequenceResoure(DelegateExecution execution) {
logger.trace("Start sequenceResoure Process ")
@@ -117,6 +129,22 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
sequencedResourceList.add(resource)
+ // if resource type is vnfResource then check for groups also
+ // Did not use continue because if same model type is used twice
+ // then we would like to add it twice for processing
+ // e.g. S{ V1{G1, G2, G1}} --> S{ V1{G1, G1, G2}}
+ if (resource instanceof VnfResource) {
+ if (resource.getGroups() != null) {
+ String[] grpSequence = resource.getGroupOrder().split(",")
+ for (String grpType in grpSequence) {
+ for (GroupResource gResource in resource.getGroups()) {
+ if (StringUtils.containsIgnoreCase(gResource.getModelInfo().getModelName(), grpType)) {
+ sequencedResourceList.add(gResource)
+ }
+ }
+ }
+ }
+ }
if (resource instanceof NetworkResource) {
networkResourceList.add(resource)
}
@@ -126,7 +154,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
} else {
//define sequenced resource list, we deploy vf first and then network and then ar
- //this is defaule sequence
+ //this is default sequence
List<VnfResource> vnfResourceList = new ArrayList<VnfResource>()
List<AllottedResource> arResourceList = new ArrayList<AllottedResource>()