From 762e0e044b08bb318438b91c38de8d8bf59f6219 Mon Sep 17 00:00:00 2001 From: romaingimbert Date: Wed, 25 Apr 2018 10:44:26 +0200 Subject: [PATCH] string "null" in temp tosca file - change uuid to id Change-Id: I3eabf0f9eedef18585d0fef00a83ab246f7117ef Issue-ID: EXTAPI-73 Signed-off-by: romaingimbert --- .../apis/servicecatalog/ToscaInfosProcessor.java | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java index cfe8d82..0503e34 100644 --- a/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ToscaInfosProcessor.java @@ -78,13 +78,14 @@ public class ToscaInfosProcessor { List resourceSpecifications = (List) serviceCatalogResponse.get("resourceSpecification"); for (LinkedHashMap resourceSpecification : resourceSpecifications) { - String id = (String) resourceSpecification.get("id"); - LOGGER.debug("get tosca infos for service id: {0}", id); - LinkedHashMap toscaInfosFromResourceId = getToscaInfosFromResourceUUID(nodeTemplate, id); - if (toscaInfosFromResourceId != null) { - resourceSpecification.put("modelCustomizationId", toscaInfosFromResourceId.get("customizationUUID")); + if(resourceSpecification.get("id")!=null){ + String id = (String) resourceSpecification.get("id"); + LOGGER.debug("get tosca infos for service id: {0}", id); + LinkedHashMap toscaInfosFromResourceId = getToscaInfosFromResourceUUID(nodeTemplate, id); + if (toscaInfosFromResourceId != null && toscaInfosFromResourceId.get("customizationUUID")!=null) { + resourceSpecification.put("modelCustomizationId", toscaInfosFromResourceId.get("customizationUUID")); + } } - } } @@ -133,10 +134,12 @@ public class ToscaInfosProcessor { for (Object nodeTemplateObject : node_templates.values()) { LinkedHashMap nodeTemplate = (LinkedHashMap) nodeTemplateObject; LinkedHashMap metadata = (LinkedHashMap) nodeTemplate.get("metadata"); - String metadataUUID = (String) metadata.get("UUID"); - String metadataType = (String) metadata.get("type"); - if ("VF".equalsIgnoreCase(metadataType) && name.equalsIgnoreCase(metadataUUID)) { - return metadata; + if(metadata.get("UUID")!=null && metadata.get("type")!=null) { + String metadataUUID = (String) metadata.get("UUID"); + String metadataType = (String) metadata.get("type"); + if ("VF".equalsIgnoreCase(metadataType) && name!=null && name.equalsIgnoreCase(metadataUUID)) { + return metadata; + } } } } @@ -149,7 +152,7 @@ public class ToscaInfosProcessor { LinkedHashMap topologyTemplate = null; String toscaModelUrl = (String) sdcResponse.get("toscaModelURL"); - String serviceId = (String) sdcResponse.get("uuid"); + String serviceId = (String) sdcResponse.get("id"); File toscaFile = sdcClient.callGetWithAttachment(toscaModelUrl); Timestamp timestamp = new Timestamp(System.currentTimeMillis()); String tempFolderName = serviceId + timestamp; -- 2.16.6