summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorLee, Tian (tl5884) <tianl@amdocs.com>2018-05-17 18:05:42 +0100
committerLee, Tian (tl5884) <tianl@amdocs.com>2018-05-17 18:05:42 +0100
commitc815a8a992026e4e1f7e2753c7a4b28972ed9af0 (patch)
tree4dbf5b65062547ffb94b9c4f5ac3f4c8babb18ea /src/main/java/org
parent697fe0f1d00668a047dc49878dd0ab98618fa609 (diff)
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) <tianl@amdocs.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java9
1 files 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<String, String> dataItem) {
- dataItem.put(ATTR_UUID, UUID.randomUUID().toString());
- return new Gson().toJson(dataItem);
- }
-
private List<Map<String, String>> 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()),