From c815a8a992026e4e1f7e2753c7a4b28972ed9af0 Mon Sep 17 00:00:00 2001 From: "Lee, Tian (tl5884)" Date: Thu, 17 May 2018 18:05:42 +0100 Subject: Fix issue with VNFImage rollback Fix issue where VNFImage data UUID is being overwritten, causing rollback failures. Change-Id: I66fd9125f7806c74d80ede6d2f0d4c04d0756cc0 Issue-ID: AAI-1148 Signed-off-by: Lee, Tian (tl5884) --- .../modelloader/entity/catalog/VnfCatalogArtifactHandler.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java b/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java index 85be50b..3480c68 100644 --- a/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java +++ b/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java @@ -89,7 +89,7 @@ public class VnfCatalogArtifactHandler extends ArtifactHandler { // If an empty dataItem is supplied, do nothing. if (dataItem.isEmpty()) { logger.warn(ModelLoaderMsgs.DISTRIBUTION_EVENT, "Empty image data supplied, skipping ingestion."); - return; + continue; } String urlParams; @@ -142,18 +142,13 @@ public class VnfCatalogArtifactHandler extends ArtifactHandler { String uuid = UUID.randomUUID().toString(); dataItem.put(ATTR_UUID, uuid); - String payload = createVnfImagePayload(dataItem); + String payload = new Gson().toJson(dataItem); String putUrl = config.getAaiBaseUrl() + config.getAaiVnfImageUrl() + "/vnf-image/" + uuid; OperationResult putResp = restClient.putResource(putUrl, payload, distributionId, MediaType.APPLICATION_JSON_TYPE); return putResp != null && putResp.getResultCode() == Response.Status.CREATED.getStatusCode(); } - private String createVnfImagePayload(Map dataItem) { - dataItem.put(ATTR_UUID, UUID.randomUUID().toString()); - return new Gson().toJson(dataItem); - } - private List> unmarshallVnfcData(Artifact vnfcArtifact) { // Unmarshall Babel JSON payload into a List of Maps of JSON attribute name/values. return new Gson().fromJson(StringEscapeUtils.unescapeJson(vnfcArtifact.getPayload()), -- cgit 1.2.3-korg