aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java40
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy120
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java104
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf5
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java55
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java12
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy16
11 files changed, 227 insertions, 144 deletions
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
index 2fec3f8b43..f8cba6afcb 100644
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
@@ -668,15 +668,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
LOGGER.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId);
- // TODO(sshank): Figure out the body format to be sent from Groovy.
- String hpaEnviromnentString = "";
- // Something similar to the following:
- /*
- if requestTypeString.substring(?) != "" {
- hpaEnviromnentString = requestTypeString.substring(?)
- }
- */
-
// Will capture execution time for metrics
long startTime = System.currentTimeMillis();
@@ -1052,6 +1043,18 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
LOGGER.debug("no environment parameter found for this Type " + vfModuleType);
}
+ // Replace flavors in environment with those returned by OOF
+ Map<String, Object> returnMap = updateFlavorsFromOof(heatEnvironmentString, inputs);
+ heatEnvironmentString = returnMap.get("heatEnvironmentString").toString();
+ LOGGER.debug("After OOF Update Heat Env String is: " + heatEnvironmentString);
+ if (returnMap.get("inputs") instanceof Map) {
+ inputs = (Map<String, String>) returnMap.get("inputs");
+ LOGGER.debug("After OOF Update inputs are: " + inputs.toString());
+ } else {
+ LOGGER.debug("inputs is not an instance of a Map: " + returnMap.get("inputs"));
+ throw new VnfException("Updating inputs using OOF info failed.", MsoExceptionCategory.INTERNAL);
+ }
+
// 1510 - Add the files: for nested templates *if* there are any
LOGGER.debug("In MsoVnfAdapterImpl, createVfModule about to call db.getNestedTemplates avec templateId="
+ heatTemplate.getArtifactUuid());
@@ -1170,12 +1173,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
//LOGGER.debug("About to create MHEE with " + sb);
mhee = new MsoHeatEnvironmentEntry(sb);
- // sshank: hpaEnviromnentString is obtained from requestTypeString above.
- if (hpaEnviromnentString != null && hpaEnviromnentString.contains("parameters:")) {
- StringBuilder hpasb = new StringBuilder(hpaEnviromnentString);
- mhee.setHPAParameters(hpasb);
- }
-
StringBuilder sb2 = new StringBuilder("\nHeat Template Parameters:\n");
for (HeatTemplateParam parm : heatTemplate.getParameters()) {
sb2.append("\t" + parm.getParamName() + ", required=" + parm.isRequired());
@@ -2163,4 +2160,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
return CatalogDatabase.getInstance();
}
+ private Map<String, Object> updateFlavorsFromOof(String heatEnvironmentString, Map<String, String> inputs) {
+ Map<String, Object> returnMap = new HashMap<>();
+ for (Map.Entry<String, String> input : inputs.entrySet()){
+ if (heatEnvironmentString.contains("label_" + input.getKey())){
+ heatEnvironmentString = heatEnvironmentString.replace("label_" + input.getKey(),
+ input.getValue());
+ inputs.remove("label_" + input.getKey());
+ }
+ }
+ returnMap.put("heatEnvironmentString", heatEnvironmentString);
+ returnMap.put("inputs", inputs);
+ return returnMap;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy
index 5e7ed982a6..f0f239b50f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy
@@ -20,11 +20,12 @@
package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.common.scripts.AaiUtil
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.core.domain.CloudFlavor
import org.openecomp.mso.bpmn.core.domain.InventoryType
import org.openecomp.mso.bpmn.core.domain.Resource
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
@@ -199,54 +200,87 @@ class OofHoming extends AbstractServiceTaskProcessor {
List<Resource> resourceList = decomposition.getServiceResources()
JSONArray arr = new JSONArray(placements)
for (int i = 0; i < arr.length(); i++) {
- JSONObject placement = arr.getJSONObject(i)
- utils.log("DEBUG", "****** JSONObject is: " + placement + " *****", "true")
- String jsonServiceResourceId = placement.getString("serviceResourceId")
- for (Resource resource : resourceList) {
- String serviceResourceId = resource.getResourceId()
- if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
- JSONObject solution = placement.getJSONObject("solution")
- String solutionType = solution.getString("identifierType")
- String inventoryType = ""
- if (solutionType.equalsIgnoreCase("serviceInstanceId")) {
- inventoryType = "service"
- } else {
- inventoryType = "cloud"
+ JSONArray arrSol = arr.getJSONArray(i)
+ for (int j = 0; j < arrSol.length(); j++) {
+ JSONObject placement = arrSol.getJSONObject(j)
+ utils.log("DEBUG", "****** JSONObject is: " + placement + " *****", "true")
+ String jsonServiceResourceId = placement.getString("serviceResourceId")
+ for (Resource resource : resourceList) {
+ String serviceResourceId = resource.getResourceId()
+ if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
+ JSONObject solution = placement.getJSONObject("solution")
+ String solutionType = solution.getString("identifierType")
+ String inventoryType = ""
+ if (solutionType.equalsIgnoreCase("serviceInstanceId")) {
+ inventoryType = "service"
+ } else {
+ inventoryType = "cloud"
+ }
+ resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
- }
- resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
+ // TODO Deal with Placement Solutions & Assignment Info here
+ JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
+ Integer arrayIndex = 0
+ Integer flavorsIndex = null
+ Boolean foundFlavors = false
+ String flavors = null
+ Map<String, String> flavorsMap = null
+ ArrayList<CloudFlavor> flavorsArrayList = new ArrayList<CloudFlavor>()
+ assignmentArr.each { element ->
+ JSONObject jsonObject = new JSONObject(element.toString())
+ if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "flavors") {
+ flavors = jsonUtil.getJsonRawValue(jsonObject.toString(), "value")
+ foundFlavors = true
+ flavorsIndex = arrayIndex
+ } else {
+ arrayIndex += 1
+ }
+ }
+ if (foundFlavors) {
+ assignmentArr.remove(flavorsIndex)
+ flavorsMap = jsonUtil.jsonStringToMap(execution, flavors.toString())
+ flavorsMap.each { label, flavor ->
+ CloudFlavor cloudFlavor = new CloudFlavor(label, flavor)
+ flavorsArrayList.add(cloudFlavor)
+ }
+ }
+ Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "key", "value")
+ String cloudOwner = assignmentMap.get("cloudOwner")
+ String cloudRegionId = assignmentMap.get("cloudRegionId")
+ resource.getHomingSolution().setCloudOwner(cloudOwner)
+ resource.getHomingSolution().setCloudRegionId(cloudRegionId)
+ if (flavorsArrayList != null && flavorsArrayList.size != 0) {
+ resource.getHomingSolution().setFlavors(flavorsArrayList)
+ execution.setVariable(cloudRegionId + "_flavorList", flavorsArrayList)
+ }
- // TODO Deal with Placement Solutions & Assignment Info here
- JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
- Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "key", "value")
- resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner"))
- resource.getHomingSolution().setCloudRegionId(assignmentMap.get("cloudRegionId"))
- if (inventoryType.equalsIgnoreCase("service")) {
- resource.getHomingSolution().setRehome(assignmentMap.get("isRehome").toBoolean())
- VnfResource vnf = new VnfResource()
- vnf.setVnfHostname(assignmentMap.get("vnfHostName"))
- resource.getHomingSolution().setVnf(vnf)
- resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString())
+ if (inventoryType.equalsIgnoreCase("service")) {
+ resource.getHomingSolution().setRehome(assignmentMap.get("isRehome").toBoolean())
+ VnfResource vnf = new VnfResource()
+ vnf.setVnfHostname(assignmentMap.get("vnfHostName"))
+ resource.getHomingSolution().setVnf(vnf)
+ resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString())
+ }
}
}
}
- }
- if (JsonUtils.jsonElementExist(response, "solutions.licenseSolutions")) {
- String licenseSolutions = jsonUtil.getJsonValue(response, "solutions.licenseSolutions")
- JSONArray licenseArr = new JSONArray(licenseSolutions)
- for (int l = 0; l < licenseArr.length(); l++) {
- JSONObject license = licenseArr.getJSONObject(l)
- String jsonServiceResourceId = license.getString("serviceResourceId")
- for (Resource resource : resourceList) {
- String serviceResourceId = resource.getResourceId()
- if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
- String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolUUID")
- List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)
- resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList)
+ if (JsonUtils.jsonElementExist(response, "solutions.licenseSolutions")) {
+ String licenseSolutions = jsonUtil.getJsonValue(response, "solutions.licenseSolutions")
+ JSONArray licenseArr = new JSONArray(licenseSolutions)
+ for (int l = 0; l < licenseArr.length(); l++) {
+ JSONObject license = licenseArr.getJSONObject(l)
+ String jsonServiceResourceId = license.getString("serviceResourceId")
+ for (Resource resource : resourceList) {
+ String serviceResourceId = resource.getResourceId()
+ if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
+ String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolUUID")
+ List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)
+ resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList)
- String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupUUID")
- List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)
- resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList)
+ String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupUUID")
+ List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)
+ resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList)
+ }
}
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy
index fc7c62baa7..4b2b0e20ac 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy
@@ -311,7 +311,7 @@ class OofUtils {
sb.append(",\n" +
" \"existingCandidates\": [\n")
def existingCandidateJson = ""
- existingCandidates.each {
+ existingCandidates.each { existingCandidate ->
type = existingCandidate.get('identifierType')
if (type == 'vimId') {
def cloudOwner = existingCandidate.get('cloudOwner')
@@ -342,7 +342,7 @@ class OofUtils {
sb.append(",\n" +
" \"excludedCandidates\": [\n")
def excludedCandidateJson = ""
- excludedCandidates.each {
+ excludedCandidates.each { excludedCandidate ->
type = excludedCandidate.get('identifierType')
if (type == 'vimId') {
def cloudOwner = excludedCandidate.get('cloudOwner')
@@ -373,7 +373,7 @@ class OofUtils {
sb.append(",\n" +
" \"requiredCandidates\": [\n")
def requiredCandidatesJson = ""
- requiredCandidates.each {
+ requiredCandidates.each { requiredCandidate ->
type = requiredCandidate.get('identifierType')
if (type == 'vimId') {
def cloudOwner = requiredCandidate.get('cloudOwner')
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java
index 45645be7cd..d7239fe0c1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java
@@ -28,6 +28,7 @@ import org.junit.Ignore;
import org.junit.Test;
import org.openecomp.mso.bpmn.core.WorkflowException;
import org.openecomp.mso.bpmn.core.domain.AllottedResource;
+import org.openecomp.mso.bpmn.core.domain.CloudFlavor;
import org.openecomp.mso.bpmn.core.domain.HomingSolution;
import org.openecomp.mso.bpmn.core.domain.ModelInfo;
import org.openecomp.mso.bpmn.core.domain.NetworkResource;
@@ -123,6 +124,12 @@ public class OofHomingTest extends WorkflowTest {
VnfResource vnf = new VnfResource();
vnf.setResourceId("testResourceIdVNF");
vnf.setResourceInstanceName("testVnfInstanceName");
+ ArrayList<CloudFlavor> flavors = new ArrayList<>();
+ CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
+ CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
+ flavors.add(flavor1);
+ flavors.add(flavor2);
+ vnf.getHomingSolution().setFlavors(flavors);
ModelInfo vnfModel = new ModelInfo();
vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
@@ -190,7 +197,7 @@ public class OofHomingTest extends WorkflowTest {
resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
null, null), resourceARHoming2String);
assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3",
- "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
"\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
resourceVNFHomingString);
assertEquals(verifyOofRequest(), expectedOofRequest);
@@ -255,7 +262,7 @@ public class OofHomingTest extends WorkflowTest {
null, null), resourceARHoming2String);
assertEquals(homingSolutionCloud("cloud","aic",
"testCloudRegionId3",
- "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
"\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
resourceVNFHomingString);
assertEquals(homingSolutionService("service", "testServiceInstanceIdNet",
@@ -264,7 +271,7 @@ public class OofHomingTest extends WorkflowTest {
null, null), resourceNetHomingString);
assertEquals(homingSolutionCloud("cloud", "aic",
"testCloudRegionIdNet2",
- "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+ false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
"\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
resourceNetHoming2String);
assertEquals(verifyOofRequest(), expectedOofRequest);
@@ -405,7 +412,7 @@ public class OofHomingTest extends WorkflowTest {
null, null), resourceARHoming2String);
assertEquals(homingSolutionCloud("cloud", "aic",
"testCloudRegionId3",
- "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
"\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
resourceVNFHomingString);
assertEquals(verifyOofRequestExistingLicense(), oofRequest);
@@ -625,43 +632,6 @@ public class OofHomingTest extends WorkflowTest {
}
- /*private String homingSolutionService(String resourceModuleName, String serviceInstanceId, String vnfHostname, String cloudOwner,
- String cloudRegionId, String licenseList) {
- String solution = "";
- if (licenseList == null || licenseList == "") {
- solution = "{\n" +
- " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
- " \"serviceResourceId\": \"some_resource_id\",\n" +
- " \"solution\": {\n" +
- " \"identifierType\": \"serviceInstanceId\",\n" +
- " \"identifiers\": [\"" + serviceInstanceId + "\"]\n" +
- " }\n" +
- " \"assignmentInfo\": [\n" +
- " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
- " { \"key\": \"vnfHostName\", \"value\": \"" + vnfHostname + "\" },\n" +
- " { \"key\": \"isRehome\", \"value\": \"False\" },\n" +
- " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
- " ]\n" +
- " }";
- } else {
- solution = "{\n" +
- " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
- " \"serviceResourceId\": \"some_resource_id\",\n" +
- " \"solution\": {\n" +
- " \"identifierType\": \"service_instance_id\",\n" +
- " \"identifiers\": [\"" + serviceInstanceId + "\"]\n" +
- " }\n" +
- " \"assignmentInfo\": [\n" +
- " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
- " { \"key\": \"vnfHostName\", \"value\": \"" + vnfHostname + "\" },\n" +
- " { \"key\": \"isRehome\", \"value\": \"False\" },\n" +
- " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
- " ], " +
- " \"licenseSolutions\" : [ {\"licenseKeyGroupUUID\": [" + licenseList + "]} ] " +
- "}";
- }
- return solution;
- }*/
private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
String vnfResourceId, String cloudOwner,
String cloudRegionId, String enList,
@@ -687,50 +657,28 @@ public class OofHomingTest extends WorkflowTest {
return solution;
}
- /*private String homingSolutionCloud(String resourceModuleName, String cloudOwner,
- String cloudRegionId, String licenseList) {
- String solution = "";
- if (licenseList == null || licenseList == "") {
- solution = "{\n" +
- " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
- " \"serviceResourceId\": \"some_resource_id\",\n" +
- " \"solution\": {\n" +
- " \"identifierType\": \"cloudRegionId\",\n" +
- " \"cloudOwner\": \"" + cloudOwner + "\",\n" +
- " \"identifiers\": [\"" + cloudRegionId + "\"]\n" +
- " }\n" +
- " \"assignmentInfo\": [\n" +
- " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
- " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
- " ]\n" +
- "}";
- } else {
- solution = "{\n" +
- " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
- " \"serviceResourceId\": \"some_resource_id\",\n" +
- " \"solution\": {\n" +
- " \"identifierType\": \"cloudRegionId\",\n" +
- " \"cloudOwner\": \"" + cloudOwner + "\",\n" +
- " \"identifiers\": [\"" + cloudRegionId + "\"]\n" +
- " }\n" +
- " \"assignmentInfo\": [\n" +
- " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
- " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
- " ]," +
- " \"licenseSolutions\" : [ {\"licenseKeyGroupUUID\": [" + licenseList + "]} ] } " +
- "}";
- }
- return solution;
- }*/
private String homingSolutionCloud(String type, String cloudOwner,
- String cloudRegionId, String enList,
+ String cloudRegionId, Boolean flavors, String enList,
String licenseList){
String solution = "";
if(enList == null){
solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
"\", \"license\" : { }, \"rehome\" : false } }";
- }else{
+ } else if (flavors && enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
+ "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
+ "\"license\" : { }, \"rehome\" : false } }";
+ } else if (flavors) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
+ "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
+ "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
+ licenseList + " ] }, \"rehome\" : false } }";
+ } else {
solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
"\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf
index 3559708728..808723828a 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf
@@ -31,6 +31,7 @@
}
],
"placementSolutions": [
+ [
{
"resourceModuleName": "ALLOTTED_RESOURCE",
"serviceInstanceId": "testSIID1",
@@ -101,9 +102,12 @@
{
"key": "cloudRegionId",
"value": "testCloudRegionId3"
- }
+ },
+ { "key":"flavors",
+ "value":{"flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
]
}
]
+ ]
}
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net
index 30fa09afd9..8766df8dba 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net
@@ -43,6 +43,7 @@
},
],
"placementSolutions": [
+ [
{
"resourceModuleName": "ALLOTTED_RESOURCE",
"serviceResourceId": "testResourceIdAR",
@@ -108,9 +109,11 @@
},
"assignmentInfo": [
{ "key": "cloudOwner", "value": "aic" },
- { "key": "cloudRegionId", "value": "testCloudRegionId3" }
+ { "key": "cloudRegionId", "value": "testCloudRegionId3" },
+ { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
]
}
]
+ ]
}
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf
index b4e748c6e7..8e6f2d46be 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf
@@ -5,6 +5,7 @@
"statusMessage": "success",
"solutions": {
"placementSolutions": [
+ [
{
"resourceModuleName": "vGMuxInfra",
"serviceResourceId": "some_resource_id",
@@ -29,9 +30,11 @@
},
"assignmentInfo": [
{ "key": "cloudOwner", "value": "amazon" },
- { "key": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }
+ { "key": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" },
+ { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
]
}
+ ]
],
"licenseSolutions": [
{
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java
new file mode 100644
index 0000000000..100d70e1b2
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+
+/**
+ * Stores Cloud Flavor information and is an attribute
+ * of a <class>HomingSolution</class>
+ *
+ */
+public class CloudFlavor extends JsonWrapper implements Serializable {
+ private String flavorLabel;
+ private String flavor;
+
+ public CloudFlavor (String flavorLabel, String flavor){
+ this.flavorLabel = flavorLabel;
+ this.flavor = flavor;
+ }
+
+ public String getFlavorLabel() {
+ return flavorLabel;
+ }
+
+ public void setFlavorLabel(String flavorLabel) {
+ this.flavorLabel = flavorLabel;
+ }
+
+ public String getFlavor() {
+ return flavor;
+ }
+
+ public void setFlavor(String flavor) {
+ this.flavor = flavor;
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java
index 611c8dfff9..f0193bc1c3 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java
@@ -45,6 +45,7 @@ public class HomingSolution extends JsonWrapper implements Serializable {
private String aicVersion;
private String tenant;
private VnfResource vnf;
+ private List<CloudFlavor> flavors;
private License license = new License();
@@ -126,6 +127,17 @@ public class HomingSolution extends JsonWrapper implements Serializable {
this.vnf = vnf;
}
+ /**
+ * @return a map<string, string> key is label name, value is any flavor
+ */
+ public List<CloudFlavor> getFlavors() {
+ return flavors;
+ }
+
+ public void setFlavors(List<CloudFlavor> flavors) {
+ this.flavors = flavors;
+ }
+
public License getLicense() {
return license;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
index 79b9239015..1869b930f0 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
@@ -931,7 +931,7 @@ public class JsonUtils {
for (int i = 0; i < arr.length(); i++){
JSONObject jo = arr.getJSONObject(i);
String key = jo.getString(keyNode);
- String value =jo.getString(valueNode);
+ String value = jo.getString(valueNode);
map.put(key, value);
}
msoLogger.debug("Outgoing Map is: " + map);
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index b9319466d9..95747d5a0b 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -18,7 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.bpmn.infrastructure.scripts;
+package org.openecomp.mso.bpmn.infrastructure.scripts
+
+import org.openecomp.mso.bpmn.core.domain.CloudFlavor
import java.util.Map
import java.util.Currency.CurrencyNameGetter
@@ -174,6 +176,12 @@ public class DoCreateVfModule extends VfModuleBase {
execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId)
rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId)
logDebug("serviceInstanceId: " + serviceInstanceId, isDebugLogEnabled)
+ //flavorList
+ ArrayList<CloudFlavor> flavorList = execution.getVariable(cloudSiteId + "_flavorList")
+ if (flavorList != null) {
+ execution.setVariable("DCVFM_flavorList", flavorList)
+ logDebug("flavorList is: " + flavorList, isDebugLogEnabled)
+ }
//source - HARDCODED
def source = "VID"
execution.setVariable("DCVFM_source", source)
@@ -927,6 +935,8 @@ public class DoCreateVfModule extends VfModuleBase {
def serviceId = execution.getVariable("DCVFM_serviceId")
//serviceInstanceId
def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId")
+ //flavorList
+ ArrayList<CloudFlavor> flavorList = execution.getVariable("DCVFM_flavorList")
//backoutOnFailure
def backoutOnFailure = execution.getVariable("DCVFM_backoutOnFailure")
//volumeGroupId
@@ -962,6 +972,10 @@ public class DoCreateVfModule extends VfModuleBase {
}
Map<String, String> vnfParamsMap = execution.getVariable("DCVFM_vnfParamsMap")
+ // Add flavorLabel List to vnfParamsMap
+ flavorList.each { cloudFlavor ->
+ vnfParamsMap.put("label_" + cloudFlavor.getFlavorLabel(), cloudFlavor.getFlavor())
+ }
String vfModuleParams = ""
//Get SDNC Response Data for VF Module Topology
String vfModuleSdncGetResponse = execution.getVariable('DCVFM_getSDNCAdapterResponse')