From 76ab7b1e386d56504f9ae5bce8f37d6272340612 Mon Sep 17 00:00:00 2001 From: Yulian Han Date: Tue, 13 Nov 2018 20:40:26 +0800 Subject: Get Csar file bug fix modify getting openecomp.db.endpoint config codes Delete bug fix for R3 config changes Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064408 Issue-ID: SO-1194 Signed-off-by: Yulian Han --- .../resources/process/CreateDeviceResource.bpmn | 71 ++-------------------- .../resources/process/DeleteDeviceResource.bpmn | 71 ++-------------------- 2 files changed, 8 insertions(+), 134 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-flows/src/main/resources/process') diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn index 3c7be0937f..5fd2c69608 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn @@ -33,7 +33,7 @@ csi.sendSyncResponse(execution)]]> SequenceFlow_1rwaeun - SequenceFlow_1ylvnxq + SequenceFlow_1ss02ik @@ -53,7 +53,7 @@ dcsi.checkDevType(execution)]]> SequenceFlow_0h4378g - + @@ -74,39 +74,6 @@ dcsi.preProcessRequest(execution)]]> - - - - - - - - - - - - - - SequenceFlow_0pg3072 - SequenceFlow_0pkp4ce - - - - SequenceFlow_1ss02ik - SequenceFlow_0pg3072 - - - - - SequenceFlow_0pkp4ce - SequenceFlow_1ylvnxq - - - SequenceFlow_0b5nrig SequenceFlow_09s5dfc @@ -203,9 +170,9 @@ dcsi.prepareUpdateProgress(execution)]]> - + - + @@ -252,36 +219,6 @@ dcsi.prepareUpdateProgress(execution)]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn index f0baac0254..73d38b383c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn @@ -33,7 +33,7 @@ csi.sendSyncResponse(execution)]]> SequenceFlow_1rwaeun - SequenceFlow_1ylvnxq + SequenceFlow_1ss02ik @@ -53,7 +53,7 @@ dcsi.checkDevType(execution)]]> SequenceFlow_0h4378g - + @@ -74,39 +74,6 @@ dcsi.preProcessRequest(execution)]]> - - - - - - - - - - - - - - SequenceFlow_0pg3072 - SequenceFlow_0pkp4ce - - - - SequenceFlow_1ss02ik - SequenceFlow_0pg3072 - - - - - SequenceFlow_0pkp4ce - SequenceFlow_1ylvnxq - - - SequenceFlow_1g6azih SequenceFlow_003svcq @@ -203,9 +170,9 @@ dcsi.prepareUpdateProgress(execution)]]> - + - + @@ -252,36 +219,6 @@ dcsi.prepareUpdateProgress(execution)]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit 1.2.3-korg From 4d1397ae3c7b0ec2821becd31f3d05e7e7e5665d Mon Sep 17 00:00:00 2001 From: Lukasz Muszkieta Date: Wed, 14 Nov 2018 17:20:26 +0100 Subject: bug fixing during pnf flow service instance is now created Change-Id: Ibb1ce55ff7ea503aebbba2177284faba8fdae734 Issue-ID: SO-1212 Signed-off-by: Lukasz Muszkieta --- .../CreateVcpeResCustService_simplified.bpmn | 195 ++++++++++++++++----- 1 file changed, 147 insertions(+), 48 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-flows/src/main/resources/process') diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn index 3b1c56628e..02b564e81f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn @@ -315,7 +315,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]> SequenceFlow_11efpvh - + @@ -339,9 +339,9 @@ CreateVcpeResCustService.prepareDecomposeService(execution)]]> - + SequenceFlow_0gj4vud - + SequenceFlow_0clhseq @@ -366,25 +366,75 @@ CreateVcpeResCustService.processDecomposition(execution)]]> SequenceFlow_0gj4vud SequenceFlow_0clhseq + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0bt420h + SequenceFlow_0ocy2qp + + + SequenceFlow_1429lyc + SequenceFlow_0bt420h + + + + SequenceFlow_0ocy2qp + SequenceFlow_11gw54u + + + + SequenceFlow_1429lyc + + + + SequenceFlow_11gw54u + + + + + + - + - + - + - - + + - + @@ -394,14 +444,14 @@ CreateVcpeResCustService.processDecomposition(execution)]]> - - + + - + - + @@ -458,10 +508,10 @@ CreateVcpeResCustService.processDecomposition(execution)]]> - - + + - + @@ -475,9 +525,9 @@ CreateVcpeResCustService.processDecomposition(execution)]]> - + - + @@ -487,9 +537,9 @@ CreateVcpeResCustService.processDecomposition(execution)]]> - + - + @@ -628,9 +678,9 @@ CreateVcpeResCustService.processDecomposition(execution)]]> - + - + @@ -676,23 +726,23 @@ CreateVcpeResCustService.processDecomposition(execution)]]> - + - + - - + + - + - - + + - + @@ -795,10 +845,10 @@ CreateVcpeResCustService.processDecomposition(execution)]]> - - + + - + @@ -867,15 +917,15 @@ CreateVcpeResCustService.processDecomposition(execution)]]> - + - + - + - + @@ -944,32 +994,81 @@ CreateVcpeResCustService.processDecomposition(execution)]]> - + - - + + - + - - + + - + - - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg From 0578fc4948e8e98e5fe92e63832336f0b7e17e85 Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Thu, 15 Nov 2018 12:27:09 +0530 Subject: Fix auth token for request-db Fix auth token for request-db. Change-Id: I898781b2294392c5cd55df6fccd173f7274bc660 Issue-ID: SO-689 Signed-off-by: subhash kumar singh --- .../adapters/requestsdb/MsoRequestsDbAdapter.java | 11 ++ .../requestsdb/MsoRequestsDbAdapterImpl.java | 32 ++++++ .../scripts/CreateCustomE2EServiceInstance.groovy | 4 +- .../serviceTask/AbstractSdncOperationTask.java | 4 +- .../process/ActivateSDNCNetworkResource.bpmn | 2 +- .../process/Create3rdONAPE2EServiceInstance.bpmn | 8 +- .../process/CreateActivateSDNCResource.bpmn | 6 +- .../process/CreateCustomE2EServiceInstance.bpmn | 116 ++++++++++----------- .../resources/process/CreateDeviceResource.bpmn | 2 +- .../process/CreateSDNCNetworkResource.bpmn | 4 +- .../process/DeActivateSDNCNetworkResource.bpmn | 2 +- .../process/Delete3rdONAPE2EServiceInstance.bpmn | 8 +- .../process/DeleteCustomE2EServiceInstance.bpmn | 2 +- .../resources/process/DeleteDeviceResource.bpmn | 2 +- .../process/DeleteSDNCNetworkResource.bpmn | 4 +- .../process/UpdateCustomE2EServiceInstance.bpmn | 6 +- .../subprocess/DoCreateE2EServiceInstance.bpmn | 2 +- .../subprocess/DoCreateE2EServiceInstanceV2.bpmn | 10 +- .../DoCustomDeleteE2EServiceInstance.bpmn | 2 +- .../DoCustomDeleteE2EServiceInstanceV2.bpmn | 10 +- .../subprocess/DoDeleteE2EServiceInstance.bpmn | 2 +- .../resources/subprocess/DoDeleteResourcesV1.bpmn | 2 +- .../subprocess/DoScaleE2EServiceInstance.bpmn | 2 +- .../subprocess/DoUpdateE2EServiceInstance.bpmn | 2 +- 24 files changed, 144 insertions(+), 101 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-flows/src/main/resources/process') diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java index e28bdb2f96..0c2a49ae53 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java @@ -72,6 +72,17 @@ public interface MsoRequestsDbAdapter { @WebParam(name = "progress") @XmlElement(required = false) String progress, @WebParam(name = "reason") @XmlElement(required = false) String reason) throws MsoRequestsDbException; + @WebMethod + public void initServiceOperationStatus( + @WebParam(name = "serviceId") @XmlElement(required = true) String serviceId, + @WebParam(name = "operationId") @XmlElement(required = false) String operationId, + @WebParam(name = "operationType") @XmlElement(required = false) String operationType, + @WebParam(name = "userId") @XmlElement(required = false) String userId, + @WebParam(name = "result") @XmlElement(required = false) String result, + @WebParam(name = "operationContent") @XmlElement(required = false) String operationContent, + @WebParam(name = "progress") @XmlElement(required = false) String progress, + @WebParam(name = "reason") @XmlElement(required = false) String reason) throws MsoRequestsDbException; + @WebMethod public void initResourceOperationStatus(@WebParam(name = "serviceId") @XmlElement(required = true) String serviceId, @WebParam(name = "operationId") @XmlElement(required = true) String operationId, diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index 33b1028cbb..62e7e2e43c 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -214,6 +214,38 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { operationStatusRepository.save(operStatus); } + /** + * Init operation status
+ * + * @param serviceId + * @param operationId + * @param operationType + * @param userId + * @param result + * @param operationContent + * @param progress + * @param reason + * @throws MsoRequestsDbException + * @since ONAP Casablanca Release + */ + @Override + @Transactional + public void initServiceOperationStatus(String serviceId, String operationId, String operationType, String userId, + String result, String operationContent, String progress, String reason) throws MsoRequestsDbException { + OperationStatus operStatus = new OperationStatus(); + + operStatus.setOperationId(operationId); + operStatus.setServiceId(serviceId); + operStatus.setUserId(userId); + operStatus.setOperation(operationType); + operStatus.setReason(reason); + operStatus.setProgress(progress); + operStatus.setResult(result); + operStatus.setOperationContent(operationContent); + operStatus.setResult(result); + operationStatusRepository.save(operStatus); + } + /** * init the operation status of all the resources
* diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index 6ef446b490..02ae6a6f48 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -302,7 +302,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor xmlns:ns="http://org.onap.so/requestsdb"> - + ${MsoUtils.xmlEscape(serviceId)} ${MsoUtils.xmlEscape(operationId)} ${MsoUtils.xmlEscape(operationType)} @@ -311,7 +311,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor ${MsoUtils.xmlEscape(operationContent)} ${MsoUtils.xmlEscape(progress)} ${MsoUtils.xmlEscape(reason)} - + """ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 3c4a35737b..0a00a61f83 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java @@ -93,7 +93,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { logger.info("AbstractSdncOperationTask.updateResOperStatus begin!"); String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); HttpPost httpPost = new HttpPost(requestsdbEndPoint); - httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk"); httpPost.addHeader("Content-type", "application/soap+xml"); String postBody = getPostStringBody(resourceOperationStatus); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); @@ -174,7 +174,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask { logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!"); String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint"); HttpPost httpPost = new HttpPost(requestsdbEndPoint); - httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk"); + httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk"); httpPost.addHeader("Content-type", "application/soap+xml"); String getBody = getGetStringBody(serviceId, operationId, resourceTemplateUUID); httpPost.setEntity(new StringEntity(getBody, ContentType.APPLICATION_XML)); diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn index fe2c8928d8..8cde4f6c56 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn @@ -38,7 +38,7 @@ dcsi.prepareUpdateAfterActivateSDNCResource(execution) application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn index 6a7cf8160a..6be6cc9899 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Create3rdONAPE2EServiceInstance.bpmn @@ -46,7 +46,7 @@ dcsi.prepareUpdateProgress(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} @@ -82,7 +82,7 @@ dcsi.doCreateE2ESIin3rdONAP(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} @@ -199,7 +199,7 @@ dcsi.prepareUpdateProgress(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} @@ -311,7 +311,7 @@ dcsi.prepareUpdateProgress(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateActivateSDNCResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateActivateSDNCResource.bpmn index 29d7a11175..5f4f964008 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateActivateSDNCResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateActivateSDNCResource.bpmn @@ -79,7 +79,7 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} @@ -101,7 +101,7 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} @@ -147,7 +147,7 @@ dcsi.prepareUpdateAfterActivateSDNCResource(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn index 6f73b46e2e..04ff48d4ed 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0s2spoq @@ -8,9 +8,9 @@ SequenceFlow_1dsbjjb SequenceFlow_1yay321 - import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution)]]> +ex.processJavaException(execution) SequenceFlow_1dsbjjb @@ -54,16 +54,16 @@ ex.processJavaException(execution)]]> SequenceFlow_0s2spoq SequenceFlow_0z4faf9 - import org.onap.so.bpmn.infrastructure.scripts.* def csi= new CreateCustomE2EServiceInstance() -csi.preProcessRequest(execution)]]> +csi.preProcessRequest(execution) SequenceFlow_14zu6wr SequenceFlow_0je30si - import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateCustomE2EServiceInstance() -csi.prepareCompletionRequest(execution)]]> +csi.prepareCompletionRequest(execution) @@ -88,9 +88,9 @@ csi.prepareCompletionRequest(execution)]]> SequenceFlow_0n9pexp SequenceFlow_01umodj - import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateCustomE2EServiceInstance() -csi.prepareFalloutRequest(execution)]]> +csi.prepareFalloutRequest(execution) @@ -107,9 +107,9 @@ csi.prepareFalloutRequest(execution)]]> SequenceFlow_0e1r62n SequenceFlow_0n9pexp - import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateCustomE2EServiceInstance() -csi.sendSyncError(execution)]]> +csi.sendSyncError(execution) @@ -119,9 +119,9 @@ csi.sendSyncError(execution)]]> SequenceFlow_081z8l2 SequenceFlow_19eilro - import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateCustomE2EServiceInstance() -csi.sendSyncResponse(execution)]]> +csi.sendSyncResponse(execution) SequenceFlow_0klbpxx @@ -138,19 +138,19 @@ csi.sendSyncResponse(execution)]]> - + #{execution.getVariable("WorkflowException") == null} - + #{execution.getVariable("WorkflowException") != null} SequenceFlow_0z4faf9 SequenceFlow_1euqjsp - import org.onap.so.bpmn.infrastructure.scripts.* def csi= new CreateCustomE2EServiceInstance() -csi.prepareInitServiceOperationStatus(execution)]]> +csi.prepareInitServiceOperationStatus(execution) @@ -160,7 +160,7 @@ csi.prepareInitServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} @@ -225,61 +225,61 @@ csi.prepareInitServiceOperationStatus(execution)]]> - - + + - - + + - - + + - - + + - - + + - - - - + + + + - - + + - - - - + + + + @@ -321,54 +321,54 @@ csi.prepareInitServiceOperationStatus(execution)]]> - - + + - - + + - - - - + + + + - - + + - - - - + + + + - - + + - - + + @@ -380,8 +380,8 @@ csi.prepareInitServiceOperationStatus(execution)]]> - - + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn index 5fd2c69608..29cec8ed1e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateDeviceResource.bpmn @@ -93,7 +93,7 @@ dcsi.prepareUpdateProgress(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn index a94569c29b..0bdc6dc0bd 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -62,7 +62,7 @@ dcsi.prepareUpdateBeforeCreateSDNCResource(execution) application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} @@ -84,7 +84,7 @@ dcsi.prepareUpdateBeforeCreateSDNCResource(execution) application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn index eaf37191d5..cfcd259d7c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn @@ -62,7 +62,7 @@ csi.sendSyncResponse(execution) application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn index 25fd6af574..f6dcff4435 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/Delete3rdONAPE2EServiceInstance.bpmn @@ -46,7 +46,7 @@ dcsi.prepareUpdateProgress(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} @@ -82,7 +82,7 @@ dcsi.doDeleteE2ESIin3rdONAP(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} @@ -192,7 +192,7 @@ dcsi.prepareUpdateProgress(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} @@ -303,7 +303,7 @@ dcsi.prepareUpdateProgress(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn index 2d68d650c5..7010442b5d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn @@ -152,7 +152,7 @@ csi.prepareInitServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn index 73d38b383c..7d9a9e2b5d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteDeviceResource.bpmn @@ -92,7 +92,7 @@ dcsi.prepareUpdateProgress(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn index 80fcc1762e..c2d4de3973 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn @@ -58,7 +58,7 @@ dcsi.prepareUpdateBeforeDeleteSDNCResource(execution) application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} @@ -80,7 +80,7 @@ dcsi.prepareUpdateBeforeDeleteSDNCResource(execution) application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn index 1be30d62e4..e2488fda6a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn @@ -136,7 +136,7 @@ csi.sendSyncError(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} @@ -246,7 +246,7 @@ csi.prepareInitServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} @@ -270,7 +270,7 @@ csi.prepareInitServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index 01040ba914..eccb9486dd 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -123,7 +123,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_initResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn index c699f911d0..31174a0b3e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn @@ -284,7 +284,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} @@ -317,7 +317,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} @@ -350,7 +350,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} @@ -381,7 +381,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_initResOperStatusRequest} @@ -404,7 +404,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn index 2e12dd3b96..1b02fd772d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn @@ -99,7 +99,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_initResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn index 2df19abf68..cc927b240b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn @@ -245,7 +245,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} @@ -278,7 +278,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} @@ -310,7 +310,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} @@ -349,7 +349,7 @@ ddsi.preUpdateServiceOperationStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateServiceOperStatusRequest} @@ -380,7 +380,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_initResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index 17f6c66e4a..fd3804c066 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -66,7 +66,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_initResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn index fe5e93cbec..16acb0d7e1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn @@ -119,7 +119,7 @@ ddrs.preProcessRequest(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_updateResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn index fa8a2213b0..dddbe18ba5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn @@ -30,7 +30,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_initResOperStatusRequest} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn index 8383ccbd1f..785db75fa1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn @@ -67,7 +67,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk + Basic YnBlbDpwYXNzd29yZDEk ${CVFMI_initResOperStatusRequest} -- cgit 1.2.3-korg From f891e734e3bc0d4b367f893e57b7efb5079d133c Mon Sep 17 00:00:00 2001 From: Rob Daugherty Date: Thu, 15 Nov 2018 15:09:30 -0500 Subject: Accept vCPE vfModuleNames in NB API This affects the vCPE custom flow. You can specify zero or more VF Module names (correlated with the model invariant UUID) in the user parameters, like this: "userParams": [ . . . { "name": "VfModuleNames", "value": [ { "VfModuleModelInvariantUuId": "5366deab-be06-44c7-b4f7-77e657b78b25", "VfModuleName": "VGW:e2:25:25:25:%" } ] } ] Change-Id: I673c04775bf5796079dc0ed19890e73e76820ac0 Issue-ID: SO-1213 Signed-off-by: Rob Daugherty --- .../scripts/DoCreateVnfAndModules.groovy | 39 +- .../vcpe/scripts/CreateVcpeResCustService.groovy | 36 +- .../scripts/DoCreateVnfAndModulesTest.groovy | 452 +++++++++++++++++++++ .../scripts/CreateVcpeResCustServiceTest.groovy | 12 +- .../VCPE/CreateVcpeResCustService/request.json | 33 +- .../process/CreateVcpeResCustServiceV2.bpmn | 1 + .../subprocess/DoCreateVnfAndModules.bpmn | 137 +++++-- 7 files changed, 646 insertions(+), 64 deletions(-) create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy (limited to 'bpmn/so-bpmn-infrastructure-flows/src/main/resources/process') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index d3dbd9107e..31f2977210 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -121,7 +121,10 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } } execution.setVariable("vnfId", vnfId) - + + Map vfModuleNames = execution.getVariable("vfModuleNames") + msoLogger.debug("Incoming vfModuleNames: " + vfModuleNames) + // Set aLaCarte to false execution.setVariable("aLaCarte", false) @@ -140,9 +143,17 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0") execution.setVariable("rollbackData", rollbackData) - sleep (20000) + String delayMS = execution.getVariable("delayMS") + long longDelayMS = 20000; + if (delayMS != null && !delayMS.isEmpty()) { + longDelayMS = Long.parseLong(delayMS); + } + if (longDelayMS > 0) { + msoLogger.debug("Delaying workflow " + longDelayMS + "ms"); + sleep(longDelayMS) + } }catch(BpmnError b){ msoLogger.debug("Rethrowing MSOWorkflowException") throw b @@ -154,7 +165,6 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { msoLogger.trace("COMPLETED DoCreateVnfAndModules PreProcessRequest Process") } - public void queryCatalogDB (DelegateExecution execution) { execution.setVariable("prefix",Prefix) @@ -162,8 +172,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { msoLogger.trace("STARTED DoCreateVnfAndModules QueryCatalogDB Process") try { VnfResource vnf = null - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") // if serviceDecomposition is specified, get info from serviceDecomposition + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") if (serviceDecomposition != null) { msoLogger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString()) List vnfs = serviceDecomposition.getVnfResources() @@ -211,6 +221,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } ModuleResource baseVfModule = null + Map vfModuleNames = execution.getVariable("vfModuleNames") for (int i = 0; i < vfModules.size; i++) { msoLogger.debug("handling VF Module ") @@ -225,6 +236,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("baseVfModuleLabel", baseVfModuleLabel) String basePersonaModelId = baseVfModuleModelInfoObject.getModelInvariantUuid() execution.setVariable("basePersonaModelId", basePersonaModelId) + String baseVfModuleName = getPredefinedVfModuleName(execution, basePersonaModelId) + execution.setVariable("baseVfModuleName", baseVfModuleName) baseVfModule = vfModule break } @@ -287,6 +300,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("addOnVfModuleLabel", addOnVfModuleLabel) String addOnPersonaModelId = addOnVfModuleModelInfoObject.getModelInvariantUuid() execution.setVariable("addOnPersonaModelId", addOnPersonaModelId) + String addOnVfModuleName = getPredefinedVfModuleName(execution, addOnPersonaModelId) + execution.setVariable("addOnVfModuleName", addOnVfModuleName) int addOnInitialCount = addOnModule.getInitialCount() execution.setVariable("initialCount", addOnInitialCount) @@ -463,5 +478,19 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { msoLogger.trace("Exit createLineOfBusiness") } + public String getPredefinedVfModuleName(DelegateExecution execution, String vfModuleModelInvariantUuid) { + Map vfModuleNames = execution.getVariable("vfModuleNames") + + if (vfModuleNames == null) { + return null + } + + String vfModuleName = vfModuleNames.get(vfModuleModelInvariantUuid) -} \ No newline at end of file + if (vfModuleName != null) { + msoLogger.debug("Using vfModuleName='" + vfModuleName + "' for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid) + } + + return vfModuleName + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 187189c694..eea784f591 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -99,7 +99,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { InitializeProcessVariables(execution) //Config Inputs - String aaiDistDelay = UrnPropertiesReader.getVariable("aai.workflowAaiDistributionDelay") + String aaiDistDelay = UrnPropertiesReader.getVariable("aai.workflowAaiDistributionDelay", execution) if (isBlank(aaiDistDelay)) { String msg = "workflowAaiDistributionDelay is null" msoLogger.debug(msg) @@ -211,14 +211,13 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { def userParams = reqMap.requestDetails?.requestParameters?.userParams Map inputMap = [:] - if (userParams) { + if (userParams) { userParams.each { - userParam -> + userParam -> if ("Customer_Location".equals(userParam?.name)) { Map customerMap = [:] userParam.value.each { param -> - inputMap.put(param.key, param.value) customerMap.put(param.key, param.value) } @@ -240,7 +239,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { param.getClass() , isDebugEnabled) } execution.setVariable("homingModelIds", modelIdLst) - } + } if ("BRG_WAN_MAC_Address".equals(userParam?.name)) { execution.setVariable("brgWanMacAddress", userParam.value) inputMap.put("BRG_WAN_MAC_Address", userParam.value) @@ -249,11 +248,34 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("homingService", userParam.value) execution.setVariable("callHoming", true) inputMap.put("Homing_Solution", userParam.value) - } + } if ("Orchestrator".equalsIgnoreCase(userParam?.name)) { execution.setVariable("orchestrator", userParam.value) inputMap.put("orchestrator", userParam.value) } + if ("VfModuleNames".equals(userParam?.name)) { + utils.log("DEBUG", "VfModuleNames: " + userParam.value.toString(), isDebugEnabled) + def vfModuleNames = [:] + userParam.value.each { + entry -> + String vfModuleModelInvariantUuid = null; + String vfModuleName = null; + entry.each { + param -> + if ("VfModuleModelInvariantUuid".equals(param.key)) { + vfModuleModelInvariantUuid = param.value; + } else if ("VfModuleName".equals(param.key)) { + vfModuleName = param.value; + } + } + + if (vfModuleModelInvariantUuid != null && !vfModuleModelInvariantUuid.isEmpty() && vfModuleName != null && !vfModuleName.isEmpty()) { + vfModuleNames.put(vfModuleModelInvariantUuid, vfModuleName) + utils.log("DEBUG", "VfModuleModelInvariantUuid: " + vfModuleModelInvariantUuid + " VfModuleName: " + vfModuleName, isDebugEnabled) + } + } + execution.setVariable("vfModuleNames", vfModuleNames) + } } } @@ -263,7 +285,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { } msoLogger.debug("User Input Parameters map: " + userParams.toString()) - execution.setVariable("serviceInputParams", inputMap) + execution.setVariable("serviceInputParams", inputMap) // DOES NOT SEEM TO BE USED msoLogger.debug("Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress')) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy new file mode 100644 index 0000000000..47db6b3b7b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy @@ -0,0 +1,452 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Assert +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.so.bpmn.core.domain.HomingSolution +import org.onap.so.bpmn.core.domain.InventoryType +import org.onap.so.bpmn.core.domain.License +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ModuleResource +import org.onap.so.bpmn.core.domain.NetworkResource +import org.onap.so.bpmn.core.domain.ResourceInstance +import org.onap.so.bpmn.core.domain.ResourceType +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.core.domain.VnfResource + +import static org.mockito.Mockito.* + +@RunWith(MockitoJUnitRunner.class) +class DoCreateVnfAndModulesTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + @Captor + static ArgumentCaptor captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Before + void init() throws IOException { + MockitoAnnotations.initMocks(this); + } + + @Test + void testPreProcessRequest() { + ExecutionEntity mockExecution = setupMock() + setupBasicProcessInputs(mockExecution) + + ServiceDecomposition serviceDecomposition = createServiceDecomposition() + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition) + + Map vfModuleNames = new HashMap() + vfModuleNames.put("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45", "VGWA:e2:25:25:25:%") + vfModuleNames.put("cc250e7e-746b-4d84-8064-df20c74213a6", "VGWB:f9:32:32:32:%") + when(mockExecution.getVariable("vfModuleNames")).thenReturn(vfModuleNames) + + DoCreateVnfAndModules obj = new DoCreateVnfAndModules() + obj.preProcessRequest(mockExecution) + + Mockito.verify(mockExecution, times(11)).setVariable(captor.capture(), captor.capture()) + + List list = captor.getAllValues() + for (int i = 0; i < list.size(); i+=2) { + System.out.println("captor[" + i/2 + "]: " + list.get(i) + + (i+1 < list.size() ? ("=" + list.get(i+1)) : "")) + } + + String someKey = list.get(18) + Assert.assertEquals("numOfCreatedAddOnModules", someKey) + Integer someValue = list.get(19) + Assert.assertEquals(0, someValue) + + String lastKey = list.get(20) + Assert.assertEquals("rollbackData", lastKey) + } + + @Test + void testQueryCatalogDB() { + ExecutionEntity mockExecution = setupMock() + setupBasicProcessInputs(mockExecution) + + ServiceDecomposition serviceDecomposition = createServiceDecomposition() + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition) + + DoCreateVnfAndModules obj = new DoCreateVnfAndModules() + obj.queryCatalogDB(mockExecution) + + Mockito.verify(mockExecution, times(11)).setVariable(captor.capture(), captor.capture()) + + List list = captor.getAllValues() + for (int i = 0; i < list.size(); i+=2) { + System.out.println("captor[" + i/2 + "]: " + list.get(i) + + (i+1 < list.size() ? ("=" + list.get(i+1)) : "")) + } + + String vfModuleNameKey = list.get(12) + Assert.assertEquals("baseVfModuleName", vfModuleNameKey) + String vfModuleNameValue = list.get(13) + Assert.assertEquals(null, vfModuleNameValue) + + String lastKey = list.get(20) + Assert.assertEquals("baseVfModuleId", lastKey) + } + + @Test + void testQueryCatalogDBWithVfModuleNames() { + ExecutionEntity mockExecution = setupMock() + setupBasicProcessInputs(mockExecution) + + ServiceDecomposition serviceDecomposition = createServiceDecomposition() + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition) + + Map vfModuleNames = new HashMap() + vfModuleNames.put("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45", "VGWA:e2:25:25:25:%") + vfModuleNames.put("cc250e7e-746b-4d84-8064-df20c74213a6", "VGWB:f9:32:32:32:%") + when(mockExecution.getVariable("vfModuleNames")).thenReturn(vfModuleNames) + + DoCreateVnfAndModules obj = new DoCreateVnfAndModules() + obj.queryCatalogDB(mockExecution) + + Mockito.verify(mockExecution, times(11)).setVariable(captor.capture(), captor.capture()) + + List list = captor.getAllValues() + for (int i = 0; i < list.size(); i+=2) { + System.out.println("captor[" + i/2 + "]: " + list.get(i) + + (i+1 < list.size() ? ("=" + list.get(i+1)) : "")) + } + + String vfModuleNameKey = list.get(12) + Assert.assertEquals("baseVfModuleName", vfModuleNameKey) + String vfModuleNameValue = list.get(13) + Assert.assertEquals("VGWA:e2:25:25:25:%", vfModuleNameValue) + + String lastKey = list.get(20) + Assert.assertEquals("baseVfModuleId", lastKey) + } + + @Test + void testPreProcessAddonModule() { + ExecutionEntity mockExecution = setupMock() + setupBasicProcessInputs(mockExecution) + + ServiceDecomposition serviceDecomposition = createServiceDecomposition() + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition) + + VnfResource vnf = serviceDecomposition.getVnfResources().get(0); + List vfModules = vnf.getAllVfModuleObjects() + + for (int i = vfModules.size()-1; i >= 0; i--) { + if (vfModules.get(i).getIsBase()) { + vfModules.remove(i); + } + } + + when(mockExecution.getVariable("addOnModules")).thenReturn(vfModules) + when(mockExecution.getVariable("addOnModulesDeployed")).thenReturn(0) + + DoCreateVnfAndModules obj = new DoCreateVnfAndModules() + obj.preProcessAddOnModule(mockExecution) + + Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) + + List list = captor.getAllValues() + for (int i = 0; i < list.size(); i+=2) { + System.out.println("captor[" + i/2 + "]: " + list.get(i) + + (i+1 < list.size() ? ("=" + list.get(i+1)) : "")) + } + + String vfModuleNameKey = list.get(14) + Assert.assertEquals("addOnVfModuleName", vfModuleNameKey) + String vfModuleNameValue = list.get(15) + Assert.assertEquals(null, vfModuleNameValue) + + String lastKey = list.get(16) + Assert.assertEquals("initialCount", lastKey) + } + + @Test + void testPreProcessAddonModuleWithVfModuleNames() { + ExecutionEntity mockExecution = setupMock() + setupBasicProcessInputs(mockExecution) + + ServiceDecomposition serviceDecomposition = createServiceDecomposition() + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition) + + Map vfModuleNames = new HashMap() + vfModuleNames.put("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45", "VGWA:e2:25:25:25:%") + vfModuleNames.put("cc250e7e-746b-4d84-8064-df20c74213a6", "VGWB:f9:32:32:32:%") + when(mockExecution.getVariable("vfModuleNames")).thenReturn(vfModuleNames) + + VnfResource vnf = serviceDecomposition.getVnfResources().get(0); + List vfModules = vnf.getAllVfModuleObjects() + + for (int i = vfModules.size()-1; i >= 0; i--) { + if (vfModules.get(i).getIsBase()) { + vfModules.remove(i); + } + } + + when(mockExecution.getVariable("addOnModules")).thenReturn(vfModules) + when(mockExecution.getVariable("addOnModulesDeployed")).thenReturn(0) + + DoCreateVnfAndModules obj = new DoCreateVnfAndModules() + obj.preProcessAddOnModule(mockExecution) + + Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture()) + + List list = captor.getAllValues() + for (int i = 0; i < list.size(); i+=2) { + System.out.println("captor[" + i/2 + "]: " + list.get(i) + + (i+1 < list.size() ? ("=" + list.get(i+1)) : "")) + } + + String vfModuleNameKey = list.get(14) + Assert.assertEquals("addOnVfModuleName", vfModuleNameKey) + String vfModuleNameValue = list.get(15) + Assert.assertEquals("VGWB:f9:32:32:32:%", vfModuleNameValue) + + String lastKey = list.get(16) + Assert.assertEquals("initialCount", lastKey) + } + + private static setupBasicProcessInputs(ExecutionEntity mockExecution) { + when(mockExecution.getVariable("prefix")).thenReturn("DCVAM_") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("28a7f01e-a6aa-44fd-b25e-e06e14873cd7") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("7d34a7df-d6c3-4f1c-8710-576412134a5a") + when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RegionOne") + when(mockExecution.getVariable("tenantId")).thenReturn("b8ad3842ab3642f7bf3fbe4e4d3b9f86") + when(mockExecution.getVariable("disableRollback")).thenReturn("true") + when(mockExecution.getVariable("delayMS")).thenReturn("0") + + } + + private static ExecutionEntity setupMock() { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateVnfAndModules") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVnfAndModules") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVnfAndModules") + when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVnfAndModules") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + public static ServiceDecomposition createServiceDecomposition() { + ServiceDecomposition serviceDecomposition = new ServiceDecomposition() + + ServiceInstance serviceInstance = new ServiceInstance() + serviceInstance.setInstanceId("7d34a7df-d6c3-4f1c-8710-576412134a5a") + serviceDecomposition.setServiceInstance(serviceInstance) + serviceDecomposition.setServiceType("") + serviceDecomposition.setServiceRole("") + + ModelInfo serviceModelInfo = new ModelInfo() + serviceDecomposition.setModelInfo(serviceModelInfo) + serviceModelInfo.setModelName("vcpesvc_rescust_1111") + serviceModelInfo.setModelUuid("1dffd5f9-bb29-4a47-8073-9b9b07f4943a") + serviceModelInfo.setModelVersion("1.0") + serviceModelInfo.setModelCustomizationUuid("") + serviceModelInfo.setModelCustomizationName("") + serviceModelInfo.setModelInstanceName("") + serviceModelInfo.setModelType("") + + List vnfResources = new ArrayList() + serviceDecomposition.setVnfResources(vnfResources) + + VnfResource vnfResource = new VnfResource() + vnfResources.add(vnfResource) + vnfResource.setResourceId("9504b6b3-d346-4387-952c-8f9b7570b055") + vnfResource.setResourceType(ResourceType.VNF) + ModelInfo vnfModelInfo = new ModelInfo() + vnfResource.setModelInfo(vnfModelInfo) + vnfModelInfo.setModelName("vcpevsp_vgw_1111") + vnfModelInfo.setModelUuid("289e96fd-a679-4286-a8a2-d76f930d650b") + vnfModelInfo.setModelInvariantUuid("0327af89-f836-4086-aadb-17d5c9bd8a83"); + vnfModelInfo.setModelVersion("1.0"); + vnfModelInfo.setModelCustomizationUuid("cf151beb-9510-44a1-a165-c783e673baa1"); + vnfModelInfo.setModelCustomizationName(""); + vnfModelInfo.setModelInstanceName("vcpevsp_vgw_1111 0") + vnfModelInfo.setModelType("") + vnfResource.setResourceInstance(new ResourceInstance()) + vnfResource.setHomingSolution(new HomingSolution()) + vnfResource.setToscaNodeType("org.openecomp.resource.vf.VcpevspVgw1111") + vnfResource.setMultiStageDesign("false") + vnfResource.setMultiStageDesign("false") + + List moduleResources = new ArrayList() + vnfResource.setModules(moduleResources) + + ModuleResource moduleResource = new ModuleResource() + moduleResources.add(moduleResource) + moduleResource.setResourceType(ResourceType.MODULE) + ModelInfo moduleModelInfo = new ModelInfo() + moduleResource.setModelInfo(moduleModelInfo); + moduleModelInfo.setModelName("VcpevspVgw1111..base_vcpe_vgw..module-0") + moduleModelInfo.setModelUuid("cf35b6b8-1f31-4efc-87a7-d53f840b8fdf") + moduleModelInfo.setModelInvariantUuid("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45") + moduleModelInfo.setModelVersion("1") + moduleModelInfo.setModelCustomizationUuid("281085b3-4598-4c94-811d-58cc685763e7") + moduleModelInfo.setModelCustomizationName("") + moduleModelInfo.setModelInstanceName("") + moduleModelInfo.setModelType("") + moduleResource.setResourceInstance(new ResourceInstance()) + moduleResource.setHomingSolution(new HomingSolution()) + moduleResource.setHasVolumeGroup(false) + moduleResource.setIsBase(true) + moduleResource.setVfModuleLabel("base_vcpe_vgw") + moduleResource.setInitialCount(1) + + // For testing an add-on module; not in the actual vCPE model + moduleResource = new ModuleResource() + moduleResources.add(moduleResource) + moduleResource.setResourceType(ResourceType.MODULE) + moduleModelInfo = new ModelInfo() + moduleResource.setModelInfo(moduleModelInfo); + moduleModelInfo.setModelName("VcpevspVgw1111..addon_vcpe_vgw..module-1") + moduleModelInfo.setModelUuid("8c8b41b2-8466-41b4-ae8d-5924830c40e8") + moduleModelInfo.setModelInvariantUuid("cc250e7e-746b-4d84-8064-df20c74213a6") + moduleModelInfo.setModelVersion("1") + moduleModelInfo.setModelCustomizationUuid("99424afc-1fb4-4598-a99b-3e0690b4cb03") + moduleModelInfo.setModelCustomizationName("") + moduleModelInfo.setModelInstanceName("") + moduleModelInfo.setModelType("") + moduleResource.setResourceInstance(new ResourceInstance()) + moduleResource.setHomingSolution(new HomingSolution()) + moduleResource.setHasVolumeGroup(false) + moduleResource.setIsBase(false) + moduleResource.setVfModuleLabel("addon_vcpe_vgw") + moduleResource.setInitialCount(1) + + serviceDecomposition.setNetworkResources(new ArrayList()) + + List allottedResources = new ArrayList() + serviceDecomposition.setAllottedResources(allottedResources) + + AllottedResource ar = new AllottedResource() + allottedResources.add(ar) + ar.setResourceId("ed4a3a9a-1411-4924-a9ee-61a41871a040") + ar.setResourceType(ResourceType.ALLOTTED_RESOURCE) + ModelInfo arModelInfo = new ModelInfo() + ar.setModelInfo(arModelInfo) + arModelInfo.setModelName("vcpear_tunnelxconn_1111") + arModelInfo.setModelUuid("d99e5442-c5e4-4197-ad8d-54f7ad43dd83") + arModelInfo.setModelInvariantUuid("61c17371-e824-4587-a9bb-21782aa28391") + arModelInfo.setModelVersion("1.0") + arModelInfo.setModelCustomizationUuid("506bb474-b8c2-41fd-aeec-4371c3ef58a4") + arModelInfo.setModelCustomizationName("") + arModelInfo.setModelInstanceName("vcpear_tunnelxconn_1111 0") + arModelInfo.setModelType("") + ar.setResourceInstance(new ResourceInstance()) + HomingSolution homingSolution = new HomingSolution() + ar.setHomingSolution(homingSolution) + homingSolution.setInventoryType(InventoryType.service) + homingSolution.setServiceInstanceId("d600c1c0-ff45-40e4-bf29-45a95fa64556") + homingSolution.setCloudOwner("CloudOwner") + homingSolution.setCloudRegionId("RegionOne") + VnfResource vnf = new VnfResource() + homingSolution.setVnf(vnf) + vnf.setResourceId("cea5e96e-9c67-437c-bf94-2329d277be09") + vnf.setResourceType(ResourceType.VNF) + vnf.setResourceInstance(new ResourceInstance()) + vnf.setHomingSolution(new HomingSolution()) + vnf.setVnfHostname("vnfHostName") + homingSolution.setLicense(new License()) + homingSolution.setRehome(false) + ar.setToscaNodeType("org.openecomp.resource.vf.VcpearTunnelxconn1111") + ar.setAllottedResourceType("TunnelXConnect") + ar.setAllottedResourceRole("TunnelXConn") + ar.setProvidingServiceModelName("org.openecomp.service.VcpesvcVgmux1111") + ar.setProvidingServiceModelInvariantUuid("d5751cb3-b9e9-470b-9c29-76a5e3ea12d0") + ar.setProvidingServiceModelUuid("61b6e96a-f0c6-4f34-a91c-dab3574dd025") + ar.setNfType("TunnelXConn") + ar.setNfRole("TunnelXConn") + + ar = new AllottedResource() + allottedResources.add(ar) + ar.setResourceId("3b1b3686-ccfe-4e7c-9d6b-76419db398f9") + ar.setResourceType(ResourceType.ALLOTTED_RESOURCE) + arModelInfo = new ModelInfo() + ar.setModelInfo(arModelInfo) + arModelInfo.setModelName("vcpear_brg_1111") + arModelInfo.setModelUuid("6b0a5aa5-98d8-455c-8cd1-618a3f1ac859") + arModelInfo.setModelInvariantUuid("531f9aa5-dea4-4958-89ad-ef03f77cbf07") + arModelInfo.setModelVersion("1.0") + arModelInfo.setModelCustomizationUuid("d23ac3fe-ea54-4060-a7c1-ec9178c79620") + arModelInfo.setModelCustomizationName("") + arModelInfo.setModelInstanceName("vcpear_brg_1111 0") + arModelInfo.setModelType("") + ar.setResourceInstance(new ResourceInstance()) + homingSolution = new HomingSolution() + ar.setHomingSolution(homingSolution) + homingSolution.setInventoryType(InventoryType.service) + homingSolution.setServiceInstanceId("bc28ebca-0cc3-4bf8-9ce9-d1524e4bec79") + homingSolution.setCloudOwner("CloudOwner") + homingSolution.setCloudRegionId("RegionOne") + vnf = new VnfResource() + homingSolution.setVnf(vnf) + vnf.setResourceId("65183e95-e6f1-46cb-9315-2da27a24c2b9") + vnf.setResourceType(ResourceType.VNF) + vnf.setResourceInstance(new ResourceInstance()) + vnf.setHomingSolution(new HomingSolution()) + vnf.setVnfHostname("vnfHostName") + homingSolution.setLicense(new License()) + homingSolution.setRehome(false) + ar.setToscaNodeType("org.openecomp.resource.vf.VcpearBrg1111") + ar.setAllottedResourceType("BRG") + ar.setAllottedResourceRole("BRG") + ar.setProvidingServiceModelName("org.openecomp.service.VcpesvcVbrg1111") + ar.setProvidingServiceModelInvariantUuid("6eff53bf-0045-41b0-bd48-b4e1284e5b7a") + ar.setProvidingServiceModelUuid("0e500bca-15ac-42eb-a2f1-4bfd3b2828ff") + ar.setNfType("BRG") + ar.setNfRole("BRG") + + return serviceDecomposition + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy index d0ded39146..160eee2337 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy @@ -85,10 +85,10 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { // ***** preProcessRequest ***** @Test - @Ignore // 1802 merge public void preProcessRequest() { ExecutionEntity mex = setupMock() def map = setupMap(mex) + initPreProcess(mex) CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() @@ -96,7 +96,6 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { verify(mex).getVariable(DBGFLAG) verify(mex).setVariable("prefix", Prefix) - verify(mex).setVariable("aaiDistDelay", "aaidelay") verify(mex).setVariable("createVcpeServiceRequest", request) verify(mex).setVariable("msoRequestId", "mri") assertEquals("sii", map.get("serviceInstanceId")) @@ -118,6 +117,8 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { def reqinfo = map.get(Prefix+"requestInfo") assertTrue(reqinfo.indexOf("mri= 0) assertTrue(reqinfo.indexOf("VID= 0) + + assertTrue(map.containsKey("vfModuleNames")) } @Test @@ -127,7 +128,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { def map = setupMap(mex) initPreProcess(mex) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(null) + when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn(null) CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() @@ -209,7 +210,6 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { .replace('"mdt1"', '"CloudOwner_CloudRegion1"') when(mex.getVariable("bpmnRequest")).thenReturn(req) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S") when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S") CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() @@ -230,8 +230,6 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { .replace('"mdt1"', '"CloudRegion1_"') when(mex.getVariable("bpmnRequest")).thenReturn(req) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(60) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S") when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S") CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService() @@ -1122,7 +1120,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { private void initPreProcess(ExecutionEntity mex) { when(mex.getVariable(DBGFLAG)).thenReturn("true") when(mex.getVariable("bpmnRequest")).thenReturn(request) - when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("aaidelay") + when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S") when(mex.getVariable("mso-request-id")).thenReturn("mri") when(mex.getVariable("serviceInstanceId")).thenReturn("sii") when(mex.getVariable("requestAction")).thenReturn("ra") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json index dc4669e8d9..766d27a26d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json @@ -23,6 +23,7 @@ }, "cloudConfiguration": { + "cloudOwner":"CloudOwner", "lcpCloudRegionId":"mdt1", "tenantId":"8b1df54faa3b49078e3416e21370a3ba" }, @@ -30,11 +31,37 @@ { "subscriptionServiceType":"123456789", "aLaCarte":"false", - "userParams": + "userParams":[ { - "BRG_WAN_MAC_Address" : "brgmac" + "name":"BRG_WAN_MAC_Address", + "value":"brgmac" + }, + { + "name":"Customer_Location", + "value":{ + "customerLatitude":"32.897480", + "customerLongitude":"-97.040443", + "customerName":"some_company" + } + }, + { + "name":"Homing_Solution", + "value":"sniro" + }, + { + "name":"VfModuleNames", + "value":[ + { + "VfModuleModelInvariantUuid":"c0e70c86-9813-4441-93c7-ad356a9a8d3b", + "VfModuleName":"VGWA:f4:56:56:56:%" + }, + { + "VfModuleModelInvariantUuid":"5366deab-be06-44c7-b4f7-77e657b78b25", + "VfModuleName":"VGWB:a9:18:18:18:%" + } + ] } + ] } - } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn index bfbdc25f18..2dbf12717c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn @@ -488,6 +488,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(execution)]]> + SequenceFlow_0ws7fjn SequenceFlow_1mkdhw9 diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn index b5988538e3..dec841c021 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0o4vuzt @@ -42,7 +42,8 @@ doCreateVnfAndModules.preProcessRequest(execution)]]> - SequenceFlow_1hf7k7q + SequenceFlow_0tbhtk8 + SequenceFlow_10nwzbe SequenceFlow_1ixcnb6 @@ -79,6 +80,7 @@ doCreateVnfAndModules.preProcessRequest(execution)]]> SequenceFlow_1lh21yl + SequenceFlow_12ffqm1 SequenceFlow_1llbx0k @@ -132,7 +134,6 @@ doCreateVnfAndModules.validateAddOnModule(execution)]]> SequenceFlow_19ohb1a - SequenceFlow_07u8e3l SequenceFlow_0jz6bqn @@ -157,12 +158,11 @@ doCreateVnfAndModules.queryCatalogDB(execution)]]> - + - @@ -173,8 +173,8 @@ doCreateVnfAndModules.queryCatalogDB(execution)]]> - SequenceFlow_07u8e3l - SequenceFlow_1hf7k7q + SequenceFlow_19ecf9p + SequenceFlow_0tbhtk8 @@ -186,7 +186,7 @@ doCreateVnfAndModules.queryCatalogDB(execution)]]> - SequenceFlow_0kld3qt + SequenceFlow_0ulldxo SequenceFlow_1lh21yl @@ -240,7 +240,6 @@ dcvam.postProcessRollback(execution)]]> - SequenceFlow_1vrogpr @@ -250,7 +249,7 @@ def doCreateVnfAndModules = new DoCreateVnfAndModules() doCreateVnfAndModules.postProcessAddOnModule(execution)]]> - + SequenceFlow_07u8e3l SequenceFlow_1t407j7 @@ -265,6 +264,25 @@ doCreateVnfAndModules.createPlatform(execution)]]> def doCreateVnfAndModules = new DoCreateVnfAndModules() doCreateVnfAndModules.createLineOfBusiness(execution)]]> + + SequenceFlow_0baw1tl + SequenceFlow_19ecf9p + SequenceFlow_10nwzbe + + + + + + + + SequenceFlow_0kld3qt + SequenceFlow_0ulldxo + SequenceFlow_12ffqm1 + + + + + @@ -303,16 +321,16 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]> - + - + - + @@ -323,11 +341,9 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]> - - - + - + @@ -356,10 +372,10 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]> - - + + - + @@ -377,27 +393,21 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]> - - - - - - - - + - + - + - - + + + - + @@ -485,13 +495,6 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]> - - - - - - - @@ -512,9 +515,9 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]> - + - + @@ -523,6 +526,56 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg From a8c9cca7c94c327015b95b4c59efc5b56ba49109 Mon Sep 17 00:00:00 2001 From: Rob Daugherty Date: Tue, 20 Nov 2018 11:41:57 -0500 Subject: Fix for vCPE flows A sequence flow was accidentally deleted in the DoCreateVnfAndModules process. This fixes it. Also adding VfModuleModuleNames support for the original (Not V2) version of CreateVcpeResCustService. Change-Id: I20bba7448802a548bb913bc2e016c9c0f2abdd42 Issue-ID: SO-1213 Signed-off-by: Rob Daugherty --- .../src/main/resources/process/CreateVcpeResCustService.bpmn | 3 ++- .../src/main/resources/subprocess/DoCreateVnfAndModules.bpmn | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-flows/src/main/resources/process') diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn index 7413e6df83..54f0947d29 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_7 @@ -518,6 +518,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceBRG(execution)]]> + SequenceFlow_0ws7fjn SequenceFlow_1mkdhw9 diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn index dec841c021..016aaa20d2 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn @@ -134,6 +134,7 @@ doCreateVnfAndModules.validateAddOnModule(execution)]]> SequenceFlow_19ohb1a + SequenceFlow_0oxfrrr SequenceFlow_0jz6bqn @@ -251,7 +252,7 @@ doCreateVnfAndModules.postProcessAddOnModule(execution)]]> - SequenceFlow_07u8e3l + SequenceFlow_0oxfrrr SequenceFlow_1t407j7 + @@ -576,6 +578,13 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]> + + + + + + + -- cgit 1.2.3-korg From 522bb0f585c7248a99c26cc10a5bbc0954e27e82 Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Wed, 5 Dec 2018 10:38:39 +0100 Subject: Use UUID to fill pnf-id in PNF PnP Issue-ID: SO-1272 Change-Id: If516b7ec38dad3fbc7409aff42275a98ef2af76b Signed-off-by: Joanna Jeremicz --- .../delegate/CreateAndActivatePnfResourceTest.java | 18 +- .../resources/applicationContext_forPnfTesting.xml | 2 +- .../delegate/CreateAaiEntryWithPnfIdDelegate.java | 57 ---- .../pnf/delegate/CreatePnfEntryInAaiDelegate.java | 66 ++++ .../pnf/delegate/ExecutionVariableNames.java | 3 + .../pnf/delegate/GeneratePnfUuidDelegate.java | 43 +++ .../pnf/delegate/PnfCheckInputs.java | 31 +- .../CreateAaiEntryWithPnfIdDelegateTest.java | 50 --- .../delegate/CreatePnfEntryInAaiDelegateTest.java | 56 ++++ .../pnf/delegate/GeneratePnfUuidDelegateTest.java | 41 +++ .../pnf/delegate/PnfCheckInputsTest.java | 89 +++-- .../process/CreateAndActivatePnfResource.bpmn | 53 +-- .../CreateVcpeResCustService_simplified.bpmn | 360 +++++++++++---------- 13 files changed, 520 insertions(+), 349 deletions(-) delete mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java delete mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java create mode 100644 bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java (limited to 'bpmn/so-bpmn-infrastructure-flows/src/main/resources/process') diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java index 2348af5dec..55910518e0 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * 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 @@ -20,6 +22,12 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; import org.assertj.core.api.Assertions; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.runtime.ProcessInstance; @@ -34,11 +42,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; -import java.util.HashMap; -import java.util.Map; - -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; - @RunWith(SpringRunner.class) @ContextConfiguration(locations = "/applicationContext_forPnfTesting.xml") public class CreateAndActivatePnfResourceTest { @@ -50,6 +53,7 @@ public class CreateAndActivatePnfResourceTest { @Autowired @Rule public ProcessEngineRule processEngineRule; + private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString(); @Autowired private AaiConnectionTestImpl aaiConnection; @@ -66,6 +70,7 @@ public class CreateAndActivatePnfResourceTest { Map variables = new HashMap<>(); variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITH_ENTRY); + variables.put(PNF_UUID, VALID_UUID); // when ProcessInstance instance = runtimeService .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); @@ -94,6 +99,7 @@ public class CreateAndActivatePnfResourceTest { Map variables = new HashMap<>(); variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITHOUT_ENTRY); + variables.put(PNF_UUID, VALID_UUID); // when ProcessInstance instance = runtimeService .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); @@ -106,7 +112,7 @@ public class CreateAndActivatePnfResourceTest { "CheckInputs", "CheckAiiForCorrelationId", "DoesAaiContainInfoAboutPnf", - "CreateAndActivatePnf_CreateAaiEntry", + "CreatePnfEntryInAai", "AaiEntryExists", "InformDmaapClient", "WaitForDmaapPnfReadyNotification", diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml index 3a41801d4a..9e9e5a2177 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml +++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml @@ -52,7 +52,7 @@ - + diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java deleted file mode 100644 index a8754cd4a0..0000000000 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.bpmn.infrastructure.pnf.delegate; - -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.onap.aai.domain.yang.Pnf; -import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * Implementation of "Create AAI entry with pnf-id = correlation_id" task in CreateAndActivatePnfResource.bpmn - * - * Inputs: - * - correlationId - String - */ -@Component -public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate { - - private AaiConnection aaiConnection; - - @Autowired - public void setAaiConnection(AaiConnection aaiConnection) { - this.aaiConnection = aaiConnection; - } - - @Override - public void execute(DelegateExecution execution) throws Exception { - String correlationId = (String) execution.getVariable(CORRELATION_ID); - Pnf pnf = new Pnf(); - pnf.setInMaint(true); - pnf.setPnfId(correlationId); - pnf.setPnfName(correlationId); - aaiConnection.createEntry(correlationId, pnf); - } -} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java new file mode 100644 index 0000000000..12cb6ffdff --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ + * 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.bpmn.infrastructure.pnf.delegate; + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.onap.aai.domain.yang.Pnf; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn + * + * Inputs: + * - correlationId - String + * - pnfUuid - String + */ +@Component +public class CreatePnfEntryInAaiDelegate implements JavaDelegate { + + private static final Logger logger = LoggerFactory.getLogger(CreatePnfEntryInAaiDelegate.class); + private AaiConnection aaiConnection; + + @Autowired + public void setAaiConnection(AaiConnection aaiConnection) { + this.aaiConnection = aaiConnection; + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + String correlationId = (String) execution.getVariable(CORRELATION_ID); + String pnfUuid = (String) execution.getVariable(PNF_UUID); + Pnf pnf = new Pnf(); + pnf.setInMaint(true); + pnf.setPnfId(pnfUuid); + pnf.setPnfName(correlationId); + aaiConnection.createEntry(correlationId, pnf); + logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", correlationId, pnfUuid); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java index b3f2f726a0..1407cb9211 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * 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 @@ -30,4 +32,5 @@ public class ExecutionVariableNames { public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp"; public final static String DMAAP_MESSAGE = "dmaapMessage"; public final static String TIMEOUT_FOR_NOTIFICATION = "timeoutForPnfEntryNotification"; + public final static String PNF_UUID = "pnfUuid"; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java new file mode 100644 index 0000000000..f5483e489e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegate.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ + * 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.bpmn.infrastructure.pnf.delegate; + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +public class GeneratePnfUuidDelegate implements JavaDelegate { + + private static final Logger logger = LoggerFactory.getLogger(GeneratePnfUuidDelegate.class); + + @Override + public void execute(DelegateExecution delegateExecution){ + UUID uuid = UUID.randomUUID(); + logger.debug("Generated UUID for pnf: {}, version: {}, variant: {}", uuid, uuid.version(), uuid.variant()); + delegateExecution.setVariable(PNF_UUID, uuid.toString()); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java index 164f51f579..c1ddf2e04e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ * 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 @@ -21,8 +23,10 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; +import com.google.common.base.Strings; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; import org.onap.so.bpmn.common.scripts.ExceptionUtil; @@ -34,6 +38,7 @@ import org.springframework.stereotype.Component; @Component public class PnfCheckInputs implements JavaDelegate { + public static final String UUID_REGEX = "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$"; private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class); private String defaultTimeout; @@ -45,19 +50,37 @@ public class PnfCheckInputs implements JavaDelegate { @Override public void execute(DelegateExecution execution) { + validateCorrelationId(execution); + validatePnfUuid(execution); + validateTimeout(execution); + } + + private void validateCorrelationId(DelegateExecution execution) { String correlationId = (String) execution.getVariable(CORRELATION_ID); - if (correlationId == null) { + if (Strings.isNullOrEmpty(correlationId)) { new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined"); } + } + + private void validatePnfUuid(DelegateExecution execution) { + String pnfUuid = (String) execution.getVariable(PNF_UUID); + if (Strings.isNullOrEmpty(pnfUuid)) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid variable not defined"); + } + if (!pnfUuid.matches(UUID_REGEX)) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid is not a valid UUID"); + } + } + + private void validateTimeout(DelegateExecution execution) { String timeout = (String) execution.getVariable(TIMEOUT_FOR_NOTIFICATION); - if (timeout == null) { + if (Strings.isNullOrEmpty(timeout)) { LOGGER.debug("timeoutForPnfEntryNotification variable not found, setting default"); if (defaultTimeout == null) { new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, - "default timeoutForPnfEntryNotification value not defined"); + "default timeoutForPnfEntryNotification value not defined"); } execution.setVariable(TIMEOUT_FOR_NOTIFICATION, defaultTimeout); } } - } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java deleted file mode 100644 index 465dc085fc..0000000000 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.bpmn.infrastructure.pnf.delegate; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.junit.Test; -import org.onap.aai.domain.yang.Pnf; - -public class CreateAaiEntryWithPnfIdDelegateTest { - - @Test - public void shouldSetPnfIdAndPnfName() throws Exception { - // given - CreateAaiEntryWithPnfIdDelegate delegate = new CreateAaiEntryWithPnfIdDelegate(); - AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl(); - delegate.setAaiConnection(aaiConnection); - DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(eq(CORRELATION_ID))).thenReturn("testCorrelationId"); - // when - delegate.execute(execution); - // then - Pnf createdEntry = aaiConnection.getCreated().get("testCorrelationId"); - assertThat(createdEntry.getPnfId()).isEqualTo("testCorrelationId"); - assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId"); - assertThat(createdEntry.isInMaint()).isTrue(); - } -} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java new file mode 100644 index 0000000000..ce6b766fa2 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright 2018 Nokia + * ================================================================================ + * 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.bpmn.infrastructure.pnf.delegate; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.BDDMockito.given; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Test; +import org.onap.aai.domain.yang.Pnf; + +public class CreatePnfEntryInAaiDelegateTest { + + @Test + public void shouldSetPnfIdAndPnfName() throws Exception { + // given + String pnfUuid = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString(); + CreatePnfEntryInAaiDelegate delegate = new CreatePnfEntryInAaiDelegate(); + AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl(); + delegate.setAaiConnection(aaiConnection); + DelegateExecution execution = mock(DelegateExecution.class); + given(execution.getVariable(eq(CORRELATION_ID))).willReturn("testCorrelationId"); + given(execution.getVariable(eq(PNF_UUID))).willReturn(pnfUuid); + // when + delegate.execute(execution); + // then + Pnf createdEntry = aaiConnection.getCreated().get("testCorrelationId"); + assertThat(createdEntry.getPnfId()).isEqualTo(pnfUuid); + assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId"); + assertThat(createdEntry.isInMaint()).isTrue(); + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java new file mode 100644 index 0000000000..c351706aff --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Nokia. + * ================================================================================ + * 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.bpmn.infrastructure.pnf.delegate; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Test; + +public class GeneratePnfUuidDelegateTest { + @Test + public void execute_shouldSetValidUuidAsPnfUuid() { + // given + GeneratePnfUuidDelegate delegate = new GeneratePnfUuidDelegate(); + DelegateExecution execution = new DelegateExecutionFake(); + // when + delegate.execute(execution); + // then + assertThat((String) execution.getVariable(PNF_UUID)).matches(PnfCheckInputs.UUID_REGEX); + } +} \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java index 2e8fb4be78..3e146be3c2 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java @@ -20,62 +20,89 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; +import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; import org.junit.Test; public class PnfCheckInputsTest { private static final String DEFAULT_TIMEOUT = "P1D"; + private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString(); + private static final String RESERVED_UUID = new UUID(0, 0).toString(); - private DelegateExecution mockDelegateExecution() { - new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); - return delegateExecution; + private DelegateExecution delegateExecution; + + @Before + public void setUp() { + delegateExecution = new DelegateExecutionFake(); + delegateExecution.setVariable("testProcessKey", "testProcessKeyValue"); } @Test - public void shouldThrowException_whenPnfIdNotSet() { - // given - PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution delegateExecution = mockDelegateExecution(); - // when, then + public void shouldThrowException_whenCorrelationIdNotSet() { + PnfCheckInputs testedObject = prepareExecutionForCorrelationId(null); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + + @Test + public void shouldThrowException_whenTimeoutIsEmptyStringAndDefaultIsNotDefined() { + PnfCheckInputs testedObject = prepareExecutionForTimeout(null, ""); assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } - private DelegateExecution mockDelegateExecutionWithCorrelationId() { - new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution delegateExecution = mockDelegateExecution(); - when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId"); - return delegateExecution; + @Test + public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() { + PnfCheckInputs testedObject = prepareExecutionForTimeout(DEFAULT_TIMEOUT, null); + testedObject.execute(delegateExecution); + assertThat(delegateExecution.getVariable(TIMEOUT_FOR_NOTIFICATION)).isEqualTo(DEFAULT_TIMEOUT); } @Test - public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() { - // given - PnfCheckInputs testedObject = new PnfCheckInputs(null); - DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); - // when, then + public void shouldThrowException_whenPnfUuidIsNotSet() { + PnfCheckInputs testedObject = prepareExecutionForUuid(null); assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); } @Test - public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() { - // given + public void shouldThrowException_whenPnfUuidIsEmptyString() { + PnfCheckInputs testedObject = prepareExecutionForUuid(""); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + + @Test + public void shouldThrowException_whenPnfUuidIsReservedUuid() { + PnfCheckInputs testedObject = prepareExecutionForUuid(RESERVED_UUID); + assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class); + } + + private PnfCheckInputs prepareExecutionForCorrelationId(String correlationId) { PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); - DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId(); - // when - testedObject.execute(delegateExecution); - // then - verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(DEFAULT_TIMEOUT)); + delegateExecution.setVariable(CORRELATION_ID, correlationId); + delegateExecution.setVariable(PNF_UUID, VALID_UUID); + return testedObject; + } + + private PnfCheckInputs prepareExecutionForTimeout(String defaultTimeout, String timeout) { + PnfCheckInputs testedObject = new PnfCheckInputs(defaultTimeout); + delegateExecution.setVariable(CORRELATION_ID, "testCorrelationId"); + delegateExecution.setVariable(PNF_UUID, VALID_UUID); + delegateExecution.setVariable(TIMEOUT_FOR_NOTIFICATION, timeout); + return testedObject; + } + + private PnfCheckInputs prepareExecutionForUuid(String uuid) { + PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT); + delegateExecution.setVariable(CORRELATION_ID, "testCorrelationId"); + delegateExecution.setVariable(PNF_UUID, uuid); + return testedObject; } } \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn index e0b14ab0db..d8079174c1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn @@ -1,10 +1,10 @@ - + - + @@ -14,12 +14,12 @@ - + #{!aaiContainsInfoAboutPnf} - + @@ -35,16 +35,11 @@ SequenceFlow_1kc34bc SequenceFlow_1miyzfe - + SequenceFlow_17s9025 SequenceFlow_1o8od8e - - SequenceFlow_1qr6cmf - SequenceFlow_1l1t6ak - SequenceFlow_17s9025 - - + SequenceFlow_0v5ffpe SequenceFlow_1qr6cmf @@ -77,11 +72,17 @@ #{timeoutForPnfEntryNotification} + + SequenceFlow_1l1t6ak + SequenceFlow_1qr6cmf + SequenceFlow_17s9025 + Inputs:  - timeoutForPnfEntryNotification - String - correlationId - String + - uuid - String @@ -113,7 +114,7 @@ - + @@ -124,12 +125,12 @@ - + - - + + - + @@ -141,7 +142,7 @@ - + @@ -186,18 +187,12 @@ - - - - - - - + - + @@ -207,7 +202,7 @@ - + @@ -281,6 +276,12 @@ + + + + + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn index 02b564e81f..3940dece12 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService_simplified.bpmn @@ -1,12 +1,12 @@ - + SequenceFlow_7 SequenceFlow_3 - import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.sendSyncResponse(execution)]]> +CreateVcpeResCustService.sendSyncResponse(execution) @@ -16,10 +16,9 @@ CreateVcpeResCustService.sendSyncResponse(execution)]]> SequenceFlow_1 SequenceFlow_7 - import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.preProcessRequest(execution) -]]> +CreateVcpeResCustService.preProcessRequest(execution) @@ -29,9 +28,9 @@ CreateVcpeResCustService.preProcessRequest(execution) SequenceFlow_0afe2pg SequenceFlow_29 - import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.postProcessResponse(execution)]]> +CreateVcpeResCustService.postProcessResponse(execution) @@ -52,8 +51,8 @@ CreateVcpeResCustService.postProcessResponse(execution)]]> SequenceFlow_8 SequenceFlow_6 - + // The following variable is checked by the unit test +execution.setVariable("CreateVcpeResCustServiceSuccessIndicator", true) @@ -72,9 +71,9 @@ execution.setVariable("CreateVcpeResCustServiceSuccessIndicator", true)]]> SequenceFlow_2 SequenceFlow_5 - import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution)]]> +ex.processJavaException(execution) @@ -124,16 +123,16 @@ ex.processJavaException(execution)]]> SequenceFlow_0jg47xm SequenceFlow_0807ukc - import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.prepareFalloutRequest(execution)]]> +CreateVcpeResCustService.prepareFalloutRequest(execution) - + #{execution.getVariable("disableRollback") != true} - + #{execution.getVariable("PONR") == true} @@ -176,16 +175,16 @@ CreateVcpeResCustService.prepareFalloutRequest(execution)]]> SequenceFlow_02o4yqx SequenceFlow_0ftzjjm - import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService= new CreateVcpeResCustService() -CreateVcpeResCustService.preProcessRollback(execution)]]> +CreateVcpeResCustService.preProcessRollback(execution) SequenceFlow_0dvsqpp SequenceFlow_1rabks0 - import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService= new CreateVcpeResCustService() -CreateVcpeResCustService.postProcessRollback(execution)]]> +CreateVcpeResCustService.postProcessRollback(execution) @@ -210,7 +209,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]> SequenceFlow_027lz43 - + #{execution.getVariable("DCARBRG_rollbackData") != null } @@ -231,7 +230,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]> SequenceFlow_0dr2fem - + #{ execution.getVariable("DCARBRG_rolledBack") == true } @@ -240,7 +239,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]> SequenceFlow_1mbymcu - + #{ execution.getVariable("DCVAM_rolledBack") ==true } @@ -259,7 +258,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]> - + #{execution.getVariable("rolledBack") != null && execution.getVariable("rolledBack") == false} @@ -275,7 +274,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]> SequenceFlow_0ne9n0g - + #{execution.getVariable("DCARTXC_rollbackData") != null } SequenceFlow_0ne9n0g @@ -284,11 +283,11 @@ CreateVcpeResCustService.postProcessRollback(execution)]]> - + #{ execution.getVariable("DCRESI_rollbackData") != null } - + #{ execution.getVariable("DCARTXC_rolledBack") == true } @@ -303,13 +302,13 @@ CreateVcpeResCustService.postProcessRollback(execution)]]> - + #{execution.getVariable("DCVAM_rollbackData") != null } SequenceFlow_12ilko1 SequenceFlow_0afe2pg - + #{execution.setVariable("PONR", true)} @@ -332,9 +331,9 @@ CreateVcpeResCustService.postProcessRollback(execution)]]> SequenceFlow_1eu60rt SequenceFlow_00h6hmd - import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.prepareDecomposeService(execution)]]> +CreateVcpeResCustService.prepareDecomposeService(execution) @@ -350,20 +349,21 @@ CreateVcpeResCustService.prepareDecomposeService(execution)]]> SequenceFlow_17g05fd SequenceFlow_11efpvh - import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.processDecomposition(execution)]]> +CreateVcpeResCustService.processDecomposition(execution) - + + - SequenceFlow_0gj4vud + SequenceFlow_1yojilk SequenceFlow_0clhseq @@ -393,16 +393,16 @@ CreateVcpeResCustService.processDecomposition(execution)]]> SequenceFlow_1429lyc SequenceFlow_0bt420h - import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.prepareCreateServiceInstance(execution)]]> +CreateVcpeResCustService.prepareCreateServiceInstance(execution) SequenceFlow_0ocy2qp SequenceFlow_11gw54u - import org.onap.so.bpmn.vcpe.scripts.* def CreateVcpeResCustService = new CreateVcpeResCustService() -CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> +CreateVcpeResCustService.postProcessServiceInstanceCreate(execution) SequenceFlow_1429lyc @@ -416,6 +416,11 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> + + + SequenceFlow_0gj4vud + SequenceFlow_1yojilk + @@ -431,8 +436,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + @@ -444,8 +449,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + @@ -454,8 +459,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + @@ -467,8 +472,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + @@ -492,24 +497,24 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - - - + + + + - - + + @@ -518,8 +523,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + @@ -582,41 +587,41 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - - + + + - - - - + + + + - - + + - - - - + + + + @@ -625,16 +630,16 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - - + + + @@ -649,30 +654,30 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - - + + + - - + + - - + + @@ -690,9 +695,9 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - - + + + @@ -701,10 +706,10 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - - - + + + + @@ -719,8 +724,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + @@ -732,15 +737,15 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - + + @@ -761,25 +766,25 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - - + + + - - + + - - - - + + + + @@ -797,8 +802,8 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + @@ -810,16 +815,16 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - - + + + @@ -831,22 +836,22 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - + + - - + + @@ -858,15 +863,15 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - + + @@ -878,40 +883,40 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - - + + + - - + + - - - - + + + + - - + + - - - + + + @@ -923,19 +928,19 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - + - + - - - - + + + + @@ -947,30 +952,30 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - + + - - - + + + - - + + @@ -979,16 +984,16 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - - + + + @@ -997,28 +1002,28 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - + + - - + + - + @@ -1042,33 +1047,40 @@ CreateVcpeResCustService.postProcessServiceInstanceCreate(execution)]]> - - + + - - + + - - + + - - + + + + + + + + + -- cgit 1.2.3-korg