From 9b158bd6b1f3ef7fc2bbc8ae8e0bc8a01ba43cc8 Mon Sep 17 00:00:00 2001 From: sanket12345 Date: Tue, 22 Feb 2022 20:51:14 +0530 Subject: CNF - Upgrade Functionality - API Handler -Added new endpoint in API-Handler -upgradeCnf as new action Issue-ID: SO-3856 Change-Id: I49f12f215c312b712f32f0a700beb8590b7c6dfe Signed-off-by: sanket12345 --- .../main/java/org/onap/so/apihandlerinfra/Action.java | 3 ++- .../org/onap/so/apihandlerinfra/ServiceInstances.java | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'mso-api-handlers/mso-api-handler-infra/src/main') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java index 469c99eeb0..5d238112cc 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java @@ -48,5 +48,6 @@ public enum Action implements Actions { healthCheck, addMembers, removeMembers, - forCustomWorkflow + forCustomWorkflow, + upgradeCnf } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index ed4a52ada0..4aa9cd0696 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -432,6 +432,24 @@ public class ServiceInstances extends AbstractRestHandler { requestHandlerUtils.getRequestUri(requestContext, uriPrefix)); } + @POST + @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/upgradeCnf") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Operation(description = "Upgrade CNF instance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) + @Transactional + public Response cnfUpgrade(String request, @PathParam("version") String version, + @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, + @Context ContainerRequestContext requestContext) throws ApiException { + String requestId = requestHandlerUtils.getRequestId(requestContext); + HashMap instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", serviceInstanceId); + instanceIdMap.put("vnfInstanceId", vnfInstanceId); + return serviceInstances(request, Action.upgradeCnf, instanceIdMap, version, requestId, + requestHandlerUtils.getRequestUri(requestContext, uriPrefix)); + } + @PUT @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}") @Consumes(MediaType.APPLICATION_JSON) -- cgit 1.2.3-korg