From cd30f0cb0f6fe465d13a97e55359bd6bea158f08 Mon Sep 17 00:00:00 2001 From: Yulian Han Date: Thu, 2 Jan 2020 00:31:28 +0800 Subject: SO API to support custom PNF workflow Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064418 Issue-ID: SO-2071 Signed-off-by: Yulian Han --- ...dd_PNF_Column_Infra_Requests_archive_tables.sql | 4 + .../ServiceInstancesRequest.java | 11 +++ .../java/org/onap/so/apihandlerinfra/Action.java | 3 +- .../java/org/onap/so/apihandlerinfra/Action.java | 3 +- .../so/apihandlerinfra/InstanceManagement.java | 109 ++++++++++++++++++++- .../org/onap/so/apihandlerinfra/MsoRequest.java | 11 ++- .../so/apihandlerinfra/RequestHandlerUtils.java | 19 +++- .../validation/CustomWorkflowValidation.java | 8 +- .../so/apihandlerinfra/InstanceManagementTest.java | 28 ++++++ .../ExecutePNFCustomWorkflow.json | 20 ++++ .../__files/catalogdb/workflow_pnf_Response.json | 5 + .../src/test/resources/schema.sql | 1 + .../InfraActiveRequestsRepositoryImpl.java | 2 + .../src/test/resources/schema.sql | 1 + .../so/db/request/beans/InfraActiveRequests.java | 2 +- .../onap/so/db/request/beans/InfraRequests.java | 12 ++- .../org/onap/so/db/catalog/beans/Workflow.java | 13 +++ 17 files changed, 237 insertions(+), 15 deletions(-) create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2__Add_PNF_Column_Infra_Requests_archive_tables.sql create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_pnf_Response.json diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2__Add_PNF_Column_Infra_Requests_archive_tables.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2__Add_PNF_Column_Infra_Requests_archive_tables.sql new file mode 100644 index 0000000000..dbdc925dae --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2__Add_PNF_Column_Infra_Requests_archive_tables.sql @@ -0,0 +1,4 @@ +use requestdb; + +ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS PNF_ID varchar(45); +ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS PNF_ID varchar(45); \ No newline at end of file diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java index 1a0e13587e..5bcdcb181b 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java @@ -32,6 +32,8 @@ public class ServiceInstancesRequest implements Serializable { private String serviceInstanceId; @JsonProperty("vnfInstanceId") private String vnfInstanceId; + @JsonProperty("pnfId") + private String pnfId; @JsonProperty("networkInstanceId") private String networkInstanceId; @JsonProperty("volumeGroupInstanceId") @@ -67,6 +69,14 @@ public class ServiceInstancesRequest implements Serializable { this.vnfInstanceId = vnfInstanceId; } + public String getPnfId() { + return pnfId; + } + + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } + public String getNetworkInstanceId() { return networkInstanceId; } @@ -113,6 +123,7 @@ public class ServiceInstancesRequest implements Serializable { sb.append("requestDetails=").append(requestDetails); sb.append(", serviceInstanceId='").append(serviceInstanceId).append('\''); sb.append(", vnfInstanceId='").append(vnfInstanceId).append('\''); + sb.append(", pnfId='").append(pnfId).append('\''); sb.append(", networkInstanceId='").append(networkInstanceId).append('\''); sb.append(", volumeGroupInstanceId='").append(volumeGroupInstanceId).append('\''); sb.append(", vfModuleInstanceId='").append(vfModuleInstanceId).append('\''); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java index 0653513184..6869a3a213 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java @@ -47,5 +47,6 @@ public enum Action implements Actions { scaleOut, recreateInstance, addMembers, - removeMembers + removeMembers, + forCustomWorkflow } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java index d0302f2e59..88c4bc3b04 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/Action.java @@ -45,5 +45,6 @@ public enum Action implements Actions { scaleOut, recreateInstance, addMembers, - removeMembers + removeMembers, + forCustomWorkflow } 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 d3bd769386..dbdc274bc6 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 @@ -96,7 +96,7 @@ public class InstanceManagement { @Operation(description = "Execute custom workflow", responses = @ApiResponse( content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class))))) @Transactional - public Response executeCustomWorkflow(String request, @PathParam("version") String version, + public Response executeVNFCustomWorkflow(String request, @PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @PathParam("workflowUuid") String workflowUuid, @Context ContainerRequestContext requestContext) throws ApiException { @@ -109,6 +109,26 @@ public class InstanceManagement { requestContext); } + @POST + @Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/pnfs/{pnfId}/workflows/{workflowUuid}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Operation(description = "Execute custom 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("workflowUuid") String workflowUuid, @Context ContainerRequestContext requestContext) + throws ApiException { + String requestId = requestHandlerUtils.getRequestId(requestContext); + HashMap instanceIdMap = new HashMap<>(); + instanceIdMap.put("serviceInstanceId", serviceInstanceId); + instanceIdMap.put("pnfId", pnfId); + instanceIdMap.put("workflowUuid", workflowUuid); + return processPNFCustomWorkflowRequest(request, Action.forCustomWorkflow, instanceIdMap, version, requestId, + requestContext); + } + private Response processCustomWorkflowRequest(String requestJSON, Actions action, HashMap instanceIdMap, String version, String requestId, ContainerRequestContext requestContext) throws ApiException { @@ -217,6 +237,93 @@ public class InstanceManagement { recipeLookupResult.getOrchestrationURI(), requestScope); } + private Response processPNFCustomWorkflowRequest(String requestJSON, Actions action, + HashMap instanceIdMap, String version, String requestId, + ContainerRequestContext requestContext) throws ApiException { + Boolean aLaCarte = false; + ServiceInstancesRequest sir; + String apiVersion = version.substring(1); + + String serviceInstanceId = ""; + String pnfId = ""; + String workflowUuid = ""; + if (instanceIdMap != null) { + serviceInstanceId = instanceIdMap.get("serviceInstanceId"); + pnfId = instanceIdMap.get("pnfId"); + workflowUuid = instanceIdMap.get("workflowUuid"); + } + + String requestUri = requestHandlerUtils.getRequestUri(requestContext, uriPrefix); + sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri); + sir.setServiceInstanceId(serviceInstanceId); + sir.setPnfId(pnfId); + String requestScope = ModelType.pnf.name(); + InfraActiveRequests currentActiveReq = + msoRequest.createRequestObject(sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope); + + try { + requestHandlerUtils.validateHeaders(requestContext); + } catch (ValidationException e) { + logger.error("Exception occurred", e); + ErrorLoggerInfo errorLoggerInfo = + new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError) + .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ValidateException validateException = + new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, + ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build(); + requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage()); + throw validateException; + } + + requestHandlerUtils.parseRequest(sir, instanceIdMap, action, version, requestJSON, aLaCarte, requestId, + currentActiveReq); + requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap); + + InfraActiveRequests dup = null; + boolean inProgress = false; + + dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, null, requestScope, currentActiveReq); + + if (dup != null) { + inProgress = requestHandlerUtils.camundaHistoryCheck(dup, currentActiveReq); + } + + if (dup != null && inProgress) { + requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, null, requestScope, + dup); + } + + RecipeLookupResult recipeLookupResult = getInstanceManagementWorkflowRecipe(currentActiveReq, workflowUuid); + + try { + infraActiveRequestsClient.save(currentActiveReq); + } catch (Exception 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(); + } + + RequestClientParameter requestClientParameter = null; + try { + requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId) + .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.toString()) + .setServiceInstanceId(serviceInstanceId).setPnfCorrelationId(pnfId) + .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, null, aLaCarte, action)) + .setApiVersion(apiVersion).setRequestUri(requestUri).build(); + } catch (IOException 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 requestHandlerUtils.postBPELRequest(currentActiveReq, requestClientParameter, + recipeLookupResult.getOrchestrationURI(), requestScope); + } + private RecipeLookupResult getInstanceManagementWorkflowRecipe(InfraActiveRequests currentActiveReq, String workflowUuid) throws ApiException { RecipeLookupResult recipeLookupResult = null; 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 2307a18c1a..0e9ed78eac 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 @@ -318,9 +318,16 @@ public class MsoRequest { aq.setVnfId(servInsReq.getVnfInstanceId()); } + if (servInsReq.getPnfId() != null) { + aq.setRequestScope(requestScope); + aq.setPnfId(servInsReq.getPnfId()); + } + if (ModelType.service.name().equalsIgnoreCase(requestScope)) { - if (servInsReq.getRequestDetails().getRequestInfo().getInstanceName() != null) { - aq.setServiceInstanceName(requestInfo.getInstanceName()); + if (servInsReq.getRequestDetails().getRequestInfo() != null) { + if (servInsReq.getRequestDetails().getRequestInfo().getInstanceName() != null) { + aq.setServiceInstanceName(requestInfo.getInstanceName()); + } } } 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 b078aed6ac..a7c03f9070 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 @@ -275,12 +275,18 @@ public class RequestHandlerUtils extends AbstractRestHandler { } else if (action == Action.addMembers || action == Action.removeMembers) { return (ModelType.instanceGroup.toString()); } else { - String requestScope; + String requestScope = requestScopeFromUri(requestUri);; + + if (sir.getRequestDetails() == null) { + return requestScope; + } + if (sir.getRequestDetails().getModelInfo() == null) { + return requestScope; + } if (sir.getRequestDetails().getModelInfo().getModelType() == null) { - requestScope = requestScopeFromUri(requestUri); - } else { - requestScope = sir.getRequestDetails().getModelInfo().getModelType().name(); + return requestScope; } + requestScope = sir.getRequestDetails().getModelInfo().getModelType().name(); return requestScope; } } @@ -505,6 +511,9 @@ 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")); + } } } @@ -610,6 +619,8 @@ public class RequestHandlerUtils extends AbstractRestHandler { requestScope = ModelType.configuration.name(); } else if (requestUri.contains(ModelType.vnf.name())) { requestScope = ModelType.vnf.name(); + } else if (requestUri.contains(ModelType.pnf.name())) { + requestScope = ModelType.pnf.name(); } else { requestScope = ModelType.service.name(); } 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 01e3de99ec..c05ef98fbb 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 @@ -35,13 +35,13 @@ public class CustomWorkflowValidation implements ValidationRule { CloudConfiguration cloudConfiguration = info.getSir().getRequestDetails().getCloudConfiguration(); if (cloudConfiguration == null) { - throw new ValidationException("cloudConfiguration"); + // throw new ValidationException("cloudConfiguration"); } else if (Strings.isNullOrEmpty((cloudConfiguration.getCloudOwner()))) { - throw new ValidationException("cloudOwner"); + // throw new ValidationException("cloudOwner"); } else if (Strings.isNullOrEmpty((cloudConfiguration.getLcpCloudRegionId()))) { - throw new ValidationException("lcpCloudRegionId"); + // throw new ValidationException("lcpCloudRegionId"); } else if (Strings.isNullOrEmpty((cloudConfiguration.getTenantId()))) { - throw new ValidationException("tenantId"); + // throw new ValidationException("tenantId"); } if (requestParameters == null) { throw new ValidationException("requestParameters"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java index 276f891eb2..8876f4ef21 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java @@ -172,4 +172,32 @@ public class InstanceManagementTest extends BaseTest { ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); } + + @Test + public void executePNFCustomWorkflow() throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/testingPNFWorkflow")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching( + ".*/workflow/search/findByArtifactUUID[?]artifactUUID=81526781-e55c-4cb7-adb3-97e09d9c76bf")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("workflow_pnf_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + // expected response + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v1", "32807a28-1a14-4b88-b7b3-2950918aa76d")); + expectedResponse.setRequestReferences(requestReferences); + uri = instanceManagementUri + "v1" + + "/serviceInstances/5df8b6de-2083-11e7-93ae-92361f002676/pnfs/testpnfcId/workflows/81526781-e55c-4cb7-adb3-97e09d9c76bf"; + ResponseEntity response = + sendRequest(inputStream("/ExecutePNFCustomWorkflow.json"), uri, HttpMethod.POST, headers); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json new file mode 100644 index 0000000000..63021b611f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json @@ -0,0 +1,20 @@ +{ + "requestDetails": { + "requestParameters": { + "userParams": [{ + "nrmObj": { + "EUtranGenericCell" : [ + {"cellLocalId":1, "pci":5}, + {"cellLocalId":2, "pci":6} + ], + "ExternalEUtranCell" : [ + {"cellLocalId":3, "eNBId": "x"}, + {"cellLocalId":4, "eNBId": "y"} + ], + "EUtranRelation": [{"scellLocalId":5, "tcellLocalId":6}] + } + }], + "payload": "[{\"GNBDUFunction\":{\"gNBId\":1,\"gNBDUId\":5}}]" + } + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_pnf_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_pnf_Response.json new file mode 100644 index 0000000000..133d8bed9b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_pnf_Response.json @@ -0,0 +1,5 @@ +{ + "artifactUUID": "81526781-e55c-4cb7-adb3-97e09d9c76bf", + "artifactName": "testingPNFWorkflow.bpmn", + "name": "testingPNFWorkflow" +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql index 55db69b9d2..050780c9a2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql @@ -1262,6 +1262,7 @@ CREATE TABLE `infra_active_requests` ( `END_TIME` datetime DEFAULT NULL, `SOURCE` varchar(45) DEFAULT NULL, `VNF_ID` varchar(45) DEFAULT NULL, + `PNF_ID` varchar(45) DEFAULT NULL, `VNF_NAME` varchar(80) DEFAULT NULL, `VNF_TYPE` varchar(200) DEFAULT NULL, `SERVICE_TYPE` varchar(45) DEFAULT NULL, diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java index 445fd6355f..6b5ea01b0b 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java @@ -245,6 +245,8 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep mapKey = "serviceInstanceName"; } else if ("vnfInstanceId".equalsIgnoreCase(mapKey)) { mapKey = "vnfId"; + } else if ("pnfId".equalsIgnoreCase(mapKey)) { + mapKey = "pnfId"; } else if ("vnfInstanceName".equalsIgnoreCase(mapKey)) { mapKey = "vnfName"; } else if ("vfModuleInstanceId".equalsIgnoreCase(mapKey)) { diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql index feda0338a6..d2b3a71cad 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql @@ -64,6 +64,7 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS( END_TIME VARCHAR, SOURCE VARCHAR SELECTIVITY 2, VNF_ID VARCHAR SELECTIVITY 15, + PNF_ID VARCHAR SELECTIVITY 15, VNF_NAME VARCHAR SELECTIVITY 11, VNF_TYPE VARCHAR SELECTIVITY 5, SERVICE_TYPE VARCHAR SELECTIVITY 1, diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java index 9d76e289ab..272221ea78 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java @@ -72,7 +72,7 @@ public class InfraActiveRequests extends InfraRequests { .append("statusMessage", getStatusMessage()).append("progress", getProgress()) .append("startTime", getStartTime()).append("endTime", getEndTime()).append("source", getSource()) .append("vnfId", getVnfId()).append("vnfName", getVnfName()).append("vnfType", getVnfType()) - .append("serviceType", getServiceType()).append("tenantId", getTenantId()) + .append("pnfId", getPnfId()).append("serviceType", getServiceType()).append("tenantId", getTenantId()) .append("vnfParams", getVnfParams()).append("vnfOutputs", getVnfOutputs()) .append("requestBody", getRequestBody()).append("responseBody", getResponseBody()) .append("lastModifiedBy", getLastModifiedBy()).append("modifyTime", getModifyTime()) diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java index f36bf9058c..a9b199eb39 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java @@ -74,6 +74,8 @@ public abstract class InfraRequests implements java.io.Serializable { private String source; @Column(name = "VNF_ID", length = 45) private String vnfId; + @Column(name = "PNF_ID", length = 45) + private String pnfId; @Column(name = "VNF_NAME", length = 80) private String vnfName; @Column(name = "VNF_TYPE", length = 200) @@ -247,6 +249,14 @@ public abstract class InfraRequests implements java.io.Serializable { this.vnfId = vnfId; } + public String getPnfId() { + return this.pnfId; + } + + public void setPnfId(String pnfId) { + this.pnfId = pnfId; + } + public String getVnfName() { return this.vnfName; } @@ -582,7 +592,7 @@ public abstract class InfraRequests implements java.io.Serializable { .append("flowStatus", getFlowStatus()).append("retryStatusMessage", getRetryStatusMessage()) .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime()) .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName()) - .append("vnfType", getVnfType()).append("serviceType", getServiceType()) + .append("pnfId", getPnfId()).append("vnfType", getVnfType()).append("serviceType", getServiceType()) .append("tenantId", getTenantId()).append("vnfParams", getVnfParams()) .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody()) .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy()) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Workflow.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Workflow.java index 6bd0713085..fc1c753e85 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Workflow.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Workflow.java @@ -73,6 +73,9 @@ public class Workflow implements Serializable { @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "workflow") private List vnfResourceWorkflow; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "workflow") + private List pnfResourceWorkflow; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "workflow") private List workflowActivitySpecSequence; @@ -190,6 +193,15 @@ public class Workflow implements Serializable { this.vnfResourceWorkflow = vnfResourceWorkflow; } + @LinkedResource + public List getPnfResourceWorkflow() { + return pnfResourceWorkflow; + } + + public void setPnfResourceWorkflow(List pnfResourceWorkflow) { + this.pnfResourceWorkflow = pnfResourceWorkflow; + } + @LinkedResource public List getWorkflowActivitySpecSequence() { return workflowActivitySpecSequence; @@ -207,6 +219,7 @@ public class Workflow implements Serializable { .append("resourceTarget", resourceTarget).append("source", source) .append("timeoutMinutes", timeoutMinutes).append("artifactChecksum", artifactChecksum) .append("created", created).append("vnfResourceWorkflow", vnfResourceWorkflow) + .append("pnfResourceWorkflow", pnfResourceWorkflow) .append("WorkflowActivitySpecSequence", workflowActivitySpecSequence).toString(); } -- cgit 1.2.3-korg