aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java
index 685e0090..a59a8856 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vnfsdk/marketplace/resource/VTPResource.java
@@ -41,6 +41,7 @@ import org.open.infc.grpc.client.OpenRemoteCli;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.gson.internal.LinkedTreeMap;
@@ -113,6 +114,15 @@ public class VTPResource {
JsonNode resultJson = mapper.readTree(result.getOutput());
((ObjectNode)resultJson).put("build_tag", System.getenv("BUILD_TAG"));
+
+ JsonNode results = resultJson.get("results");
+ if (results != null && results.isArray()) {
+ ArrayNode resultsArray = (ArrayNode)results;
+ if (resultsArray.size() >= 0) {
+ String error = resultsArray.get(0).get("error").asText();
+ ((ObjectNode)resultJson).put("criteria", "SUCCESS".equalsIgnoreCase(error) ? "PASS" : "FAILED");
+ }
+ }
return Response.ok(resultJson.toString(), MediaType.APPLICATION_JSON).build();
}