diff options
author | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2021-01-12 09:12:23 -0500 |
---|---|---|
committer | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2021-08-04 08:55:43 -0400 |
commit | 30106b39d2ac1bc206134cfcb8fc73eb1f29b923 (patch) | |
tree | be83e5d35925fdd87c39cba7607feaefc23c34b5 /mso-api-handlers/mso-api-handler-infra | |
parent | 872613eafe80034cca612bd93294286b3dbed4b1 (diff) |
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 <jozsef.csongvai@bell.ca>
Change-Id: Ic5f067a1267053a61f46e2d9563ca4e4ac869bdf
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
2 files changed, 19 insertions, 0 deletions
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 @@ -379,6 +379,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<String, String> 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) @Produces(MediaType.APPLICATION_JSON) |