summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src
diff options
context:
space:
mode:
authorChuanyu Chen <chenchuanyu@huawei.com>2018-04-18 12:40:16 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-18 12:40:16 +0000
commitcb28756cf544a5dd6d35d6a134a471181c0abcc1 (patch)
treeaca04ad81f6ee46fbcedc59653a0ad302072b549 /bpmn/MSOInfrastructureBPMN/src
parent21005fb11f754fd25d5a2c2872c0834950295ccf (diff)
parent17d4e43f11ac66fa1d5cba27894f440fae877818 (diff)
Merge "Add resource sequence if config file not defined"
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src')
-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
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java5
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java30
4 files changed, 60 insertions, 51 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"
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java
index acf8f052cd..dbb552c818 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java
@@ -52,9 +52,6 @@ public class BPMNProperties {
if (resourceSequence != null) {
return Arrays.asList(resourceSequence.split(","));
}
- return Arrays.asList(ResourceSequence.RESOURCE_EPC,
- ResourceSequence.RESOURCE_IMS,
- ResourceSequence.RESOUCE_OVERLAY,
- ResourceSequence.RESOURCE_UNDERLAY);
+ return null;
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java
deleted file mode 100644
index 86e5d30b11..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.bpmn.infrastructure.properties;
-
-public final class ResourceSequence {
-
- public static final String RESOURCE_IMS = "ims";
- public static final String RESOURCE_EPC = "epc";
- public static final String RESOUCE_OVERLAY = "overlay";
- public static final String RESOURCE_UNDERLAY = "underlay";
-
- private ResourceSequence() {}
-} \ No newline at end of file