diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2018-04-10 08:58:46 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-04-10 08:58:46 +0000 |
commit | 0bc1ab2a99319a4e4f6f56aba15ee031820cbed4 (patch) | |
tree | dceddaa1ac5ff72d06d4bf84fecf37caa63b27dc /adapters | |
parent | f115334f0e8711e36dd43bc79335f2c98c77723f (diff) | |
parent | 22a25ae0b0690c5b26f949cd0d5bc7079cf05d2a (diff) |
Merge "Bug Fix - OOF api updates processing flavor-label"
Diffstat (limited to 'adapters')
-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; + } } |