aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java27
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ModelType.java2
4 files changed, 39 insertions, 5 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index 64c42a0498..af507c6d56 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -376,7 +376,9 @@ public class MsoRequest {
aq.setInstanceGroupId(servInsReq.getInstanceGroupId());
aq.setInstanceGroupName(requestInfo.getInstanceName());
}
- if (ModelType.vnf.name().equalsIgnoreCase(requestScope)) {
+
+ if (ModelType.vnf.name().equalsIgnoreCase(requestScope)
+ || ModelType.cnf.name().equalsIgnoreCase(requestScope)) {
if (requestInfo != null) {
aq.setVnfName(requestInfo.getInstanceName());
}
@@ -712,7 +714,8 @@ public class MsoRequest {
} else if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
vnfType = serviceModelName + "/" + vnfModelName;
sir.setVolumeGroupInstanceId(volumeGroupId);
- } else if (requestScope.equalsIgnoreCase(ModelType.vnf.name()))
+ } else if (requestScope.equalsIgnoreCase(ModelType.vnf.name())
+ || requestScope.equalsIgnoreCase(ModelType.cnf.name()))
vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
return vnfType;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index a0f3e1a20a..4338e6109e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -406,7 +406,8 @@ public class RequestHandlerUtils extends AbstractRestHandler {
if (StringUtils.isNotBlank(instanceId)) {
if (ModelType.service.name().equalsIgnoreCase(requestScope)) {
currentActiveReq.setServiceInstanceId(instanceId);
- } else if (ModelType.vnf.name().equalsIgnoreCase(requestScope)) {
+ } else if (ModelType.vnf.name().equalsIgnoreCase(requestScope)
+ || ModelType.cnf.name().equalsIgnoreCase(requestScope)) {
currentActiveReq.setVnfId(instanceId);
} else if (ModelType.vfModule.name().equalsIgnoreCase(requestScope)) {
currentActiveReq.setVfModuleId(instanceId);
@@ -547,6 +548,9 @@ public class RequestHandlerUtils extends AbstractRestHandler {
requestScope = ModelType.vnf.name();
} else if (requestUri.contains(ModelType.pnf.name())) {
requestScope = ModelType.pnf.name();
+
+ } else if (requestUri.contains(ModelType.cnf.name())) {
+ requestScope = ModelType.cnf.name();
} else {
requestScope = ModelType.service.name();
}
@@ -727,6 +731,8 @@ public class RequestHandlerUtils extends AbstractRestHandler {
recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
} else if (modelInfo.getModelType().equals(ModelType.instanceGroup)) {
recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
+ } else if (modelInfo.getModelType().equals(ModelType.cnf)) {
+ recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
}
if (recipeLookupResult == null) {
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
@@ -379,6 +381,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<String, String> 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)
@Produces(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);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ModelType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ModelType.java
index e24ecd4eac..723bdd558b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ModelType.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/vnfbeans/ModelType.java
@@ -24,5 +24,5 @@ package org.onap.so.apihandlerinfra.vnfbeans;
* Enum for Status values returned by API Handler to Tail-F
*/
public enum ModelType {
- service, vnf, vfModule, volumeGroup, network
+ service, vnf, vfModule, volumeGroup, network, cnf
}