From 063fcdcf4c1415c4d34d505a097afd4fb875ca05 Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Wed, 11 Apr 2018 11:10:57 +0000 Subject: Implement resource sequence for create implement resource sequence for create. Change-Id: I08bdba08e07cbf1692124f4c2c73801c74f5fd1f Issue-ID: SO-422 Signed-off-by: subhash kumar singh --- .../scripts/DoCreateResources.groovy | 32 ++++++++++------------ 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp') 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 5dd33c9181..ff9a825f99 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,8 @@ package org.openecomp.mso.bpmn.infrastructure.scripts +import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties + import java.util.ArrayList import java.util.Iterator import java.util.List @@ -100,29 +102,25 @@ public class DoCreateResources extends AbstractServiceTaskProcessor List addResourceList = execution.getVariable("addResourceList") - //we use VF to define a network service - List vnfResourceList = new ArrayList() - //here wan is defined as a network resource List networkResourceList = new ArrayList() - //allotted resource - List arResourceList = new ArrayList() //define sequenced resource list, we deploy vf first and then network and then ar //this is defaule sequence List sequencedResourceList = new ArrayList() - 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) + def resourceSequence = BPMNProperties.getResourceSequenceProp() + + 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) + } + } } - } - sequencedResourceList.addAll(vnfResourceList) - sequencedResourceList.addAll(networkResourceList) - sequencedResourceList.addAll(arResourceList) - + } + String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true" execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) -- cgit 1.2.3-korg