aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra
diff options
context:
space:
mode:
authorraviteja.karumuri <raviteja.karumuri@est.tech>2023-01-25 13:45:59 +0000
committerraviteja.karumuri <raviteja.karumuri@est.tech>2023-02-10 11:49:22 +0000
commit1a6b1ef83417efbbb8ec7cfe204c105e49e7e1f2 (patch)
treeff8d77a06139509fe9b29dc98f194ccf1e356409 /mso-api-handlers/mso-api-handler-infra
parent9cb10c58aacb2c0a79b0c93accf1ca4fe29522f9 (diff)
[SO] Create changes for SO-API and BPMN-INFRA to support CNF's through ASD
Issue-ID: SO-4069 Signed-off-by: raviteja.karumuri <raviteja.karumuri@est.tech> Change-Id: Ia8defe62c70e126df683ca523b10efe55a26db87
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
-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
}