aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornellix93 <aniellopaolo.malinconico@guest.telecomitalia.it>2022-04-08 09:36:28 +0200
committernellix93 <aniellopaolo.malinconico@guest.telecomitalia.it>2022-04-08 09:36:36 +0200
commit1042db9b6106f50ead940a602015f1ba0fc232a5 (patch)
tree44018b1684e96b1312d9eaf57bede2c323a5ef33
parent7471bd7e10998bc5cdfe591ed42b0f4c9eb41205 (diff)
Fix multiple instantations via serviceOrder
Change-Id: Ic591a263c69d38151fad0921f57cf168fda9a875 Signed-off-by: nellix93 <aniellopaolo.malinconico@guest.telecomitalia.it> Issue-ID: EXTAPI-602
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java
index 0cafcde..83e3785 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/PostSoProcessor.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
+import java.util.Random;
import org.onap.nbi.apis.servicecatalog.ServiceSpecificationService;
import org.onap.nbi.apis.serviceorder.SoClient;
@@ -321,13 +322,22 @@ public class PostSoProcessor {
Map<String, String> lob = new HashMap<>();
lob.put("lineOfBusinessName", "LOB-Demonstration");
+ //Create a random variable that will be concatanate to the instanceName
+ Random rand = new Random();
+ int upperbound = 100000;
+ //generate random values from 0-upperbound
+ int int_random = rand.nextInt(upperbound);
+
+ String vnfInstanceNameTmp = (String) resSpecMap.get("resourceInstanceName");
+ String vnfInstanceName = vnfInstanceNameTmp + int_random;
+
Map<String, Object> vnfModel = new HashMap<>();
vnfModel.put("modelInfo", vnfInfoObject);
vnfModel.put("cloudConfiguration", cloudConfiguration);
vnfModel.put("platform", platformName);
vnfModel.put("lineOfBusiness", lob);
vnfModel.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- vnfModel.put("instanceName", (String) resSpecMap.get("resourceInstanceName"));
+ vnfModel.put("instanceName", vnfInstanceName);
vnfModel.put("instanceParams", vnfInstanceParam);
List<Object> vfModulesObjects = new ArrayList<>();
@@ -348,13 +358,19 @@ public class PostSoProcessor {
Map<String, Object> vfModuleObject = new HashMap<>();
Map<String, String> vfModuleInfo = new HashMap<>();
+ //generate random values from 0-upperbound
+ int_random = rand.nextInt(upperbound);
+
+ String vfmoduleInstanceNameTmp = (String) crsObject.getModelName();
+ String vfmoduleInstanceName = vfmoduleInstanceNameTmp + int_random;
+
vfModuleInfo.put("modelName", crsObject.getModelName());
vfModuleInfo.put("modelVersionId", crsObject.getModelUuid());
vfModuleInfo.put("modelInvariantUuid", crsObject.getModelInvariantUuid());
vfModuleInfo.put("modelVersion", crsObject.getModelVersion());
vfModuleInfo.put("modelCustomizationId", crsObject.getModelCustomizationUuid());
vfModuleObject.put("modelInfo", vfModuleInfo);
- vfModuleObject.put("instanceName", crsObject.getModelName());
+ vfModuleObject.put("instanceName", vfmoduleInstanceName);
vfModuleObject.put("instanceParams", vfInstanceParam);
vfModulesObjects.add(vfModuleObject);