aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java732
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/ActivateOrDeactivate3gppService.java98
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Allocate3gppService.java117
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/DeAllocate3gppService.java94
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Modify3gppService.java105
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/QuerySubnetCapability.java47
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/SubnetTypes.java25
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java181
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/activateRequest.json9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/allocateRequest.json55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/deActivateRequest.json9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/deAllocate.json13
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/modifyRequest.json18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/BPMN_response.json7
15 files changed, 1511 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
index 168f82bdf3..d69c395f96 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -64,6 +64,7 @@ public class JerseyConfiguration extends ResourceConfig {
register(GlobalHealthcheckHandler.class);
register(NodeHealthcheckHandler.class);
register(ServiceInstances.class);
+ register(Onap3gppServiceInstances.class);
register(TasksHandler.class);
register(CloudOrchestration.class);
register(CloudResourcesOrchestration.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java
new file mode 100644
index 0000000000..e7b96b16a9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstances.java
@@ -0,0 +1,732 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.UUID;
+import java.util.function.Function;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.http.HttpStatus;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.apihandler.camundabeans.CamundaResponse;
+import org.onap.so.apihandler.common.CamundaClient;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandler.common.ResponseHandler;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
+import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.ActivateOrDeactivate3gppService;
+import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.Allocate3gppService;
+import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.DeAllocate3gppService;
+import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.Modify3gppService;
+import org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans.QuerySubnetCapability;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.logger.LogConstants;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+
+@Component
+@Path("/onap/so/infra/onap3gppServiceInstances")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/onap3gppServiceInstances",
+ description = "API Requests for 3GPP Service Instances"))
+public class Onap3gppServiceInstances {
+
+ private static final Logger logger = LoggerFactory.getLogger(Onap3gppServiceInstances.class);
+
+ private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
+
+ private static final String SAVE_TO_DB = "save instance to db";
+
+ private static String uriPrefix = "/onap3gppServiceInstances/";
+
+ @Autowired
+ private MsoRequest msoRequest;
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ @Autowired
+ private RequestsDbClient requestsDbClient;
+
+ @Autowired
+ private RequestHandlerUtils requestHandlerUtils;
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ @Autowired
+ private CamundaClient camundaClient;
+
+ @Autowired
+ private ResponseHandler responseHandler;
+
+ /**
+ * POST Requests for 3GPP Service create Instance on a version provided
+ *
+ * @throws ApiException
+ */
+
+ @POST
+ @Path("/{version:[vV][1]}/allocate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Create a 3GPP Service Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response createServiceInstance(Allocate3gppService request, @PathParam("version") String version,
+ @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ return processServiceInstanceRequest(request, Action.createInstance, version, requestId, null,
+ requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ }
+
+ /**
+ * PUT Requests for 3GPP Service update Instance on a version provided
+ *
+ * @throws ApiException
+ */
+
+ @PUT
+ @Path("/{version:[vV][1]}/modify")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Modify a 3GPP Service Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response updateServiceInstance(Modify3gppService request, @PathParam("version") String version,
+ @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
+ return updateServiceInstances(request, Action.updateInstance, version, requestId, instanceIdMap,
+ requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ }
+
+ /**
+ * DELETE Requests for 3GPP Service delete Instance on a specified version
+ *
+ * @throws ApiException
+ */
+
+ @DELETE
+ @Path("/{version:[vV][1]}/deAllocate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Terminate/Deallocate a 3GPP Service Instance on a version provided",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response deleteServiceInstance(DeAllocate3gppService request, @PathParam("version") String version,
+ @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
+ return deleteServiceInstances(request, Action.deleteInstance, version, requestId, instanceIdMap,
+ requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ }
+
+ /**
+ * POST Requests for 3GPP Service Activate on a specified version
+ *
+ * @throws ApiException
+ */
+
+ @POST
+ @Path("/{version:[vV][1]}/activate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Activate a 3GPP Service Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response activateServiceInstance(ActivateOrDeactivate3gppService request,
+ @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
+ return activateOrDeactivateServiceInstances(request, Action.activateInstance, version, requestId, instanceIdMap,
+ requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ }
+
+ /**
+ * POST Requests for 3GPP Service DeActivate on a specified version
+ *
+ * @throws ApiException
+ */
+
+ @POST
+ @Path("/{version:[vV][1]}/deActivate")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Deactivate a 3GPP Service Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response deActivateServiceInstance(ActivateOrDeactivate3gppService request,
+ @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
+ return activateOrDeactivateServiceInstances(request, Action.deactivateInstance, version, requestId,
+ instanceIdMap, requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ }
+
+ /**
+ *
+ * GET requests for slice subnet capabilities on a specified version
+ *
+ * @param version
+ * @return
+ * @throws ApiException
+ */
+ @GET
+ @Path("/{version:[vV][1]}/subnetCapabilityQuery")
+ @Operation(description = "Provides subnet capability based on subnet types", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Response getSliceSubnetCapabilities(QuerySubnetCapability request, @PathParam("version") String version)
+ throws ApiException {
+ logger.debug("Request received {}", request);
+ String subnetType = null;
+ return getSubnetCapabilities(subnetType, version);
+ }
+
+ /**
+ * Process allocate service request and send request to corresponding workflow
+ *
+ * @param request
+ * @param action
+ * @param version
+ * @return
+ * @throws ApiException
+ */
+ private Response processServiceInstanceRequest(Allocate3gppService request, Action action, String version,
+ String requestId, HashMap<String, String> instanceIdMap, String requestUri) throws ApiException {
+ String defaultServiceModelName = "COMMON_SS_DEFAULT";
+ String requestScope = ModelType.service.name();
+ String apiVersion = version.substring(1);
+ String serviceRequestJson = toString.apply(request);
+ if (serviceRequestJson != null) {
+ InfraActiveRequests currentActiveReq = createRequestObject(request, action, requestId, Status.IN_PROGRESS,
+ requestScope, serviceRequestJson);
+ String instanceName = request.getName();
+ requestHandlerUtils.checkForDuplicateRequests(action, instanceIdMap, requestScope, currentActiveReq,
+ instanceName);
+ try {
+ requestsDbClient.save(currentActiveReq);
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
+
+ RecipeLookupResult recipeLookupResult;
+ try {
+ recipeLookupResult =
+ getServiceInstanceOrchestrationURI(request.getModelUuid(), action, defaultServiceModelName);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ if (recipeLookupResult == null) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ String serviceInstanceType = request.getSubscriptionServiceType();
+ RequestClientParameter parameter;
+ try {
+ parameter = new RequestClientParameter.Builder().setRequestId(requestId).setBaseVfModule(false)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name())
+ .setServiceInstanceId(null).setServiceType(serviceInstanceType)
+ .setRequestDetails(serviceRequestJson).setApiVersion(version).setALaCarte(false)
+ .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).setApiVersion(apiVersion).build();
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
+ }
+ return postBPELRequest(currentActiveReq, parameter, recipeLookupResult.getOrchestrationURI(), requestScope);
+ } else {
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, "JsonProcessingException occurred - serviceRequestJson is null",
+ ErrorNumbers.SVC_BAD_PARAMETER, null, version);
+ return response;
+ }
+ }
+
+ /**
+ * process modify service request and call corresponding workflow
+ *
+ * @param request
+ * @param action
+ * @param version
+ * @return
+ * @throws ApiException
+ */
+ private Response updateServiceInstances(Modify3gppService request, Action action, String version, String requestId,
+ HashMap<String, String> instanceIdMap, String requestUri) throws ApiException {
+ String defaultServiceModelName = "COMMON_SS_DEFAULT";
+ String requestScope = ModelType.service.name();
+ String apiVersion = version.substring(1);
+ String serviceRequestJson = toString.apply(request);
+ if (serviceRequestJson != null) {
+ InfraActiveRequests currentActiveReq = createRequestObject(request, action, requestId, Status.IN_PROGRESS,
+ requestScope, serviceRequestJson);
+ String instanceName = request.getName();
+ requestHandlerUtils.checkForDuplicateRequests(action, instanceIdMap, requestScope, currentActiveReq,
+ instanceName);
+ try {
+ requestsDbClient.save(currentActiveReq);
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
+
+ RecipeLookupResult recipeLookupResult;
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI(null, action, defaultServiceModelName);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ if (recipeLookupResult == null) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ String serviceInstanceType = request.getSubscriptionServiceType();
+ String serviceInstanceId = request.getServiceInstanceID();
+ RequestClientParameter parameter;
+ try {
+ parameter = new RequestClientParameter.Builder().setRequestId(requestId).setBaseVfModule(false)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name())
+ .setServiceInstanceId(serviceInstanceId).setServiceType(serviceInstanceType)
+ .setRequestDetails(serviceRequestJson).setApiVersion(version).setALaCarte(false)
+ .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).setApiVersion(apiVersion).build();
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
+ }
+ return postBPELRequest(currentActiveReq, parameter, recipeLookupResult.getOrchestrationURI(), requestScope);
+
+ } else {
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, "JsonProcessingException occurred - serviceRequestJson is null",
+ ErrorNumbers.SVC_BAD_PARAMETER, null, version);
+ return response;
+ }
+ }
+
+ /**
+ * process delete service instance request and call corresponding workflow
+ *
+ * @param request
+ * @param action
+ * @param version
+ * @return
+ * @throws ApiException
+ */
+ private Response deleteServiceInstances(DeAllocate3gppService request, Action action, String version,
+ String requestId, HashMap<String, String> instanceIdMap, String requestUri) throws ApiException {
+ String defaultServiceModelName = "COMMON_SS_DEFAULT";
+ String requestScope = ModelType.service.name();
+ String apiVersion = version.substring(1);
+ String serviceRequestJson = toString.apply(request);
+ if (serviceRequestJson != null) {
+ InfraActiveRequests currentActiveReq = createRequestObject(request, action, requestId, Status.IN_PROGRESS,
+ requestScope, serviceRequestJson);
+ requestHandlerUtils.checkForDuplicateRequests(action, instanceIdMap, requestScope, currentActiveReq, null);
+ try {
+ requestsDbClient.save(currentActiveReq);
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
+ RecipeLookupResult recipeLookupResult;
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI(null, action, defaultServiceModelName);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ if (recipeLookupResult == null) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ String serviceInstanceType = request.getSubscriptionServiceType();
+ String serviceInstanceId = request.getServiceInstanceID();
+ RequestClientParameter parameter;
+ try {
+ parameter = new RequestClientParameter.Builder().setRequestId(requestId).setBaseVfModule(false)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name())
+ .setServiceInstanceId(serviceInstanceId).setServiceType(serviceInstanceType)
+ .setRequestDetails(serviceRequestJson).setApiVersion(version).setALaCarte(false)
+ .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).setApiVersion(apiVersion).build();
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
+ }
+ return postBPELRequest(currentActiveReq, parameter, recipeLookupResult.getOrchestrationURI(), requestScope);
+ } else {
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, "JsonProcessingException occurred - serviceRequestJson is null",
+ ErrorNumbers.SVC_BAD_PARAMETER, null, version);
+ return response;
+ }
+ }
+
+ /**
+ * process activate/deactivate service request and call corresponding workflow
+ *
+ * @param request the request object for activate/deactivate service
+ * @param action the action for the service
+ * @param version
+ * @return
+ * @throws ApiException
+ */
+ private Response activateOrDeactivateServiceInstances(ActivateOrDeactivate3gppService request, Action action,
+ String version, String requestId, HashMap<String, String> instanceIdMap, String requestUri)
+ throws ApiException {
+ String defaultServiceModelName = "COMMON_SS_DEFAULT";
+ String requestScope = ModelType.service.name();
+ String apiVersion = version.substring(1);
+ String serviceRequestJson = toString.apply(request);
+ if (serviceRequestJson != null) {
+ InfraActiveRequests currentActiveReq = createRequestObject(request, action, requestId, Status.IN_PROGRESS,
+ requestScope, serviceRequestJson);
+ if (action == Action.activateInstance) {
+ requestHandlerUtils.checkForDuplicateRequests(action, instanceIdMap, requestScope, currentActiveReq,
+ request.getServiceInstanceID());
+ } else {
+ requestHandlerUtils.checkForDuplicateRequests(action, instanceIdMap, requestScope, currentActiveReq,
+ null);
+ }
+ try {
+ requestsDbClient.save(currentActiveReq);
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
+ RecipeLookupResult recipeLookupResult;
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI(null, action, defaultServiceModelName);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ if (recipeLookupResult == null) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ String serviceInstanceType = request.getSubscriptionServiceType();
+ String serviceInstanceId = request.getServiceInstanceID();
+ RequestClientParameter parameter;
+ try {
+ parameter = new RequestClientParameter.Builder().setRequestId(requestId).setBaseVfModule(false)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name())
+ .setServiceInstanceId(serviceInstanceId).setServiceType(serviceInstanceType)
+ .setRequestDetails(serviceRequestJson).setApiVersion(version).setALaCarte(false)
+ .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).setApiVersion(apiVersion).build();
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
+ }
+ return postBPELRequest(currentActiveReq, parameter, recipeLookupResult.getOrchestrationURI(), requestScope);
+ } else {
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, "JsonProcessingException occurred - serviceRequestJson is null",
+ ErrorNumbers.SVC_BAD_PARAMETER, null, version);
+ return response;
+ }
+ }
+
+ // To be implemented for fetching Subnet capabilities
+ private Response getSubnetCapabilities(String subnetType, String version) throws ApiException {
+ return null;
+ }
+
+ /**
+ * Getting recipes from catalogDb
+ *
+ * @param serviceModelUUID the service model version uuid
+ * @param action the action for the service
+ * @param defaultServiceModelName default service name
+ * @return the service recipe result
+ */
+ private RecipeLookupResult getServiceInstanceOrchestrationURI(String serviceModelUUID, Action action,
+ String defaultServiceModelName) {
+
+ RecipeLookupResult recipeLookupResult = getServiceURI(serviceModelUUID, action, defaultServiceModelName);
+
+ if (recipeLookupResult != null) {
+ logger.debug("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: "
+ + Integer.toString(recipeLookupResult.getRecipeTimeout()));
+ } else {
+ logger.debug("No matching recipe record found");
+ }
+ return recipeLookupResult;
+ }
+
+ /**
+ * Getting recipes from catalogDb If Service recipe is not set, use default recipe, if set , use special recipe.
+ *
+ * @param serviceModelUUID the service version uuid
+ * @param action the action of the service.
+ * @param defaultServiceModelName default service name
+ * @return the service recipe result.
+ */
+ private RecipeLookupResult getServiceURI(String serviceModelUUID, Action action, String defaultServiceModelName) {
+
+ Service defaultServiceRecord =
+ catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ // set recipe as default generic recipe
+ ServiceRecipe recipe =
+ catalogDbClient.getFirstByServiceModelUUIDAndAction(defaultServiceRecord.getModelUUID(), action.name());
+ // check the service special recipe
+ if (null != serviceModelUUID && !serviceModelUUID.isEmpty()) {
+ ServiceRecipe serviceSpecialRecipe =
+ catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceModelUUID, action.name());
+ if (null != serviceSpecialRecipe) {
+ // set service special recipe.
+ recipe = serviceSpecialRecipe;
+ }
+ }
+
+ if (recipe == null) {
+ return null;
+ }
+ return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout(), recipe.getParamXsd());
+
+ }
+
+ Function<Object, String> toString = serviceRequest -> {
+ ObjectMapper mapper = new ObjectMapper();
+ String requestAsString = null;
+ try {
+ requestAsString = mapper.writeValueAsString(serviceRequest);
+ } catch (JsonProcessingException e) {
+ logger.debug("Exception while converting service request object to String {}", e);
+ }
+ return requestAsString;
+ };
+
+ public InfraActiveRequests createRequestObject(Object request, Action action, String requestId, Status status,
+ String requestScope, String requestJson) {
+ InfraActiveRequests aq = new InfraActiveRequests();
+ try {
+ String networkType = null;
+ String serviceInstanceName = null;
+ String serviceInstanceId = null;
+ if (action.name().equals("createInstance")) {
+ networkType = ((Allocate3gppService) request).getNetworkType();
+ serviceInstanceName = ((Allocate3gppService) request).getName();
+ aq.setServiceInstanceName(serviceInstanceName);
+ } else if (action.name().equals("updateInstance")) {
+ networkType = ((Modify3gppService) request).getNetworkType();
+ serviceInstanceName = ((Modify3gppService) request).getName();
+ serviceInstanceId = ((Modify3gppService) request).getServiceInstanceID();
+ aq.setServiceInstanceName(serviceInstanceName);
+ aq.setServiceInstanceId(serviceInstanceId);
+ } else if (action.name().equals("deleteInstance")) {
+ networkType = ((DeAllocate3gppService) request).getNetworkType();
+ serviceInstanceId = ((DeAllocate3gppService) request).getServiceInstanceID();
+ aq.setServiceInstanceId(serviceInstanceId);
+ } else if (action.name().equals("activateInstance")) {
+ networkType = ((ActivateOrDeactivate3gppService) request).getNetworkType();
+ serviceInstanceId = ((ActivateOrDeactivate3gppService) request).getServiceInstanceID();
+ aq.setServiceInstanceName(serviceInstanceId); // setting serviceInstanceId as serviceInstanceName
+ // -->serviceInstanceName shouldn't be null for action -
+ // activateInstance duplicateRequests check
+ aq.setServiceInstanceId(serviceInstanceId);
+ } else if (action.name().equals("deactivateInstance")) {
+ networkType = ((ActivateOrDeactivate3gppService) request).getNetworkType();
+ serviceInstanceId = ((ActivateOrDeactivate3gppService) request).getServiceInstanceID();
+ aq.setServiceInstanceId(serviceInstanceId);
+ }
+
+ aq.setRequestId(requestId);
+ aq.setRequestAction(action.toString());
+ aq.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ aq.setStartTime(startTimeStamp);
+ aq.setRequestScope(requestScope);
+ aq.setRequestBody(requestJson);
+ aq.setRequestStatus(status.toString());
+ aq.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ aq.setNetworkType(networkType);
+ } catch (Exception e) {
+ logger.error("Exception when creation record request", e);
+
+ if (!status.equals(Status.FAILED)) {
+ throw e;
+ }
+ }
+ return aq;
+ }
+
+ private Response postBPELRequest(InfraActiveRequests currentActiveReq, RequestClientParameter parameter,
+ String orchestrationURI, String requestScope) throws ApiException {
+ ResponseEntity<String> response =
+ requestHandlerUtils.postRequest(currentActiveReq, parameter, orchestrationURI);
+ logger.debug("BPEL response : " + response);
+ int bpelStatus = responseHandler.setStatus(response.getStatusCodeValue());
+ String jsonResponse;
+ try {
+ responseHandler.acceptedResponse(response);
+ CamundaResponse camundaResponse = responseHandler.getCamundaResponse(response);
+ String responseBody = camundaResponse.getResponse();
+ if ("Success".equalsIgnoreCase(camundaResponse.getMessage())) {
+ jsonResponse = responseBody;
+ } else {
+ BPMNFailureException bpmnException =
+ new BPMNFailureException.Builder(String.valueOf(bpelStatus) + responseBody, bpelStatus,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).build();
+ requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, bpmnException.getMessage());
+ throw bpmnException;
+ }
+ } catch (ApiException e) {
+ requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, e.getMessage());
+ throw e;
+ }
+ return builder.buildResponse(HttpStatus.SC_ACCEPTED, parameter.getRequestId(), jsonResponse,
+ parameter.getApiVersion());
+ }
+}
+
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/ActivateOrDeactivate3gppService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/ActivateOrDeactivate3gppService.java
new file mode 100644
index 0000000000..3f094a8cc9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/ActivateOrDeactivate3gppService.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Model class for 3GPP service instance Activate request
+ */
+
+public class ActivateOrDeactivate3gppService {
+
+ @JsonProperty("serviceInstanceID")
+ private String serviceInstanceID;
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+
+ @JsonProperty("networkType")
+ private String networkType;
+
+ @JsonProperty("additionalProperties")
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public String getServiceInstanceID() {
+ return serviceInstanceID;
+ }
+
+ public void setServiceInstanceID(String serviceInstanceID) {
+ this.serviceInstanceID = serviceInstanceID;
+ }
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ public void setNetworkType(String networkType) {
+ this.networkType = networkType;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+
+ @Override
+ public String toString() {
+ return "ActivateOrDeactivate3gppService [serviceInstanceID=" + serviceInstanceID + ", globalSubscriberId="
+ + globalSubscriberId + ", subscriptionServiceType=" + subscriptionServiceType + ", networkType="
+ + networkType + ", additionalProperties=" + additionalProperties + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Allocate3gppService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Allocate3gppService.java
new file mode 100644
index 0000000000..0444e66842
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Allocate3gppService.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Model class for 3GPP service instance create request
+ */
+public class Allocate3gppService {
+
+ @JsonProperty("name")
+ private String name;
+
+ @JsonProperty("modelInvariantUuid")
+ private String modelInvariantUuid;
+
+ @JsonProperty("modelUuid")
+ private String modelUuid;
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+
+ @JsonProperty("networkType")
+ private String networkType;
+
+ @JsonProperty("additionalProperties")
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+
+ public String getModelUuid() {
+ return modelUuid;
+ }
+
+ public void setModelUuid(String modelUuid) {
+ this.modelUuid = modelUuid;
+ }
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ public void setNetworkType(String networkType) {
+ this.networkType = networkType;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+ @Override
+ public String toString() {
+ return "Allocate3gppService [name=" + name + ", modelInvariantUuid=" + modelInvariantUuid + ", modelUuid="
+ + modelUuid + ", globalSubscriberId=" + globalSubscriberId + ", subscriptionServiceType="
+ + subscriptionServiceType + ", networkType=" + networkType + ", additionalProperties="
+ + additionalProperties + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/DeAllocate3gppService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/DeAllocate3gppService.java
new file mode 100644
index 0000000000..24ebb6b410
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/DeAllocate3gppService.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Model class for 3GPP service instance terminate request
+ */
+public class DeAllocate3gppService {
+
+ @JsonProperty("serviceInstanceID")
+ private String serviceInstanceID;
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+
+ @JsonProperty("networkType")
+ private String networkType;
+
+ @JsonProperty("additionalProperties")
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public String getServiceInstanceID() {
+ return serviceInstanceID;
+ }
+
+ public void setServiceInstanceID(String serviceInstanceID) {
+ this.serviceInstanceID = serviceInstanceID;
+ }
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ public void setNetworkType(String networkType) {
+ this.networkType = networkType;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+ @Override
+ public String toString() {
+ return "DeAllocate3gppService [serviceInstanceID=" + serviceInstanceID + ", globalSubscriberId="
+ + globalSubscriberId + ", subscriptionServiceType=" + subscriptionServiceType + ", networkType="
+ + networkType + ", additionalProperties=" + additionalProperties + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Modify3gppService.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Modify3gppService.java
new file mode 100644
index 0000000000..ffe76c06ef
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/Modify3gppService.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Model class for 3GPP service instance Update request
+ */
+public class Modify3gppService {
+
+ @JsonProperty("name")
+ private String name;
+
+ @JsonProperty("serviceInstanceID")
+ private String serviceInstanceID;
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+
+ @JsonProperty("networkType")
+ private String networkType;
+
+ @JsonProperty("additionalProperties")
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getServiceInstanceID() {
+ return serviceInstanceID;
+ }
+
+ public void setServiceInstanceID(String serviceInstanceID) {
+ this.serviceInstanceID = serviceInstanceID;
+ }
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ public void setNetworkType(String networkType) {
+ this.networkType = networkType;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+ @Override
+ public String toString() {
+ return "Modify3gppService [name=" + name + ", serviceInstanceID=" + serviceInstanceID + ", globalSubscriberId="
+ + globalSubscriberId + ", subscriptionServiceType=" + subscriptionServiceType + ", networkType="
+ + networkType + ", additionalProperties=" + additionalProperties + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/QuerySubnetCapability.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/QuerySubnetCapability.java
new file mode 100644
index 0000000000..2e479e1ecb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/QuerySubnetCapability.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans;
+
+
+import java.util.List;
+
+/**
+ * Model class for slice subnet capability query
+ */
+public class QuerySubnetCapability {
+
+ private SubnetTypes subnetType;
+
+ public SubnetTypes getSubnetType() {
+ return subnetType;
+ }
+
+ public void setSubnetType(SubnetTypes subnetType) {
+ this.subnetType = subnetType;
+ }
+
+ @Override
+ public String toString() {
+ return "QuerySubnetCapability [subnetType=" + subnetType + "]";
+ }
+
+}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/SubnetTypes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/SubnetTypes.java
new file mode 100644
index 0000000000..5d6deb7158
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/onap3gppserviceinstancebeans/SubnetTypes.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.onap3gppserviceinstancebeans;
+
+public enum SubnetTypes {
+ AN, AN_NF, CN, TN_FH, TN_MH, TN_BH
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java
new file mode 100644
index 0000000000..503af1bdcb
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/Onap3gppServiceInstancesTest.java
@@ -0,0 +1,181 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.junit.Assert.assertEquals;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.http.HttpStatus;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.util.UriComponentsBuilder;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class Onap3gppServiceInstancesTest extends BaseTest {
+
+ private String onap3gppServicesUri = "/onap/so/infra/onap3gppServiceInstances/";
+
+ private final ObjectMapper mapper = new ObjectMapper();
+
+ @Before
+ public void init() throws JsonProcessingException {
+
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setServiceModelUUID(defaultService.getModelUUID());
+ serviceRecipe.setRecipeTimeout(180);
+ serviceRecipe.setOrchestrationUri("/mso/async/services/commonNssmfTest");
+
+ wireMockServer.stubFor(get(urlPathEqualTo("/service/search/findFirstByModelNameOrderByModelVersionDesc"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlPathEqualTo("/serviceRecipe/search/findFirstByServiceModelUUIDAndAction"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/")).willReturn(aResponse()
+ .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_OK)));
+ Mockito.doReturn(null).when(requestsDbClient).getInfraActiveRequestbyRequestId(Mockito.any());
+ }
+
+ public String inputStream(String JsonInput) throws IOException {
+ JsonInput = "src/test/resources/Onap3gppServiceInstancesTest" + JsonInput;
+ return new String(Files.readAllBytes(Paths.get(JsonInput)));
+ }
+
+ public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
+ headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAP_PARTNER_NAME, "VID");
+ headers.set(REQUESTOR_ID, "xxxxxx");
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath));
+ HttpEntity<String> request = new HttpEntity<>(requestJson, headers);
+
+ return restTemplate.exchange(builder.toUriString(), reqMethod, request, String.class);
+ }
+
+ @Test
+ public void createServiceInstanceTest() throws IOException {
+ String uri = onap3gppServicesUri + "v1/allocate";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonNssmfTest")).willReturn(
+ aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/BPMN_response.json")
+ .withStatus(org.apache.http.HttpStatus.SC_ACCEPTED)));
+
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/allocateRequest.json"), uri, HttpMethod.POST);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+ @Test
+ public void updateServiceInstanceTest() throws IOException {
+ String uri = onap3gppServicesUri + "v1/modify";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonNssmfTest")).willReturn(
+ aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/BPMN_response.json")
+ .withStatus(org.apache.http.HttpStatus.SC_ACCEPTED)));
+
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/modifyRequest.json"), uri, HttpMethod.PUT);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+ @Test
+ public void deleteServiceInstanceTest() throws IOException {
+ String uri = onap3gppServicesUri + "v1/deAllocate";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonNssmfTest")).willReturn(
+ aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/BPMN_response.json")
+ .withStatus(org.apache.http.HttpStatus.SC_ACCEPTED)));
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/deAllocate.json"), uri, HttpMethod.DELETE);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+ @Test
+ public void activateServiceInstanceTest() throws IOException {
+ String uri = onap3gppServicesUri + "v1/activate";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonNssmfTest")).willReturn(
+ aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/BPMN_response.json")
+ .withStatus(org.apache.http.HttpStatus.SC_ACCEPTED)));
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/activateRequest.json"), uri, HttpMethod.POST);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+ @Test
+ public void deActivateServiceInstance() throws IOException {
+ String uri = onap3gppServicesUri + "v1/deActivate";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonNssmfTest")).willReturn(
+ aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/BPMN_response.json")
+ .withStatus(org.apache.http.HttpStatus.SC_ACCEPTED)));
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/deActivateRequest.json"), uri, HttpMethod.POST);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+}
+
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/activateRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/activateRequest.json
new file mode 100644
index 0000000000..e67809c80e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/activateRequest.json
@@ -0,0 +1,9 @@
+{
+ "serviceInstanceID": "NSSI-C-001-HDBNJ-NSSMF-01-A-ZX",
+ "networkType": "an/cn/tn",
+ "globalSubscriberId": "5GCustomer",
+ "subscriptionServiceType": "5G",
+ "additionalProperties": {
+ "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX"
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/allocateRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/allocateRequest.json
new file mode 100644
index 0000000000..24cea593b9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/allocateRequest.json
@@ -0,0 +1,55 @@
+{
+ "name": "eMBB-001",
+ "modelInvariantUuid": "NSST-C-001-HDBNJ-NSSMF-01-A-ZX",
+ "modelUuid": "NSST-C-001-HDBNJ-NSSMF-01-A-ZX-UUID",
+ "globalSubscriberId": "5GCustomer",
+ "subscriptionServiceType": "5G",
+ "networkType": "an/cn/tn",
+ "additionalProperties": {
+ "sliceProfile": {
+ "snssaiList": [
+ "001-100001"
+ ],
+ "sliceProfileId": "ab9af40f13f721b5f13539d87484098",
+ "plmnIdList": [
+ "460-00",
+ "460-01"
+ ],
+ "perfReq": {
+ "perfReqEmbbList ": [
+ {
+ "activityFactor": 50
+ }
+ ]
+ },
+ "maxNumberofUEs": 200,
+ "coverageAreaTAList": [
+ "1",
+ "2",
+ "3",
+ "4"
+ ],
+ "latency": 2,
+ "resourceSharingLevel": "non-shared"
+ },
+ "endPoints": [
+ {
+ "nodeId": "",
+ "additionalInfo": {
+ "xxx": "xxx"
+ }
+ },
+ {
+ "nodeId": "",
+ "additionalInfo": {
+ "xxx": "xxx"
+ }
+ }
+ ],
+ "nsiInfo": {
+ "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+ "nsiName": "eMBB-001"
+ },
+ "scriptName": "AN1"
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/deActivateRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/deActivateRequest.json
new file mode 100644
index 0000000000..e67809c80e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/deActivateRequest.json
@@ -0,0 +1,9 @@
+{
+ "serviceInstanceID": "NSSI-C-001-HDBNJ-NSSMF-01-A-ZX",
+ "networkType": "an/cn/tn",
+ "globalSubscriberId": "5GCustomer",
+ "subscriptionServiceType": "5G",
+ "additionalProperties": {
+ "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX"
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/deAllocate.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/deAllocate.json
new file mode 100644
index 0000000000..50729317e3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/deAllocate.json
@@ -0,0 +1,13 @@
+{
+ "serviceInstanceID": "NSSI-C-001-HDBNJ-NSSMF-01-A-ZX ",
+ "networkType": "an/cn/tn",
+ "globalSubscriberId": "5GCustomer",
+ "subscriptionServiceType": "5G",
+ "additionalProperties": {
+ "snssaiList": [
+ "001-100001"
+ ],
+ "scriptName": "AN1",
+ "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX"
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/modifyRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/modifyRequest.json
new file mode 100644
index 0000000000..6a7db0165b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Onap3gppServiceInstancesTest/modifyRequest.json
@@ -0,0 +1,18 @@
+{
+ "name": "eMBB-001",
+ "globalSubscriberId": "5GCustomer",
+ "subscriptionServiceType": "5G",
+ "networkType": "an/cn/tn",
+ "serviceInstanceID": "NSSI-C-001-HDBNJ-NSSMF-01-A-ZX",
+ "additionalProperties": {
+ "modifyAction": "allocate/deallocate",
+ "snssaiList": [
+ "001-100001"
+ ],
+ "nsiInfo": {
+ "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+ "nsiName": "eMBB-001"
+ },
+ "scriptName": "AN1"
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/BPMN_response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/BPMN_response.json
new file mode 100644
index 0000000000..b2c29ac4c6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/BPMN_response.json
@@ -0,0 +1,7 @@
+{
+ "response":"{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}",
+ "message":"Success",
+ "processInstanceID":"8878ccf8-1efc-11e8-b332-0050569a141e",
+ "variables":null,
+ "messageCode":202
+}