aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2021-08-04 06:51:34 +0000
committerGerrit Code Review <gerrit@onap.org>2021-08-04 06:51:34 +0000
commit872613eafe80034cca612bd93294286b3dbed4b1 (patch)
tree0f14309d02bb1ea862368095a65ebfd04871884d /bpmn
parente32fa2efac9f9b9e5a01a86f494664714042c352 (diff)
parented5c51313c1bd3745a554888c969e840341599b0 (diff)
Merge "Support instantiation of same model vnfs/vf-modules"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java60
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ResourceNotFoundException.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java134
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java114
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java39
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java138
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java81
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json187
22 files changed, 886 insertions, 125 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
index 30a6e1fe35..641cd35027 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
@@ -34,5 +34,7 @@ public enum ResourceKey {
VPN_ID,
VPN_BONDING_LINK_ID,
INSTANCE_GROUP_ID,
- PNF
+ PNF,
+ VNF_INSTANCE_NAME,
+ VF_MODULE_INSTANCE_NAME
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
index 508709e12c..5df7c60f74 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
@@ -40,6 +40,8 @@ public class WorkflowResourceIds implements Serializable {
private String networkCollectionId;
private String configurationId;
private String instanceGroupId;
+ private String vnfInstanceName;
+ private String vfModuleInstanceName;
public WorkflowResourceIds() {
@@ -139,4 +141,20 @@ public class WorkflowResourceIds implements Serializable {
public void setInstanceGroupId(String instanceGroupId) {
this.instanceGroupId = instanceGroupId;
}
+
+ public String getVnfInstanceName() {
+ return vnfInstanceName;
+ }
+
+ public void setVnfInstanceName(String vnfInstanceName) {
+ this.vnfInstanceName = vnfInstanceName;
+ }
+
+ public String getVfModuleInstanceName() {
+ return vfModuleInstanceName;
+ }
+
+ public void setVfModuleInstanceName(String vfModuleInstanceName) {
+ this.vfModuleInstanceName = vfModuleInstanceName;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 83d1f5249f..569f6b1c77 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -31,6 +31,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
+import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.javatuples.Pair;
@@ -74,6 +75,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException;
+import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ResourceNotFoundException;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.ServiceModelNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
@@ -258,6 +260,8 @@ public class BBInputSetup implements JavaDelegate {
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId());
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, workflowResourceIds.getConfigurationId());
lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
+ lookupKeyMap.put(ResourceKey.VNF_INSTANCE_NAME, workflowResourceIds.getVnfInstanceName());
+ lookupKeyMap.put(ResourceKey.VF_MODULE_INSTANCE_NAME, workflowResourceIds.getVfModuleInstanceName());
}
protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB,
@@ -1581,7 +1585,13 @@ public class BBInputSetup implements JavaDelegate {
.setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).build();
if (bbName.contains(VNF) || (bbName.contains(CONTROLLER)
&& (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
- vnfs = findVnfsByKey(key, resources, vnfs);
+ String vnfInstanceName = lookupKeyMap.get(ResourceKey.VNF_INSTANCE_NAME);
+ if (StringUtils.isNotBlank(vnfInstanceName)) {
+ vnfs = findVnfsByInstanceName(vnfInstanceName, resources);
+ } else {
+ vnfs = findVnfsByKey(key, resources);
+ }
+
String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
// This stores the vnf id in request db to be retrieved later when
// working on a vf module or volume group
@@ -1611,15 +1621,15 @@ public class BBInputSetup implements JavaDelegate {
.ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance));
} else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP) || (bbName.contains(CONTROLLER)
&& (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
- Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources);
- if (vnfsAndVfModules != null) {
- vfModules = vnfsAndVfModules.getValue1();
- vnfs = vnfsAndVfModules.getValue0();
+ String vfModuleInstanceName = lookupKeyMap.get(ResourceKey.VF_MODULE_INSTANCE_NAME);
+ if (StringUtils.isNotBlank(vfModuleInstanceName)) {
+ vfModules = getVfModulesByInstanceName(vfModuleInstanceName, resources);
+ } else {
+ vfModules = getVfModulesByKey(key, resources);
}
+
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap));
- if (vnfs == null) {
- throw new Exception("Could not find Vnf to orchestrate VfModule");
- }
+
parameter.setModelInfo(vfModules.getModelInfo());
if (bbName.contains(VOLUME_GROUP)) {
parameter.setResourceId(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
@@ -1682,25 +1692,45 @@ public class BBInputSetup implements JavaDelegate {
return null;
}
- protected Pair<Vnfs, VfModules> getVfModulesAndItsVnfsByKey(String key, Resources resources) {
+ protected VfModules getVfModulesByInstanceName(String vfModuleInstanceName, Resources resources) {
+ for (Vnfs vnfs : resources.getVnfs()) {
+ for (VfModules vfModules : vnfs.getVfModules()) {
+ if (vfModules.getInstanceName().equals(vfModuleInstanceName)) {
+ return vfModules;
+ }
+ }
+ }
+ throw new ResourceNotFoundException(
+ "Could not find vf-module with instanceName: " + vfModuleInstanceName + " in userparams");
+ }
+
+ protected VfModules getVfModulesByKey(String key, Resources resources) {
for (Vnfs vnfs : resources.getVnfs()) {
for (VfModules vfModules : vnfs.getVfModules()) {
if (vfModules.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) {
- return new Pair<Vnfs, VfModules>(vnfs, vfModules);
+ return vfModules;
}
}
}
- return null;
+ throw new ResourceNotFoundException("Could not find vf-module with key: " + key + " in userparams");
+ }
+
+ protected Vnfs findVnfsByInstanceName(String instanceName, Resources resources) {
+ for (Vnfs tempVnfs : resources.getVnfs()) {
+ if (tempVnfs.getInstanceName().equals(instanceName)) {
+ return tempVnfs;
+ }
+ }
+ throw new ResourceNotFoundException("Could not find vnf with instanceName: " + instanceName + " in userparams");
}
- protected Vnfs findVnfsByKey(String key, Resources resources, Vnfs vnfs) {
+ protected Vnfs findVnfsByKey(String key, Resources resources) {
for (Vnfs tempVnfs : resources.getVnfs()) {
if (tempVnfs.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) {
- vnfs = tempVnfs;
- break;
+ return tempVnfs;
}
}
- return vnfs;
+ throw new ResourceNotFoundException("Could not find vnf with key: " + key + " in userparams");
}
protected CloudRegion getCloudRegionFromMacroRequest(CloudConfiguration cloudConfiguration, Resources resources) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ResourceNotFoundException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ResourceNotFoundException.java
new file mode 100644
index 0000000000..d8eed9610a
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/exceptions/ResourceNotFoundException.java
@@ -0,0 +1,14 @@
+package org.onap.so.bpmn.servicedecomposition.tasks.exceptions;
+
+public class ResourceNotFoundException extends RuntimeException {
+
+ static final long serialVersionUID = -2741357347054072719L;
+
+ public ResourceNotFoundException() {
+ super();
+ }
+
+ public ResourceNotFoundException(String message) {
+ super(message);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
index 6f850fa898..eeaecb9264 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
@@ -21,7 +21,7 @@
package org.onap.so.client.cds;
import com.google.gson.JsonObject;
-import org.onap.so.client.cds.ExtractServiceFromUserParameters;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.VfModules;
@@ -47,12 +47,17 @@ public class ConfigureInstanceParamsForVfModule {
* @throws PayloadGenerationException- If it doesn't able to populate instance parameters from SO payload.
*/
public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest,
- String vnfCustomizationUuid, String vfModuleCustomizationUuid) throws PayloadGenerationException {
+ String vnfCustomizationUuid, String vfModuleCustomizationUuid, String vfModuleInstanceName)
+ throws PayloadGenerationException {
try {
Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- List<Map<String, String>> instanceParamsList =
- getInstanceParams(service, vnfCustomizationUuid, vfModuleCustomizationUuid);
+ List<Map<String, String>> instanceParamsList;
+ if (StringUtils.isNotBlank(vfModuleInstanceName)) {
+ instanceParamsList = getInstanceParamsByInstanceNames(service, vfModuleInstanceName);
+ } else {
+ instanceParamsList = getInstanceParams(service, vnfCustomizationUuid, vfModuleCustomizationUuid);
+ }
instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
.forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
@@ -61,6 +66,14 @@ public class ConfigureInstanceParamsForVfModule {
}
}
+ private List<Map<String, String>> getInstanceParamsByInstanceNames(Service service, String vfModuleInstanceName)
+ throws PayloadGenerationException {
+ return service.getResources().getVnfs().stream().map(Vnfs::getVfModules).flatMap(List::stream)
+ .filter(vfm -> vfModuleInstanceName.equals(vfm.getInstanceName())).findFirst()
+ .map(VfModules::getInstanceParams).orElseThrow(() -> new PayloadGenerationException(
+ "Could not find vfModule with instanceName: " + vfModuleInstanceName));
+ }
+
private List<Map<String, String>> getInstanceParams(Service service, String vnfCustomizationUuid,
String vfModuleCustomizationUuid) throws PayloadGenerationException {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
index 22c9a7bee4..43283ac98b 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
@@ -21,6 +21,7 @@
package org.onap.so.client.cds;
import com.google.gson.JsonObject;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.client.exception.PayloadGenerationException;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.Vnfs;
@@ -45,10 +46,16 @@ public class ConfigureInstanceParamsForVnf {
* @throws PayloadGenerationException if it doesn't able to populate instance parameters from SO payload.
*/
public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest,
- String modelCustomizationUuid) throws PayloadGenerationException {
+ String modelCustomizationUuid, String vnfInstanceName) throws PayloadGenerationException {
try {
Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
- List<Map<String, String>> instanceParamsList = getInstanceParamForVnf(service, modelCustomizationUuid);
+
+ List<Map<String, String>> instanceParamsList;
+ if (StringUtils.isNotBlank(vnfInstanceName)) {
+ instanceParamsList = getInstanceParamByVnfInstanceName(service, vnfInstanceName);
+ } else {
+ instanceParamsList = getInstanceParamForVnf(service, modelCustomizationUuid);
+ }
instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
.forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
@@ -57,6 +64,13 @@ public class ConfigureInstanceParamsForVnf {
}
}
+ private List<Map<String, String>> getInstanceParamByVnfInstanceName(Service service, String instanceName)
+ throws PayloadGenerationException {
+ return service.getResources().getVnfs().stream().filter(vnf -> instanceName.equals(vnf.getInstanceName()))
+ .findFirst().map(Vnfs::getInstanceParams).orElseThrow(
+ () -> new PayloadGenerationException("Could not find vnf with instanceName: " + instanceName));
+ }
+
private List<Map<String, String>> getInstanceParamForVnf(Service service, String genericVnfModelCustomizationUuid)
throws PayloadGenerationException {
Optional<Vnfs> foundedVnf = service.getResources().getVnfs().stream()
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
index 478b65c349..06ab84a114 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
@@ -104,9 +104,11 @@ public class VfModuleCDSRequestProvider implements CDSRequestProvider {
final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
List<Map<String, Object>> userParamsFromRequest =
buildingBlock.getRequestContext().getRequestParameters().getUserParams();
+ String vfModuleInstanceName =
+ execution.getLookupMap().getOrDefault(ResourceKey.VF_MODULE_INSTANCE_NAME, "");
if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
configureInstanceParamsForVfModule.populateInstanceParams(vfModuleObject, userParamsFromRequest,
- modelCustomizationUuidForVnf, modelCustomizationUuidForVfModule);
+ modelCustomizationUuidForVnf, modelCustomizationUuidForVfModule, vfModuleInstanceName);
}
} catch (Exception e) {
throw new PayloadGenerationException("Failed to buildPropertyObject for VF-Module", e);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
index 6251eb6fad..5f63732458 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
@@ -23,6 +23,7 @@
package org.onap.so.client.cds;
import com.google.gson.JsonObject;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -93,9 +94,10 @@ public class VnfCDSRequestProvider implements CDSRequestProvider {
final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
List<Map<String, Object>> userParamsFromRequest =
buildingBlock.getRequestContext().getRequestParameters().getUserParams();
+ String vnfInstanceName = execution.getLookupMap().getOrDefault(ResourceKey.VNF_INSTANCE_NAME, "");
if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
configureInstanceParamsForVnf.populateInstanceParams(vnfObject, userParamsFromRequest,
- modelCustomizationUuid);
+ modelCustomizationUuid, vnfInstanceName);
}
} catch (Exception e) {
throw new PayloadGenerationException("Failed to buildPropertyObjectForVnf", e);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 127253a72e..8961c996a8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -131,6 +131,8 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
@RunWith(MockitoJUnitRunner.class)
public class BBInputSetupTest {
@@ -2116,6 +2118,8 @@ public class BBInputSetupTest {
String volumeGroupId = "volumeGroupId";
String configurationId = "configurationId";
String instanceGroupId = "instancegroupId";
+ String vnfInstanceName = "vnfInstanceName";
+ String vfModuleInstanceName = "vfModuleInstanceName";
expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);
expected.put(ResourceKey.NETWORK_ID, networkId);
@@ -2125,6 +2129,8 @@ public class BBInputSetupTest {
expected.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId);
expected.put(ResourceKey.CONFIGURATION_ID, configurationId);
expected.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupId);
+ expected.put(ResourceKey.VNF_INSTANCE_NAME, vnfInstanceName);
+ expected.put(ResourceKey.VF_MODULE_INSTANCE_NAME, vfModuleInstanceName);
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId(serviceInstanceId);
@@ -2135,6 +2141,8 @@ public class BBInputSetupTest {
workflowResourceIds.setVolumeGroupId(volumeGroupId);
workflowResourceIds.setConfigurationId(configurationId);
workflowResourceIds.setInstanceGroupId(instanceGroupId);
+ workflowResourceIds.setVnfInstanceName(vnfInstanceName);
+ workflowResourceIds.setVfModuleInstanceName(vfModuleInstanceName);
SPY_bbInputSetup.populateLookupKeyMapWithIds(workflowResourceIds, actual);
@@ -2142,6 +2150,44 @@ public class BBInputSetupTest {
}
@Test
+ public void testGetVfModulesByInstanceName() throws IOException {
+ org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(
+ new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
+ Resources resources = serviceMacro.getResources();
+ VfModules expectedVfModule = resources.getVnfs().get(0).getVfModules().get(2);
+ assertEquals(expectedVfModule,
+ SPY_bbInputSetup.getVfModulesByInstanceName("vmxnjr001_AVPN_base_vRE_BV_expansion_002", resources));
+ }
+
+ @Test
+ public void testGetVfModulesByKey() throws IOException {
+ org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(
+ new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
+ Resources resources = serviceMacro.getResources();
+ VfModules expectedVfModule = resources.getVnfs().get(0).getVfModules().get(0);
+ assertEquals(expectedVfModule,
+ SPY_bbInputSetup.getVfModulesByKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", resources));
+ }
+
+ @Test
+ public void testFindVnfsByInstanceName() throws IOException {
+ org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(
+ new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
+ Resources resources = serviceMacro.getResources();
+ Vnfs expectedVnf = resources.getVnfs().get(0);
+ assertEquals(expectedVnf, SPY_bbInputSetup.findVnfsByInstanceName("vmxnjr001", resources));
+ }
+
+ @Test
+ public void testVnfsByKey() throws IOException {
+ org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(
+ new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
+ Resources resources = serviceMacro.getResources();
+ Vnfs expectedVnf = resources.getVnfs().get(0);
+ assertEquals(expectedVnf, SPY_bbInputSetup.findVnfsByKey("ab153b6e-c364-44c0-bef6-1f2982117f04", resources));
+ }
+
+ @Test
public void testGBBMacroNoUserParamsVrfConfiguration() throws Exception {
String resourceId = "123";
String vnfType = "vnfType";
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
index 06defaa84c..6de1364a47 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
@@ -82,6 +82,7 @@ public abstract class AbstractVnfCDSRequestProviderTest {
@Before
public void setUp() {
buildingBlockExecution = createBuildingBlockExecution();
+ buildingBlockExecution.setVariable("lookupKeyMap", new HashMap<>());
executeBuildingBlock = new ExecuteBuildingBlock();
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
index 9baf5dc5bf..0273b9dbf6 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
@@ -20,27 +20,27 @@
package org.onap.so.client.cds;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
import com.google.gson.JsonObject;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.Resources;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.VfModules;
import org.onap.so.serviceinstancebeans.Vnfs;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.anyList;
-import static org.mockito.Mockito.doReturn;
-@RunWith(MockitoJUnitRunner.Silent.class)
+@RunWith(MockitoJUnitRunner.class)
public class ConfigureInstanceParamsForVfModuleTest {
@InjectMocks
@@ -49,79 +49,77 @@ public class ConfigureInstanceParamsForVfModuleTest {
@Mock
private ExtractServiceFromUserParameters extractServiceFromUserParameters;
- private static final String TEST_VNF_MODEL_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce4";
- private static final String TEST_VF_MODULE_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce2";
- private static final String TEST_INSTANCE_PARAM_VALUE_1 = "vf-module-1-value";
- private static final String TEST_INSTANCE_PARAM_VALUE_2 = "vf-module-2-value";
- private static final String TEST_INSTANCE_PARAM_KEY_1 = "instance-param-1";
- private static final String TEST_INSTANCE_PARAM_KEY_2 = "instance-param-2";
+ private static final String VNF_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+ private static final String VFMODULE_1_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+ private static final String VFMODULE_2_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+ private static final String VFMODULE_1_INSTANCE_NAME = "vfmodule-instance-1";
+ private static final String VFMODULE_2_INSTANCE_NAME = "vfmodule-instance-2";
+ private static final List<Map<String, String>> VFMODULE_1_INSTANCE_PARAMS =
+ Arrays.asList(Map.of("param-1", "xyz", "param-2", "123"), Map.of("param-3", "CCC"));
+ private static final List<Map<String, String>> VFMODULE_2_INSTANCE_PARAMS =
+ Arrays.asList(Map.of("param-1", "abc", "param-2", "999"), Map.of("param-3", "AAA"));
+
@Test
- public void testInstanceParamsForVfModule() throws Exception {
- // given
- List<Map<String, Object>> userParamsFromRequest = createRequestParameters();
- JsonObject jsonObject = new JsonObject();
- doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList());
+ public void testPopulateInstanceParamsByInstanceName() throws Exception {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setVnfs(createVnfs());
+ service.setResources(resources);
- // when
- configureInstanceParamsForVfModule.populateInstanceParams(jsonObject, userParamsFromRequest,
- TEST_VNF_MODEL_CUSTOMIZATION_UUID, TEST_VF_MODULE_CUSTOMIZATION_UUID);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(service);
+ JsonObject jsonObject = new JsonObject();
- // verify
- assertEquals(TEST_INSTANCE_PARAM_VALUE_1, jsonObject.get(TEST_INSTANCE_PARAM_KEY_1).getAsString());
- assertEquals(TEST_INSTANCE_PARAM_VALUE_2, jsonObject.get(TEST_INSTANCE_PARAM_KEY_2).getAsString());
- }
+ configureInstanceParamsForVfModule.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_CUSTOMIZATION_ID,
+ VFMODULE_2_CUSTOMIZATION_ID, VFMODULE_2_INSTANCE_NAME);
- private List<Map<String, Object>> createRequestParameters() {
- List<Map<String, Object>> userParams = new ArrayList<>();
- Map<String, Object> userParamMap = new HashMap<>();
- userParamMap.put("service", getUserParams());
- userParams.add(userParamMap);
- return userParams;
+ assertEquals("abc", jsonObject.get("param-1").getAsString());
+ assertEquals("999", jsonObject.get("param-2").getAsString());
+ assertEquals("AAA", jsonObject.get("param-3").getAsString());
}
- private Service getUserParams() {
+ @Test
+ public void testPopulateInstanceParamsByCustomizationId() throws Exception {
Service service = new Service();
Resources resources = new Resources();
resources.setVnfs(createVnfs());
service.setResources(resources);
- return service;
- }
-
- private List<Vnfs> createVnfs() {
- Vnfs searchedVnf = createVnf();
- List<Vnfs> vnfList = new ArrayList<>();
- vnfList.add(searchedVnf);
- return vnfList;
- }
-
- private Vnfs createVnf() {
- Vnfs vnf = new Vnfs();
- ModelInfo modelInfoForVnf = new ModelInfo();
- modelInfoForVnf.setModelCustomizationId(TEST_VNF_MODEL_CUSTOMIZATION_UUID);
- vnf.setModelInfo(modelInfoForVnf);
-
- VfModules vfModule = new VfModules();
- ModelInfo modelInfoForVfModule = new ModelInfo();
- modelInfoForVfModule.setModelCustomizationId(TEST_VF_MODULE_CUSTOMIZATION_UUID);
-
- vfModule.setModelInfo(modelInfoForVfModule);
-
- // Set instance parameters.
- List<Map<String, String>> instanceParamsListSearchedVfModule = new ArrayList<>();
- Map<String, String> instanceParams = new HashMap<>();
- instanceParams.put("instance-param-1", TEST_INSTANCE_PARAM_VALUE_1);
- instanceParams.put("instance-param-2", TEST_INSTANCE_PARAM_VALUE_2);
-
- instanceParamsListSearchedVfModule.add(instanceParams);
- vfModule.setInstanceParams(instanceParamsListSearchedVfModule);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(service);
+ JsonObject jsonObject = new JsonObject();
- List<VfModules> vfModules = new ArrayList<>();
- vfModules.add(vfModule);
+ // No instance name is passed
+ configureInstanceParamsForVfModule.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_CUSTOMIZATION_ID,
+ VFMODULE_1_CUSTOMIZATION_ID, null);
- vnf.setVfModules(vfModules);
+ assertEquals("xyz", jsonObject.get("param-1").getAsString());
+ assertEquals("123", jsonObject.get("param-2").getAsString());
+ assertEquals("CCC", jsonObject.get("param-3").getAsString());
+ }
- return vnf;
+ private List<Vnfs> createVnfs() {
+ Vnfs vnf1 = new Vnfs();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VNF_CUSTOMIZATION_ID);
+ vnf1.setModelInfo(modelInfo);
+
+ VfModules vfModule1 = new VfModules();
+ modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VFMODULE_1_CUSTOMIZATION_ID);
+ vfModule1.setModelInfo(modelInfo);
+ vfModule1.setInstanceName(VFMODULE_1_INSTANCE_NAME);
+ vfModule1.setInstanceParams(VFMODULE_1_INSTANCE_PARAMS);
+
+ VfModules vfModule2 = new VfModules();
+ modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VFMODULE_2_CUSTOMIZATION_ID);
+ vfModule2.setModelInfo(modelInfo);
+ vfModule2.setInstanceName(VFMODULE_2_INSTANCE_NAME);
+ vfModule2.setInstanceParams(VFMODULE_2_INSTANCE_PARAMS);
+
+ vnf1.setVfModules(Arrays.asList(vfModule1, vfModule2));
+
+ return Arrays.asList(vnf1);
}
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java
new file mode 100644
index 0000000000..547129e898
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnfTest.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Bell Canada
+ * ================================================================================
+ * 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.onap.so.client.cds;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+import com.google.gson.JsonObject;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.Resources;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Vnfs;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ConfigureInstanceParamsForVnfTest {
+
+ @InjectMocks
+ private ConfigureInstanceParamsForVnf configureInstanceParamsForVnf;
+
+ @Mock
+ private ExtractServiceFromUserParameters extractServiceFromUserParameters;
+
+ private static final String VNF_1_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+ private static final String VNF_2_CUSTOMIZATION_ID = UUID.randomUUID().toString();
+ private static final String VNF_1_INSTANCE_NAME = "vnf-instance-1";
+ private static final String VNF_2_INSTANCE_NAME = "vnf-instance-2";
+ private static final List<Map<String, String>> VNF_1_INSTANCE_PARAMS =
+ Arrays.asList(Map.of("param-1", "xyz", "param-2", "123"), Map.of("param-3", "CCC"));
+ private static final List<Map<String, String>> VNF_2_INSTANCE_PARAMS =
+ Arrays.asList(Map.of("param-1", "abc", "param-2", "999"), Map.of("param-3", "AAA"));
+
+
+ @Test
+ public void testPopulateInstanceParamsByInstanceName() throws Exception {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setVnfs(createVnfs());
+ service.setResources(resources);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(service);
+ JsonObject jsonObject = new JsonObject();
+
+ configureInstanceParamsForVnf.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_2_CUSTOMIZATION_ID,
+ VNF_2_INSTANCE_NAME);
+
+ assertEquals("abc", jsonObject.get("param-1").getAsString());
+ assertEquals("999", jsonObject.get("param-2").getAsString());
+ assertEquals("AAA", jsonObject.get("param-3").getAsString());
+ }
+
+ @Test
+ public void testPopulateInstanceParamsByCustomizationId() throws Exception {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setVnfs(createVnfs());
+ service.setResources(resources);
+ when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(service);
+ JsonObject jsonObject = new JsonObject();
+
+ // No instance name is passed
+ configureInstanceParamsForVnf.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_1_CUSTOMIZATION_ID,
+ null);
+
+ assertEquals("xyz", jsonObject.get("param-1").getAsString());
+ assertEquals("123", jsonObject.get("param-2").getAsString());
+ assertEquals("CCC", jsonObject.get("param-3").getAsString());
+ }
+
+ private List<Vnfs> createVnfs() {
+ Vnfs vnf1 = new Vnfs();
+ vnf1.setInstanceName(VNF_1_INSTANCE_NAME);
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VNF_1_CUSTOMIZATION_ID);
+ vnf1.setModelInfo(modelInfo);
+ vnf1.setInstanceParams(VNF_1_INSTANCE_PARAMS);
+
+ Vnfs vnf2 = new Vnfs();
+ modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VNF_2_CUSTOMIZATION_ID);
+ vnf2.setModelInfo(modelInfo);
+ vnf2.setInstanceName(VNF_2_INSTANCE_NAME);
+ vnf2.setInstanceParams(VNF_2_INSTANCE_PARAMS);
+
+ return Arrays.asList(vnf1, vnf2);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
index f224ebf21e..f5045b1ea0 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
@@ -22,18 +22,28 @@ package org.onap.so.client.cds;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.JsonObject;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.UUID;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
-import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.Resources;
import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.*;
@@ -68,7 +78,7 @@ public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProvide
ResourceKey.VF_MODULE_ID);
doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList());
doCallRealMethod().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(),
- anyString());
+ anyString(), any());
// when
vfModuleCDSRequestProvider.setExecutionObject(buildingBlockExecution);
@@ -105,7 +115,7 @@ public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProvide
ResourceKey.VF_MODULE_ID);
doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList());
doCallRealMethod().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(),
- anyString());
+ anyString(), any());
vfModuleCDSRequestProvider.setExecutionObject(buildingBlockExecution);
String payload = vfModuleCDSRequestProvider.buildRequestPayload(DEPLOY_ACTION).get();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java
index 7aafd900d4..e801c2afab 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java
@@ -50,8 +50,6 @@ public class VnfCDSRequestProviderTest extends AbstractVnfCDSRequestProviderTest
ResourceKey.SERVICE_INSTANCE_ID);
doReturn(createGenericVnf()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
ResourceKey.GENERIC_VNF_ID);
- doNothing().when(configureInstanceParamsForVnf).populateInstanceParams(any(), any(), anyString());
-
// when
vnfCDSRequestProvider.setExecutionObject(buildingBlockExecution);
String payload = vnfCDSRequestProvider.buildRequestPayload(ASSIGN_ACTION).get();
@@ -81,7 +79,6 @@ public class VnfCDSRequestProviderTest extends AbstractVnfCDSRequestProviderTest
ResourceKey.SERVICE_INSTANCE_ID);
doReturn(createGenericVnf()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
ResourceKey.GENERIC_VNF_ID);
- doNothing().when(configureInstanceParamsForVnf).populateInstanceParams(any(), any(), any());
// when
vnfCDSRequestProvider.setExecutionObject(buildingBlockExecution);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
index 0d2844d08b..99cff932c5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
@@ -23,7 +23,6 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
@@ -37,6 +36,7 @@ public class Resource {
private String vnfCustomizationId;
private String vfModuleCustomizationId;
private String cvnfModuleCustomizationId;
+ private String instanceName;
private int processingPriority;
private Resource parent;
private List<Resource> children;
@@ -121,6 +121,14 @@ public class Resource {
this.cvnfModuleCustomizationId = cvnfModuleCustomizationId;
}
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
public int getProcessingPriority() {
return processingPriority == 0 ? (isBaseVfModule() ? Integer.MIN_VALUE + 1 : 0) : processingPriority;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index ce775af476..e49aed8b25 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -43,14 +43,18 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.apache.commons.lang3.SerializationUtils;
+import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.aai.domain.yang.Vnfc;
@@ -666,11 +670,12 @@ public class WorkflowAction {
for (Pair<WorkflowType, String> pair : aaiResourceIds) {
logger.debug("{}, {}", pair.getValue0(), pair.getValue1());
}
-
+ Map<Resource, String> resourceInstanceIds = new HashMap<>();
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE))
.forEach(type -> resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
- .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(),
- retrieveAAIResourceId(aaiResourceIds, type), null, serviceInstanceId)));
+ .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource,
+ retrieveAAIResourceId(aaiResourceIds, type), null, serviceInstanceId,
+ resourceInstanceIds)));
}
private String retrieveAAIResourceId(List<Pair<WorkflowType, String>> aaiResourceIds, WorkflowType resource) {
@@ -687,27 +692,45 @@ public class WorkflowAction {
private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList,
String serviceInstanceId) {
+ Map<Resource, String> resourceInstanceIds = new HashMap<>();
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE))
.forEach(type -> resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
- .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(),
- null, resource.getVirtualLinkKey(), serviceInstanceId)));
+ .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource, null,
+ resource.getVirtualLinkKey(), serviceInstanceId, resourceInstanceIds)));
}
protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resourceType,
- String key, String id, String virtualLinkKey, String serviceInstanceId) {
+ Resource resource, String id, String virtualLinkKey, String serviceInstanceId,
+ Map<Resource, String> resourceInstanceIds) {
+ String key = resource.getResourceId();
String resourceId = id;
if (resourceId == null) {
resourceId = UUID.randomUUID().toString();
}
+ resourceInstanceIds.put(resource, resourceId);
+ Set<String> assignedFlows = new LinkedHashSet<>();
for (ExecuteBuildingBlock ebb : flowsToExecute) {
- if (key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey()) && (ebb.getBuildingBlock()
- .getBpmnFlowName().contains(resourceType.toString())
- || (ebb.getBuildingBlock().getBpmnFlowName().contains(CONTROLLER)
- && ebb.getBuildingBlock().getBpmnScope().equalsIgnoreCase(resourceType.toString())))) {
+ String resourceTypeStr = resourceType.toString();
+ String flowName = ebb.getBuildingBlock().getBpmnFlowName();
+ String scope = StringUtils.defaultString(ebb.getBuildingBlock().getBpmnScope());
+ String action = StringUtils.defaultString(ebb.getBuildingBlock().getBpmnAction());
+
+ if (key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey())
+ && isFlowAssignable(assignedFlows, ebb, resourceType, flowName + action)
+ && (flowName.contains(resourceTypeStr)
+ || (flowName.contains(CONTROLLER) && resourceTypeStr.equalsIgnoreCase(scope)))) {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId(serviceInstanceId);
+ Resource parent = resource.getParent();
+ if (parent != null && resourceInstanceIds.containsKey(parent)) {
+ WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, parent.getResourceType(),
+ resourceInstanceIds.get(parent));
+ }
+ WorkflowResourceIdsUtils.setInstanceNameByWorkflowType(workflowResourceIds, resourceType,
+ resource.getInstanceName());
WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, resourceType, resourceId);
ebb.setWorkflowResourceIds(workflowResourceIds);
+ assignedFlows.add(flowName + action);
}
if (virtualLinkKey != null && ebb.getBuildingBlock().isVirtualLink()
&& virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) {
@@ -719,6 +742,12 @@ public class WorkflowAction {
}
}
+ private boolean isFlowAssignable(Set<String> assignedFlows, ExecuteBuildingBlock ebb, WorkflowType resourceType,
+ String assignedFlowName) {
+ String id = WorkflowResourceIdsUtils.getResourceIdByWorkflowType(ebb.getWorkflowResourceIds(), resourceType);
+ return !assignedFlows.contains(assignedFlowName) && id.isEmpty();
+ }
+
protected WorkflowResourceIds populateResourceIdsFromApiHandler(DelegateExecution execution) {
return WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
index 1f932743ca..c383b4a73a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
@@ -114,6 +114,7 @@ public class UserParamsServiceTraversal {
Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getModelInfo().getModelCustomizationId(), false,
serviceResource);
vnfResource.setProcessingPriority(vnf.getProcessingPriority());
+ vnfResource.setInstanceName(vnf.getInstanceName());
resourceList.add(vnfResource);
setResourceListForVfModules(execution, resourceList, vnfResource, validate, vnf);
}
@@ -170,6 +171,7 @@ public class UserParamsServiceTraversal {
resource.setProcessingPriority(vfModule.getProcessingPriority());
resource.setBaseVfModule(vfModuleCustomization.getVfModule().getIsBase() != null
&& vfModuleCustomization.getVfModule().getIsBase());
+ resource.setInstanceName(vfModule.getInstanceName());
resourceList.add(resource);
return resource;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
index d16eac147e..9cabf6665c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
@@ -20,6 +20,7 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks.utils;
+import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
@@ -63,6 +64,42 @@ public final class WorkflowResourceIdsUtils {
}
}
+ public static void setInstanceNameByWorkflowType(WorkflowResourceIds workflowResourceIds, WorkflowType resourceType,
+ String instanceName) {
+ if (resourceType == WorkflowType.VNF) {
+ workflowResourceIds.setVnfInstanceName(instanceName);
+ } else if (resourceType == WorkflowType.VFMODULE) {
+ workflowResourceIds.setVfModuleInstanceName(instanceName);
+ }
+ }
+
+ public static String getResourceIdByWorkflowType(WorkflowResourceIds workflowResourceIds,
+ WorkflowType resourceType) {
+ switch (resourceType) {
+ case SERVICE:
+ return StringUtils.defaultString(workflowResourceIds.getServiceInstanceId());
+ case VNF:
+ return StringUtils.defaultString(workflowResourceIds.getVnfId());
+ case PNF:
+ return StringUtils.defaultString(workflowResourceIds.getPnfId());
+ case VFMODULE:
+ return StringUtils.defaultString(workflowResourceIds.getVfModuleId());
+ case VOLUMEGROUP:
+ return StringUtils.defaultString(workflowResourceIds.getVolumeGroupId());
+ case NETWORK:
+ return StringUtils.defaultString(workflowResourceIds.getNetworkId());
+ case NETWORKCOLLECTION:
+ return StringUtils.defaultString(workflowResourceIds.getNetworkCollectionId());
+ case CONFIGURATION:
+ return StringUtils.defaultString(workflowResourceIds.getConfigurationId());
+ case INSTANCE_GROUP:
+ return StringUtils.defaultString(workflowResourceIds.getInstanceGroupId());
+ default:
+ return "";
+ }
+ }
+
+
public static WorkflowResourceIds getWorkflowResourceIdsFromExecution(DelegateExecution execution) {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
@@ -71,6 +108,8 @@ public final class WorkflowResourceIdsUtils {
workflowResourceIds.setVnfId((String) execution.getVariable("vnfId"));
workflowResourceIds.setVolumeGroupId((String) execution.getVariable("volumeGroupId"));
workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
+ workflowResourceIds.setVnfInstanceName((String) execution.getVariable("vnfInstanceName"));
+ workflowResourceIds.setVfModuleInstanceName((String) execution.getVariable("vfModuleInstanceName"));
return workflowResourceIds;
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index e52d2dfecf..021bac3a7a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -51,8 +51,11 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
+import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -118,6 +121,8 @@ public class WorkflowActionTest extends BaseTaskTest {
private static final String MACRO_CREATE_NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
private static final String MACRO_VNF_MACRO_REPLACE_JSON = "Macro/VnfMacroReplace.json";
private static final String MACRO_CREATE_JSON = "Macro/ServiceMacroAssignVnfAndPnf.json";
+ private static final String MACRO_CREATE_SERVICE_MULTIPLE_SAME_MODEL_VNF_VFMODULE =
+ "Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json";
@Mock
protected Environment environment;
@@ -752,6 +757,139 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListServiceMacroCreateWithMultipleSameModelVnfAndVfModules() throws Exception {
+ String gAction = "createInstance";
+ String resource = "Service";
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_SERVICE_MULTIPLE_SAME_MODEL_VNF_VFMODULE);
+ initExecution(gAction, bpmnRequest, false);
+ execution.setVariable("requestUri", "v7/serviceInstances");
+ execution.setVariable("serviceInstanceId", UUID.randomUUID().toString());
+
+ // Service-Macro-Create
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
+ "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "ControllerExecutionBB",
+ "AssignPnfBB", "WaitForPnfReadyBB", "ControllerExecutionBB", "ControllerExecutionBB", "ActivatePnfBB",
+ "CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB",
+ "CreateVfModuleBB", "ActivateVfModuleBB", "ControllerExecutionBB", "ActivateVnfBB",
+ "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
+ orchFlows.get(6).setBpmnAction("config-assign");
+ orchFlows.get(6).setBpmnScope("vnf");
+ orchFlows.get(9).setBpmnAction("config-assign");
+ orchFlows.get(9).setBpmnScope("pnf");
+ orchFlows.get(10).setBpmnAction("config-deploy");
+ orchFlows.get(10).setBpmnScope("pnf");
+ orchFlows.get(18).setBpmnAction("config-deploy");
+ orchFlows.get(18).setBpmnScope("vnf");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ Service service = new Service();
+ service.setModelUUID("f2444885-3c76-4ddc-8668-7741c0631495");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0");
+ vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
+ org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
+ vfModule.setVolumeHeatTemplate(new HeatTemplate());
+ vfModuleCustomization.setVfModule(vfModule);
+
+ VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization();
+ vfModuleCustomization2.setModelCustomizationUUID("83677d89-428a-407b-b4ec-738e68275d84");
+ vfModuleCustomization2.setHeatEnvironment(new HeatEnvironment());
+ org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule();
+ vfModule2.setModuleHeatTemplate(new HeatTemplate());
+ vfModuleCustomization2.setVfModule(vfModule2);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "DEFAULT")).thenReturn(northBoundRequest);
+ when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0"))
+ .thenReturn(vfModuleCustomization);
+ when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("83677d89-428a-407b-b4ec-738e68275d84"))
+ .thenReturn(vfModuleCustomization2);
+ when(catalogDbClient.getServiceByID("f2444885-3c76-4ddc-8668-7741c0631495")).thenReturn(service);
+
+
+ Resource serviceResource =
+ new Resource(WorkflowType.SERVICE, "f2444885-3c76-4ddc-8668-7741c0631495", false, null);
+ Resource vnfResource1 =
+ new Resource(WorkflowType.VNF, "0d0ba1ee-6b7f-47fe-8266-2967993b2c08", false, serviceResource);
+ vnfResource1.setInstanceName("vnf-instanceName-1");
+ Resource vfmResource1 =
+ new Resource(WorkflowType.VFMODULE, "3bd19000-6d21-49f1-9eb3-ea76a6eac5e0", false, vnfResource1);
+ vfmResource1.setInstanceName("demo-network-1");
+ Resource vfmResource2 =
+ new Resource(WorkflowType.VFMODULE, "83677d89-428a-407b-b4ec-738e68275d84", false, vnfResource1);
+ vfmResource2.setInstanceName("demo-1");
+ Resource vnfResource2 =
+ new Resource(WorkflowType.VNF, "0d0ba1ee-6b7f-47fe-8266-2967993b2c08", false, serviceResource);
+ vnfResource2.setInstanceName("vnf-instanceName-2");
+ Resource vfmResource3 =
+ new Resource(WorkflowType.VFMODULE, "83677d89-428a-407b-b4ec-738e68275d84", false, vnfResource2);
+ vfmResource3.setInstanceName("demo-2");
+ Resource vfmResource4 =
+ new Resource(WorkflowType.VFMODULE, "83677d89-428a-407b-b4ec-738e68275d84", false, vnfResource2);
+ vfmResource4.setInstanceName("demo-3");
+
+ when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), any()))
+ .thenReturn(Arrays.asList(serviceResource, vnfResource1, vnfResource2, vfmResource1, vfmResource2,
+ vfmResource3, vfmResource4));
+
+ workflowAction.selectExecutionList(execution);
+
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+
+ Map<String, List<ExecuteBuildingBlock>> flowNamesToEbbList =
+ ebbs.stream().collect(Collectors.groupingBy(e -> e.getBuildingBlock().getBpmnFlowName()));
+
+ assertEquals(1, flowNamesToEbbList.get("AssignServiceInstanceBB").size());
+ assertEquals(2, flowNamesToEbbList.get("AssignVnfBB").size());
+ assertEquals(4, flowNamesToEbbList.get("AssignVfModuleBB").size());
+ assertEquals(4, flowNamesToEbbList.get("ControllerExecutionBB").size());
+ assertEquals(4, flowNamesToEbbList.get("CreateVfModuleBB").size());
+ assertEquals(4, flowNamesToEbbList.get("ActivateVfModuleBB").size());
+ assertEquals(2, flowNamesToEbbList.get("ActivateVnfBB").size());
+ assertEquals(1, flowNamesToEbbList.get("ActivateServiceInstanceBB").size());
+
+ String vnfInstanceId1 = flowNamesToEbbList.get("AssignVnfBB").get(0).getWorkflowResourceIds().getVnfId();
+ String vnfInstanceId2 = flowNamesToEbbList.get("AssignVnfBB").get(1).getWorkflowResourceIds().getVnfId();
+
+ // should be 3 = 1 AssignVfModuleBB + 1 CreateVfModuleBB + 1 ActivateVfModuleBB
+ boolean allEbbsForVfModule1HaveCorrectParentVnfId =
+ 3 == ebbs.stream().map(ExecuteBuildingBlock::getWorkflowResourceIds)
+ .filter(w -> "demo-network-1".equals(w.getVfModuleInstanceName())
+ && vnfInstanceId1.equals(w.getVnfId()))
+ .count();
+ boolean allEbbsForVfModule2HaveCorrectParentVnfId = 3 == ebbs.stream()
+ .map(ExecuteBuildingBlock::getWorkflowResourceIds)
+ .filter(w -> "demo-1".equals(w.getVfModuleInstanceName()) && vnfInstanceId1.equals(w.getVnfId()))
+ .count();
+ boolean allEbbsForVfModule3HaveCorrectParentVnfId = 3 == ebbs.stream()
+ .map(ExecuteBuildingBlock::getWorkflowResourceIds)
+ .filter(w -> "demo-2".equals(w.getVfModuleInstanceName()) && vnfInstanceId2.equals(w.getVnfId()))
+ .count();
+ boolean allEbbsForVfModule4HaveCorrectParentVnfId = 3 == ebbs.stream()
+ .map(ExecuteBuildingBlock::getWorkflowResourceIds)
+ .filter(w -> "demo-3".equals(w.getVfModuleInstanceName()) && vnfInstanceId2.equals(w.getVnfId()))
+ .count();
+ assertTrue(allEbbsForVfModule1HaveCorrectParentVnfId);
+ assertTrue(allEbbsForVfModule2HaveCorrectParentVnfId);
+ assertTrue(allEbbsForVfModule3HaveCorrectParentVnfId);
+ assertTrue(allEbbsForVfModule4HaveCorrectParentVnfId);
+
+ boolean controllerExecutionBBsforVnf1HaveCorrectVnfId = flowNamesToEbbList.get("ControllerExecutionBB").stream()
+ .filter(e -> vnfInstanceId1.equals(e.getWorkflowResourceIds().getVnfId()))
+ .map(ExecuteBuildingBlock::getBuildingBlock).map(BuildingBlock::getBpmnAction)
+ .collect(Collectors.toSet()).containsAll(Set.of("config-assign", "config-deploy"));
+ assertTrue(controllerExecutionBBsforVnf1HaveCorrectVnfId);
+
+ boolean controllerExecutionBBsforVnf2HaveCorrectVnfId = flowNamesToEbbList.get("ControllerExecutionBB").stream()
+ .filter(e -> vnfInstanceId2.equals(e.getWorkflowResourceIds().getVnfId()))
+ .map(ExecuteBuildingBlock::getBuildingBlock).map(BuildingBlock::getBpmnAction)
+ .collect(Collectors.toSet()).containsAll(Set.of("config-assign", "config-deploy"));
+ assertTrue(controllerExecutionBBsforVnf2HaveCorrectVnfId);
+ }
+
+ @Test
public void selectExecutionListServiceMacroDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Service";
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
index 58fee86ade..cac7f872b3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
@@ -53,6 +53,7 @@ import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
@@ -63,6 +64,8 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
private static final String MACRO_ASSIGN_PNF_JSON = "Macro/ServiceMacroAssignPnf.json";
private static final String NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
private static final String MACRO_CREATE_WITHOUT_RESOURCES_JSON = "Macro/ServiceMacroCreateWithoutResources.json";
+ private static final String MACRO_CREATE_SVC_SAME_MODEL_VNF_VFMODULE =
+ "Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json";
private static final String serviceInstanceId = "123";
private DelegateExecution execution;
private CatalogDbClient mockCatalogDbClient;
@@ -80,8 +83,6 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
@Test
public void getResourceListFromUserParams() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_CREATE_WITHOUT_RESOURCES_JSON), false);
- Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
- .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
anyString(), anyString());
@@ -96,9 +97,62 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
}
@Test
+ public void getResourceListFromUserParamsMultipleSameModelVnfVfModule() throws Exception {
+ initExecution("createInstance", readBpmnRequestFromFile(MACRO_CREATE_SVC_SAME_MODEL_VNF_VFMODULE), false);
+ Mockito.doReturn(getVfModuleCustomization("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0", false))
+ .when(mockCatalogDbClient)
+ .getVfModuleCustomizationByModelCuztomizationUUID("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0");
+ Mockito.doReturn(getVfModuleCustomization("83677d89-428a-407b-b4ec-738e68275d84", false))
+ .when(mockCatalogDbClient)
+ .getVfModuleCustomizationByModelCuztomizationUUID("83677d89-428a-407b-b4ec-738e68275d84");
+
+ List<Resource> resources = userParamsServiceTraversal.getResourceListFromUserParams(execution, getUserParams(),
+ serviceInstanceId, requestAction);
+
+ assertEquals(7, resources.size());
+
+ Resource service = resources.get(0);
+ assertTrue(service.getResourceType() == WorkflowType.SERVICE);
+ assertEquals(2, service.getChildren().size());
+
+ Resource vnf1 = service.getChildren().get(0);
+ assertEquals(service, vnf1.getParent());
+ assertEquals("vnf-instanceName-1", vnf1.getInstanceName());
+ assertEquals("0d0ba1ee-6b7f-47fe-8266-2967993b2c08", vnf1.getResourceId());
+ assertEquals(2, vnf1.getChildren().size());
+
+ Resource vnf2 = service.getChildren().get(1);
+ assertEquals(service, vnf2.getParent());
+ assertEquals("vnf-instanceName-2", vnf2.getInstanceName());
+ assertEquals("0d0ba1ee-6b7f-47fe-8266-2967993b2c08", vnf2.getResourceId());
+ assertEquals(2, vnf2.getChildren().size());
+
+ Resource vfmodule1 = vnf1.getChildren().get(0);
+ assertEquals(vnf1, vfmodule1.getParent());
+ assertEquals("demo-network-1", vfmodule1.getInstanceName());
+ assertEquals("3bd19000-6d21-49f1-9eb3-ea76a6eac5e0", vfmodule1.getResourceId());
+
+ Resource vfmodule2 = vnf1.getChildren().get(1);
+ assertEquals(vnf1, vfmodule2.getParent());
+ assertEquals("demo-1", vfmodule2.getInstanceName());
+ assertEquals("83677d89-428a-407b-b4ec-738e68275d84", vfmodule2.getResourceId());
+
+ Resource vfmodule3 = vnf2.getChildren().get(0);
+ assertEquals(vnf2, vfmodule3.getParent());
+ assertEquals("demo-2", vfmodule3.getInstanceName());
+ assertEquals("83677d89-428a-407b-b4ec-738e68275d84", vfmodule3.getResourceId());
+
+ Resource vfmodule4 = vnf2.getChildren().get(1);
+ assertEquals(vnf2, vfmodule4.getParent());
+ assertEquals("demo-3", vfmodule4.getInstanceName());
+ assertEquals("83677d89-428a-407b-b4ec-738e68275d84", vfmodule4.getResourceId());
+ }
+
+ @Test
public void getResourceListFromUserParamsForVnfs() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_JSON), false);
- Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
+ Mockito.doReturn(getVfModuleCustomization("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", true))
+ .when(mockCatalogDbClient)
.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
anyString(), anyString());
@@ -117,7 +171,8 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
@Test
public void getResourceListFromUserParamsForVnfsWithPriorities() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_CREATE_JSON), false);
- Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
+ Mockito.doReturn(getVfModuleCustomization("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", true))
+ .when(mockCatalogDbClient)
.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
anyString(), anyString());
@@ -137,8 +192,6 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
@Test
public void getResourceListFromUserParamsForPnfs() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_PNF_JSON), false);
- Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
- .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
anyString(), anyString());
@@ -156,8 +209,6 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
public void getResourceListFromUserParamsForNetworks() throws Exception {
requestAction = "createInstance";
initExecution(requestAction, readBpmnRequestFromFile(NETWORK_COLLECTION_JSON), false);
- Mockito.doReturn(getVfModuleCustomization()).when(mockCatalogDbClient)
- .getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
Mockito.doReturn(getCvnfcCustomizations()).when(mockCatalogDbClient).getCvnfcCustomization(anyString(),
anyString(), anyString());
Mockito.doReturn(getService()).when(mockCatalogDbClient).getServiceByID(anyString());
@@ -230,13 +281,17 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
return service;
}
- private VfModuleCustomization getVfModuleCustomization() {
+ private VfModuleCustomization getVfModuleCustomization(String modelCustomizationUUID, boolean includeVolumeGroup) {
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
- vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
- vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
+ vfModuleCustomization.setModelCustomizationUUID(modelCustomizationUUID);
VfModule vfModule = new VfModule();
- vfModule.setVolumeHeatTemplate(new HeatTemplate());
- vfModule.setModelName("helm");
+ if (includeVolumeGroup) {
+ vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
+ vfModule.setVolumeHeatTemplate(new HeatTemplate());
+ vfModule.setModelName("helm");
+ } else {
+ vfModuleCustomization.setHeatEnvironment(new HeatEnvironment());
+ }
vfModule.setModuleHeatTemplate(new HeatTemplate());
vfModuleCustomization.setVfModule(vfModule);
return vfModuleCustomization;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
index 0d68cf362b..996c0c07e1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
@@ -40,7 +40,8 @@ public class WorkflowResourceIdsUtilsTest {
private static final String PNF_ID = "pnfId";
private static final String NETWORK_COLLECTION_ID = "networkCollectionId";
private static final String CONFIGURATION_ID = "configurationId";
-
+ private static final String VNF_INSTANCE_NAME = "vnfInstanceNameId";
+ private static final String VF_MODULE_INSTANCE_NAME = "vfModuleInstanceNameId";
private WorkflowResourceIds workflowResourceIds;
@Before
@@ -57,6 +58,8 @@ public class WorkflowResourceIdsUtilsTest {
execution.setVariable("vnfId", VNF_ID);
execution.setVariable("volumeGroupId", VOLUME_GROUP_ID);
execution.setVariable("instanceGroupId", INSTANCE_GROUP_ID);
+ execution.setVariable("vnfInstanceName", VNF_INSTANCE_NAME);
+ execution.setVariable("vfModuleInstanceName", VF_MODULE_INSTANCE_NAME);
workflowResourceIds = WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
@@ -66,54 +69,84 @@ public class WorkflowResourceIdsUtilsTest {
assertEquals(VNF_ID, workflowResourceIds.getVnfId());
assertEquals(VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId());
assertEquals(INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
+ assertEquals(VNF_INSTANCE_NAME, workflowResourceIds.getVnfInstanceName());
+ assertEquals(VF_MODULE_INSTANCE_NAME, workflowResourceIds.getVfModuleInstanceName());
}
@Test
public void shouldProperlySetServiceInstanceId() {
assertFieldSetProperly(WorkflowType.SERVICE, SERVICE_ID, workflowResourceIds::getServiceInstanceId);
+ assertEquals(SERVICE_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.SERVICE));
}
@Test
public void shouldProperlySetVnfId() {
assertFieldSetProperly(WorkflowType.VNF, VNF_ID, workflowResourceIds::getVnfId);
-
+ assertEquals(VNF_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.VNF));
}
@Test
public void shouldProperlySetPnfId() {
assertFieldSetProperly(WorkflowType.PNF, PNF_ID, workflowResourceIds::getPnfId);
+ assertEquals(PNF_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.PNF));
}
@Test
public void shouldProperlySetVfModuleId() {
assertFieldSetProperly(WorkflowType.VFMODULE, VF_MODULE_ID, workflowResourceIds::getVfModuleId);
+ assertEquals(VF_MODULE_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.VFMODULE));
}
@Test
public void shouldProperlySetVolumeGroupId() {
assertFieldSetProperly(WorkflowType.VOLUMEGROUP, VOLUME_GROUP_ID, workflowResourceIds::getVolumeGroupId);
+ assertEquals(VOLUME_GROUP_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.VOLUMEGROUP));
}
@Test
public void shouldProperlySetNetworkId() {
assertFieldSetProperly(WorkflowType.NETWORK, NETWORK_ID, workflowResourceIds::getNetworkId);
+ assertEquals(NETWORK_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.NETWORK));
}
@Test
public void shouldProperlySetNetworkCollectionId() {
assertFieldSetProperly(WorkflowType.NETWORKCOLLECTION, NETWORK_COLLECTION_ID,
workflowResourceIds::getNetworkCollectionId);
-
+ assertEquals(NETWORK_COLLECTION_ID, WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds,
+ WorkflowType.NETWORKCOLLECTION));
}
@Test
public void shouldProperlySetConfigurationId() {
assertFieldSetProperly(WorkflowType.CONFIGURATION, CONFIGURATION_ID, workflowResourceIds::getConfigurationId);
+ assertEquals(CONFIGURATION_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.CONFIGURATION));
}
@Test
public void shouldProperlySetInstanceGroupId() {
assertFieldSetProperly(WorkflowType.INSTANCE_GROUP, INSTANCE_GROUP_ID, workflowResourceIds::getInstanceGroupId);
+ assertEquals(INSTANCE_GROUP_ID,
+ WorkflowResourceIdsUtils.getResourceIdByWorkflowType(workflowResourceIds, WorkflowType.INSTANCE_GROUP));
+ }
+
+ @Test
+ public void shouldPropertySetVnfInstanceName() {
+ assertFieldSetProperlyInstanceName(WorkflowType.VNF, VNF_INSTANCE_NAME,
+ workflowResourceIds::getVnfInstanceName);
+ }
+
+ @Test
+ public void shouldPropertySetVfModuleInstanceName() {
+ assertFieldSetProperlyInstanceName(WorkflowType.VFMODULE, VF_MODULE_INSTANCE_NAME,
+ workflowResourceIds::getVfModuleInstanceName);
}
private void assertFieldSetProperly(WorkflowType workflowType, String expectedId,
@@ -121,4 +154,13 @@ public class WorkflowResourceIdsUtilsTest {
WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, workflowType, expectedId);
assertEquals(expectedId, testedObjectField.get());
}
+
+ private void assertFieldSetProperlyInstanceName(WorkflowType workflowType, String expectedId,
+ Supplier<String> testedObjectField) {
+ WorkflowResourceIdsUtils.setInstanceNameByWorkflowType(workflowResourceIds, workflowType, expectedId);
+ assertEquals(expectedId, testedObjectField.get());
+ }
+
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json
new file mode 100644
index 0000000000..059754846a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json
@@ -0,0 +1,187 @@
+{
+ "requestDetails": {
+ "subscriberInfo": {
+ "globalSubscriberId": "test-customer"
+ },
+ "requestInfo": {
+ "suppressRollback": false,
+ "instanceName": "test",
+ "productFamilyId": "6ea37d21-1a8d-4cd5-a727-e543191a5bb6",
+ "requestorId": "portal",
+ "source": "source"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "cloudid",
+ "tenantId": "tenantid",
+ "cloudOwner": "cloudowner"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "ubuntu",
+ "userParams": [
+ {
+ "Homing_Solution": "none"
+ },
+ {
+ "service": {
+ "instanceParams": [],
+ "resources": {
+ "vnfs": [
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF",
+ "modelVersionId": "744a1610-782e-47cf-bb45-d83319e33e17",
+ "modelInvariantUuid": "fc573bb4-d312-48ab-b81d-8b3313df4d07",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "0d0ba1ee-6b7f-47fe-8266-2967993b2c08",
+ "modelInstanceName": "Ubuntu VF 0"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "cloudid",
+ "tenantId": "tenantid",
+ "cloudOwner": "cloudowner"
+ },
+ "platform": {
+ "platformName": "platform"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lob"
+ },
+ "productFamilyId": "6ea37d21-1a8d-4cd5-a727-e543191a5bb6\n",
+ "instanceName": "vnf-instanceName-1",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF..base..module-0",
+ "modelVersionId": "8fa495ac-d057-4060-b772-868d8e97766e",
+ "modelInvariantUuid": "71dcbf41-9838-4b3d-baa4-4024d22ef0cc",
+ "modelVersion": "1",
+ "modelCustomizationId": "3bd19000-6d21-49f1-9eb3-ea76a6eac5e0"
+ },
+ "instanceName": "demo-network-1",
+ "instanceParams": [
+ {
+ "name": "demo-network-1",
+ "cidr": "10.10.10.0/24"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF..base..module-1",
+ "modelVersionId": "21954495-830f-48b7-b7b2-030d837789b3",
+ "modelInvariantUuid": "90355af6-55f3-460e-abe6-bec9a27a15e6",
+ "modelVersion": "1",
+ "modelCustomizationId": "83677d89-428a-407b-b4ec-738e68275d84"
+ },
+ "instanceName": "demo-1",
+ "instanceParams": [
+ {
+ "name": "demo-ubuntu-1",
+ "network_mgmt": "vlan101",
+ "network_name": "demo-network-1"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF",
+ "modelVersionId": "744a1610-782e-47cf-bb45-d83319e33e17",
+ "modelInvariantUuid": "fc573bb4-d312-48ab-b81d-8b3313df4d07",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "0d0ba1ee-6b7f-47fe-8266-2967993b2c08",
+ "modelInstanceName": "Ubuntu VF 0"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "cloudid",
+ "tenantId": "tenantid",
+ "cloudOwner": "cloudowner"
+ },
+ "platform": {
+ "platformName": "platform"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lob"
+ },
+ "productFamilyId": "6ea37d21-1a8d-4cd5-a727-e543191a5bb6\n",
+ "instanceName": "vnf-instanceName-2",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF..base..module-1",
+ "modelVersionId": "21954495-830f-48b7-b7b2-030d837789b3",
+ "modelInvariantUuid": "90355af6-55f3-460e-abe6-bec9a27a15e6",
+ "modelVersion": "1",
+ "modelCustomizationId": "83677d89-428a-407b-b4ec-738e68275d84"
+ },
+ "instanceName": "demo-2",
+ "instanceParams": [
+ {
+ "name": "demo-ubuntu-2",
+ "network_mgmt": "vlan101",
+ "network_name": "demo-network-1"
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF..base..module-1",
+ "modelVersionId": "21954495-830f-48b7-b7b2-030d837789b3",
+ "modelInvariantUuid": "90355af6-55f3-460e-abe6-bec9a27a15e6",
+ "modelVersion": "1",
+ "modelCustomizationId": "83677d89-428a-407b-b4ec-738e68275d84"
+ },
+ "instanceName": "demo-3",
+ "instanceParams": [
+ {
+ "name": "demo-ubuntu-3",
+ "network_mgmt": "vlan101",
+ "network_name": "demo-network-1"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "f2444885-3c76-4ddc-8668-7741c0631495",
+ "modelInvariantId": "3bd19000-6d21-49f1-9eb3-ea76a6eac5e0",
+ "modelName": "UbuntuSVC",
+ "modelType": "service"
+ }
+ }
+ }
+ ],
+ "aLaCarte": false
+ },
+ "project": {
+ "projectName": "Project-UbuntuDemo"
+ },
+ "owningEntity": {
+ "owningEntityId": "33a8b609-1cfe-4d19-8dc2-5b95b921de1e",
+ "owningEntityName": "demo"
+ },
+ "modelInfo": {
+ "modelVersion": "1.0",
+ "modelVersionId": "f2444885-3c76-4ddc-8668-7741c0631495",
+ "modelInvariantId": "3bd19000-6d21-49f1-9eb3-ea76a6eac5e0",
+ "modelName": "UbuntuSVC",
+ "modelType": "service"
+ }
+ }
+} \ No newline at end of file