aboutsummaryrefslogtreecommitdiffstats
path: root/vnfmarket-be/vnf-sdk-marketplace/src/main
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2019-08-02 14:40:14 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2019-08-06 12:59:59 +0530
commitaa7237cb5d5d0af57741be06009419bcd85bff42 (patch)
tree331d6045210e47826763f1cf5f5f1dde05286167 /vnfmarket-be/vnf-sdk-marketplace/src/main
parentb761c64db074de56defbf049748d74bdeb7cff6b (diff)
Add log cli
Issue-ID: VNFSDK-424 Change-Id: If3fcd4b7db74389beefe0520d158613073cb30e3 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'vnfmarket-be/vnf-sdk-marketplace/src/main')
-rw-r--r--vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java
index 1427a578..b0cbcad8 100644
--- a/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java
+++ b/vnfmarket-be/vnf-sdk-marketplace/src/main/java/org/onap/vtp/execution/VTPExecutionResource.java
@@ -370,4 +370,36 @@ public class VTPExecutionResource extends VTPResource{
return Response.ok(this.getTestExecutionHandler(executionId).toString(), MediaType.APPLICATION_JSON).build();
}
+
+ public String getTestExecutionLogsHandler(
+ String executionId, String action) throws VTPException, IOException{
+ List<String> args = new ArrayList<>();
+ args.addAll(Arrays.asList(new String[] {
+ "--product", "open-cli", "execution-show-" + action, "--execution-id", executionId, "--format", "text"
+ }));
+
+
+ Result result = this.makeRpc(args);
+
+ return result.getOutput();
+ }
+
+ @Path("/executions/{executionId}/logs")
+ @GET
+ @ApiOperation(tags = "VTP Execution", value = "Retrieve test execution logs details", response = String.class)
+ @Produces(MediaType.TEXT_PLAIN)
+ @ApiResponses(value = {
+ @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500,
+ message = "Failed to perform the operation",
+ response = VTPError.class) })
+ public Response getTestExecutionLogs(
+ @ApiParam("Test execution Id") @PathParam("executionId") String executionId,
+ @ApiParam("Test console reports, Options: out, err, debug") @DefaultValue("out") @QueryParam("option") String option
+ ) throws VTPException, IOException {
+ if (!(option.equalsIgnoreCase("out") || option.equalsIgnoreCase("err") || option.equalsIgnoreCase("debug"))) {
+ option = "out";
+ }
+
+ return Response.ok(this.getTestExecutionLogsHandler(executionId, option), MediaType.TEXT_PLAIN).build();
+ }
}