diff options
author | Chuanyu Chen <chenchuanyu@huawei.com> | 2020-02-21 07:59:17 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-21 07:59:17 +0000 |
commit | 8017827345ee6d9e3d1015879e191c5fad3a4257 (patch) | |
tree | 023991a035bf73db74907e6ae2edd6f9187fb9e4 /mso-api-handlers/mso-api-handler-infra/src/main/java | |
parent | b1861dea5628f79ec8728d6f8ed97ea4e6278095 (diff) | |
parent | 133d5eefe0d37963dc1d79915e275c1d21612e27 (diff) |
Merge "use pnfName in custom pnf workflow execution procedure"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java')
4 files changed, 16 insertions, 23 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java index 028abd6d25..88028d32a1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java @@ -95,7 +95,7 @@ public class InstanceManagement { @Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/workflows/{workflowUuid}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @Operation(description = "Execute custom workflow", responses = @ApiResponse( + @Operation(description = "Execute custom VNF workflow", responses = @ApiResponse( content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response executeVNFCustomWorkflow(String request, @PathParam("version") String version, @@ -112,20 +112,20 @@ public class InstanceManagement { } @POST - @Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/pnfs/{pnfId}/workflows/{workflowUuid}") + @Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/pnfs/{pnfName}/workflows/{workflowUuid}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - @Operation(description = "Execute custom workflow", responses = @ApiResponse( + @Operation(description = "Execute custom PNF workflow", responses = @ApiResponse( content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional public Response executePNFCustomWorkflow(String request, @PathParam("version") String version, - @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("pnfId") String pnfId, + @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("pnfName") String pnfName, @PathParam("workflowUuid") String workflowUuid, @Context ContainerRequestContext requestContext) throws ApiException { String requestId = requestHandlerUtils.getRequestId(requestContext); HashMap<String, String> instanceIdMap = new HashMap<>(); instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("pnfId", pnfId); + instanceIdMap.put("pnfName", pnfName); instanceIdMap.put("workflowUuid", workflowUuid); return processPNFCustomWorkflowRequest(request, Action.forCustomWorkflow, instanceIdMap, version, requestId, requestContext); @@ -255,18 +255,18 @@ public class InstanceManagement { String apiVersion = version.substring(1); String serviceInstanceId = ""; - String pnfId = ""; + String pnfName = ""; String workflowUuid = ""; if (instanceIdMap != null) { serviceInstanceId = instanceIdMap.get("serviceInstanceId"); - pnfId = instanceIdMap.get("pnfId"); + pnfName = instanceIdMap.get("pnfName"); workflowUuid = instanceIdMap.get("workflowUuid"); } String requestUri = requestHandlerUtils.getRequestUri(requestContext, uriPrefix); sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri); sir.setServiceInstanceId(serviceInstanceId); - sir.setPnfId(pnfId); + sir.setPnfName(pnfName); String requestScope = ModelType.pnf.name(); InfraActiveRequests currentActiveReq = msoRequest.createRequestObject(sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope); @@ -299,7 +299,7 @@ public class InstanceManagement { try { requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId) .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.toString()) - .setServiceInstanceId(serviceInstanceId).setPnfCorrelationId(pnfId) + .setServiceInstanceId(serviceInstanceId).setPnfCorrelationId(pnfName) .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, null, aLaCarte, action)) .setApiVersion(apiVersion).setRequestUri(requestUri).build(); } catch (IOException e) { 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 5c81f4e6a5..31e026b332 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 @@ -311,9 +311,9 @@ public class MsoRequest { aq.setVnfId(servInsReq.getVnfInstanceId()); } - if (servInsReq.getPnfId() != null) { + if (servInsReq.getPnfName() != null) { aq.setRequestScope(requestScope); - aq.setPnfId(servInsReq.getPnfId()); + aq.setPnfName(servInsReq.getPnfName()); } if (ModelType.service.name().equalsIgnoreCase(requestScope)) { 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 75b7e74d49..38fb1596d0 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 @@ -506,8 +506,8 @@ public class RequestHandlerUtils extends AbstractRestHandler { if (instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID) != null) { currentActiveReq.setInstanceGroupId(instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID)); } - if (instanceIdMap.get("PnfId") != null) { - currentActiveReq.setPnfId(instanceIdMap.get("PnfId")); + if (instanceIdMap.get("pnfName") != null) { + currentActiveReq.setPnfName(instanceIdMap.get("pnfName")); } } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java index c05ef98fbb..01c7fd33f9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java @@ -29,20 +29,13 @@ import com.google.common.base.Strings; public class CustomWorkflowValidation implements ValidationRule { + /** + * This function should be generic both for custom VNF workflow and PNF workflow + */ @Override public ValidationInformation validate(ValidationInformation info) throws ValidationException { RequestParameters requestParameters = info.getSir().getRequestDetails().getRequestParameters(); - CloudConfiguration cloudConfiguration = info.getSir().getRequestDetails().getCloudConfiguration(); - if (cloudConfiguration == null) { - // throw new ValidationException("cloudConfiguration"); - } else if (Strings.isNullOrEmpty((cloudConfiguration.getCloudOwner()))) { - // throw new ValidationException("cloudOwner"); - } else if (Strings.isNullOrEmpty((cloudConfiguration.getLcpCloudRegionId()))) { - // throw new ValidationException("lcpCloudRegionId"); - } else if (Strings.isNullOrEmpty((cloudConfiguration.getTenantId()))) { - // throw new ValidationException("tenantId"); - } if (requestParameters == null) { throw new ValidationException("requestParameters"); } |