diff options
Diffstat (limited to 'adapters/mso-vnf-adapter/src')
-rw-r--r-- | adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java | 40 |
1 files changed, 25 insertions, 15 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; + } } |