From 30106b39d2ac1bc206134cfcb8fc73eb1f29b923 Mon Sep 17 00:00:00 2001 From: Jozsef Csongvai Date: Tue, 12 Jan 2021 09:12:23 -0500 Subject: Add new endpoint and macro for service upgrade This enables upgrading an existing service instance by updating its model UUID's in AAI and md-sal. Issue-ID: SO-3636 Signed-off-by: Jozsef Csongvai Change-Id: Ic5f067a1267053a61f46e2d9563ca4e4ac869bdf --- .../main/java/org/onap/so/apihandlerinfra/Action.java | 1 + .../org/onap/so/apihandlerinfra/ServiceInstances.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'mso-api-handlers/mso-api-handler-infra') 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 88c4bc3b04..2a91eaef5a 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 @@ -26,6 +26,7 @@ public enum Action implements Actions { updateInstance, deleteInstance, configureInstance, + upgradeInstance, replaceInstance, replaceInstanceRetainAssignments, activateInstance, 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 bcbc7c7ca6..36922a878f 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 @@ -378,6 +378,24 @@ public class ServiceInstances extends AbstractRestHandler { } } + @POST + @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/upgrade") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Operation(description = "Upgrade a Service Instance to newer model", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) + @Transactional + public Response upgradeServiceInstance(String request, @PathParam("version") String version, + @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) + throws ApiException { + String requestId = requestHandlerUtils.getRequestId(requestContext); + HashMap instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", serviceInstanceId); + + return serviceInstances(request, Action.upgradeInstance, instanceIdMap, version, requestId, + requestHandlerUtils.getRequestUri(requestContext, uriPrefix)); + } + @POST @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace") @Consumes(MediaType.APPLICATION_JSON) -- cgit 1.2.3-korg