diff options
Diffstat (limited to 'asdc-controller/src/main')
-rw-r--r-- | asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 56ec77cdee..da7aad4319 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -986,11 +986,30 @@ public class ToscaResourceInstaller { pnfResourceCustomization.setBlueprintVersion(getStringValue(properties.get(SDNC_MODEL_VERSION))); pnfResourceCustomization.setSkipPostInstConf(getBooleanValue(properties.get(SKIP_POST_INST_CONF))); pnfResourceCustomization.setControllerActor(getStringValue(properties.get(CONTROLLER_ACTOR))); - pnfResourceCustomization.setDefaultSoftwareVersion(getStringValue(properties.get(DEFAULT_SOFTWARE_VERSION))); + pnfResourceCustomization.setDefaultSoftwareVersion(extractDefaultSoftwareVersionFromSwVersions(properties)); pnfResourceCustomization.setPnfResources(pnfResource); return pnfResourceCustomization; } + private String extractDefaultSoftwareVersionFromSwVersions(Map<String, Property> properties) { + final String SOFTWARE_VERSIONS = "software_versions"; + final String EMPTY_STRING = ""; + String defaultSoftwareVersionValue = getStringValue(properties.get(DEFAULT_SOFTWARE_VERSION)); + if (defaultSoftwareVersionValue != null && !defaultSoftwareVersionValue.isEmpty()) { + return defaultSoftwareVersionValue; + } + if (properties.containsKey(SOFTWARE_VERSIONS) && properties.get(SOFTWARE_VERSIONS).getValue() != null) { + if (properties.get(SOFTWARE_VERSIONS).getValue() instanceof List) { + List<String> propertyValueList = (List) properties.get(SOFTWARE_VERSIONS).getValue(); + return propertyValueList.get(0); + } else if (properties.get(SOFTWARE_VERSIONS).getValue() instanceof String) { + return getStringValue(properties.get(SOFTWARE_VERSIONS)); + } + } + + return EMPTY_STRING; + } + /** * Get value from {@link Property} and cast to boolean value. Return true if property is null. */ |