aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-04-11 11:10:57 +0000
committerSeshu Kumar M <seshu.kumar.m@huawei.com>2018-04-11 12:27:22 +0000
commit063fcdcf4c1415c4d34d505a097afd4fb875ca05 (patch)
treece2c88f5068ee877c05425470ddcff39b612b556 /bpmn/MSOInfrastructureBPMN/src
parent991d65c35ee2f8aa9857059a0336ab05c39ae118 (diff)
Implement resource sequence for create
implement resource sequence for create. Change-Id: I08bdba08e07cbf1692124f4c2c73801c74f5fd1f Issue-ID: SO-422 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy32
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java15
2 files changed, 22 insertions, 25 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 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<Resource> addResourceList = execution.getVariable("addResourceList")
- //we use VF to define a network service
- List<VnfResource> vnfResourceList = new ArrayList<VnfResource>()
- //here wan is defined as a network resource
List<NetworkResource> networkResourceList = new ArrayList<NetworkResource>()
- //allotted resource
- List<AllottedResource> arResourceList = new ArrayList<AllottedResource>()
//define sequenced resource list, we deploy vf first and then network and then ar
//this is defaule sequence
List<Resource> sequencedResourceList = new ArrayList<Resource>()
- 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)
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 70572dc94a..fbc2bd3b0a 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
@@ -29,29 +29,28 @@ import java.util.List;
public class BPMNProperties {
- public static String MSO_PROP_BPMN = "MSO_PROP_BPMN";
+ public static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
public static String getProperty(String key, String defaultValue) {
String value;
try {
- value = new MsoPropertiesFactory().getMsoJavaProperties(MSO_PROP_BPMN).getProperty(key, defaultValue);
+ value = new MsoPropertiesFactory().getMsoJavaProperties(MSO_PROP_APIHANDLER_INFRA).getProperty(key, defaultValue);
} catch (MsoPropertiesException e) {
msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: "
- + MSO_PROP_BPMN, "BPMN", "", MsoLogger.ErrorCode.DataError,
+ + MSO_PROP_APIHANDLER_INFRA, "BPMN", "", MsoLogger.ErrorCode.DataError,
"Exception - Mso Properties ID not found in cache", e);
return null;
}
- msoLogger.debug("Config read for " + MSO_PROP_BPMN + " - key:" + key + " value:" + value);
+ msoLogger.debug("Config read for " + MSO_PROP_APIHANDLER_INFRA + " - key:" + key + " value:" + value);
return value;
}
public static List<String> getResourceSequenceProp() {
- String resource_sequence = getProperty("resource_sequence", null);
- if (resource_sequence != null) {
- String[] resourceSequence = resource_sequence.split(",");
- return Arrays.asList(resource_sequence);
+ String resourceSequence = getProperty("mso.workflow.default.resource.sequence", null);
+ if (resourceSequence != null) {
+ return Arrays.asList(resourceSequence.split(","));
}
return Arrays.asList(ResourceSequence.RESOURCE_EPC,
ResourceSequence.RESOURCE_IMS,