aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-04-18 11:08:23 +0000
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2018-04-18 11:08:23 +0000
commit17d4e43f11ac66fa1d5cba27894f440fae877818 (patch)
treea3174f1069234035274773c4cf76e1014061bbdf /bpmn/MSOInfrastructureBPMN/src/main/groovy
parentae4462a157c19c543502d12ff7bf244abe11928b (diff)
Add resource sequence if config file not defined
Add resource sequence if config file not defined Change-Id: I2016c3a58a182be3851bb99e40193f013c24b934 Issue-ID: SO-422 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy41
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy35
2 files changed, 59 insertions, 17 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..d9080b8942 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
@@ -100,25 +100,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"
@@ -156,7 +175,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")
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
index 690738b312..6e19a3469a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
@@ -32,11 +32,13 @@ import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.core.domain.AllottedResource
import org.openecomp.mso.bpmn.core.domain.ModelInfo
import org.openecomp.mso.bpmn.core.domain.NetworkResource
import org.openecomp.mso.bpmn.core.domain.Resource
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.ServiceInstance
+import org.openecomp.mso.bpmn.core.domain.VnfResource
import org.openecomp.mso.bpmn.core.json.JsonUtils
import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties
@@ -156,16 +158,37 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
def resourceSequence = BPMNProperties.getResourceSequenceProp()
- for (resourceType in resourceSequence.reverse()) {
- for (resource in delResourceList) {
- if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
- sequencedResourceList.add(resource)
+ if(resourceSequence != null) {
+ for (resourceType in resourceSequence.reverse()) {
+ for (resource in delResourceList) {
+ if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
+ sequencedResourceList.add(resource)
- if (resource instanceof NetworkResource) {
- wanResources.add(resource)
+ if (resource instanceof NetworkResource) {
+ wanResources.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 : delResourceList) {
+ 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(arResourceList)
+ sequencedResourceList.addAll(networkResourceList)
+ sequencedResourceList.addAll(vnfResourceList)
}
String isContainsWanResource = wanResources.isEmpty() ? "false" : "true"