aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-vnf-adapter
diff options
context:
space:
mode:
authorMarcus G K Williams <marcus.williams@intel.com>2018-03-28 16:26:11 -0700
committerMarcus Williams <marcus.williams@intel.com>2018-04-09 16:20:39 +0000
commit22a25ae0b0690c5b26f949cd0d5bc7079cf05d2a (patch)
tree91b69438d2cfd386105021ed6413105489ae7aef /adapters/mso-vnf-adapter
parent955768f7bf4520fb8b9120121251f9537b260db6 (diff)
Bug Fix - OOF api updates processing flavor-label
Additional API interactions were added to OOF response post API freeze that enable core HPA functionality. This patch updates the processsing of the API reponse to process additional flavor parameters. Issue-ID: SO-408 Change-Id: I1656a7ba955ab41c57b7a3e07a3d0cc38b16e2fa Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>
Diffstat (limited to 'adapters/mso-vnf-adapter')
-rw-r--r--adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java40
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;
+ }
}