X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=mso-api-handlers%2Fmso-api-handler-infra%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fso%2Fapihandlerinfra%2FServiceInstances.java;h=021807703e8452a14f6f6c5f3e7c344a615779ef;hb=1a6b1ef83417efbbb8ec7cfe204c105e49e7e1f2;hp=353daf8afb42b300a90b6c05031016e64e6820f6;hpb=9cb10c58aacb2c0a79b0c93accf1ca4fe29522f9;p=so.git 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 353daf8afb..021807703e 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 @@ -7,6 +7,8 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ + * Modifications Copyright (c) 2023 Nordix Foundation. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -378,6 +380,28 @@ public class ServiceInstances extends AbstractRestHandler { } } + @POST + @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/cnfs") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Operation(description = "Create CNF on a specified version and serviceInstance", responses = @ApiResponse( + content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) + @Transactional + public Response createCnfInstance(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); + try { + return serviceInstances(request, Action.createInstance, instanceIdMap, version, requestId, + requestHandlerUtils.getRequestUri(requestContext, uriPrefix)); + } catch (Exception e) { + logger.error("Error in cnf", e); + throw e; + } + } + @POST @Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/upgrade") @Consumes(MediaType.APPLICATION_JSON) @@ -946,7 +970,8 @@ public class ServiceInstances extends AbstractRestHandler { requestHandlerUtils.parseRequest(sir, instanceIdMap, action, version, requestJSON, aLaCarte, requestId, currentActiveReq); if ((action == Action.replaceInstance || action == Action.replaceInstanceRetainAssignments) - && (requestScope.equals(ModelType.vnf.toString()) || requestScope.equals(ModelType.vfModule.toString())) + && (requestScope.equals(ModelType.vnf.toString()) || requestScope.equals(ModelType.vfModule.toString()) + || requestScope.equals(ModelType.cnf.toString())) && sir.getRequestDetails().getCloudConfiguration() == null) { CloudConfiguration cloudConfiguration = getCloudConfigurationOnReplace(requestScope, instanceIdMap, currentActiveReq);