diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-05-28 17:26:39 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2020-05-28 17:36:09 +0200 |
commit | badc1b5e02d60e15d08e231883cf74d2a28d92e1 (patch) | |
tree | 8f3b37ecf59df9a97bfedfa4d89121ed83660ff2 /src/main | |
parent | 9e25792898ae648234239403374db8bb923bc180 (diff) |
Fix crash at SDC deploy
If CDS properties are not there, it can crash a standard VF resource blueprint deployment.
Issue-ID: CLAMP-857
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I4172427046250fed52984c2b94531370727f0fa0
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/onap/clamp/loop/cds/CdsDataInstaller.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/org/onap/clamp/loop/cds/CdsDataInstaller.java b/src/main/java/org/onap/clamp/loop/cds/CdsDataInstaller.java index 9c1cd3bc2..d18cae1d6 100644 --- a/src/main/java/org/onap/clamp/loop/cds/CdsDataInstaller.java +++ b/src/main/java/org/onap/clamp/loop/cds/CdsDataInstaller.java @@ -73,18 +73,23 @@ public class CdsDataInstaller { for (NodeTemplate nodeTemplate : csar.getSdcCsarHelper().getServiceNodeTemplateBySdcType(type)) { // get cds artifact information and save in resources Prop if (SdcTypes.PNF == type || SdcTypes.VF == type) { - JsonObject controllerProperties = createCdsArtifactProperties(nodeTemplate.getPropertyValue( - SDNC_MODEL_NAME).toString(), - nodeTemplate.getPropertyValue(SDNC_MODEL_VERSION).toString()); + JsonObject controllerProperties = createCdsArtifactProperties( + String.valueOf(nodeTemplate.getPropertyValue(SDNC_MODEL_NAME)), + String.valueOf(nodeTemplate.getPropertyValue(SDNC_MODEL_VERSION))); if (controllerProperties != null) { resourcesPropByType.getAsJsonObject(nodeTemplate.getName()) .add(CONTROLLER_PROPERTIES, controllerProperties); + logger.info("Successfully installed the CDS data in Service"); + } + else { + logger.warn("Skipping CDS data installation in Service, as sdnc_model_name and " + + "sdnc_model_version are not provided in the CSAR"); } } } } serviceRepository.save(service); - logger.info("Successfully installed the CDS data in Service"); + return service; } @@ -129,7 +134,8 @@ public class CdsDataInstaller { * @return Returns CDS artifacts information */ private JsonObject createCdsArtifactProperties(String sdncModelName, String sdncModelVersion) { - if (sdncModelName != null && sdncModelVersion != null) { + if (sdncModelName != null && !"null".equals(sdncModelName) + && sdncModelVersion != null && !"null".equals(sdncModelVersion)) { JsonObject controllerProperties = new JsonObject(); controllerProperties.addProperty(SDNC_MODEL_NAME, sdncModelName); controllerProperties.addProperty(SDNC_MODEL_VERSION, sdncModelVersion); |