aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy19
3 files changed, 30 insertions, 2 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
index 419f545cdf..b3439d58e3 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
@@ -245,7 +245,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
*/
@JsonIgnore
public List<Resource> getServiceResources() {
- ArrayList serviceResources = new ArrayList();
+ ArrayList<Resource> serviceResources = new ArrayList();
if (this.getAllottedResources() != null) {
serviceResources.addAll(this.getAllottedResources());
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
index 0804cbb11b..da8d5a1f13 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfResource.java
@@ -55,6 +55,9 @@ public class VnfResource extends Resource {
@JsonProperty("groups")
private List<GroupResource> groups;
+ @JsonProperty("group-order")
+ private String groupOrder;
+
private String vnfHostname;
private String vnfType;
private String nfFunction;
@@ -163,6 +166,14 @@ public class VnfResource extends Resource {
this.groups = groups;
}
+ public String getGroupOrder() {
+ return groupOrder;
+ }
+
+ public void setGroupOrder(String groupOrder) {
+ this.groupOrder = groupOrder;
+ }
+
/**
* Returns a list of all VfModule objects. Base module is first entry in the list
*
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..a7d453d56d 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
@@ -23,6 +23,7 @@
package org.onap.so.bpmn.infrastructure.scripts
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
@@ -117,6 +118,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 +143,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>()