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;
response = soClient.callMacroCreateServiceInstance(msoMacroPayload);
break;
case DELETE:
- // response = soClient.callDeleteServiceInstance(msoPayload,
- // serviceOrderItem.getService().getId());
+ response = soClient.callMacroDeleteServiceInstance(msoMacroPayload,
+ serviceOrderItem.getService().getId());
break;
case MODIFY:
if (StateType.INPROGRESS_MODIFY_ITEM_TO_CREATE == serviceOrderItem.getState()) {
instanceSpecification.putAll(vnfInstanceParams);
vnfInstanceParam.add(instanceSpecification);
} else {
- vnfInstanceParams.put("k8s-rb-profile-name", k8sRbProfileName);
+ //if skip_post_instantiation_configuration is true then add k8s-rb-profile-name
+ if(instanceSpecification.get("skip_post_instantiation_configuration").equals(true))
+ vnfInstanceParams.put("k8s-rb-profile-name", k8sRbProfileName);
vnfInstanceParam.add(vnfInstanceParams);
}
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<>();
} else {
Map<String, Object> instanceParam = new HashMap<>();
- instanceParam.put("k8s-rb-profile-name", k8sRbProfileName);
+ if(instanceSpecification.get("skip_post_instantiation_configuration").equals(true))
+ instanceParam.put("k8s-rb-profile-name", k8sRbProfileName);
vfInstanceParam.add(instanceParam);
}
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);