From 43dc0ba3222a5751a1ea4ae06ed70262f3b061a7 Mon Sep 17 00:00:00 2001 From: Rob Daugherty Date: Thu, 21 Sep 2017 15:25:28 -0400 Subject: Initial commit of vCPE flows Note: vCpeResCust isn't done yet. Waiting for Homing BB integration. Change-Id: I9c6bcbd13eb1857085cb44d9aabe96ffb600b9a1 Issue-id: SO-147 Signed-off-by: Rob Daugherty --- .../vcpe/scripts/CreateVcpeResCustService.groovy | 883 ++++++++++++ .../vcpe/scripts/DeleteVcpeResCustService.groovy | 495 +++++++ .../scripts/DoCreateAllottedResourceBRG.groovy | 652 +++++++++ .../DoCreateAllottedResourceBRGRollback.groovy | 258 ++++ .../scripts/DoCreateAllottedResourceTXC.groovy | 643 +++++++++ .../DoCreateAllottedResourceTXCRollback.groovy | 258 ++++ .../scripts/DoDeleteAllottedResourceBRG.groovy | 349 +++++ .../scripts/DoDeleteAllottedResourceTXC.groovy | 349 +++++ .../vcpe/workflow/WorkflowAsyncVcpeResource.java | 26 + .../process/CreateVcpeResCustService.bpmn | 1472 ++++++++++++++++++++ .../process/DeleteVcpeResCustService.bpmn | 807 +++++++++++ .../subprocess/DoCreateAllottedResourceBRG.bpmn | 735 ++++++++++ .../DoCreateAllottedResourceBRGRollback.bpmn | 635 +++++++++ .../subprocess/DoCreateAllottedResourceTXC.bpmn | 735 ++++++++++ .../DoCreateAllottedResourceTXCRollback.bpmn | 635 +++++++++ .../subprocess/DoDeleteAllottedResourceBRG.bpmn | 422 ++++++ .../subprocess/DoDeleteAllottedResourceTXC.bpmn | 422 ++++++ .../scripts/DoCreateAllottedResourceBRGTest.groovy | 1131 +++++++++++++++ .../bpmn/vcpe/CreateVcpeResCustServiceTest.java | 590 ++++++++ .../DoCreateAllottedResourceBRGRollbackTest.java | 96 ++ .../bpmn/vcpe/DoCreateAllottedResourceBRGTest.java | 107 ++ .../DoCreateAllottedResourceTXCRollbackTest.java | 96 ++ .../bpmn/vcpe/DoCreateAllottedResourceTXCTest.java | 104 ++ .../bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java | 80 ++ .../bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java | 80 ++ .../__files/BuildingBlocks/sniroCallback2AR1Vnf | 107 ++ .../BuildingBlocks/sniroCallback2AR1Vnf2Net | 165 +++ .../BuildingBlocks/sniroCallbackNoSolutionFound | 15 + .../BuildingBlocks/sniroCallbackPolicyException | 9 + .../BuildingBlocks/sniroCallbackServiceException | 12 + .../__files/GenericFlows/getARUrlById.xml | 6 + .../__files/GenericFlows/getParentSIUrlById.xml | 6 + .../GenericFlows/getParentServiceInstance.xml | 30 + .../createServiceInstance_AAIResponse_success.xml | 11 + .../SDNCTopologyQueryCallback.xml | 37 + .../VCPE/DoCreateAllottedResourceBRG/getAR.xml | 8 + .../VCPE/DoCreateAllottedResourceBRG/getArBrg.xml | 31 + .../arGetById.xml | 31 + .../sdncActivateRollbackReq.xml | 51 + .../sdncAssignRollbackReq.xml | 51 + .../sdncCreateRollbackReq.xml | 51 + .../SDNCTopologyQueryCallback.xml | 24 + .../arGetById.xml | 31 + .../sdncActivateRollbackReq.xml | 51 + .../sdncAssignRollbackReq.xml | 51 + .../sdncCreateRollbackReq.xml | 51 + .../VCPE/DoDeleteAllottedResourceBRG/arGetById.xml | 31 + .../VCPE/DoDeleteAllottedResourceTXC/arGetById.xml | 31 + .../__files/VCPE/SDNCTopologyCreateCallback.xml | 16 + .../VCPE/SDNCTopologyDeactivateCallback.xml | 13 + .../__files/VCPE/SDNCTopologyDeleteCallback.xml | 16 + .../__files/VCPE/SDNCTopologyUnassignCallback.xml | 16 + .../__files/VCPE/VNFAdapterRestCreateCallback.xml | 55 + ...ance_genericQueryByInstance_AAIResponse_200.xml | 13 + .../test/resources/__files/VCPE/getARUrlById.xml | 6 + .../__files/VCPE/getCatalogNetworkData.json | 28 + .../VCPE/getCatalogServiceResourcesData.json | 93 ++ .../getCatalogServiceResourcesDataNoNetwork.json | 62 + ...getCatalogServiceResourcesDataNoNetworkVnf.json | 26 + ...CatalogServiceResourcesDataServiceAllotted.json | 84 ++ ...logServiceResourcesDataServiceInstanceOnly.json | 13 + .../getCatalogServiceResourcesServiceNetwork.json | 27 + .../VCPE/getCatalogServiceResourcesServiceVnf.json | 40 + .../resources/__files/VCPE/getCatalogVcpe.json | 76 + .../resources/__files/VCPE/getCatalogVnfData.json | 1 + .../test/resources/__files/VCPE/getCustomer.xml | 7 + .../src/test/resources/__files/VCPE/getNetwork.xml | 92 ++ .../resources/__files/VCPE/getParentSIUrlById.xml | 6 + .../__files/VCPE/getParentServiceInstance.xml | 30 + .../src/test/resources/__files/VCPE/request.json | 40 + .../__files/VCPE/serviceDecompositionATMFW.json | 110 ++ 71 files changed, 13821 insertions(+) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/CreateVcpeResCustService.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DeleteVcpeResCustService.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceBRG.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceTXC.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getARUrlById.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateServiceInstance/createServiceInstance_AAIResponse_success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyCreateCallback.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeactivateCallback.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeleteCallback.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyUnassignCallback.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/VNFAdapterRestCreateCallback.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/createServiceInstance_genericQueryByInstance_AAIResponse_200.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getARUrlById.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogNetworkData.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesData.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetwork.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceAllotted.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceInstanceOnly.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceNetwork.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceVnf.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVcpe.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVnfData.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCustomer.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getNetwork.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentSIUrlById.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentServiceInstance.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/request.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/serviceDecompositionATMFW.json (limited to 'bpmn/MSOInfrastructureBPMN') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/CreateVcpeResCustService.groovy new file mode 100644 index 0000000000..3b24ebf544 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/CreateVcpeResCustService.groovy @@ -0,0 +1,883 @@ +/* + * © 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe.scripts; + +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.domain.* + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +/** + * This groovy class supports the CreateVcpeResCustService.bpmn process. + * + * @author ek1439 + * + */ +public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { + + String Prefix="CVRCS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public InitializeProcessVariables(Execution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable("createVcpeServiceRequest", "") + execution.setVariable("globalSubscriberId", "") + execution.setVariable("serviceInstanceName", "") + execution.setVariable("msoRequestId", "") + execution.setVariable("CVRCS_NetworksCreatedCount", 0) + execution.setVariable("CVRCS_VnfsCreatedCount", 0) + execution.setVariable("productFamilyId", "") + execution.setVariable("brgWanMacAddress", "") + + //TODO + execution.setVariable("sdncVersion", "1707") + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // check for incoming json message/input + String createVcpeServiceRequest = execution.getVariable("bpmnRequest") + utils.logAudit(createVcpeServiceRequest) + execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); + println 'createVcpeServiceRequest - ' + createVcpeServiceRequest + + // extract requestId + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { + serviceInstanceId = UUID.randomUUID().toString() + utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId , isDebugEnabled) + } else { + utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId , isDebugEnabled) + } + + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + String requestAction = execution.getVariable("requestAction") + execution.setVariable("requestAction", requestAction) + + setBasicDBAuthHeader(execution, isDebugEnabled) + + String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source") + if ((source == null) || (source.isEmpty())) { + execution.setVariable("source", "VID") + } else { + execution.setVariable("source", source) + } + + // extract globalSubscriberId + String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId") + + // verify element global-customer-id is sent from JSON input, throw exception if missing + if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { + String dataErrorMessage = " Element 'globalSubscriberId' is missing. " + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + execution.setVariable("globalCustomerId", globalSubscriberId) + } + + // extract subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) + + String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback") + execution.setVariable("disableRollback", suppressRollback) + utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) + + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) + + String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo") + execution.setVariable("subscriberInfo", subscriberInfo) + utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled) + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map inputMap = [:] + if (userParams) { + userParams.each { + name, value -> inputMap.put(name, value) + if (name.equals("BRG_WAN_MAC_Address")) + execution.setVariable("brgWanMacAddress", value) + } + } + + utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) + execution.setVariable("serviceInputParams", inputMap) + + utils.log("DEBUG", "Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'), isDebugEnabled) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${requestId} + CREATE + ${source} + """ + + execution.setVariable("CVRCS_requestInfo", requestInfo) + + utils.log("DEBUG", " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void sendSyncResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareDecomposeService(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + + //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB + String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + + utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") +// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters") +// execution.setVariable("serviceInputParams", serviceInputParams) + + + String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) + + utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void postProcessServiceInstanceCreate (Execution execution){ + def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' +'execution=' + execution.getId() +')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + String source = execution.getVariable("source") + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + + try { + + String payload = """ + + + + + ${requestId} + BPEL + ${serviceInstanceId} + ${serviceInstanceName} + + + + """ + execution.setVariable("CVRCS_setUpdateDbInstancePayload", payload) + utils.logAudit("CVRCS_setUpdateDbInstancePayload: " + payload) + logDebug('Exited ' + method, isDebugLogEnabled) + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + } + + + public void processDecomposition (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside getDataFromDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + List networkList = serviceDecomposition.getServiceNetworks() + + + execution.setVariable("networkList", networkList) + execution.setVariable("networkListString", networkList.toString()) + + utils.log("DEBUG", "networkList: "+ networkList, isDebugEnabled) + + if (networkList != null && networkList.size() > 0) { + execution.setVariable("CVRCS_NetworksCount", networkList.size()) + utils.log("DEBUG", "networks to create: "+ networkList.size(), isDebugEnabled) + } else { + execution.setVariable("CVRCS_NetworksCount", 0) + utils.log("DEBUG", "no networks to create based upon serviceDecomposition content", isDebugEnabled) + } + + // VNFs + List vnfList = serviceDecomposition.getServiceVnfs() + execution.setVariable("vnfList", vnfList) + execution.setVariable("vnfListString", vnfList.toString()) + + String vnfModelInfoString = "" + if (vnfList != null && vnfList.size() > 0) { + execution.setVariable("CVRCS_VNFsCount", vnfList.size()) + utils.log("DEBUG", "vnfs to create: "+ vnfList.size(), isDebugEnabled) + ModelInfo vnfModelInfo = vnfList[0].getModelInfo() + + vnfModelInfoString = vnfModelInfo.toString() + String vnfModelInfoWithRoot = vnfModelInfo.toString() + vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") + } else { + execution.setVariable("CVRCS_VNFsCount", 0) + utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled) + } + + execution.setVariable("vnfModelInfo", vnfModelInfoString) + execution.setVariable("vnfModelInfoString", vnfModelInfoString) + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed getDataFromDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. getDataFromDecomposition() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareNetworkCreate (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside preparenNetworkCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + + List networkList = execution.getVariable("networkList") + utils.log("DEBUG", "networkList: "+ networkList, isDebugEnabled) + + Integer networksCreatedCount = execution.getVariable("CVRCS_NetworksCreatedCount") + String networkModelInfoString = "" + + if (networkList != null) { + utils.log("DEBUG", " getting model info for network # :" + networksCreatedCount, isDebugEnabled) + ModelInfo networkModelInfo = networkList[networksCreatedCount.intValue()].getModelInfo() + //Currently use String representation in JSON format as an input + //execution.setVariable("networkModelInfo", networkModelInfo) + networkModelInfoString = networkModelInfo.toJsonStringNoRootName() + } else { + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected number of networks to create - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + //Currently use String representation in JSON format as an input + execution.setVariable("networkModelInfo", networkModelInfoString) + utils.log("DEBUG", " networkModelInfoString :" + networkModelInfoString, isDebugEnabled) + + // extract cloud configuration + String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) + utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) + String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) + +// List vnfList = execution.getVariable("vnfList") +// utils.log("DEBUG", "vnfList: "+ vnfList.toString(), isDebugEnabled) +// +// String vnfModelInfo = execution.getVariable("vnfModelInfo") +// utils.log("DEBUG", "vnfModelInfo: "+ vnfModelInfo, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed preparenNetworkCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareNetworkCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Network request Section -> increment count + // ******************************* + public void validateNetworkCreate (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside validateNetworkCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + Integer networksCreatedCount = execution.getVariable("CVRCS_NetworksCreatedCount") + networksCreatedCount++ + execution.setVariable("CVRCS_NetworksCreatedCount", networksCreatedCount) + + execution.setVariable("DCRENI_rollbackData"+networksCreatedCount, execution.getVariable("DCRENI_rollbackData")) + + utils.log("DEBUG", "networksCreatedCount: "+ networksCreatedCount, isDebugEnabled) + utils.log("DEBUG", "DCRENI_rollbackData N : "+ execution.getVariable("DCRENI_rollbackData"+networksCreatedCount), isDebugEnabled) + +// JSONArray vnfList = execution.getVariable("vnfList") +// utils.log("DEBUG", "vnfList: "+ vnfList, isDebugEnabled) + + String vnfModelInfo = execution.getVariable("vnfModelInfo") + utils.log("DEBUG", "vnfModelInfo: "+ vnfModelInfo, isDebugEnabled) + + List networkList = execution.getVariable("networkList") + utils.log("DEBUG", "networkList: "+ networkList, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed validateNetworkCreate of CreateVcpeResCustService ***** "+" network # "+networksCreatedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateNetworkCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + public void prepareCreateAllottedResourceTXC(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //parentServiceInstanceId + //The parentServiceInstanceId will be a Landing Network service. This value will have been provided to the calling flow by SNIRO query (homing solution). + //serviceDecomposition.getServiceNetworks() + + //For 1707, the vIPR Tenant OAM flow will use the BRG allotted resource parent service ID (since it is known that the security zone also comes from the vIPR FW). + //Beyond 1707, this would need to be captured somehow in TOSCA model and also provided by SNIRO. + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. + List allottedResources = serviceDecomposition.getServiceAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()){ + AllottedResource allottedResource = (AllottedResource)iter.next(); + + utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonString(), isDebugEnabled) + utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) + if(allottedResource.getAllottedResourceType() != null && allottedResource.getAllottedResourceType().equalsIgnoreCase("TunnelXConn")){ + //set create flag to true + execution.setVariable("createTXCAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonString()) + execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType()) + + //from Homing Solution. This is the infraServiceInstanceId in the BRG Allotted Resource decomposition structure. + execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //Populate with the A&AI network ID (l3-network object) for the Tenant OAM network that was created in prior step + //String sourceNetworkId = execution.getVariable("networkId") + //execution.setVariable("sourceNetworkId", sourceNetworkId) + //Populate with the network-role (from A&AI l3-network object) for the Tenant OAM network from prior step + + //List networkResources = serviceDecomposition.getServiceNetworks() + //if (networkResources != null) { + //Iterator iter = networkResources.iterator(); + //while (iter.hasNext()){ + //NetworkResource networkResource = (NetworkResource)iter.next(); + //execution.setVariable("sourceNetworkRole", networkResource.getNetworkRole()) + //} + //} + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdTXC", allottedResourceId) + utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + public void prepareCreateAllottedResourceBRG(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //parentServiceInstanceId + //The parentServiceInstanceId will be a Landing Network service. This value will have been provided to the calling flow by SNIRO query (homing solution). + //serviceDecomposition.getServiceNetworks() + + //For 1707, the vIPR Tenant OAM flow will use the BRG allotted resource parent service ID (since it is known that the security zone also comes from the vIPR FW). + //Beyond 1707, this would need to be captured somehow in TOSCA model and also provided by SNIRO. + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. + List allottedResources = serviceDecomposition.getServiceAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()){ + AllottedResource allottedResource = (AllottedResource)iter.next(); + + utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonString(), isDebugEnabled) + utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) + if (allottedResource.getAllottedResourceType() != null && allottedResource.getAllottedResourceType().equalsIgnoreCase("BRG")) { + //set create flag to true + execution.setVariable("createBRGAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonString()) + execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType()) + //For 1707, the vIPR Tenant OAM flow will use the BRG allotted resource parent service ID (since it is known that the security zone also comes from the vIPR FW). + //This Id should be taken from the homing solution for the BRG resource. + //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG, + //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated). + + //from Homing Solution. This is the infraServiceInstanceId in the BRG Allotted Resource decomposition structure. + execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //Populate with the A&AI network ID (l3-network object) for the Tenant OAM network that was created in prior step + //String sourceNetworkId = execution.getVariable("networkId") + //execution.setVariable("sourceNetworkId", sourceNetworkId) + //Populate with the network-role (from A&AI l3-network object) for the Tenant OAM network from prior step + + //List networkResources = serviceDecomposition.getServiceNetworks() + //if (networkResources != null) { + //Iterator iter = networkResources.iterator(); + //while (iter.hasNext()){ + //NetworkResource networkResource = (NetworkResource)iter.next(); + //execution.setVariable("sourceNetworkRole", networkResource.getNetworkRole()) + //} + //} + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdBRG", allottedResourceId) + utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareVnfAndModulesCreate (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + // String disableRollback = execution.getVariable("disableRollback") + // def backoutOnFailure = "" + // if(disableRollback != null){ + // if ( disableRollback == true) { + // backoutOnFailure = "false" + // } else if ( disableRollback == false) { + // backoutOnFailure = "true" + // } + // } + //failIfExists - optional + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG","productFamilyId: "+ productFamilyId, isDebugEnabled) + + List vnfList = execution.getVariable("vnfList") + + Integer vnfsCreatedCount = execution.getVariable("CVRCS_VnfsCreatedCount") + String vnfModelInfoString = null; + + if (vnfList != null && vnfList.size() > 0 ) { + utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled) + ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() + utils.log("DEBUG", "got 0 ", isDebugEnabled) + ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() + vnfModelInfoString = vnfModelInfo.toString() + } else { + //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored + vnfModelInfoString = execution.getVariable("vnfModelInfo") + } + + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + // extract cloud configuration + String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) + utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) + String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfCreate (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + Integer vnfsCreatedCount = execution.getVariable("CVRCS_VnfsCreatedCount") + vnfsCreatedCount++ + + execution.setVariable("CVRCS_VnfsCreatedCount", vnfsCreatedCount) + + utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Network request Section -> decrement count + // ******************************* + public void validateNetworkRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside validateNetworkRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + + Integer networksCreatedCount = execution.getVariable("CVRCS_NetworksCreatedCount") + networksCreatedCount-- + + execution.setVariable("CVRCS_NetworksCreatedCount", networksCreatedCount) + + execution.setVariable("DCRENI_rollbackData", execution.getVariable("DCRENI_rollbackData"+networksCreatedCount)) + + utils.log("DEBUG", " ***** Completed validateNetworkRollback of CreateVcpeResCustService ***** "+" network # "+networksCreatedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateNetworkRollback() - " + ex.getMessage() + //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + execution.setVariable("CVRCS_NetworksCreatedCount", 0) + utils.log("ERROR", exceptionMessage, true) + } + } + + // ***************************************** + // Prepare Completion request Section + // ***************************************** + public void postProcessResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String source = execution.getVariable("source") + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String msoCompletionRequest = + """ + + ${requestId} + CREATE + ${source} + + Service Instance has been created successfully via macro orchestration + ${serviceInstanceId} + BPMN macro create + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + utils.logAudit(xmlMsoCompletionRequest) + execution.setVariable("CVRCS_Success", true) + execution.setVariable("CVRCS_CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void preProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) + } + + public void postProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) + } + + public void prepareFalloutRequest(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestInfo = execution.getVariable("CVRCS_requestInfo") + utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) + + //TODO. hmmm. there is no way to UPDATE error message. +// String errorMessage = wfex.getErrorMessage() +// boolean successIndicator = execution.getVariable("DCRESI_rollbackSuccessful") +// if (successIndicator){ +// errorMessage = errorMessage + ". Rollback successful." +// } else { +// errorMessage = errorMessage + ". Rollback not completed." +// } + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable("CVRCS_falloutRequest", falloutRequest) + + } catch (Exception ex) { + utils.log("DEBUG", "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") + } + utils.log("DEBUG", "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled) + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${errorMessage} + 7000 + """ + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + } + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + try{ + utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("CRESI_unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") + }catch(BpmnError b){ + utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("CRESI_unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DeleteVcpeResCustService.groovy new file mode 100644 index 0000000000..960bb5cc7f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -0,0 +1,495 @@ +/* + * © 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe.scripts + +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +/** + * This groovy class supports the DeleteVcpeResCustService.bpmn process. + * + * @author dm4252 + * + */ +public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { + + String Prefix="DELVAS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + NetworkUtils networkUtils = new NetworkUtils() + + /** + * This method is executed during the preProcessRequest task of the DeleteVcpeResCustService.bpmn process. + * @param execution + */ + public InitializeProcessVariables(Execution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable("DeleteVcpeResCustServiceRequest", "") + execution.setVariable("msoRequestId", "") + execution.setVariable("DELVAS_vnfsDeletedCount", 0) + execution.setVariable("DELVAS_vnfsCount", 0) + execution.setVariable("DELVAS_networksCount", 0) + execution.setVariable("DELVAS_networksDeletedCount", 0) + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest DeleteVcpeResCustService Request ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // check for incoming json message/input + String DeleteVcpeResCustServiceRequest = execution.getVariable("bpmnRequest") + utils.logAudit(DeleteVcpeResCustServiceRequest) + execution.setVariable("DeleteVcpeResCustServiceRequest", DeleteVcpeResCustServiceRequest); + println 'DeleteVcpeResCustServiceRequest - ' + DeleteVcpeResCustServiceRequest + + // extract requestId + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { + String dataErrorMessage = " Element 'serviceInstanceId' is missing. " + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + String requestAction = execution.getVariable("requestAction") + execution.setVariable("requestAction", requestAction) + + String source = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.source") + if ((source == null) || (source.isEmpty())) { + execution.setVariable("source", "VID") + } else { + execution.setVariable("source", source) + } + + // extract globalSubscriberId + String globalSubscriberId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId") + + // global-customer-id is optional on Delete + + execution.setVariable("globalSubscriberId", globalSubscriberId) + execution.setVariable("globalCustomerId", globalSubscriberId) + + String suppressRollback = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.suppressRollback") + execution.setVariable("disableRollback", suppressRollback) + utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) + + String productFamilyId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) + + // extract subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) + + // extract cloud configuration + String lcpCloudRegionId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) + utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) + String tenantId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) + + String sdncVersion = "1702" + execution.setVariable("sdncVersion", sdncVersion) + utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${requestId} + DELETE + ${source} + """ + + execution.setVariable("DELVAS_requestInfo", requestInfo) + + //Setting for Generic Sub Flows + execution.setVariable("GENGS_type", "service-instance") + + utils.log("DEBUG", " ***** Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ***** ", isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void sendSyncResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside sendSyncResponse of DeleteVcpeResCustService ***** ", isDebugEnabled) + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()^M + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void prepareServiceDelete (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ***** Inside prepareServiceInstanceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled) + + try { + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // confirm if ServiceInstance was found + if ( !execution.getVariable("GENGS_FoundIndicator") ) + { + String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + // get variable within incoming json + String DeleteVcpeResCustServiceRequest = execution.getVariable("DeleteVcpeResCustServiceRequest"); + + // get SI extracted by GenericGetService + String serviceInstanceAaiRecord = execution.getVariable("GENGS_service"); + + utils.log("DEBUG", "serviceInstanceAaiRecord: "+serviceInstanceAaiRecord, isDebugEnabled) + + // determine if AR needs to be deleted + boolean DELVAS_TunnelXConn = false + boolean DELVAS_BRG = false + String TXC_allottedResourceId + String BRG_allottedResourceId + XmlParser xmlParser = new XmlParser() + def groovy.util.Node siNode = xmlParser.parseText(serviceInstanceAaiRecord) + def groovy.util.Node arList = utils.getChildNode(siNode, 'allotted-resources') + if (arList != null) { + def groovy.util.NodeList ars = utils.getIdenticalChildren(arList, 'allotted-resource') + for (groovy.util.Node ar in ars) { + def groovy.util.Node type = utils.getChildNode(ar, 'type') + if ((type != null) && (type.text().equals('TunnelXConn'))) { + utils.log("DEBUG","TunnelXConn AR found", isDebugEnabled) + def groovy.util.Node id = utils.getChildNode(ar, 'id') + if (id != null){ + DELVAS_TunnelXConn = true + TXC_allottedResourceId = id + } + } + if ((type != null) && (type.text().equals('BRG'))) { + utils.log("DEBUG","FW AR found", isDebugEnabled) + def groovy.util.Node id = utils.getChildNode(ar, 'id') + if (id != null){ + DELVAS_BRG = true + BRG_allottedResourceId = id + } + } + } + } + execution.setVariable("DELVAS_TunnelXConn", DELVAS_TunnelXConn) + utils.log("DEBUG", "DELVAS_TunnelXConn : " + DELVAS_TunnelXConn, isDebugEnabled) + execution.setVariable("TXC_allottedResourceId", TXC_allottedResourceId) + utils.log("DEBUG", "TXC_allottedResourceId : " + TXC_allottedResourceId, isDebugEnabled) + + execution.setVariable("DELVAS_BRG", DELVAS_BRG) + utils.log("DEBUG", "DELVAS_BRG : " + DELVAS_BRG, isDebugEnabled) + execution.setVariable("BRG_allottedResourceId", BRG_allottedResourceId) + utils.log("DEBUG", "BRG_allottedResourceId : " + BRG_allottedResourceId, isDebugEnabled) + + String relationship = "" + try { + relationship = networkUtils.getFirstNodeXml(serviceInstanceAaiRecord, "relationship-list") + } catch (Exception ex) { + //no relationships found + } + utils.log("DEBUG", " relationship string - " + relationship, isDebugEnabled) + + int vnfsCount = 0 + int networksCount = 0 + + if (relationship != null && relationship.length() > 0){ + relationship = relationship.trim().replace("tag0:","").replace(":tag0","") + + // Check if Network TableREf is present, then build a List of network policy + List relatedVnfIdList = networkUtils.getRelatedVnfIdList(relationship) + vnfsCount = relatedVnfIdList.size() + execution.setVariable("DELVAS_vnfsCount", vnfsCount) + utils.log("DEBUG", " DELVAS_vnfsCount : " + vnfsCount, isDebugEnabled) + execution.setVariable("DELVAS_relatedVnfIdList", relatedVnfIdList) + + // Check if Network TableREf is present, then build a List of network policy + List relatedNetworkIdList = networkUtils.getRelatedNetworkIdList(relationship) + networksCount = relatedNetworkIdList.size() + execution.setVariable("DELVAS_networksCount", networksCount) + utils.log("DEBUG", " DELVAS_networksCount : " + networksCount, isDebugEnabled) + execution.setVariable("DELVAS_relatedNetworkIdList", relatedNetworkIdList) + } else { + execution.setVariable("DELVAS_vnfsCount", 0) + utils.log("DEBUG", " DELVAS_vnfsCount : " + vnfsCount, isDebugEnabled) + execution.setVariable("DELVAS_networksCount", 0) + utils.log("DEBUG", " DELVAS_networksCount : " + networksCount, isDebugEnabled) + } + + utils.log("DEBUG", " ***** Completed prepareServiceInstanceDelete() of DeleteVcpeCusRestService ***** ", isDebugEnabled) + } catch (BpmnError e){ + throw e; + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in DeleteVcpeCusRestService flow. prepareServiceInstanceDelete() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + // ******************************* + // + // ******************************* + public void prepareVnfAndModulesDelete (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareVnfAndModulesDelete of DeleteServiceInstanceMacro ***** ", isDebugEnabled) + + List vnfList = execution.getVariable("DELVAS_relatedVnfIdList") + Integer vnfsDeletedCount = execution.getVariable("DELVAS_vnfsDeletedCount") + String vnfModelInfoString = "" + String vnfId = "" + if (vnfList.size() > 0 ) { + vnfId = vnfList.get(vnfsDeletedCount.intValue()) + } + + execution.setVariable("vnfId", vnfId) + utils.log("DEBUG", "need to delete vnfId:" + vnfId, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareVnfAndModulesDelete of DeleteServiceInstanceMacro ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteServiceInstanceMacro flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfDelete (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside validateVnfDelete of DeleteVcpeCusRestService ***** ", isDebugEnabled) + + String vnfsDeletedCount = execution.getVariable("DELVAS_vnfsDeletedCount") + vnfsDeletedCount++ + + execution.setVariable("DELVAS_vnfsDeletedCount", vnfsDeletedCount) + + utils.log("DEBUG", " ***** Completed validateVnfDelete of DeleteVcpeCusRestService ***** "+" vnf # "+vnfsDeletedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteVcpeCusRestService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareNetworkDelete (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareNetworkDelete of DeleteVcpeCusRestService ***** ", isDebugEnabled) + + List networkList = execution.getVariable("DELVAS_relatedNetworkIdList") + Integer networksDeletedCount = execution.getVariable("DELVAS_networksDeletedCount") + + String networkId = "" + if (networkList.size() > 0) { + networkId = networkList.get(networksDeletedCount.intValue()) + } + + execution.setVariable("networkId", networkId) + utils.log("DEBUG", "need to delete networkId:" + networkId, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareNetworkDelete of DeleteVcpeCusRestService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = q"Bpmn error encountered in DeleteVcpeCusRestService flow. Unexpected Error from method prepareNetworkDelete() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Network request Section + // ******************************* + public void validateNetworkDelete (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside validateNetworkDelete of DeleteVcpeCusRestService ***** ", isDebugEnabled) + + Integer networksDeletedCount = execution.getVariable("DELVAS_networksDeletedCount") + networksDeletedCount++ + + execution.setVariable("DELVAS_networksDeletedCount", networksDeletedCount) + + utils.log("DEBUG", " ***** Completed validateNetworkDelete of DeleteVcpeCusRestService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteVcpeCusRestService flow. Unexpected Error from method validateNetworkDelete() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + // ***************************************** + // Prepare Completion request Section + // ***************************************** + public void postProcessResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteVcpeCusRestService ***** ", isDebugEnabled) + + try { + String source = execution.getVariable("source") + String requestId = execution.getVariable("msoRequestId") + + String msoCompletionRequest = + """ + + ${requestId} + DELETE + ${source} + + vCPE Res Cust Service Instance has been deleted successfully. + BPMN Service Instance macro action: DELETE + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + utils.logAudit(xmlMsoCompletionRequest) + execution.setVariable("DELVAS_Success", true) + execution.setVariable("DELVAS_CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void prepareFalloutRequest(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** STARTED DeleteVcpeCusRestService prepareFalloutRequest Process *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestInfo = execution.getVariable("DELVAS_requestInfo") + utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable("DELVAS_falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("DEBUG", "Error Occured in DeleteVcpeCusRestService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVcpeCusRestService prepareFalloutRequest Process") + } + utils.log("DEBUG", "*** COMPLETED DeleteVcpeCusRestService prepareFalloutRequest Process ***", isDebugEnabled) + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ***** Inside sendSyncError() of DeleteServiceInstanceInfra ***** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${errorMessage} + 7000 + """ + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + } + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + try{ + utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("DELVAS_unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") + }catch(BpmnError b){ + utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("DELVAS_unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) + } + + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceBRG.groovy new file mode 100644 index 0000000000..528a804b6f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -0,0 +1,652 @@ +/* + * © 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe.scripts; + +import org.openecomp.mso.bpmn.common.scripts.*; +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + + +/** + * This groovy class supports the DoCreateAllottedResourceBRG.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDEbugLogEnabled + * @param - disableRollback + * @param - failExists - O + * @param - serviceInstanceId + * @param - parentServiceInstanceId + * @param - allottedReourceId - O + * @param - allottedResourceModelInfo + * @param - allottedResourceRole + * @param - allottedResourceType + * @param - brgWanMacAddress + * @param - vni + * @param - vgmuxBearerIP + * + * Outputs: + * @param - rollbackData (localRB->null) + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * @param - WorkflowException - O + * @param - allottedResourceId + * @param - allottedResourceName + * + */ +public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ + + String Prefix="DCARBRG_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) + + try { + execution.setVariable("prefix", Prefix) + + //Config Inputs + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + + //Request Inputs + if (isBlank(execution.getVariable("serviceInstanceId"))){ + msg = "Input serviceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("parentServiceInstanceId"))) { + msg = "Input parentServiceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceModelInfo"))) { + msg = "Input allottedResourceModelInfo is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("vni"))) { + msg = "Input vni is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("vgmuxBearerIP"))) { + msg = "Input vgmuxBearerIP is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("brgWanMacAddress"))) { + msg = "Input brgWanMacAddress is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceRole"))) { + msg = "Input allottedResourceRole is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceType"))) { + msg = "Input allottedResourceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void getAaiAR (Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled) + + String arType = execution.getVariable("allottedResourceType") + String arRole = execution.getVariable("allottedResourceRole") + + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String orchStatus = arUtils.getAROrchStatus(execution) + + String errorMsg = "" + + if (orchStatus != null) // AR was found + { + if ("true".equals(execution.getVariable("failExists"))) + { + errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists" + } + else + { + if ("Active".equals(orchStatus)) + { + execution.setVariable("foundActiveAR", true) + } + else // blanks included + { + errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus + } + } + } + if (!isBlank(errorMsg)) { + utils.log("DEBUG", errorMsg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) + } + utils.log("DEBUG"," *****Exit getAaiAR *****", isDebugEnabled) + } + + public void createAaiAR(Execution execution) { + + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** createAaiAR ***** ", isDebugEnabled) + String msg = "" + + String allottedResourceId = execution.getVariable("allottedResourceId") + if (isBlank(allottedResourceId)) + { + allottedResourceId = UUID.randomUUID().toString() + execution.setVariable("allottedResourceId", allottedResourceId) + } + String arUrl = "" + try { + + //AAI PUT + AaiUtil aaiUriUtil = new AaiUtil(this) + String aaiEndpoint = execution.getVariable("URN_aai_endpoint") + String siResourceLink= execution.getVariable("PSI_resourceLink") + + String siUri = "" + utils.log("DEBUG", "PSI_resourceLink:" + siResourceLink, isDebugEnabled) + + if(!isBlank(siResourceLink)) { + utils.log("DEBUG", "Incoming PSI Resource Link is: " + siResourceLink, isDebugEnabled) + String[] split = siResourceLink.split("/aai/") + siUri = "/aai/" + split[1] + } + else + { + msg = "Parent Service Link in AAI is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + execution.setVariable("aaiARPath", arUrl) + utils.log("DEBUG", "GET AllottedResource AAI URL is:\n" + arUrl, isDebugEnabled) + + String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl) + + String arType = execution.getVariable("allottedResourceType") + String arRole = execution.getVariable("allottedResourceRole") + String CSI_resourceLink = execution.getVariable("CSI_resourceLink") + String arModelInfo = execution.getVariable("allottedResourceModelInfo") + String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") + String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") + String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") + + if (modelInvariantId == null) { + modelInvariantId = "" + } + if (modelVersionId == null) { + modelVersionId = "" + } + if (modelCustomizationId == null) { + modelCustomizationId = "" + } + + String payload = + """ + ${allottedResourceId} + + ${arType} + ${arRole} + + ${modelInvariantId} + ${modelVersionId} + ${modelCustomizationId} + PendingCreate + + + + service-instance + ${CSI_resourceLink} + + + """.trim() + + execution.setVariable("AaiARPayload", payload) + utils.log("DEBUG", " payload to create AllottedResource in AAI:" + "\n" + payload, isDebugEnabled) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, arUrl, payload) + int responseCode = response.getStatusCode() + utils.log("DEBUG", "AllottedResource AAI PUT responseCode:" + responseCode, isDebugEnabled) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + utils.log("DEBUG", "AllottedResource AAI PUT responseStr:" + aaiResponse, isDebugEnabled) + + //200 OK 201 CREATED 202 ACCEPTED + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + { + utils.log("DEBUG", "AAI PUT AllottedResource received a Good Response", isDebugEnabled) + } + else{ + utils.log("DEBUG", "AAI Put AllottedResouce received a Bad Response Code: " + responseCode, isDebugEnabled) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + } catch (Exception ex) { + msg = "Exception in createAaiAR " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + //start rollback set up + RollbackData rollbackData = new RollbackData() + def disableRollback = execution.getVariable("disableRollback") + rollbackData.put(Prefix, "disableRollback", disableRollback.toString()) + rollbackData.put(Prefix, "rollbackAAI", "true") + rollbackData.put(Prefix, "allottedResourceId", allottedResourceId) + rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId")) + rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId")) + rollbackData.put(Prefix, "aaiARPath", arUrl) + execution.setVariable("rollbackData", rollbackData) + utils.log("DEBUG"," *** Exit createAaiAR*** ", isDebugEnabled) + } + + public String buildSDNCRequest(Execution execution, String action, String sdncRequestId) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled) + String sdncReq = null + + try { + + String allottedResourceId = execution.getVariable("allottedResourceId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") + String callbackUrl = execution.getVariable("sdncCallbackUrl") + String requestId = execution.getVariable("msoRequestId") + + String brgWanMacAddress = execution.getVariable("brgWanMacAddress") + String vni = execution.getVariable("vni") + String vgmuxBearerIP = execution.getVariable("vgmuxBearerIP") + + String arModelInfo = execution.getVariable("allottedResourceModelInfo") + String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") + String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion") + String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") + String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") + String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName") + + if (modelInvariantId == null) { + modelInvariantId = "" + } + if (modelVersion == null) { + modelVersion = "" + } + if (modelUUId == null) { + modelUUId = "" + } + if (modelName == null) { + modelName = "" + } + if (modelCustomizationId == null) { + modelCustomizationId = "" + } + + sdncReq = + """ + + ${sdncRequestId} + ${serviceInstanceId} + ${action} + brg-topology-operation + ${callbackUrl} + + + + ${requestId} + CreateBRGInstance + MSO + + + + + + + + + ${parentServiceInstanceId} + + + + + ${allottedResourceId} + brg + ${parentServiceInstanceId} + + ${modelInvariantId} + ${modelUUId} + ${modelCustomizationId} + ${modelVersion} + ${modelName} + + + + ${brgWanMacAddress} + ${vni} + ${vgmuxBearerIP} + + + """ + + utils.log("DEBUG","sdncRequest:\n" + sdncReq, isDebugEnabled) + sdncReq = utils.formatXml(sdncReq) + + } catch(Exception ex) { + msg = "Exception in buildSDNCRequest. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit buildSDNCRequest *****", isDebugEnabled) + return sdncReq + } + + public void preProcessSDNCAssign(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCAssign *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId) + execution.setVariable("sdncAssignRequest", sdncAssignReq) + utils.logAudit("sdncAssignRequest: " + sdncAssignReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + utils.log("DEBUG","sdncAssignRollbackReq:\n" + sdncAssignRollbackReq, isDebugEnabled) + utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCAssign. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCAssign *****", isDebugEnabled) + } + + public void preProcessSDNCCreate(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCCreate *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId) + execution.setVariable("sdncCreateRequest", sdncCreateReq) + utils.logAudit("sdncCreateReq: " + sdncCreateReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + utils.log("DEBUG","sdncCreateRollbackReq:\n" + sdncCreateRollbackReq, isDebugEnabled) + utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCCreate. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCCreate *****", isDebugEnabled) + } + + public void preProcessSDNCActivate(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCActivate *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId) + execution.setVariable("sdncActivateRequest", sdncActivateReq) + utils.logAudit("sdncActivateReq: " + sdncActivateReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + utils.log("DEBUG","sdncActivateRollbackReq:\n" + sdncActivateRollbackReq, isDebugEnabled) + utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCActivate. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCActivate *****", isDebugEnabled) + } + + public void validateSDNCResp(Execution execution, String response, String method){ + + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + utils.logAudit("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) + + if (!"get".equals(method)) + { + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true") + execution.setVariable("rollbackData", rollbackData) + } + + }else{ + utils.log("DEBUG", "Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) + } + + public void preProcessSDNCGet(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", "*** preProcessSDNCGet *** ", isDebugLogEnabled) + try{ + + def callbackUrl = execution.getVariable("sdncCallbackUrl") + // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI + // or from "object-path" in SDNC response for assign when AR does not exist in AA + + String serviceOperation = "" + + if (execution.getVariable("foundActiveAR")) { + def aaiQueryResponse = execution.getVariable("aaiARGetResponse") + serviceOperation = utils.getNodeText1(aaiQueryResponse, "selflink") + utils.log("DEBUG", "AR service operation/aaiARSelfLink: " + serviceOperation, isDebugLogEnabled) + } + else + { + String response = execution.getVariable("sdncAssignResponse") + String data = utils.getNodeXml(response, "response-data") + data = data.replaceAll("<", "<") + data = data.replaceAll(">", ">") + utils.log("DEBUG", "Assign responseData: " + data, isDebugLogEnabled) + serviceOperation = utils.getNodeText1(data, "object-path") + utils.log("DEBUG", "AR service operation:" + serviceOperation, isDebugLogEnabled) + } + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String sdncRequestId = UUID.randomUUID().toString() + + String tsleep = execution.getVariable("junitSleepMs") + + //workaround for sdnc replication issue + sleep(tsleep == null ? 5000 : tsleep as Long) + + //neeed the same url as used by vfmodules + String SDNCGetRequest = + """ + + ${sdncRequestId} + ${serviceInstanceId} + query + ${serviceOperation} + ${callbackUrl} + vfmodule + + + """ + + execution.setVariable("sdncGetRequest", SDNCGetRequest) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + e, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "*** Exit preProcessSDNCGet *** ", isDebugLogEnabled) + } + + public void updateAaiAROrchStatus(Execution execution, String status){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled) + String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) + } + + public void generateOutputs(Execution execution) + { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** generateOutputs ***** ", isDebugEnabled) + try { + String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped + utils.log("DEBUG", "resp:" + sdncGetResponse, isDebugEnabled) + String arData = utils.getNodeXml(sdncGetResponse, "brg-topology") + arData = utils.removeXmlNamespaces(arData) + + String brga = utils.getNodeXml(arData, "brg-assignments") + String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") + execution.setVariable("allotedResourceName", utils.getNodeText1(ari, "allotted-resource-name")) + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error in generateOutputs ", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in generateOutputs " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit generateOutputs *** ", isDebugEnabled) + + } + + public void preProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) + } + + public void postProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy new file mode 100644 index 0000000000..0e0f5c2035 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy @@ -0,0 +1,258 @@ +/* + * © 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe.scripts; + +import org.openecomp.mso.bpmn.common.scripts.*; +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.MsoUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + +/** + * This groovy class supports the CreateAllottedResourceBRGRollback.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - disableRollback - O + * @param - rollbackData + * + * Outputs: + * @param - rollbackError + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * + */ +public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProcessor{ + + String Prefix="DCARBRGRB_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) + execution.setVariable("prefix", Prefix) + String rbType = "DCARBRG_" + try { + + def rollbackData = execution.getVariable("rollbackData") + utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) + + if (rollbackData != null) { + if (rollbackData.hasType(rbType)) { + + execution.setVariable("serviceInstanceId", rollbackData.get(rbType, "serviceInstanceId")) + execution.setVariable("parentServiceInstanceId", rollbackData.get(rbType, "parentServiceInstanceId")) + execution.setVariable("allottedResourceId", rollbackData.get("SERVICEINSTANCE", "allottedResourceId")) + + + def rollbackAAI = rollbackData.get(rbType, "rollbackAAI") + if ("true".equals(rollbackAAI)) + { + execution.setVariable("rollbackAAI",true) + execution.setVariable("aaiARPath", rollbackData.get(rbType, "aaiARPath")) + + } + def rollbackSDNC = rollbackData.get(rbType, "rollbackSDNCassign") + if ("true".equals(rollbackSDNC)) + { + execution.setVariable("rollbackSDNC", true) + execution.setVariable("deactivateSdnc", rollbackData.get(rbType, "rollbackSDNCactivate")) + execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate")) + execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign")) + + utils.log("DEBUG","sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") , isDebugEnabled) + utils.log("DEBUG","sdncDelete:\n" + execution.getVariable("deleteSdnc"), isDebugEnabled) + utils.log("DEBUG","sdncUnassign:\n" + execution.getVariable("unassignSdnc"), isDebugEnabled) + + execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq")) + execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq")) + execution.setVariable("sdncUnassignRequest", rollbackData.get(rbType, "sdncAssignRollbackReq")) + } + + if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) + { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + if (execution.getVariable("disableRollback").equals("true" )) + { + execution.setVariable("skipRollback", true) + } + + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + // aaiARPath set during query (existing AR) + public void updateAaiAROrchStatus(Execution execution, String status){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = null; + utils.log("DEBUG", " *** updateAaiAROrchStatus ***", isDebugEnabled) + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String aaiARPath = execution.getVariable("aaiARPath") + utils.log("DEBUG", " aaiARPath:" + aaiARPath, isDebugEnabled) + String ar = null; //need this for getting resourceVersion for delete + if (!isBlank(aaiARPath)) + { + ar = arUtils.getARbyLink(execution, aaiARPath, "") + } + if (isBlank(ar)) + { + msg = "AR not found in AAI at:" + aaiARPath + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) + } + + public void validateSDNCResp(Execution execution, String response, String method){ + + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + utils.logAudit("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) + + }else{ + + utils.log("DEBUG", "Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + if (e.getErrorCode() == 404) + { + msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback" + utils.log("DEBUG", msg, isDebugEnabled) + } + else { + throw e; + } + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) + } + + public void deleteAaiAR(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + try{ + utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled) + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = null //need to get resource-version + String arLink = execution.getVariable("aaiARPath") + if (!isBlank(arLink)) + { + ar = arUtils.getARbyLink(execution, arLink, "") + } + arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) + } catch (BpmnError e) { + throw e; + }catch(Exception ex){ + utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + ex, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) + } + utils.log("DEBUG", " *** Exit deleteAaiAR *** ", isDebugLogEnabled) + } + + public void postProcessRequest(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled) + String msg = "" + try { + execution.setVariable("rollbackData", null) + boolean skipRollback = execution.getVariable("skipRollback") + if (skipRollback != true) + { + execution.setVariable("rolledBack", true) + utils.log("DEBUG","rolledBack", isDebugEnabled) + } + utils.log("DEBUG","*** Exit postProcessRequest ***", isDebugEnabled) + + } catch (BpmnError e) { + msg = "Bpmn Exception in postProcessRequest. " + utils.log("DEBUG", msg, isDebugEnabled) + } catch (Exception ex) { + msg = "Exception in postProcessRequest. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + + } + + public void processRollbackException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled) + try{ + utils.log("DEBUG", "Caught an Exception in DoCreateAllottedResourceRollback", isDebugEnabled) + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") + execution.setVariable("WorkflowException", null) + + }catch(BpmnError b){ + utils.log("DEBUG", "BPMN Error during processRollbackExceptions Method: ", isDebugEnabled) + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processRollbackExceptions Method: " + e.getMessage(), isDebugEnabled) + } + + utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) + } + + public void processRollbackJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled) + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") + utils.log("DEBUG", "Caught Exception in processRollbackJavaException", isDebugEnabled) + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception in processRollbackJavaException " + e.getMessage(), isDebugEnabled) + } + utils.log("DEBUG", "***** Exit processRollbackJavaException *****", isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceTXC.groovy new file mode 100644 index 0000000000..28f3d6a771 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -0,0 +1,643 @@ +/* + * © 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe.scripts; + +import org.openecomp.mso.bpmn.common.scripts.*; +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + + +/** + * This groovy class supports the DoCreateAllottedResourceTXC.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDEbugLogEnabled + * @param - disableRollback + * @param - failExists - O + * @param - serviceInstanceId + * @param - parentServiceInstanceId + * @param - allottedReourceId - O + * @param - allottedResourceModelInfo + * @param - allottedResourceRole + * @param - allottedResourceType + * @param - brgWanMacAddress + * + * Outputs: + * @param - rollbackData (localRB->null) + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * @param - WorkflowException - O + * @param - allottedResourceId + * @param - allottedResourceName + * @param - vni + * @param - vgmuxBearerIP + * @param - vgmuxLanIP + * + */ +public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ + + String Prefix="DCARTXC_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) + + try { + execution.setVariable("prefix", Prefix) + + //Config Inputs + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + + //Request Inputs + if (isBlank(execution.getVariable("serviceInstanceId"))){ + msg = "Input serviceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("parentServiceInstanceId"))) { + msg = "Input parentServiceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceModelInfo"))) { + msg = "Input allottedResourceModelInfo is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("brgWanMacAddress"))) { + msg = "Input brgWanMacAddress is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceRole"))) { + msg = "Input allottedResourceRole is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceType"))) { + msg = "Input allottedResourceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void getAaiAR (Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled) + + String arType = execution.getVariable("allottedResourceType") + String arRole = execution.getVariable("allottedResourceRole") + + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String orchStatus = arUtils.getAROrchStatus(execution) + + String errorMsg = "" + + if (orchStatus != null) // AR was found + { + if ("true".equals(execution.getVariable("failExists"))) + { + errorMsg = "Allotted resource " + arType + " with Role " + arRole + " already exists" + } + else + { + if ("Active".equals(orchStatus)) + { + execution.setVariable("foundActiveAR", true) + } + else // blanks included + { + errorMsg = "Allotted Resource " + arType + " with Role " + arRole + " already exists in an incomplete state -" + orchStatus + } + } + } + if (!isBlank(errorMsg)) { + utils.log("DEBUG", errorMsg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) + } + utils.log("DEBUG"," *****Exit getAaiAR *****", isDebugEnabled) + } + + public void createAaiAR(Execution execution) { + + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** createAaiAR ***** ", isDebugEnabled) + String msg = "" + + String allottedResourceId = execution.getVariable("allottedResourceId") + if (isBlank(allottedResourceId)) + { + allottedResourceId = UUID.randomUUID().toString() + execution.setVariable("allottedResourceId", allottedResourceId) + } + String arUrl = "" + try { + + //AAI PUT + AaiUtil aaiUriUtil = new AaiUtil(this) + String aaiEndpoint = execution.getVariable("URN_aai_endpoint") + String siResourceLink= execution.getVariable("PSI_resourceLink") + + String siUri = "" + utils.log("DEBUG", "PSI_resourceLink:" + siResourceLink, isDebugEnabled) + + if(!isBlank(siResourceLink)) { + utils.log("DEBUG", "Incoming PSI Resource Link is: " + siResourceLink, isDebugEnabled) + String[] split = siResourceLink.split("/aai/") + siUri = "/aai/" + split[1] + } + else + { + msg = "Parent Service Link in AAI is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + arUrl = "${aaiEndpoint}${siUri}" + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + execution.setVariable("aaiARPath", arUrl) + utils.log("DEBUG", "GET AllottedResource AAI URL is:\n" + arUrl, isDebugEnabled) + + String namespace = aaiUriUtil.getNamespaceFromUri(execution, arUrl) + + String arType = execution.getVariable("allottedResourceType") + String arRole = execution.getVariable("allottedResourceRole") + String CSI_resourceLink = execution.getVariable("CSI_resourceLink") + String arModelInfo = execution.getVariable("allottedResourceModelInfo") + String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") + String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") + String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") + + if (modelInvariantId == null) { + modelInvariantId = "" + } + if (modelVersionId == null) { + modelVersionId = "" + } + if (modelCustomizationId == null) { + modelCustomizationId = "" + } + + String payload = + """ + ${allottedResourceId} + + ${arType} + ${arRole} + + ${modelInvariantId} + ${modelVersionId} + ${modelCustomizationId} + PendingCreate + + + + service-instance + ${CSI_resourceLink} + + + """.trim() + + execution.setVariable("AaiARPayload", payload) + utils.log("DEBUG", " payload to create AllottedResource in AAI:" + "\n" + payload, isDebugEnabled) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, arUrl, payload) + int responseCode = response.getStatusCode() + utils.log("DEBUG", "AllottedResource AAI PUT responseCode:" + responseCode, isDebugEnabled) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + utils.log("DEBUG", "AllottedResource AAI PUT responseStr:" + aaiResponse, isDebugEnabled) + + //200 OK 201 CREATED 202 ACCEPTED + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + { + utils.log("DEBUG", "AAI PUT AllottedResource received a Good Response", isDebugEnabled) + } + else{ + utils.log("DEBUG", "AAI Put AllottedResouce received a Bad Response Code: " + responseCode, isDebugEnabled) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + } catch (Exception ex) { + msg = "Exception in createAaiAR " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + //start rollback set up + RollbackData rollbackData = new RollbackData() + def disableRollback = execution.getVariable("disableRollback") + rollbackData.put(Prefix, "disableRollback", disableRollback.toString()) + rollbackData.put(Prefix, "rollbackAAI", "true") + rollbackData.put(Prefix, "allottedResourceId", allottedResourceId) + rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId")) + rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId")) + rollbackData.put(Prefix, "aaiARPath", arUrl) + execution.setVariable("rollbackData", rollbackData) + utils.log("DEBUG"," *** Exit createAaiAR*** ", isDebugEnabled) + } + + public String buildSDNCRequest(Execution execution, String action, String sdncRequestId) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled) + String sdncReq = null + + try { + + String allottedResourceId = execution.getVariable("allottedResourceId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") + String serviceChainServiceInstanceId = execution.getVariable("serviceChainServiceInstanceId") + String callbackUrl = execution.getVariable("sdncCallbackUrl") + String requestId = execution.getVariable("msoRequestId") + + String brgWanMacAddress = execution.getVariable("brgWanMacAddress") + + String arModelInfo = execution.getVariable("allottedResourceModelInfo") + String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") + String modelVersion = jsonUtil.getJsonValue(arModelInfo, "modelVersion") + String modelUUId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") + String modelCustomizationId = jsonUtil.getJsonValue(arModelInfo, "modelCustomizationUuid") + String modelName = jsonUtil.getJsonValue(arModelInfo, "modelName") + + if (modelInvariantId == null) { + modelInvariantId = "" + } + if (modelVersion == null) { + modelVersion = "" + } + if (modelUUId == null) { + modelUUId = "" + } + if (modelName == null) { + modelName = "" + } + if (modelCustomizationId == null) { + modelCustomizationId = "" + } + + sdncReq = + """ + + ${sdncRequestId} + ${serviceInstanceId} + ${action} + tunnelxconn-topology-operation + ${callbackUrl} + + + + ${requestId} + CreateTunnelXConnInstance + MSO + + + + + + + + + ${parentServiceInstanceId} + + + + + ${allottedResourceId} + tunnelxconn + ${parentServiceInstanceId} + + ${modelInvariantId} + ${modelUUId} + ${modelCustomizationId} + ${modelVersion} + ${modelName} + + + + ${brgWanMacAddress} + + + """ + + utils.log("DEBUG","sdncRequest:\n" + sdncReq, isDebugEnabled) + sdncReq = utils.formatXml(sdncReq) + + } catch(Exception ex) { + msg = "Exception in buildSDNCRequest. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit buildSDNCRequest *****", isDebugEnabled) + return sdncReq + } + + public void preProcessSDNCAssign(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCAssign *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId) + execution.setVariable("sdncAssignRequest", sdncAssignReq) + utils.logAudit("sdncAssignRequest: " + sdncAssignReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + utils.log("DEBUG","sdncAssignRollbackReq:\n" + sdncAssignRollbackReq, isDebugEnabled) + utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCAssign. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCAssign *****", isDebugEnabled) + } + + public void preProcessSDNCCreate(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCCreate *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId) + execution.setVariable("sdncCreateRequest", sdncCreateReq) + utils.logAudit("sdncCreateReq: " + sdncCreateReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + utils.log("DEBUG","sdncCreateRollbackReq:\n" + sdncCreateRollbackReq, isDebugEnabled) + utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCCreate. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCCreate *****", isDebugEnabled) + } + + public void preProcessSDNCActivate(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCActivate *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId) + execution.setVariable("sdncActivateRequest", sdncActivateReq) + utils.logAudit("sdncActivateReq: " + sdncActivateReq) + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq) + execution.setVariable("rollbackData", rollbackData) + + utils.log("DEBUG","sdncActivateRollbackReq:\n" + sdncActivateRollbackReq, isDebugEnabled) + utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCActivate. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCActivate *****", isDebugEnabled) + } + + public void validateSDNCResp(Execution execution, String response, String method){ + + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + utils.logAudit("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) + + if (!"get".equals(method)) + { + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put(Prefix, "rollback" + "SDNC" + method, "true") + execution.setVariable("rollbackData", rollbackData) + } + + }else{ + utils.log("DEBUG", "Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) + } + + public void preProcessSDNCGet(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", "*** preProcessSDNCGet *** ", isDebugLogEnabled) + try{ + + def callbackUrl = execution.getVariable("sdncCallbackUrl") + // serviceOperation (URI for topology GET) will be retrieved from "selflink" from AAI if active AR exists in AAI + // or from "object-path" in SDNC response for assign when AR does not exist in AA + + String serviceOperation = "" + + if (execution.getVariable("foundActiveAR")) { + def aaiQueryResponse = execution.getVariable("aaiARGetResponse") + serviceOperation = utils.getNodeText1(aaiQueryResponse, "selflink") + utils.log("DEBUG", "AR service operation/aaiARSelfLink: " + serviceOperation, isDebugLogEnabled) + } + else + { + String response = execution.getVariable("sdncAssignResponse") + String data = utils.getNodeXml(response, "response-data") + data = data.replaceAll("<", "<") + data = data.replaceAll(">", ">") + utils.log("DEBUG", "Assign responseData: " + data, isDebugLogEnabled) + serviceOperation = utils.getNodeText1(data, "object-path") + utils.log("DEBUG", "AR service operation:" + serviceOperation, isDebugLogEnabled) + } + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String sdncRequestId = UUID.randomUUID().toString() + + String tsleep = execution.getVariable("junitSleepMs") + + //workaround for sdnc replication issue + sleep(tsleep == null ? 5000 : tsleep as Long) + + //neeed the same url as used by vfmodules + String SDNCGetRequest = + """ + + ${sdncRequestId} + ${serviceInstanceId} + query + ${serviceOperation} + ${callbackUrl} + vfmodule + + + """ + + execution.setVariable("sdncGetRequest", SDNCGetRequest) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + e, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "*** Exit preProcessSDNCGet *** ", isDebugLogEnabled) + } + + public void updateAaiAROrchStatus(Execution execution, String status){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled) + String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) + } + + public void generateOutputs(Execution execution) + { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** generateOutputs ***** ", isDebugEnabled) + try { + String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped + utils.log("DEBUG", "resp:" + sdncGetResponse, isDebugEnabled) + String arData = utils.getNodeXml(sdncGetResponse, "tunnelxconn-topology") + arData = utils.removeXmlNamespaces(arData) + + String txca = utils.getNodeXml(arData, "tunnelxconn-assignments") + String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") + execution.setVariable("allotedResourceName", utils.getNodeText1(ari, "allotted-resource-name")) + execution.setVariable("vni", utils.getNodeText1(ari, "vni")) + execution.setVariable("vgmuxBearerIp", utils.getNodeText1(ari, "vgmux_bearer_ip")) + execution.setVariable("vgmuxLanIP", utils.getNodeText1(ari, "vgmux_lan_ip")) + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error in generateOutputs ", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in generateOutputs " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit generateOutputs *** ", isDebugEnabled) + + } + + public void preProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) + } + + public void postProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy new file mode 100644 index 0000000000..142ddde6b5 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy @@ -0,0 +1,258 @@ +/* + * © 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe.scripts; + +import org.openecomp.mso.bpmn.common.scripts.*; +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.MsoUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + +/** + * This groovy class supports the CreateAllottedResourceTXCRollback.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - disableRollback - O + * @param - rollbackData + * + * Outputs: + * @param - rollbackError + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * + */ +public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProcessor{ + + String Prefix="DCARTXCRB_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) + execution.setVariable("prefix", Prefix) + String rbType = "DCARTXC_" + try { + + def rollbackData = execution.getVariable("rollbackData") + utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) + + if (rollbackData != null) { + if (rollbackData.hasType(rbType)) { + + execution.setVariable("serviceInstanceId", rollbackData.get(rbType, "serviceInstanceId")) + execution.setVariable("parentServiceInstanceId", rollbackData.get(rbType, "parentServiceInstanceId")) + execution.setVariable("allottedResourceId", rollbackData.get("SERVICEINSTANCE", "allottedResourceId")) + + + def rollbackAAI = rollbackData.get(rbType, "rollbackAAI") + if ("true".equals(rollbackAAI)) + { + execution.setVariable("rollbackAAI",true) + execution.setVariable("aaiARPath", rollbackData.get(rbType, "aaiARPath")) + + } + def rollbackSDNC = rollbackData.get(rbType, "rollbackSDNCassign") + if ("true".equals(rollbackSDNC)) + { + execution.setVariable("rollbackSDNC", true) + execution.setVariable("deactivateSdnc", rollbackData.get(rbType, "rollbackSDNCactivate")) + execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate")) + execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign")) + + utils.log("DEBUG","sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") , isDebugEnabled) + utils.log("DEBUG","sdncDelete:\n" + execution.getVariable("deleteSdnc"), isDebugEnabled) + utils.log("DEBUG","sdncUnassign:\n" + execution.getVariable("unassignSdnc"), isDebugEnabled) + + execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq")) + execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq")) + execution.setVariable("sdncUnassignRequest", rollbackData.get(rbType, "sdncAssignRollbackReq")) + } + + if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) + { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + if (execution.getVariable("disableRollback").equals("true" )) + { + execution.setVariable("skipRollback", true) + } + + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + // aaiARPath set during query (existing AR) + public void updateAaiAROrchStatus(Execution execution, String status){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = null; + utils.log("DEBUG", " *** updateAaiAROrchStatus ***", isDebugEnabled) + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String aaiARPath = execution.getVariable("aaiARPath") + utils.log("DEBUG", " aaiARPath:" + aaiARPath, isDebugEnabled) + String ar = null; //need this for getting resourceVersion for delete + if (!isBlank(aaiARPath)) + { + ar = arUtils.getARbyLink(execution, aaiARPath, "") + } + if (isBlank(ar)) + { + msg = "AR not found in AAI at:" + aaiARPath + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) + } + + public void validateSDNCResp(Execution execution, String response, String method){ + + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + utils.logAudit("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) + + }else{ + + utils.log("DEBUG", "Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + if (e.getErrorCode() == 404) + { + msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback" + utils.log("DEBUG", msg, isDebugEnabled) + } + else { + throw e; + } + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) + } + + public void deleteAaiAR(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + try{ + utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled) + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = null //need to get resource-version + String arLink = execution.getVariable("aaiARPath") + if (!isBlank(arLink)) + { + ar = arUtils.getARbyLink(execution, arLink, "") + } + arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) + } catch (BpmnError e) { + throw e; + }catch(Exception ex){ + utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + ex, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) + } + utils.log("DEBUG", " *** Exit deleteAaiAR *** ", isDebugLogEnabled) + } + + public void postProcessRequest(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled) + String msg = "" + try { + execution.setVariable("rollbackData", null) + boolean skipRollback = execution.getVariable("skipRollback") + if (skipRollback != true) + { + execution.setVariable("rolledBack", true) + utils.log("DEBUG","rolledBack", isDebugEnabled) + } + utils.log("DEBUG","*** Exit postProcessRequest ***", isDebugEnabled) + + } catch (BpmnError e) { + msg = "Bpmn Exception in postProcessRequest. " + utils.log("DEBUG", msg, isDebugEnabled) + } catch (Exception ex) { + msg = "Exception in postProcessRequest. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + + } + + public void processRollbackException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled) + try{ + utils.log("DEBUG", "Caught an Exception in DoCreateAllottedResourceRollback", isDebugEnabled) + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") + execution.setVariable("WorkflowException", null) + + }catch(BpmnError b){ + utils.log("DEBUG", "BPMN Error during processRollbackExceptions Method: ", isDebugEnabled) + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processRollbackExceptions Method: " + e.getMessage(), isDebugEnabled) + } + + utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) + } + + public void processRollbackJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled) + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") + utils.log("DEBUG", "Caught Exception in processRollbackJavaException", isDebugEnabled) + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception in processRollbackJavaException " + e.getMessage(), isDebugEnabled) + } + utils.log("DEBUG", "***** Exit processRollbackJavaException *****", isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy new file mode 100644 index 0000000000..9dbca8664b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy @@ -0,0 +1,349 @@ +/* + * © 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe.scripts; + +import org.openecomp.mso.bpmn.common.scripts.*; +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.MsoUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + +/** + * This groovy class supports the DoDeleteAllottedResourceBRG.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - disableRollback - O ignored + * @param - failNotfound - O + * @param - serviceInstanceId + * @param - allottedResourceId + * + * Outputs: + * @param - rollbackData - N/A + * @param - rolledBack - true if no deletions performed + * @param - WorkflowException - O + * @param - wasDeleted - O (ie not silentSuccess) + * + */ +public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ + + String Prefix="DDARBRG_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) + + try { + execution.setVariable("prefix", Prefix) + + //Config Inputs + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + + //Request Inputs + if (isBlank(execution.getVariable("serviceInstanceId"))){ + msg = "Input serviceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceId"))){ + msg = "Input allottedResourceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void getAaiAR (Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled) + + String allottedResourceId = execution.getVariable("allottedResourceId") + + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = arUtils.getARbyId(execution, allottedResourceId) + + String errorMsg = "" + if (isBlank(ar)) // AR was !found + { + errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId + } + else + { + String aaiARPath = execution.getVariable("aaiARPath") + String parentServiceInstanceId = arUtils.getPSIFmARLink(execution, aaiARPath) + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + } + if (!isBlank(errorMsg)) { + utils.log("DEBUG", errorMsg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) + } + utils.log("DEBUG"," ***** getAaiAR *****", isDebugEnabled) + + } + + // aaiARPath set during query (existing AR) + public void updateAaiAROrchStatus(Execution execution, String status){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled) + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) + } + + public String buildSDNCRequest(Execution execution, String action, String sdncRequestId) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled) + String sdncReq = null + + try { + + String allottedResourceId = execution.getVariable("allottedResourceId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") + + String callbackUrl = execution.getVariable("sdncCallbackUrl") + String requestId = execution.getVariable("msoRequestId") + + String serviceChainServiceInstanceId = "" + String sourceNetworkId = "" + String sourceNetworkRole = "" + String allottedResourceRole = "" + + String arModelInfo = "" + String modelInvariantId = "" + String modelVersion = "" + String modelUUId = "" + String modelCustomizationId = "" + String modelName = "" + + + sdncReq = + """ + + ${sdncRequestId} + ${serviceInstanceId} + ${action} + brg-topology-operation + ${callbackUrl} + + + + ${requestId} + DeleteBRGInstance + MSO + + + + + + + + + ${parentServiceInstanceId} + + + + + ${allottedResourceId} + brg + ${parentServiceInstanceId} + + ${modelInvariantId} + ${modelUUId} + ${modelCustomizationId} + ${modelVersion} + ${modelName} + + + + + + """ + + utils.log("DEBUG","sdncRequest:\n" + sdncReq, isDebugEnabled) + sdncReq = utils.formatXml(sdncReq) + + } catch(Exception ex) { + msg = "Exception in buildSDNCRequest. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit buildSDNCRequest *****", isDebugEnabled) + return sdncReq + } + + public void preProcessSDNCUnassign(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCUnassign *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId) + execution.setVariable("sdncUnassignRequest", sdncUnassignReq) + utils.logAudit("sdncUnassignRequest: " + sdncUnassignReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCUnassign *****", isDebugEnabled) + } + + public void preProcessSDNCDelete(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId) + execution.setVariable("sdncDeleteRequest", sdncDeleteReq) + utils.logAudit("sdncDeleteReq: " + sdncDeleteReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) + } + + public void preProcessSDNCDeactivate(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCDeactivate *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId) + execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq) + utils.logAudit("sdncDeactivateReq: " + sdncDeactivateReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCDeactivate *****", isDebugEnabled) + } + + public void validateSDNCResp(Execution execution, String response, String method){ + + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + utils.logAudit("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) + + }else{ + String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode') + utils.log("DEBUG", method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode, isDebugLogEnabled) + if (sdncRespCode.equals("404") && "deactivate".equals(method)) + { + execution.setVariable("ARNotFoundInSDNC", true) + if ("true".equals(execution.getVariable("failNotFound"))) + { + msg = "Allotted Resource Not found in SDNC" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + else + { + execution.setVariable("wasDeleted", false) + } + } + else + { + throw new BpmnError("MSOWorkflowException") + } + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) + } + + public void deleteAaiAR(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + try{ + utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled) + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = null //need to get resource-version again + String arLink = execution.getVariable("aaiARPath") + if (!isBlank(arLink)) + { + ar = arUtils.getARbyLink(execution, arLink, "") + } + arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) + } catch (BpmnError e) { + throw e; + }catch(Exception ex){ + utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + ex, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) + } + utils.log("DEBUG", " *** Exit deleteAaiAR *** ", isDebugLogEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy new file mode 100644 index 0000000000..a66e88852b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy @@ -0,0 +1,349 @@ +/* + * © 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe.scripts; + +import org.openecomp.mso.bpmn.common.scripts.*; +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.MsoUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils; +import static org.apache.commons.lang3.StringUtils.* + +/** + * This groovy class supports the DoDeleteAllottedResourceTXC.bpmn process. + * + * @author + * + * Inputs: + * @param - msoRequestId + * @param - isDebugLogEnabled + * @param - disableRollback - O ignored + * @param - failNotfound - O + * @param - serviceInstanceId + * @param - allottedResourceId + * + * Outputs: + * @param - rollbackData - N/A + * @param - rolledBack - true if no deletions performed + * @param - WorkflowException - O + * @param - wasDeleted - O (ie not silentSuccess) + * + */ +public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ + + String Prefix="DDARTXC_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void preProcessRequest (Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) + + try { + execution.setVariable("prefix", Prefix) + + //Config Inputs + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + + //Request Inputs + if (isBlank(execution.getVariable("serviceInstanceId"))){ + msg = "Input serviceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(execution.getVariable("allottedResourceId"))){ + msg = "Input allottedResourceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void getAaiAR (Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled) + + String allottedResourceId = execution.getVariable("allottedResourceId") + + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = arUtils.getARbyId(execution, allottedResourceId) + + String errorMsg = "" + if (isBlank(ar)) // AR was !found + { + errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId + } + else + { + String aaiARPath = execution.getVariable("aaiARPath") + String parentServiceInstanceId = arUtils.getPSIFmARLink(execution, aaiARPath) + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + } + if (!isBlank(errorMsg)) { + utils.log("DEBUG", errorMsg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) + } + utils.log("DEBUG"," ***** getAaiAR *****", isDebugEnabled) + + } + + // aaiARPath set during query (existing AR) + public void updateAaiAROrchStatus(Execution execution, String status){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled) + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) + String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) + utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) + } + + public String buildSDNCRequest(Execution execution, String action, String sdncRequestId) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled) + String sdncReq = null + + try { + + String allottedResourceId = execution.getVariable("allottedResourceId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") + + String callbackUrl = execution.getVariable("sdncCallbackUrl") + String requestId = execution.getVariable("msoRequestId") + + String serviceChainServiceInstanceId = "" + String sourceNetworkId = "" + String sourceNetworkRole = "" + String allottedResourceRole = "" + + String arModelInfo = "" + String modelInvariantId = "" + String modelVersion = "" + String modelUUId = "" + String modelCustomizationId = "" + String modelName = "" + + + sdncReq = + """ + + ${sdncRequestId} + ${serviceInstanceId} + ${action} + tunnelxconn-topology-operation + ${callbackUrl} + + + + ${requestId} + DeleteTunnelXConnInstance + MSO + + + + + + + + + ${parentServiceInstanceId} + + + + + ${allottedResourceId} + tunnelxconn + ${parentServiceInstanceId} + + ${modelInvariantId} + ${modelUUId} + ${modelCustomizationId} + ${modelVersion} + ${modelName} + + + + + + """ + + utils.log("DEBUG","sdncRequest:\n" + sdncReq, isDebugEnabled) + sdncReq = utils.formatXml(sdncReq) + + } catch(Exception ex) { + msg = "Exception in buildSDNCRequest. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit buildSDNCRequest *****", isDebugEnabled) + return sdncReq + } + + public void preProcessSDNCUnassign(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCUnassign *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId) + execution.setVariable("sdncUnassignRequest", sdncUnassignReq) + utils.logAudit("sdncUnassignRequest: " + sdncUnassignReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCUnassign *****", isDebugEnabled) + } + + public void preProcessSDNCDelete(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId) + execution.setVariable("sdncDeleteRequest", sdncDeleteReq) + utils.logAudit("sdncDeleteReq: " + sdncDeleteReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) + } + + public void preProcessSDNCDeactivate(Execution execution) { + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCDeactivate *****", isDebugEnabled) + + try { + String sdncRequestId = UUID.randomUUID().toString() + String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId) + execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq) + utils.logAudit("sdncDeactivateReq: " + sdncDeactivateReq) + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCDeactivate *****", isDebugEnabled) + } + + public void validateSDNCResp(Execution execution, String response, String method){ + + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + utils.logAudit("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG", "Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response, isDebugLogEnabled) + + }else{ + String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode') + utils.log("DEBUG", method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode, isDebugLogEnabled) + if (sdncRespCode.equals("404") && "deactivate".equals(method)) + { + execution.setVariable("ARNotFoundInSDNC", true) + if ("true".equals(execution.getVariable("failNotFound"))) + { + msg = "Allotted Resource Not found in SDNC" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + else + { + execution.setVariable("wasDeleted", false) + } + } + else + { + throw new BpmnError("MSOWorkflowException") + } + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in validateSDNCResp. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) + } + + public void deleteAaiAR(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + try{ + utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled) + AllottedResourceUtils arUtils = new AllottedResourceUtils(this) + String ar = null //need to get resource-version again + String arLink = execution.getVariable("aaiARPath") + if (!isBlank(arLink)) + { + ar = arUtils.getARbyLink(execution, arLink, "") + } + arUtils.deleteAR(execution, arLink + '?resource-version=' + UriUtils.encode(execution.getVariable("aaiARResourceVersion"),"UTF-8")) + } catch (BpmnError e) { + throw e; + }catch(Exception ex){ + utils.log("ERROR", "Exception Occurred Processing preProcessSDNCGetRequest. Exception is:\n" + ex, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) + } + utils.log("DEBUG", " *** Exit deleteAaiAR *** ", isDebugLogEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java new file mode 100644 index 0000000000..6317be9408 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java @@ -0,0 +1,26 @@ +package org.openecomp.mso.bpmn.vcpe.workflow; + +import javax.ws.rs.Path; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.ProcessEngines; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource; + + +/** + * + * @version 1.0 + * Asynchronous Workflow processing using JAX RS RESTeasy implementation + * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background + * and the server thread is freed up, server scales better to process more incoming requests + * + * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response + * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process + */ +@Path("/async") +public class WorkflowAsyncVcpeResource extends WorkflowAsyncResource { + + protected ProcessEngineServices getProcessEngineServices() { + return pes4junit.orElse(ProcessEngines.getProcessEngine("vcpe")); + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn new file mode 100644 index 0000000000..c893690f79 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn @@ -0,0 +1,1472 @@ + + + + + SequenceFlow_7 + SequenceFlow_3 + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + SequenceFlow_1eu60rt + + + + SequenceFlow_0afe2pg + SequenceFlow_29 + + + + + + + + + + + + + + + SequenceFlow_29 + SequenceFlow_8 + + + + SequenceFlow_8 + SequenceFlow_6 + + + + + SequenceFlow_6 + + + + + SequenceFlow_2 + + + + SequenceFlow_5 + + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + SequenceFlow_12ilko1 + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0j6sjye + SequenceFlow_1ky2sv9 + + + SequenceFlow_3 + + + + + SequenceFlow_0zq7i3q + SequenceFlow_0zpbskl + SequenceFlow_0dhf2js + + + SequenceFlow_0zq7i3q + + + + SequenceFlow_0zpbskl + SequenceFlow_1sx5llu + SequenceFlow_02o4yqx + + + SequenceFlow_0t3mtod + SequenceFlow_19mxskt + SequenceFlow_1sl79hn + + + + + + + + + + + SequenceFlow_0807ukc + SequenceFlow_19yywk8 + + + SequenceFlow_19yywk8 + + + SequenceFlow_0jg47xm + SequenceFlow_0807ukc + + + + + + + + + + + + + + + + + + + + SequenceFlow_1a7e8l1 + SequenceFlow_1f1hd3l + + + SequenceFlow_1sx5llu + SequenceFlow_0dhf2js + SequenceFlow_1rabks0 + SequenceFlow_0jg47xm + + + + + + + SequenceFlow_19mxskt + SequenceFlow_17cz98f + SequenceFlow_0sezboq + SequenceFlow_1a7e8l1 + + + + + SequenceFlow_1f1hd3l + SequenceFlow_0sezboq + SequenceFlow_1mbymcu + SequenceFlow_00by7l7 + SequenceFlow_1lv5ld6 + + + SequenceFlow_02o4yqx + SequenceFlow_0ftzjjm + + + + SequenceFlow_0dvsqpp + SequenceFlow_1rabks0 + + + + + SequenceFlow_12dakwh + SequenceFlow_0orpdrl + SequenceFlow_0ya1cr3 + + + + + + + + + + SequenceFlow_0orpdrl + SequenceFlow_1t3cnnx + + + SequenceFlow_0ya1cr3 + SequenceFlow_1sim44y + SequenceFlow_027lz43 + + + + + + + + SequenceFlow_027lz43 + SequenceFlow_1kpdu1j + SequenceFlow_007p8k3 + + + SequenceFlow_1kpdu1j + SequenceFlow_1quvahv + SequenceFlow_0t3mtod + + + + SequenceFlow_1t3cnnx + SequenceFlow_1sim44y + SequenceFlow_0dr2fem + + + + + + + SequenceFlow_1mpsdaj + SequenceFlow_1quvahv + SequenceFlow_1mbymcu + + + + + + + SequenceFlow_0ftzjjm + SequenceFlow_12dakwh + SequenceFlow_09nn9a9 + + + + + SequenceFlow_1lv5ld6 + SequenceFlow_09nn9a9 + SequenceFlow_0dr2fem + SequenceFlow_0dvsqpp + + + + + + + + + + + + + + + + + SequenceFlow_1sl79hn + SequenceFlow_0ne9n0g + + + + + + SequenceFlow_0ne9n0g + SequenceFlow_00by7l7 + SequenceFlow_17cz98f + + + + + + + + + + + + + + + + + + SequenceFlow_007p8k3 + SequenceFlow_1mpsdaj + + + + + + + + SequenceFlow_15odbkz + SequenceFlow_0j6sjye + + + + SequenceFlow_12ilko1 + SequenceFlow_0afe2pg + + + + + + SequenceFlow_1jbuf1t + + + + + + + + ${URN_mso_adapters_db_endpoint} + + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + POST + + soap-http-connector + + + SequenceFlow_0vj46ej + SequenceFlow_13uceka + + + + SequenceFlow_1ky2sv9 + SequenceFlow_0vj46ej + + + + + + + + + + + + + + SequenceFlow_00h6hmd + SequenceFlow_17g05fd + + + SequenceFlow_1eu60rt + SequenceFlow_00h6hmd + + + + + + SequenceFlow_0x9pjgm + SequenceFlow_1kgaq0j + + + + SequenceFlow_0x9pjgm + + + + + SequenceFlow_1kgaq0j + SequenceFlow_0ofjahh + SequenceFlow_16qob4p + + + SequenceFlow_0ofjahh + SequenceFlow_1cgpklo + SequenceFlow_0o6tf9p + + + + + + + + SequenceFlow_15odbkz + + + + SequenceFlow_13uceka + + + + + + + + + + + + + + + + + SequenceFlow_17g05fd + SequenceFlow_1jbuf1t + + + + + SequenceFlow_15vce9o + + + + SequenceFlow_0hwsm6n + + + + SequenceFlow_0yecpl2 + SequenceFlow_0loks1u + SequenceFlow_0b5ztoe + + + SequenceFlow_0loks1u + SequenceFlow_0e9e6fo + SequenceFlow_0hwsm6n + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0b5ztoe + SequenceFlow_0e9e6fo + + + + + + + + + SequenceFlow_15vce9o + SequenceFlow_0yecpl2 + + + + + + SequenceFlow_0o6tf9p + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0ws7fjn + SequenceFlow_1mkdhw9 + + + SequenceFlow_0p75l97 + SequenceFlow_0ws7fjn + + + + SequenceFlow_1ufio7c + + + + SequenceFlow_0aza7xq + + + + SequenceFlow_0aza7xq + SequenceFlow_0p75l97 + SequenceFlow_13iuk3s + + + SequenceFlow_1mkdhw9 + SequenceFlow_13iuk3s + SequenceFlow_1ufio7c + + + + in 1702 scope only one VNF will be created + + + 0}]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_16qob4p + SequenceFlow_1cgpklo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn new file mode 100644 index 0000000000..39fcd66c60 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn @@ -0,0 +1,807 @@ + + + + + SequenceFlow_7 + SequenceFlow_3 + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + SequenceFlow_10o22u2 + + + + SequenceFlow_12ilko1 + SequenceFlow_29 + + + + + + + + + + + + + + + SequenceFlow_29 + SequenceFlow_8 + + + + SequenceFlow_8 + SequenceFlow_6 + + + + + SequenceFlow_6 + + + + + SequenceFlow_2 + + + + SequenceFlow_5 + + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + SequenceFlow_12ilko1 + + + + + + + + + + + + + + + SequenceFlow_10o22u2 + SequenceFlow_04ao07f + + + SequenceFlow_3 + + + + + SequenceFlow_06llof4 + + + + + + + + + + + + SequenceFlow_0807ukc + SequenceFlow_19yywk8 + + + SequenceFlow_19yywk8 + + + SequenceFlow_06llof4 + SequenceFlow_0807ukc + + + + + + + + + + SequenceFlow_04ao07f + + + + + + + + + + + + + + SequenceFlow_0jek18q + SequenceFlow_1ttswdr + + + SequenceFlow_1ttswdr + SequenceFlow_18103ca + + + + SequenceFlow_0jek18q + + + + SequenceFlow_18103ca + + + + + + + + + + + + + + + + + + SequenceFlow_05cjs89 + SequenceFlow_0snq0kw + + + SequenceFlow_0zaircn + + + + SequenceFlow_09i2jj0 + + + + SequenceFlow_09i2jj0 + SequenceFlow_05cjs89 + SequenceFlow_03n4wb1 + + + SequenceFlow_0snq0kw + SequenceFlow_03n4wb1 + SequenceFlow_1jjh8rv + + + SequenceFlow_0xgpd0u + SequenceFlow_0nk8vsb + SequenceFlow_0npvfo3 + + + SequenceFlow_0nk8vsb + SequenceFlow_0et9p0i + SequenceFlow_0zaircn + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0npvfo3 + SequenceFlow_0et9p0i + + + + + + + + + + + + + + + + + SequenceFlow_128485i + SequenceFlow_04fys47 + + + SequenceFlow_1yamcyn + SequenceFlow_19cxgtm + SequenceFlow_128485i + + + + SequenceFlow_1lfph6u + + + + SequenceFlow_1ofw0fi + + + + SequenceFlow_1ofw0fi + SequenceFlow_1yamcyn + SequenceFlow_0vq7f6b + + + SequenceFlow_0vq7f6b + SequenceFlow_10scc5r + SequenceFlow_1lfph6u + + + SequenceFlow_04fys47 + SequenceFlow_1o5cutr + + + + SequenceFlow_1o5cutr + SequenceFlow_19cxgtm + SequenceFlow_10scc5r + + + + + 0}]]> + + + + + + + + + + + SequenceFlow_1jjh8rv + + + + SequenceFlow_0xgpd0u + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn new file mode 100644 index 0000000000..c1cb102e47 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn @@ -0,0 +1,735 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + notFound + SequenceFlow_6 + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_4 + + + + SequenceFlow_4 + notFound + found + + + + found + SequenceFlow_0gbsa12 + + + + SequenceFlow_6 + + + + SequenceFlow_17p4ohs + SequenceFlow_11 + + + + + SequenceFlow_09xwplc + + + + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1q6udwm + + + + + + + + + + + + SequenceFlow_1q6udwm + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + SequenceFlow_0c5h00o + SequenceFlow_1lalmvp + + + + + + + + + + + + SequenceFlow_1lalmvp + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_15z3gpq + + + + SequenceFlow_04t1zc2 + SequenceFlow_06w33tk + + + + + + + + + + + + SequenceFlow_06w33tk + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_00i7x43 + + + + + + + + + + + + + + + + + SequenceFlow_030mhcm + SequenceFlow_0q1hz2p + + + + + + + + + + + + + + + SequenceFlow_1m8u8dl + SequenceFlow_1vg5rfa + + + + SequenceFlow_1vg5rfa + SequenceFlow_17p4ohs + SequenceFlow_0f7u5pu + + + + + + SequenceFlow_0f7u5pu + SequenceFlow_16o7col + + + + SequenceFlow_16o7col + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_0t4ut76 + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + SequenceFlow_1cxj4yz + SequenceFlow_0t4ut76 + + + + + + + + + + + + + + SequenceFlow_1kbzr5v + SequenceFlow_1cxj4yz + + + + + SequenceFlow_00i7x43 + SequenceFlow_1dgzhsm + + + + SequenceFlow_15z3gpq + SequenceFlow_04t1zc2 + + + + SequenceFlow_1dgzhsm + SequenceFlow_0z8luou + SequenceFlow_030mhcm + + + + SequenceFlow_0q1hz2p + SequenceFlow_1iy3cqb + + + + + + SequenceFlow_0gbsa12 + SequenceFlow_1m8u8dl + SequenceFlow_0z8luou + + + + + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_11 + + + + + + + + SequenceFlow_1iy3cqb + SequenceFlow_09xwplc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn new file mode 100644 index 0000000000..380f4fdfa7 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn @@ -0,0 +1,635 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_0bfuk6l + + + + SequenceFlow_0ymy62j + + + + + + + + + + + + + + + SequenceFlow_1fvfplx + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + + + + + + + + + SequenceFlow_0m483rd + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_149adfw + SequenceFlow_0sh1u69 + + + + + + + + + + + + SequenceFlow_04hdt5s + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_041l824 + SequenceFlow_00i7x43 + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_1kbzr5v + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + + + + SequenceFlow_00i7x43 + SequenceFlow_13mhe5h + SequenceFlow_03bkrg4 + + + + SequenceFlow_0c5h00o + SequenceFlow_0m483rd + SequenceFlow_0m483st + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_144pxkp + SequenceFlow_0g4cl5f + + + + SequenceFlow_0g4cl5f + + + + + + + + + + + + + SequenceFlow_0ebobc7 + + + + SequenceFlow_0ebobc7 + SequenceFlow_1ugqw84 + + + + SequenceFlow_1ugqw84 + + + + + + + SequenceFlow_03bkrg4 + SequenceFlow_0oe57h4 + SequenceFlow_0ymy62j + + + + SequenceFlow_0sh1u69 + SequenceFlow_04hdt5s + SequenceFlow_0m483td + + + + + + + + SequenceFlow_1c07scr + SequenceFlow_0xm9g9s + SequenceFlow_144pxkp + + + + + + SequenceFlow_0xm9g9s + + + + SequenceFlow_0m483td + + + + + SequenceFlow_13mhe5h + + + + + SequenceFlow_0bfuk6l + SequenceFlow_1c07scr + SequenceFlow_0oe57h4 + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1fvfplx + SequenceFlow_0dzz8fp + + + + + + + SequenceFlow_0dzz8fp + + + + SequenceFlow_0m483st + + + + SequenceFlow_149adfw + + + + SequenceFlow_041l824 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn new file mode 100644 index 0000000000..7978ea6220 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn @@ -0,0 +1,735 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + notFound + SequenceFlow_6 + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_4 + + + + SequenceFlow_4 + notFound + found + + + + found + SequenceFlow_0gbsa12 + + + + SequenceFlow_6 + + + + SequenceFlow_17p4ohs + SequenceFlow_11 + + + + + SequenceFlow_09xwplc + + + + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1q6udwm + + + + + + + + + + + + SequenceFlow_1q6udwm + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + SequenceFlow_0c5h00o + SequenceFlow_1lalmvp + + + + + + + + + + + + SequenceFlow_1lalmvp + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_15z3gpq + + + + SequenceFlow_04t1zc2 + SequenceFlow_06w33tk + + + + + + + + + + + + SequenceFlow_06w33tk + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_00i7x43 + + + + + + + + + + + + + + + + + SequenceFlow_030mhcm + SequenceFlow_0q1hz2p + + + + + + + + + + + + + + + SequenceFlow_1m8u8dl + SequenceFlow_1vg5rfa + + + + SequenceFlow_1vg5rfa + SequenceFlow_17p4ohs + SequenceFlow_0f7u5pu + + + + + + SequenceFlow_0f7u5pu + SequenceFlow_16o7col + + + + SequenceFlow_16o7col + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_0t4ut76 + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + SequenceFlow_1cxj4yz + SequenceFlow_0t4ut76 + + + + + + + + + + + + + + SequenceFlow_1kbzr5v + SequenceFlow_1cxj4yz + + + + + SequenceFlow_00i7x43 + SequenceFlow_1dgzhsm + + + + SequenceFlow_15z3gpq + SequenceFlow_04t1zc2 + + + + SequenceFlow_1dgzhsm + SequenceFlow_0z8luou + SequenceFlow_030mhcm + + + + SequenceFlow_0q1hz2p + SequenceFlow_1iy3cqb + + + + + + SequenceFlow_0gbsa12 + SequenceFlow_1m8u8dl + SequenceFlow_0z8luou + + + + + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_11 + + + + + + + + SequenceFlow_1iy3cqb + SequenceFlow_09xwplc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn new file mode 100644 index 0000000000..1c31913e4e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn @@ -0,0 +1,635 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_0bfuk6l + + + + SequenceFlow_0ymy62j + + + + + + + + + + + + + + + SequenceFlow_1fvfplx + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + + + + + + + + + SequenceFlow_0m483rd + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_149adfw + SequenceFlow_0sh1u69 + + + + + + + + + + + + SequenceFlow_04hdt5s + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_041l824 + SequenceFlow_00i7x43 + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_1kbzr5v + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + + + + SequenceFlow_00i7x43 + SequenceFlow_13mhe5h + SequenceFlow_03bkrg4 + + + + SequenceFlow_0c5h00o + SequenceFlow_0m483rd + SequenceFlow_0m483st + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_144pxkp + SequenceFlow_0g4cl5f + + + + SequenceFlow_0g4cl5f + + + + + + + + + + + + + SequenceFlow_0ebobc7 + + + + SequenceFlow_0ebobc7 + SequenceFlow_1ugqw84 + + + + SequenceFlow_1ugqw84 + + + + + + + SequenceFlow_03bkrg4 + SequenceFlow_0oe57h4 + SequenceFlow_0ymy62j + + + + SequenceFlow_0sh1u69 + SequenceFlow_04hdt5s + SequenceFlow_0m483td + + + + + + + + SequenceFlow_1c07scr + SequenceFlow_0xm9g9s + SequenceFlow_144pxkp + + + + + + SequenceFlow_0xm9g9s + + + + SequenceFlow_0m483td + + + + + SequenceFlow_13mhe5h + + + + + SequenceFlow_0bfuk6l + SequenceFlow_1c07scr + SequenceFlow_0oe57h4 + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1fvfplx + SequenceFlow_0dzz8fp + + + + + + + SequenceFlow_0dzz8fp + + + + SequenceFlow_0m483st + + + + SequenceFlow_149adfw + + + + SequenceFlow_041l824 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn new file mode 100644 index 0000000000..82524a1507 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceBRG.bpmn @@ -0,0 +1,422 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_0bfuk6l + + + + SequenceFlow_0bfuk6l + SequenceFlow_0xm9g9s + + + + SequenceFlow_0ymy62j + + + + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1q6udwm + + + + + + + + + + + + SequenceFlow_1q6udwm + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + foundInSDNC + SequenceFlow_1lalmvp + + + + + + + + + + + + SequenceFlow_1lalmvp + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_15z3gpq + + + + SequenceFlow_15z3gpq + SequenceFlow_06w33tk + + + + + + + + + + + + SequenceFlow_06w33tk + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_00i7x43 + + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_1kbzr5v + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + + + + SequenceFlow_00i7x43 + notFoundInSDNC + SequenceFlow_0ymy62j + + + + SequenceFlow_0c5h00o + foundInSDNC + notFoundInSDNC + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_0xm9g9s + SequenceFlow_0g4cl5f + + + + SequenceFlow_0g4cl5f + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn new file mode 100644 index 0000000000..cac6c241a5 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteAllottedResourceTXC.bpmn @@ -0,0 +1,422 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_0bfuk6l + + + + SequenceFlow_0bfuk6l + SequenceFlow_0xm9g9s + + + + SequenceFlow_0ymy62j + + + + + + + + + + SequenceFlow_0gd64w9 + SequenceFlow_1q6udwm + + + + + + + + + + + + SequenceFlow_1q6udwm + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + foundInSDNC + SequenceFlow_1lalmvp + + + + + + + + + + + + SequenceFlow_1lalmvp + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_15z3gpq + + + + SequenceFlow_15z3gpq + SequenceFlow_06w33tk + + + + + + + + + + + + SequenceFlow_06w33tk + SequenceFlow_1s7yieq + + + SequenceFlow_1s7yieq + SequenceFlow_00i7x43 + + + + + + + + SequenceFlow_1h61pqs + + + + SequenceFlow_1kbzr5v + + + SequenceFlow_1h61pqs + SequenceFlow_1kbzr5v + + + + + + + SequenceFlow_00i7x43 + notFoundInSDNC + SequenceFlow_0ymy62j + + + + SequenceFlow_0c5h00o + foundInSDNC + notFoundInSDNC + + + SequenceFlow_0gd64w9 + + + + + SequenceFlow_0xm9g9s + SequenceFlow_0g4cl5f + + + + SequenceFlow_0g4cl5f + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy new file mode 100644 index 0000000000..f34f84a5fd --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy @@ -0,0 +1,1131 @@ +package org.openecomp.mso.bpmn.vcpe.scripts + + +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.camunda.bpm.engine.runtime.Execution +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.junit.Ignore +import org.mockito.MockitoAnnotations +import org.mockito.ArgumentCaptor +import org.camunda.bpm.engine.delegate.BpmnError +import org.openecomp.mso.bpmn.common.scripts.MsoUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.mock.FileUtil + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse +import static com.github.tomakehurst.wiremock.client.WireMock.get +import static com.github.tomakehurst.wiremock.client.WireMock.patch +import static com.github.tomakehurst.wiremock.client.WireMock.put +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching +import static org.junit.Assert.*; +import static org.mockito.Mockito.* +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource +import org.openecomp.mso.bpmn.core.RollbackData + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +class DoCreateAllottedResourceBRGTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090) + + static def urnProps = new Properties() + static def aaiUriPfx + + String Prefix="DCARBRG_" + def utils = new MsoUtils() + + @BeforeClass + public static void setUpBeforeClass() { + def fr = new FileReader("src/test/resources/mso.bpmn.urn.properties") + urnProps.load(fr) + fr.close() + + aaiUriPfx = urnProps.get("aai.endpoint") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + + // ***** preProcessRequest ***** + + @Test +// @Ignore + public void preProcessRequest() { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessRequest(mex) + + verify(mex).getVariable("isDebugLogEnabled") + verify(mex).setVariable("prefix", Prefix) + + assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback")) + assertTrue(checkMissingPreProcessRequest("serviceInstanceId")) + assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId")) + assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo")) + assertTrue(checkMissingPreProcessRequest("vni")) + assertTrue(checkMissingPreProcessRequest("vgmuxBearerIP")) + assertTrue(checkMissingPreProcessRequest("brgWanMacAddress")) + assertTrue(checkMissingPreProcessRequest("allottedResourceRole")) + assertTrue(checkMissingPreProcessRequest("allottedResourceType")) + } + + + // ***** getAaiAR ***** + + @Test +// @Ignore + public void getAaiAR() { + def arData = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml") + def arBrg = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + + wireMockRule + .stubFor(get(urlMatching("/aai/v[0-9]+/mylink")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VCPE/DoCreateAllottedResourceBRG/getArBrg.xml"))) + + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("allottedResourceType")).thenReturn("BRGt") + when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr") + when(mex.getVariable("CSI_service")).thenReturn(arData) + when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) + when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.getAaiAR(mex) + + verify(mex).setVariable("foundActiveAR", true) + } + + @Test +// @Ignore + public void getAaiAR_Duplicate() { + def arData = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml") + def arBrg = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + + wireMockRule + .stubFor(get(urlMatching("/aai/v[0-9]+/mylink")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VCPE/DoCreateAllottedResourceBRG/getArBrg.xml"))) + + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("allottedResourceType")).thenReturn("BRGt") + when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr") + when(mex.getVariable("CSI_service")).thenReturn(arData) + when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) + when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active") + + // fail if duplicate + when(mex.getVariable("failExists")).thenReturn("true") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) })) + } + + @Test +// @Ignore + public void getAaiAR_NotActive() { + def arData = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml") + def arBrg = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + + wireMockRule + .stubFor(get(urlMatching("/aai/v[0-9]+/mylink")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VCPE/DoCreateAllottedResourceBRG/getArBrg.xml"))) + + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("allottedResourceType")).thenReturn("BRGt") + when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr") + when(mex.getVariable("CSI_service")).thenReturn(arData) + when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) + + // not active + when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) })) + } + + @Test +// @Ignore + public void getAaiAR_NoStatus() { + def arData = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml") + def arBrg = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + + wireMockRule + .stubFor(get(urlMatching("/aai/v[0-9]+/mylink")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VCPE/DoCreateAllottedResourceBRG/getArBrg.xml"))) + + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("allottedResourceType")).thenReturn("BRGt") + when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr") + when(mex.getVariable("CSI_service")).thenReturn(arData) + when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) + + when(mex.getVariable("aaiAROrchStatus")).thenReturn(null) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.getAaiAR(mex) + + verify(mex, never()).setVariable("foundActiveAR", true) + } + + + // ***** createAaiAR ***** + + @Test +// @Ignore + public void createAaiAR() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + wireMockRule + .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/myid")) + .willReturn(aResponse() + .withStatus(200))) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.createAaiAR(mex) + + ArgumentCaptor keycap = ArgumentCaptor.forClass(String.class) + ArgumentCaptor valcap = ArgumentCaptor.forClass(Object.class) + + verify(mex, times(3)).setVariable(keycap.capture(), valcap.capture()) + + assertFalse(keycap.getAllValues().isEmpty()) + assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1)) + + def data = valcap.getAllValues().get(valcap.getAllValues().size()-1) + assertNotNull(data) + assertTrue(data instanceof RollbackData) + + assertEquals("45", data.get(Prefix, "disableRollback")) + assertEquals("true", data.get(Prefix, "rollbackAAI")) + assertEquals("myid", data.get(Prefix, "allottedResourceId")) + assertEquals("sii", data.get(Prefix, "serviceInstanceId")) + assertEquals("psii", data.get(Prefix, "parentServiceInstanceId")) + assertEquals(aaiUriPfx+"/aai/v9/mypsi/allotted-resources/allotted-resource/myid", data.get(Prefix, "aaiARPath")) + } + + @Test +// @Ignore + public void createAaiAR_NoArid_NoModelUuids() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + // no allottedResourceId - will be generated + + when(mex.getVariable("allottedResourceId")).thenReturn(null) + + wireMockRule + .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/.*")) + .willReturn(aResponse() + .withStatus(200))) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.createAaiAR(mex) + + ArgumentCaptor keycap = ArgumentCaptor.forClass(String.class) + ArgumentCaptor valcap = ArgumentCaptor.forClass(Object.class) + + verify(mex, times(4)).setVariable(keycap.capture(), valcap.capture()) + + assertFalse(keycap.getAllValues().isEmpty()) + assertEquals("allottedResourceId", keycap.getAllValues().get(0)) + assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1)) + + def arid = valcap.getAllValues().get(0) + assertNotNull(arid) + assertFalse(arid.isEmpty()) + + def data = valcap.getAllValues().get(valcap.getAllValues().size()-1) + assertNotNull(data) + assertTrue(data instanceof RollbackData) + + assertEquals(arid, data.get(Prefix, "allottedResourceId")) + } + + @Test +// @Ignore + public void createAaiAR_MissingPsiLink() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + when(mex.getVariable("PSI_resourceLink")).thenReturn(null) + + wireMockRule + .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/myid")) + .willReturn(aResponse() + .withStatus(200))) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) + } + + @Test +// @Ignore + public void createAaiAR_HttpFailed() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + // return 500 status + wireMockRule + .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/myid")) + .willReturn(aResponse() + .withStatus(500))) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) + } + + @Test +// @Ignore + public void createAaiAR_BpmnError() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + when(mex.getVariable("URN_aai_endpoint")).thenThrow(new BpmnError("expected exception")) + + wireMockRule + .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/myid")) + .willReturn(aResponse() + .withStatus(200))) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) + } + + @Test +// @Ignore + public void createAaiAR_Ex() { + ExecutionEntity mex = setupMock() + initCreateAaiAr(mex) + + when(mex.getVariable("URN_aai_endpoint")).thenThrow(new RuntimeException("expected exception")) + + wireMockRule + .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/myid")) + .willReturn(aResponse() + .withStatus(200))) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) })) + } + + + // ***** buildSDNCRequest ***** + + @Test +// @Ignore + public void buildSDNCRequest() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") + + assertTrue(result.indexOf("myreq= 0) + assertTrue(result.indexOf("myact= 0) + assertTrue(result.indexOf("ari= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("psii= 0) + assertTrue(result.indexOf("psii= 0) + assertTrue(result.indexOf("scu= 0) + assertTrue(result.indexOf("mri= 0) + assertTrue(result.indexOf("bwma= 0) + assertTrue(result.indexOf("myvni= 0) + assertTrue(result.indexOf("vbi= 0) + assertTrue(result.indexOf("miu= 0) + assertTrue(result.indexOf("mu= 0) + assertTrue(result.indexOf("mcu= 0) + assertTrue(result.indexOf("mv= 0) + assertTrue(result.indexOf("mn= 0) + } + + @Test +// @Ignore + public void buildSDNCRequest_EmptyModelInfo() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{}") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") + + assertTrue(result.indexOf("myreq= 0) + assertTrue(result.indexOf("myact= 0) + assertTrue(result.indexOf("ari= 0) + assertTrue(result.indexOf("sii= 0) + assertTrue(result.indexOf("psii= 0) + assertTrue(result.indexOf("psii= 0) + assertTrue(result.indexOf("scu= 0) + assertTrue(result.indexOf("mri= 0) + assertTrue(result.indexOf("bwma= 0) + assertTrue(result.indexOf("myvni= 0) + assertTrue(result.indexOf("vbi= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + assertTrue(result.indexOf("") >= 0) + } + + @Test +// @Ignore + public void buildSDNCRequest_Ex() { + ExecutionEntity mex = setupMock() + initBuildSDNCRequest(mex) + + when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") })) + } + + + // ***** preProcessSDNCAssign ***** + + @Test +// @Ignore + public void preProcessSDNCAssign() { + ExecutionEntity mex = setupMock() + def data = initPreProcessSDNC(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) + + ArgumentCaptor keycap = ArgumentCaptor.forClass(String.class) + ArgumentCaptor valcap = ArgumentCaptor.forClass(Object.class) + + verify(mex, times(2)).setVariable(keycap.capture(), valcap.capture()) + + assertFalse(keycap.getAllValues().isEmpty()) + assertEquals("sdncAssignRequest", keycap.getAllValues().get(0)) + assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1)) + + def req = valcap.getAllValues().get(0) + assertNotNull(req) + + assertEquals(data, valcap.getAllValues().get(valcap.getAllValues().size()-1)) + + def rbreq = data.get(Prefix, "sdncAssignRollbackReq") + + assertTrue(req.indexOf("assign= 0) + assertTrue(req.indexOf("CreateBRGInstance= 0) + assertTrue(req.indexOf("") >= 0) + + assertTrue(rbreq.indexOf("unassign= 0) + assertTrue(rbreq.indexOf("DeleteBRGInstance= 0) + assertTrue(rbreq.indexOf("") >= 0) + } + + @Test +// @Ignore + public void preProcessSDNCAssign_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCAssign_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) })) + } + + + // ***** preProcessSDNCCreate ***** + + @Test +// @Ignore + public void preProcessSDNCCreate() { + ExecutionEntity mex = setupMock() + def data = initPreProcessSDNC(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) + + ArgumentCaptor keycap = ArgumentCaptor.forClass(String.class) + ArgumentCaptor valcap = ArgumentCaptor.forClass(Object.class) + + verify(mex, times(2)).setVariable(keycap.capture(), valcap.capture()) + + assertFalse(keycap.getAllValues().isEmpty()) + assertEquals("sdncCreateRequest", keycap.getAllValues().get(0)) + assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1)) + + def req = valcap.getAllValues().get(0) + assertNotNull(req) + + assertEquals(data, valcap.getAllValues().get(valcap.getAllValues().size()-1)) + + def rbreq = data.get(Prefix, "sdncCreateRollbackReq") + + assertTrue(req.indexOf("create= 0) + assertTrue(req.indexOf("CreateBRGInstance= 0) + assertTrue(req.indexOf("") >= 0) + + assertTrue(rbreq.indexOf("delete= 0) + assertTrue(rbreq.indexOf("DeleteBRGInstance= 0) + assertTrue(rbreq.indexOf("") >= 0) + + } + + @Test +// @Ignore + public void preProcessSDNCCreate_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCCreate_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) })) + } + + + // ***** preProcessSDNCActivate ***** + + @Test +// @Ignore + public void preProcessSDNCActivate() { + ExecutionEntity mex = setupMock() + def data = initPreProcessSDNC(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) + + ArgumentCaptor keycap = ArgumentCaptor.forClass(String.class) + ArgumentCaptor valcap = ArgumentCaptor.forClass(Object.class) + + verify(mex, times(2)).setVariable(keycap.capture(), valcap.capture()) + + assertFalse(keycap.getAllValues().isEmpty()) + assertEquals("sdncActivateRequest", keycap.getAllValues().get(0)) + assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1)) + + def req = valcap.getAllValues().get(0) + assertNotNull(req) + + assertEquals(data, valcap.getAllValues().get(valcap.getAllValues().size()-1)) + + def rbreq = data.get(Prefix, "sdncActivateRollbackReq") + + assertTrue(req.indexOf("activate= 0) + assertTrue(req.indexOf("CreateBRGInstance= 0) + assertTrue(req.indexOf("") >= 0) + + assertTrue(rbreq.indexOf("deactivate= 0) + assertTrue(rbreq.indexOf("DeleteBRGInstance= 0) + assertTrue(rbreq.indexOf("") >= 0) + + } + + @Test +// @Ignore + public void preProcessSDNCActivate_BpmnError() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) })) + } + + @Test +// @Ignore + public void preProcessSDNCActivate_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNC(mex) + + when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) })) + } + + + // ***** validateSDNCResp ***** + + @Test +// @Ignore + public void validateSDNCResp() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") + + verify(mex).getVariable("WorkflowException") + verify(mex).getVariable("SDNCA_SuccessIndicator") + verify(mex).getVariable("rollbackData") + + ArgumentCaptor keycap = ArgumentCaptor.forClass(String.class) + ArgumentCaptor valcap = ArgumentCaptor.forClass(Object.class) + + verify(mex, times(4)).setVariable(keycap.capture(), valcap.capture()) + + assertFalse(keycap.getAllValues().isEmpty()) + assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1)) + + assertEquals(data, valcap.getAllValues().get(valcap.getAllValues().size()-1)) + + assertEquals("true", data.get(Prefix, "rollback" + "SDNCcreate")) + + } + + @Test +// @Ignore + public void validateSDNCResp_Get() { + ExecutionEntity mex = setupMock() + def data = initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "get") + + verify(mex).getVariable("WorkflowException") + verify(mex).getVariable("SDNCA_SuccessIndicator") + + verify(mex, never()).getVariable("rollbackData") + } + + @Test +// @Ignore + public void validateSDNCResp_Unsuccessful() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + // unsuccessful + when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) + } + + @Test +// @Ignore + public void validateSDNCResp_BpmnError() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) + } + + @Test +// @Ignore + public void validateSDNCResp_Ex() { + ExecutionEntity mex = setupMock() + initValidateSDNCResp(mex) + def resp = initValidateSDNCResp_Resp() + + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") })) + } + + + // ***** preProcessSDNCGet ***** + + @Test +// @Ignore + public void preProcessSDNCGet_FoundAR() { + ExecutionEntity mex = setupMock() + initPreProcessSDNCGet(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) + + ArgumentCaptor keycap = ArgumentCaptor.forClass(String.class) + ArgumentCaptor valcap = ArgumentCaptor.forClass(Object.class) + + verify(mex, times(1)).setVariable(keycap.capture(), valcap.capture()) + + assertFalse(keycap.getAllValues().isEmpty()) + assertEquals("sdncGetRequest", keycap.getAllValues().get(keycap.getAllValues().size()-1)) + + String req = valcap.getAllValues().get(valcap.getAllValues().size()-1) + + assertTrue(req.indexOf("") >= 0) + assertTrue(req.indexOf("sii= 0) + assertTrue(req.indexOf("arlink= 0) + assertTrue(req.indexOf("myurl= 0) + + } + + @Test +// @Ignore + public void preProcessSDNCGet_NotFoundAR() { + ExecutionEntity mex = setupMock() + initPreProcessSDNCGet(mex) + + when(mex.getVariable("foundActiveAR")).thenReturn(false) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) + + ArgumentCaptor keycap = ArgumentCaptor.forClass(String.class) + ArgumentCaptor valcap = ArgumentCaptor.forClass(Object.class) + + verify(mex, times(1)).setVariable(keycap.capture(), valcap.capture()) + + assertFalse(keycap.getAllValues().isEmpty()) + assertEquals("sdncGetRequest", keycap.getAllValues().get(keycap.getAllValues().size()-1)) + + String req = valcap.getAllValues().get(valcap.getAllValues().size()-1) + + assertTrue(req.indexOf("") >= 0) + assertTrue(req.indexOf("sii= 0) + assertTrue(req.indexOf("assignlink= 0) + assertTrue(req.indexOf("myurl= 0) + + } + + @Test +// @Ignore + public void preProcessSDNCGet_Ex() { + ExecutionEntity mex = setupMock() + initPreProcessSDNCGet(mex) + + when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) })) + } + + + // ***** updateAaiAROrchStatus ***** + + @Test +// @Ignore + public void updateAaiAROrchStatus() { + ExecutionEntity mex = setupMock() + initUpdateAaiAROrchStatus(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.updateAaiAROrchStatus(mex, "success") + } + + + // ***** generateOutputs ***** + + @Test +// @Ignore + public void generateOutputs() { + ExecutionEntity mex = setupMock() + def brgtop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml") + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(brgtop) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.generateOutputs(mex) + + verify(mex).setVariable("allotedResourceName", "namefromrequest") + + } + + @Test +// @Ignore + public void generateOutputs_BadXml() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.generateOutputs(mex) + + verify(mex, never()).setVariable(anyString(), anyString()) + + } + + @Test +// @Ignore + public void generateOutputs_BpmnError() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.generateOutputs(mex) + verify(mex, never()).setVariable(anyString(), anyString()) + + } + + @Test +// @Ignore + public void generateOutputs_Ex() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.generateOutputs(mex) + verify(mex, never()).setVariable(anyString(), anyString()) + + } + + + // ***** preProcessRollback ***** + + @Test +// @Ignore + public void preProcessRollback() { + ExecutionEntity mex = setupMock() + WorkflowException wfe = mock(WorkflowException.class) + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenReturn(wfe) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessRollback(mex) + + verify(mex).setVariable("prevWorkflowException", wfe) + + } + + @Test +// @Ignore + public void preProcessRollback_NotWFE() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.preProcessRollback(mex) + +// verify(mex, never()).setVariable("prevWorkflowException", any()) + + } + + @Test +// @Ignore + public void preProcessRollback_BpmnError() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.preProcessRollback(mex) + + } + + @Test +// @Ignore + public void preProcessRollback_Ex() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.preProcessRollback(mex) + + } + + + // ***** postProcessRollback ***** + + @Test +// @Ignore + public void postProcessRollback() { + ExecutionEntity mex = setupMock() + WorkflowException wfe = mock(WorkflowException.class) + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenReturn(wfe) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.postProcessRollback(mex) + + verify(mex).setVariable("WorkflowException", wfe) + verify(mex).setVariable("rollbackData", null) + + } + + @Test +// @Ignore + public void postProcessRollback_NotWFE() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE") + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + DoCreateAllottedResourceBRG.postProcessRollback(mex) + +// verify(mex, never()).setVariable("WorkflowException", any()) + verify(mex).setVariable("rollbackData", null) + + } + + @Test +// @Ignore + public void postProcessRollback_BpmnError() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.postProcessRollback(mex) })) + verify(mex, never()).setVariable("rollbackData", null) + + } + + @Test +// @Ignore + public void postProcessRollback_Ex() { + ExecutionEntity mex = setupMock() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception")) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + DoCreateAllottedResourceBRG.postProcessRollback(mex) + verify(mex, never()).setVariable("rollbackData", null) + + } + + private boolean checkMissingPreProcessRequest(String fieldnm) { + ExecutionEntity mex = setupMock() + initPreProcess(mex) + + DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() + + when(mex.getVariable(fieldnm)).thenReturn("") + + return doBpmnError( { _ -> DoCreateAllottedResourceBRG.preProcessRequest(mex) }) + } + + private boolean doBpmnError(def func) { + + try { + func() + return false; + + } catch(BpmnError e) { + return true; + } + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi") + when(mex.getVariable("vni")).thenReturn("myvni") + when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi") + when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma") + when(mex.getVariable("allottedResourceRole")).thenReturn("arr") + when(mex.getVariable("allottedResourceType")).thenReturn("art") + } + + private initCreateAaiAr(ExecutionEntity mex) { + when(mex.getVariable("disableRollback")).thenReturn(45) + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("allottedResourceId")).thenReturn("myid") + when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx) + when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace")) + when(mex.getVariable("PSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mypsi") + when(mex.getVariable("allottedResourceType")).thenReturn("BRGt") + when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr") + when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mycsi") + when(mex.getVariable("allottedResourceModelInfo")).thenReturn(""" + { + "modelInvariantUuid":"modelinvuuid", + "modelUuid":"modeluuid", + "modelCustomizationUuid":"modelcustuuid" + } + """) + } + + private initBuildSDNCRequest(ExecutionEntity mex) { + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("allottedResourceId")).thenReturn("ari") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu") + when(mex.getVariable("msoRequestId")).thenReturn("mri") + when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma") + when(mex.getVariable("vni")).thenReturn("myvni") + when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi") + when(mex.getVariable("allottedResourceModelInfo")).thenReturn(""" + { + "modelInvariantUuid":"miu", + "modelUuid":"mu", + "modelCustomizationUuid":"mcu", + "modelVersion":"mv", + "modelName":"mn" + } + """) + } + + private RollbackData initPreProcessSDNC(ExecutionEntity mex) { + def data = new RollbackData() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("rollbackData")).thenReturn(data) + + return data + } + + private initPreProcessSDNCGet(ExecutionEntity mex) { + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") + when(mex.getVariable("foundActiveAR")).thenReturn(true) + when(mex.getVariable("aaiARGetResponse")).thenReturn("arlink") + when(mex.getVariable("sdncAssignResponse")).thenReturn("<object-path>assignlink</object-path>") + when(mex.getVariable("serviceInstanceId")).thenReturn("sii") + when(mex.getVariable("junitSleepMs")).thenReturn("5") + when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl") + } + + private RollbackData initValidateSDNCResp(ExecutionEntity mex) { + def data = new RollbackData() + + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("prefix")).thenReturn(Prefix) + when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + when(mex.getVariable("rollbackData")).thenReturn(data) + + return data + } + + private String initValidateSDNCResp_Resp() { + return "<response-code>200</response-code>" + } + + private initUpdateAaiAROrchStatus(ExecutionEntity mex) { + when(mex.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx+"/aai/v9/myurl") + + wireMockRule + .stubFor(patch(urlMatching("/aai/v[0-9]+/myurl")) + .willReturn(aResponse() + .withStatus(200))) + } + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("DoCreateAllottedResourceBRG") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateAllottedResourceBRG") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mex = mock(ExecutionEntity.class) + + when(mex.getId()).thenReturn("100") + when(mex.getProcessDefinitionId()).thenReturn("DoCreateAllottedResourceBRG") + when(mex.getProcessInstanceId()).thenReturn("DoCreateAllottedResourceBRG") + when(mex.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mex.getProcessEngineServices().getRepositoryService().getProcessDefinition(mex.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mex + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java new file mode 100644 index 0000000000..893eceb1a9 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java @@ -0,0 +1,590 @@ +package org.openecomp.mso.bpmn.vcpe; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCustomer; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; +// TODO: uncomment when Homing BB is merged +// import static org.openecomp.mso.bpmn.mock.StubResponseSNIRO.mockSNIRO; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +import org.openecomp.mso.bpmn.mock.FileUtil; + +public class CreateVcpeResCustServiceTest extends WorkflowTest { + + private final CallbackSet callbacks = new CallbackSet(); + private final String request; + + public CreateVcpeResCustServiceTest() throws IOException { + callbacks.put("assign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/SDNCTopologyQueryCallbackNetworkInstance.xml")); + callbacks.put("activate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyActivateCallback.xml")); + callbacks.put("vnfCreate", FileUtil.readResourceFile("__files/VCPE/VfModularity/VNFAdapterRestCreateCallback.xml")); + callbacks.put("create", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyCreateCallback.xml")); + callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml")); + callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml")); + + callbacks.put("sniro", JSON, "SNIROResponse", FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf")); + callbacks.put("sniro2", JSON, "SNIROResponse", FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net")); + callbacks.put("sniroNoSol", JSON, "SNIROResponse", FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound")); + callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException")); + callbacks.put("sniroServiceEx", JSON, "SNIROResponse", FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException")); + + request = FileUtil.readResourceFile("__files/VCPE/request.json"); + } + + +// /** +// * End-to-End flow - Unit test for CreateVcpeResCustService.bpmn +// * - String input & String response +// */ +// +// @Test +// @Ignore +// @Deployment(resources = {"process/CreateVcpeResCustService.bpmn", +// "subprocess/DoCreateServiceInstance.bpmn", +// "subprocess/DoCreateServiceInstanceRollback.bpmn", +// "subprocess/DoCreateNetworkInstance.bpmn", +// "subprocess/DoCreateNetworkInstanceRollback.bpmn", +// "subprocess/DoCreateVnfAndModules.bpmn", +// "subprocess/DoCreateAllottedResourceTXC.bpmn", +// "subprocess/DoCreateAllottedResourceTXCRollback.bpmn", +// "subprocess/DoCreateAllottedResourceBRG.bpmn", +// "subprocess/DoCreateAllottedResourceBRGRollback.bpmn", +// "subprocess/BuildingBlock/DecomposeService.bpmn", +// "subprocess/BuildingBlock/Homing.bpmn", +// "subprocess/GenericGetService.bpmn", +// "subprocess/GenericPutService.bpmn", +// "subprocess/SDNCAdapterV1.bpmn", +// "subprocess/DoCreateVnf.bpmn", +// "subprocess/GenericGetVnf.bpmn", +// "subprocess/GenericPutVnf.bpmn", +// "subprocess/FalloutHandler.bpmn", +// "subprocess/GenericDeleteService.bpmn", +// "subprocess/ReceiveWorkflowMessage.bpmn", +// "subprocess/CompleteMsoProcess.bpmn"}) +// +// public void invokeCreateServiceInstanceInfra_Success() throws Exception { +// +// logStart(); +// +// // setup simulators +// //MockGetCustomer_VCPE(); +// MockGetCustomer("MCBH-1610", "VCPE/getCustomer.xml"); +// //MockGetNetworkCatalogData_VCPE(); +// MockGetNetworkCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/getCatalogNetworkData.json"); +// //MockGetVnfCatalogData_VCPE(); +// MockGetVnfCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/getCatalogVnfData.json"); +// //MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/getCatalogServiceResourcesData.json"); +// MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json"); +// MockGetServiceInstanceById_VCPE(); +// MockPutServiceInstance_VCPE(); +// +// //SDNC Adapter Mocks +// mockSDNCAdapterRest(); +// mockSDNCAdapter(); +// +// //from CreateNetworkInstanceTest +// sdncAdapterNetworkTopologySimulator_CreateNetworkV2(); +// MockNetworkAdapterResponse_CreateSuccessV2(); +// MockAAIResponse_queryName_CreateNetwork_404V2(); // 'network-name' not in AAI , Ok to Create. +// MockAAIResponse_cloudRegion25_Success(); +// MockAAIResponse_queryId_CreateNetwork_SuccessV2(); +// MockAAIResponse_queryVpnBinding_CreateNetwork_SuccessV2(); +// MockAAIResponse_queryVpnBinding2_CreateNetwork_SuccessV2(); +// MockAAIResponse_queryNetworkPolicy_CreateNetwork_SuccessV2(); +// MockAAIResponse_queryNetworkTableRef_CreateNetwork_SuccessV2(); +// MockAAIResponse_updateContrail_CreateNetwork_SuccessV2(); +// MockDBUpdate_Success(); +// MocksAAIResponse_queryNetworkInstance_CreateNetwork_Success(); +// +// //network AAI Mocks +// MockGetNetworkById("680b7453-0ec4-4d96-b355-280d981d418f", "VCPE/getNetwork.xml"); +// MockGetNetworkById("444a701a-6419-45b2-aa52-b45a1b719cf6", "VCPE/getNetwork.xml"); +// MockGetNetworkById("cf82a73f-de7f-4f84-8dfc-16a487c63a36", "VCPE/getNetwork.xml"); +// MockPutNetwork("680b7453-0ec4-4d96-b355-280d981d418f"); +// MockPutNetwork("cf82a73f-de7f-4f84-8dfc-16a487c63a36"); +// +// MockPutGenericVnf("9c61db87-345c-49ae-ac80-472211df5deb"); +// +// mockSNIRO(); +// +// String businessKey = UUID.randomUUID().toString(); +//// String createVfModuleRequest = +//// FileUtil.readResourceFile("__files/VCPE/CreateVfModule_VID_request.json"); +// +// Map variables = setupVariablesObjectMap(); +// +// TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVcpeResCustService", +// "v1", businessKey, getRequest(), variables); +// +// WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); +// +// String responseBody = response.getResponse(); +// System.out.println("Workflow (Synch) Response:\n" + responseBody); +// +// injectSDNCCallbacks(callbacks, "assign, query"); +// injectSDNCCallbacks(callbacks, "activate"); +// +// // TODO add appropriate assertions +// +// waitForProcessEnd(businessKey, 10000); +// checkVariable(businessKey, "CreateVcpeResCustServiceSuccessIndicator", true); +// +// logEnd(); +// } + + + /** + * TEST Decompose + Homing - Unit test for CreateVcpeResCustService.bpmn + * - String input & String response + */ + + @Test +// TODO: run this test when Homing BB is merged + @Ignore + @Deployment(resources = {"process/CreateVcpeResCustService.bpmn", + "subprocess/DoCreateServiceInstance.bpmn", + "subprocess/DoCreateServiceInstanceRollback.bpmn", + "subprocess/DoCreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstanceRollback.bpmn", + "subprocess/BuildingBlock/DecomposeService.bpmn", + "subprocess/BuildingBlock/Homing.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericPutService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/DoCreateVnf.bpmn", + "subprocess/GenericGetVnf.bpmn", + "subprocess/GenericPutVnf.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/GenericDeleteService.bpmn", + "subprocess/DoCreateAllottedResourceBRG.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn", + "subprocess/DoCreateAllottedResourceTXC.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn", + "subprocess/CompleteMsoProcess.bpmn"}) + + public void invokeDecompositionHomingCreateServiceInstanceNetwork() throws Exception { + + logStart(); + + // setup simulators + MockGetCustomer("MCBH-1610", "VCPE/getCustomer.xml"); + + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/getCatalogVcpe.json"); + +// MockPutServiceInstance_VCPE(); + +// MockGetNetworkByIdWithDepth("680b7453-0ec4-4d96-b355-280d981d418f", "VCPE/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); +// MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "VCPE/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + + MockPutGenericVnf("39ae1b77-4edd-4e94-846a-d087a35a2260"); + + // stuff to satisfy TXC & BRG subflows + MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + MockNodeQueryServiceInstanceById("MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1"); + MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1"); + + mockSDNCAdapter(200); + + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + +// TODO: uncomment when Homing BB is merged +// mockSNIRO(); + + //Below works for Homing/Sniro + + Map variables = setupVariablesObjectMap(); + + String businessKey = UUID.randomUUID().toString(); + TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVcpeResCustService", + "v1", businessKey, request, variables); + + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + + injectWorkflowMessages(callbacks, "sniro"); + injectSDNCCallbacks(callbacks, "assign, create, activate, queryTXC"); + injectSDNCCallbacks(callbacks, "assign, create, activate, queryBRG"); + + waitForProcessEnd(businessKey, 10000); + checkVariable(businessKey, "CreateVcpeResCustServiceSuccessIndicator", true); + + logEnd(); + } + + + /** + * TEST Decompose + Homing - Unit test for CreateVcpeResCustService.bpmn + * - String input & String response + */ + +// @Test +// @Deployment(resources = {"process/CreateVcpeResCustService.bpmn", +// "subprocess/DoCreateServiceInstance.bpmn", +// "subprocess/DoCreateServiceInstanceRollback.bpmn", +// "subprocess/DoCreateNetworkInstance.bpmn", +// "subprocess/DoCreateNetworkInstanceRollback.bpmn", +// "subprocess/BuildingBlock/DecomposeService.bpmn", +// "subprocess/BuildingBlock/Homing.bpmn", +// "subprocess/DoCreateAllottedResourceTXC.bpmn", +// "subprocess/DoCreateAllottedResourceTXCRollback.bpmn", +// "subprocess/DoCreateAllottedResourceBRG.bpmn", +// "subprocess/DoCreateAllottedResourceBRGRollback.bpmn", +// "subprocess/GenericGetService.bpmn", +// "subprocess/GenericPutService.bpmn", +// "subprocess/SDNCAdapterV1.bpmn", +// "subprocess/DoCreateVnf.bpmn", +// "subprocess/GenericGetVnf.bpmn", +// "subprocess/GenericPutVnf.bpmn", +// "subprocess/FalloutHandler.bpmn", +// "subprocess/GenericDeleteService.bpmn", +// "subprocess/ReceiveWorkflowMessage.bpmn", +// "subprocess/CompleteMsoProcess.bpmn"}) +// +// public void invokeDecompositionHomingCreateServiceInstanceARs() throws Exception { +// +// logStart(); +// +// // setup simulators +// MockGetCustomer("MCBH-1610", "VCPE/getCustomer.xml"); +// +// MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/getCatalogServiceResourcesDataServiceAllotted.json"); +// +// MockPutServiceInstance_VCPE(); +// //network AAI Mocks +// MockGetNetworkById("cf82a73f-de7f-4f84-8dfc-16a487c63a36", "VCPE/getNetwork.xml"); +// MockPutNetwork("cf82a73f-de7f-4f84-8dfc-16a487c63a36"); +// +// MockNodeQueryServiceInstanceById("c763d462-dfe4-4577-9706-fa3a9db640be", "VCPE/getSIUrlById.xml"); +// +// mockSDNCAdapter(); +// +// MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); +// MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); +// MockPutAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1"); +// MockPutAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET_in-use", "arId-1"); +// MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET_in-use", "arId-1"); +// +// +// MockDBUpdateVfModule(); +// +// mockSNIRO(); +// +// String businessKey = UUID.randomUUID().toString(); +// +// //Below works for Homing/Sniro +// +// Map variables = setupVariablesObjectMap(); +// TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVcpeResCustService", "v1", businessKey, getRequest(), variables); +// WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); +// String responseBody = response.getResponse(); +// System.out.println("Workflow (Synch) Response:\n" + responseBody); +// +// //Below is from CreateVcpeResCustService +//// Map variables = setupVariables(); +//// WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVcpeResCustService", variables); +//// waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); +//// String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateVcpeResCustService", "WorkflowResponse"); +// +// injectWorkflowMessages(callbacks, "sniro"); +// // TODO add appropriate assertions +// injectSDNCCallbacks(callbacks, "assign, query, create, activate, queryTXC, assign, create, activate, queryBRG"); +// waitForProcessEnd(businessKey, 10000); +// +//// checkVariable(businessKey, "CreateVcpeResCustServiceSuccessIndicator", true); +// +// logEnd(); +// } +// +// +// /** +// * TEST Decompose + Homing - Unit test for CreateVcpeResCustService.bpmn +// * - String input & String response +// */ +// +// @Test +// //@Ignore +// @Deployment(resources = {"process/CreateVcpeResCustService.bpmn", +// "subprocess/DoCreateServiceInstance.bpmn", +// "subprocess/DoCreateServiceInstanceRollback.bpmn", +// "subprocess/DoCreateNetworkInstance.bpmn", +// "subprocess/DoCreateNetworkInstanceRollback.bpmn", +// "subprocess/BuildingBlock/DecomposeService.bpmn", +// "subprocess/BuildingBlock/Homing.bpmn", +// "subprocess/DoCreateVnfAndModules.bpmn", +// "subprocess/DoCreateVnfAndModulesRollback.bpmn", +// "subprocess/DoCreateAllottedResourceTXC.bpmn", +// "subprocess/DoCreateAllottedResourceTXCRollback.bpmn", +// "subprocess/DoCreateAllottedResourceBRG.bpmn", +// "subprocess/DoCreateAllottedResourceBRGRollback.bpmn", +// "subprocess/GenericGetService.bpmn", +// "subprocess/GenericPutService.bpmn", +// "subprocess/SDNCAdapterV1.bpmn", +// "subprocess/DoCreateVnf.bpmn", +// "subprocess/GenericGetVnf.bpmn", +// "subprocess/GenericPutVnf.bpmn", +// "subprocess/FalloutHandler.bpmn", +// "subprocess/GenericDeleteService.bpmn", +// "subprocess/ReceiveWorkflowMessage.bpmn", +// "subprocess/CompleteMsoProcess.bpmn"}) +// +// public void invokeDecompositionHomingCreateServiceVnf() throws Exception { +// +// logStart(); +// +// // setup simulators +// MockGetCustomer("MCBH-1610", "VCPE/getCustomer.xml"); +// +// MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/getCatalogServiceResourcesServiceVnf.json"); +// +// MockPutServiceInstance_VCPE(); +// //network AAI Mocks +// MockGetNetworkById("cf82a73f-de7f-4f84-8dfc-16a487c63a36", "VCPE/getNetwork.xml"); +// MockPutNetwork("cf82a73f-de7f-4f84-8dfc-16a487c63a36"); +// +// MockNodeQueryServiceInstanceById("c763d462-dfe4-4577-9706-fa3a9db640be", "VCPE/getSIUrlById.xml"); +// +// +// MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVcpe.xml"); +// MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); +// MockGetGenericVnfById_404("testVnfId"); +// MockPutGenericVnf(".*"); +// MockAAIVfModule(); +// MockPatchGenericVnf("skask"); +// MockPatchVfModuleId("skask", ".*"); +// MockSDNCAdapterVfModule(); +// MockVNFAdapterRestVfModule(); +// MockDBUpdateVfModule(); +// +// +// mockSDNCAdapter(); +// //mockSDNCAdapterRest(); +// +// //MockSDNCAdapterServiceInstanceModule(); +// +// //mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); +// +// MockDBUpdateVfModule(); +// +// mockSNIRO(); +// +// String businessKey = UUID.randomUUID().toString(); +// +// //Below works for Homing/Sniro +// +// Map variables = setupVariablesObjectMap(); +// TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVcpeResCustService", "v1", businessKey, getRequest(), variables); +// WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); +// String responseBody = response.getResponse(); +// System.out.println("Workflow (Synch) Response:\n" + responseBody); +// +// //Below is from CreateVcpeResCustService +//// Map variables = setupVariables(); +//// WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVcpeResCustService", variables); +//// waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); +//// String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateVcpeResCustService", "WorkflowResponse"); +// +// injectWorkflowMessages(callbacks, "sniro"); +// // TODO add appropriate assertions +// injectSDNCCallbacks(callbacks, "assign, query"); +// waitForProcessEnd(businessKey, 10000); +// +//// checkVariable(businessKey, "CreateVcpeResCustServiceSuccessIndicator", true); +// +// logEnd(); +// } +// +// +// /** +// * TEST Decompose + Homing - Unit test for CreateVcpeResCustService.bpmn +// * - String input & String response +// */ +// +// @Test +// //@Ignore +// @Deployment(resources = {"process/CreateVcpeResCustService.bpmn", +// "subprocess/DoCreateServiceInstance.bpmn", +// "subprocess/DoCreateServiceInstanceRollback.bpmn", +// "subprocess/DoCreateNetworkInstance.bpmn", +// "subprocess/DoCreateNetworkInstanceRollback.bpmn", +// "subprocess/BuildingBlock/DecomposeService.bpmn", +// "subprocess/BuildingBlock/Homing.bpmn", +// "subprocess/DoCreateVnfAndModules.bpmn", +// "subprocess/DoCreateVnfAndModulesRollback.bpmn", +// "subprocess/DoCreateAllottedResourceTXC.bpmn", +// "subprocess/DoCreateAllottedResourceTXCRollback.bpmn", +// "subprocess/DoCreateAllottedResourceBRG.bpmn", +// "subprocess/DoCreateAllottedResourceBRGRollback.bpmn", +// "subprocess/GenericGetService.bpmn", +// "subprocess/GenericPutService.bpmn", +// "subprocess/SDNCAdapterV1.bpmn", +// "subprocess/DoCreateVnf.bpmn", +// "subprocess/GenericGetVnf.bpmn", +// "subprocess/GenericPutVnf.bpmn", +// "subprocess/FalloutHandler.bpmn", +// "subprocess/GenericDeleteService.bpmn", +// "subprocess/ReceiveWorkflowMessage.bpmn", +// "subprocess/CompleteMsoProcess.bpmn"}) +// +// public void invokeCreateAll() throws Exception { +// +// logStart(); +// +// // setup simulators +// MockGetCustomer("MCBH-1610", "VCPE/getCustomer.xml"); +// +// MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/getCatalogServiceResourcesData.json"); +// +// MockPutServiceInstance_VCPE(); +// //network AAI Mocks +// MockGetNetworkById("cf82a73f-de7f-4f84-8dfc-16a487c63a36", "VCPE/getNetwork.xml"); +// MockPutNetwork("cf82a73f-de7f-4f84-8dfc-16a487c63a36"); +// +// MockNodeQueryServiceInstanceById("c763d462-dfe4-4577-9706-fa3a9db640be", "VCPE/getSIUrlById.xml"); +// +// MockGetNetworkByIdWithDepth("680b7453-0ec4-4d96-b355-280d981d418f", "VCPE/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); +// MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "VCPE/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); +// MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "VCPE/createNetworkRequest"); +// MockGetNetworkVpnBindingWithDepth("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017", "all"); +// MockGetNetworkVpnBindingWithDepth("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6", "all"); +// MockGetNetworkPolicyWithDepth("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg", "all"); +// MockGetNetworkTableReferenceWithDepth("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1", "all"); +// MockGetNetworkTableReferenceWithDepth("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN2", "all"); +// MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "680b7453-0ec4-4d96-b355-280d981d418f", "1"); +// MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); +// +// +// MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVcpe.xml"); +// MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); +// MockGetGenericVnfById_404("testVnfId"); +// MockPutGenericVnf(".*"); +// MockAAIVfModule(); +// MockPatchGenericVnf("skask"); +// MockPatchVfModuleId("skask", ".*"); +// MockSDNCAdapterVfModule(); +// MockVNFAdapterRestVfModule(); +// MockDBUpdateVfModule(); +// +// +// mockSDNCAdapter(); +// //mockSDNCAdapterRest(); +// +// //MockSDNCAdapterServiceInstanceModule(); +// +// //mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); +// +// MockDBUpdateVfModule(); +// +// mockSNIRO(); +// +// String businessKey = UUID.randomUUID().toString(); +// +// //Below works for Homing/Sniro +// +// Map variables = setupVariablesObjectMap(); +// TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVcpeResCustService", "v1", businessKey, getRequest(), variables); +// WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); +// String responseBody = response.getResponse(); +// System.out.println("Workflow (Synch) Response:\n" + responseBody); +// +// //Below is from CreateVcpeResCustService +//// Map variables = setupVariables(); +//// WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVcpeResCustService", variables); +//// waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); +//// String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateVcpeResCustService", "WorkflowResponse"); +// +// injectWorkflowMessages(callbacks, "sniro"); +// // TODO add appropriate assertions +// injectSDNCCallbacks(callbacks, "assign, query"); +// waitForProcessEnd(businessKey, 10000); +// +//// checkVariable(businessKey, "CreateVcpeResCustServiceSuccessIndicator", true); +// +// logEnd(); +// } + + // ***************** + // Utility Section + // ***************** + + // Success Scenario + private Map setupVariablesObjectMap() { + Map variables = new HashMap<>(); + variables.put("requestId", "testRequestId"); + variables.put("request-id", "testRequestId"); + variables.put("CREVAS_testServiceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); // assigned for testing + variables.put("serviceInstanceId", "c763d462-dfe4-4577-9706-fa3a9db640be");// unit test + variables.put("sourceNetworkId", "c763d462-dfe4-4577-9706-fa3a9db640be");// unit test + variables.put("networkId", "c763d462-dfe4-4577-9706-fa3a9db640be");// unit test + variables.put("sourceNetworkRole", "whoknows");// unit test + variables.put("allottedResourceId", "arId-1"); + variables.put("junitSleepMs", "5"); + return variables; + + } + +// private Map setupVariables() { +// Map variables = new HashMap(); +// variables.put("bpmnRequest", getRequest()); +// variables.put("mso-request-id", "testRequestId"); +// variables.put("CREVAS_testServiceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); // assigned for testing +// variables.put("serviceInstanceId", "c763d462-dfe4-4577-9706-fa3a9db640be");// unit test +// variables.put("sourceNetworkId", "c763d462-dfe4-4577-9706-fa3a9db640be");// unit test +// variables.put("sourceNetworkRole", "whoknows");// unit test +// variables.put("allottedResourceId", "arId-1"); +// variables.put("junitSleepMs", "5"); +// return variables; +// +// } + + // start of mocks used locally and by other VF Module unit tests + public static void MockSDNCAdapterVfModule() { + // simplified the implementation to return "success" for all requests + stubFor(post(urlEqualTo("/SDNCAdapter")) +// .withRequestBody(containing("SvcInstanceId><")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); +// stubFor(post(urlEqualTo("/SDNCAdapter")) +// .withRequestBody(containing("vnf-type>STMTN")) +// .willReturn(aResponse() +// .withStatus(200) +// .withHeader("Content-Type", "text/xml") +// .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); +// stubFor(post(urlEqualTo("/SDNCAdapter")) +// .withRequestBody(containing("SvcAction>query")) +// .willReturn(aResponse() +// .withStatus(200) +// .withHeader("Content-Type", "text/xml") +// .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); + } + + + + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java new file mode 100644 index 0000000000..b702313670 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java @@ -0,0 +1,96 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.core.RollbackData; +import org.openecomp.mso.bpmn.mock.FileUtil; + + +public class DoCreateAllottedResourceBRGRollbackTest extends WorkflowTest { + + private static final String RbType = "DCARBRG_"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceBRGRollbackTest() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRGRollback_success() throws Exception { + + MockGetAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1"); + MockDeleteAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "1490627351232"); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess("DoCreateAllottedResourceBRGRollback", businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateAllottedResourceBRGRollback", "WorkflowException"); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + } + + private void setVariablesSuccess(Map variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", "arId-1"); + + variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET"); + variables.put("parentServiceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET"); + RollbackData rollbackData = new RollbackData(); + + rollbackData.put(RbType, "serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET"); + rollbackData.put(RbType, "serviceSubscriptionType", "123456789"); + rollbackData.put(RbType, "disablerollback", "false"); + rollbackData.put(RbType, "rollbackAAI", "true"); + rollbackData.put(RbType, "rollbackSDNCassign", "true"); + rollbackData.put(RbType, "rollbackSDNCactivate", "true"); + rollbackData.put(RbType, "rollbackSDNCcreate", "true"); + rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1"); + + rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml")); + rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml")); + rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml")); + + variables.put("rollbackData",rollbackData); + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java new file mode 100644 index 0000000000..bc3bdd2d46 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java @@ -0,0 +1,107 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.mock.FileUtil; + + +public class DoCreateAllottedResourceBRGTest extends WorkflowTest { + + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceBRGTest() throws IOException { + callbacks.put("assign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("create", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyCreateCallback.xml")); + callbacks.put("activate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyActivateCallback.xml")); + callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRG.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRG_success() throws Exception{ + + MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + MockNodeQueryServiceInstanceById("MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1"); + MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1"); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + invokeSubProcess("DoCreateAllottedResourceBRG", businessKey, variables); + + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "query"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String allotedResourceName = BPMNUtil.getVariable(processEngineRule, "DoCreateAllottedResourceBRG", "allotedResourceName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateAllottedResourceBRG", "WorkflowException"); + assertEquals("namefromrequest", allotedResourceName); + assertEquals(null, workflowException); + } + + private void setVariablesSuccess(Map variables, String requestId) { + // TODO: need all of these? + variables.put("isDebugLogEnabled", "true"); + variables.put("failExists", "true"); + variables.put("disableRollback", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("sourceNetworkId", "snId"); + variables.put("sourceNetworkRole", "snRole"); + variables.put("allottedResourceRole", "txc"); + variables.put("allottedResourceType", "BRG"); + variables.put("allottedResourceId", "arId-1"); + variables.put("vni", "BRG"); + variables.put("vgmuxBearerIP", "bearerip"); + variables.put("brgWanMacAddress", "wanmac"); + variables.put("junitSleepMs", "5"); + + variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET"); + variables.put("parentServiceInstanceId","MIS%252F1604%252F0027%252FSW_INTERNET"); + variables.put("serviceChainServiceInstanceId", "scsiId"); + + String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," + + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"vSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + + "}"; + variables.put("allottedResourceModelInfo", arModelInfo); + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java new file mode 100644 index 0000000000..de5e0f226e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java @@ -0,0 +1,96 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.core.RollbackData; +import org.openecomp.mso.bpmn.mock.FileUtil; + + +public class DoCreateAllottedResourceTXCRollbackTest extends WorkflowTest { + + private static final String RbType = "DCARTXC_"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceTXCRollbackTest() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXCRollback_success() throws Exception{ + + MockGetAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1"); + MockDeleteAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "1490627351232"); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess("DoCreateAllottedResourceTXCRollback", businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateAllottedResourceTXCRollback", "WorkflowException"); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + } + + private void setVariablesSuccess(Map variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", "arId-1"); + + variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET"); + variables.put("parentServiceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET"); + RollbackData rollbackData = new RollbackData(); + + rollbackData.put(RbType, "serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET"); + rollbackData.put(RbType, "serviceSubscriptionType", "123456789"); + rollbackData.put(RbType, "disablerollback", "false"); + rollbackData.put(RbType, "rollbackAAI", "true"); + rollbackData.put(RbType, "rollbackSDNCassign", "true"); + rollbackData.put(RbType, "rollbackSDNCactivate", "true"); + rollbackData.put(RbType, "rollbackSDNCcreate", "true"); + rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1"); + + rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml")); + rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml")); + rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml")); + + variables.put("rollbackData",rollbackData); + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java new file mode 100644 index 0000000000..936cb4a706 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java @@ -0,0 +1,104 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.mock.FileUtil; + + +public class DoCreateAllottedResourceTXCTest extends WorkflowTest { + + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceTXCTest() throws IOException { + callbacks.put("assign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("create", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyCreateCallback.xml")); + callbacks.put("activate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyActivateCallback.xml")); + callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXC.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXC_success() throws Exception{ + + MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + MockNodeQueryServiceInstanceById("MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1"); + MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1"); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + setVariablesSuccess(variables, "testRequestId123"); + + invokeSubProcess("DoCreateAllottedResourceTXC", businessKey, variables); + + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "query"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateAllottedResourceTXC", "WorkflowException"); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + logEnd(); + } + + private void setVariablesSuccess(Map variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failExists", "true"); + variables.put("disableRollback", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("sourceNetworkId", "snId"); + variables.put("sourceNetworkRole", "snRole"); + variables.put("allottedResourceRole", "txc"); + variables.put("allottedResourceType", "TunnelXConn"); + variables.put("allottedResourceId", "arId-1"); + variables.put("brgWanMacAddress", "wanmac"); + variables.put("junitSleepMs", "5"); + + variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET"); + variables.put("parentServiceInstanceId","MIS%252F1604%252F0027%252FSW_INTERNET"); + variables.put("serviceChainServiceInstanceId", "scsiId"); + + String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," + + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"vSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + + "}"; + variables.put("allottedResourceModelInfo", arModelInfo); + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java new file mode 100644 index 0000000000..054b6f5ed2 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java @@ -0,0 +1,80 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.mock.FileUtil; + + +public class DoDeleteAllottedResourceBRGTest extends WorkflowTest { + + private final CallbackSet callbacks = new CallbackSet(); + + public DoDeleteAllottedResourceBRGTest() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoDeleteAllottedResourceBRG.bpmn"}) + public void testDoDeleteAllottedResourceBRG_success() throws Exception { + + MockQueryAllottedResourceById("arId-1", "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); + MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1"); + MockDeleteAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "1490627351232"); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess("DoDeleteAllottedResourceBRG", businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteAllottedResourceBRG", "WorkflowException"); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + } + + private void setVariablesSuccess(Map variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", "arId-1"); + + variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET"); + variables.put("parentServiceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET"); + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java new file mode 100644 index 0000000000..a3faef1e67 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java @@ -0,0 +1,80 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.vcpe; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.mock.FileUtil; + + +public class DoDeleteAllottedResourceTXCTest extends WorkflowTest { + + private final CallbackSet callbacks = new CallbackSet(); + + public DoDeleteAllottedResourceTXCTest() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoDeleteAllottedResourceTXC.bpmn"}) + public void testDoDeleteAllottedResourceTXC_success() throws Exception { + + MockQueryAllottedResourceById("arId-1", "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); + MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1"); + MockDeleteAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "1490627351232"); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess("DoDeleteAllottedResourceTXC", businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteAllottedResourceTXC", "WorkflowException"); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + } + + private void setVariablesSuccess(Map variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", "arId-1"); + + variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET"); + variables.put("parentServiceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET"); + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf new file mode 100644 index 0000000000..19f18cce52 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf @@ -0,0 +1,107 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "licenseInfo": [ + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolList": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placement": [ + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "dfwtx", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostname2" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId2", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID2", + "serviceResourceId": "testResourceIdAR2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli3" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId3", + "inventoryType": "cloud", + "resourceModuleName": "VNF", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdVNF" + } + ] + } +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net new file mode 100644 index 0000000000..5a9ef4b4f9 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net @@ -0,0 +1,165 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "licenseInfo": [ + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05n", + "j1d563e8-e714-4393-8f99-cc480144a05n" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05n", + "b1d563e8-e714-4393-8f99-cc480144a05n" + ], + "resourceModuleName": "net", + "serviceResourceId": "testResourceIdNet2" + }, + { + "entitlementPoolList": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placement": [ + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "dfwtx", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostname2" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId2", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID2", + "serviceResourceId": "testResourceIdAR2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostNameNet" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClliNet" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionIdNet", + "inventoryType": "service", + "resourceModuleName": "NETWORK", + "serviceInstanceId": "testServiceInstanceIdNet", + "serviceResourceId": "testResourceIdNet" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClliNet2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionIdNet2", + "inventoryType": "cloud", + "resourceModuleName": "NETWORK", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdNet2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli3" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId3", + "inventoryType": "cloud", + "resourceModuleName": "VNF", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdVNF" + } + ] + } +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound new file mode 100644 index 0000000000..5cb748ae9d --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound @@ -0,0 +1,15 @@ +{ + "requestState": "", + "responseTime": "", + "solutionInfo": { + "placement": [], + "licenseInfo": { + "featureGroupId": "" + } + }, + "percentProgress": "", + "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e", + "startTime": "", + "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8", + "requestType": "" +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException new file mode 100644 index 0000000000..b82688428e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException @@ -0,0 +1,9 @@ +{ + "requestError": { + "policyException": { + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "Message content size exceeds the allowable limit", + "messageId": "SVC0001" + } + } +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException new file mode 100644 index 0000000000..6cc78a7cdb --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException @@ -0,0 +1,12 @@ +{ + "requestError": { + "serviceException": { + "variables": [ + "severity", 400 + ], + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", + "messageId": "SVC0001" + } + } +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getARUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getARUrlById.xml new file mode 100644 index 0000000000..e178583a34 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getARUrlById.xml @@ -0,0 +1,6 @@ + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml new file mode 100644 index 0000000000..c29133e539 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0027%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml new file mode 100644 index 0000000000..bc810c6014 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getParentServiceInstance.xml @@ -0,0 +1,30 @@ + + MIS/1604/0027/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateServiceInstance/createServiceInstance_AAIResponse_success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateServiceInstance/createServiceInstance_AAIResponse_success.xml new file mode 100644 index 0000000000..5f810bab4c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateServiceInstance/createServiceInstance_AAIResponse_success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..410ba05e5f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml @@ -0,0 +1,37 @@ + + + + 36e20198-c67a-464b-96d0-aaa99eb2639e + 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba + 1.0 + BRGmodelname + 013bd784-9bca-4919-ae2f-ae57af27bad9 + + + parent-service-instance-id + consuming-service-instance-id + namefromrequest + brg + allottedresourceidfromrequest + + + fq-name + + d1 + drole + + vlan-tag + + s2 + srole + + txc-id + + 1 + 123 + a.b.c.d + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml new file mode 100644 index 0000000000..b6da551d23 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml @@ -0,0 +1,8 @@ + + + + allotted-resource + http://localhost:28090/aai/v9/mylink + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml new file mode 100644 index 0000000000..361d44032b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + BRGr + BRGt + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + MCBH-1610 + + + service-subscription.service-type + vcpesvc + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml new file mode 100644 index 0000000000..6a35247b09 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + BRG + BRG + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + MCBH-1610 + + + service-subscription.service-type + vcpesvc + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml new file mode 100644 index 0000000000..6f86e0fb86 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d1 + MIS%252F1604%252F0026%252FSW_INTERNET + deactvate + brg-topology-operation + http://localhost:28090/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteBRGInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + brg + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml new file mode 100644 index 0000000000..30d4c7ae49 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d3 + MIS%252F1604%252F0026%252FSW_INTERNET + unassign + brg-topology-operation + http://localhost:28090/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteBRGInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + brg + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml new file mode 100644 index 0000000000..e20850a7b9 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d2 + MIS%252F1604%252F0026%252FSW_INTERNET + delete + brg-topology-operation + http://localhost:28090/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteBRGInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + brg + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..ac85be4e97 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml @@ -0,0 +1,24 @@ + + + + 36e20198-c67a-464b-96d0-aaa99eb2639e + 5b9b15d0-5dd7-47dc-95b9-0440c340a3ba + 1.0 + TXCmodelname + 013bd784-9bca-4919-ae2f-ae57af27bad9 + + + parent-service-instance-id + consuming-service-instance-id + namefromrequest + tunnelxconn + allottedresourceidfromrequest + + + my-vni + my-bearer-ip + my-lan-ip + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml new file mode 100644 index 0000000000..713ef56b50 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + TunnelXConn + TunnelXConn + TunnelXConn + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + MCBH-1610 + + + service-subscription.service-type + vcpesvc + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml new file mode 100644 index 0000000000..efec7eb001 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d1 + MIS%252F1604%252F0026%252FSW_INTERNET + deactvate + tunnelxconn-topology-operation + http://localhost:8080/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteTunnelXConnInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + tunnelxconn + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml new file mode 100644 index 0000000000..9f52758750 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d3 + MIS%252F1604%252F0026%252FSW_INTERNET + unassign + tunnelxconn-topology-operation + http://localhost:8080/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteTunnelXConnInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + tunnelxconn + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml new file mode 100644 index 0000000000..025195e326 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml @@ -0,0 +1,51 @@ + + + b043d290-140d-4a38-a9b6-95d3b8bd27d2 + MIS%252F1604%252F0026%252FSW_INTERNET + delete + tunnelxconn-topology-operation + http://localhost:8080/mso/SDNCAdapterCallbackService + + + + RaaTestRequestId1 + DeleteTunnelXConnInstance + MSO + + + + + + + + + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + arId-1 + tunnelxconn + MIS%252F1604%252F0026%252FSW_INTERNET + + + + + + + + + + + ${sourceNetworkId} + ${sourceNetworkRole} + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml new file mode 100644 index 0000000000..6a35247b09 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + BRG + BRG + BRG + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + MCBH-1610 + + + service-subscription.service-type + vcpesvc + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml new file mode 100644 index 0000000000..713ef56b50 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml @@ -0,0 +1,31 @@ + + ar-1 + Active + TunnelXConn + TunnelXConn + TunnelXConn + + 1490627351232 + + + service-instance + http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + customer.global-customer-id + MCBH-1610 + + + service-subscription.service-type + vcpesvc + + + service-instance.service-instance-id + 88819355-9a71-4ddc-9e22-373f0644b40b + + + service-instance.service-instance-name + vcpe-1702-m010904-name4 + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyCreateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyCreateCallback.xml new file mode 100644 index 0000000000..11022f6aec --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyCreateCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeactivateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeactivateCallback.xml new file mode 100644 index 0000000000..acea1459bc --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeactivateCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeleteCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeleteCallback.xml new file mode 100644 index 0000000000..11022f6aec --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeleteCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyUnassignCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyUnassignCallback.xml new file mode 100644 index 0000000000..11022f6aec --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyUnassignCallback.xml @@ -0,0 +1,16 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + + restconf/SDNCObjectPath + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/VNFAdapterRestCreateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/VNFAdapterRestCreateCallback.xml new file mode 100644 index 0000000000..49ecd0bf3f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/VNFAdapterRestCreateCallback.xml @@ -0,0 +1,55 @@ + + skask + supercool + slowburn + true + + + key1 + value1 + + + key2 + value2 + + +server1_private_ip +192.168.28.3 + + +contrail-service-instance-fqdn +default-domain:MSOTest:MsoNW-RA + + +policyKey1_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN1 + + +policyKey2_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN2 + + +oam_management_v6_address +2000:abc:bce:1111 + + +oam_management_v4_address +127.0.0.1 + + + + skask + supercool + slowburn + true + tenantId + cloudSiteId + + requestId + serviceInstanceId + + {{MESSAGE-ID}} + + {{MESSAGE-ID}} + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/createServiceInstance_genericQueryByInstance_AAIResponse_200.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/createServiceInstance_genericQueryByInstance_AAIResponse_200.xml new file mode 100644 index 0000000000..2f38a4f535 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/createServiceInstance_genericQueryByInstance_AAIResponse_200.xml @@ -0,0 +1,13 @@ + + + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + gg0e927b-6087-5574-9ef8-c5e4d5847db5 + V1.0 + vMOG-AKRON-1234 + 1462561835 + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getARUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getARUrlById.xml new file mode 100644 index 0000000000..e178583a34 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getARUrlById.xml @@ -0,0 +1,6 @@ + + + allotted-resource + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1 + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogNetworkData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogNetworkData.json new file mode 100644 index 0000000000..cab2637955 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogNetworkData.json @@ -0,0 +1,28 @@ +{ + "serviceNetworks": [ + { + "version": null, + "modelCustomizationUuid": "93a5f915-403f-487d-89e4-7107359635b0", + "modelName": "VIPR_TENANT_OAM_NET", + "modelInstanceName": "VIPR_TENANT_OAM_NET 1", + "modelUuid": "6524c8ad-dc17-44c0-ad24-08c4d2df52e6", + "modelVersion": "1.0", + "modelInvariantUuid": "b2667e06-1ec1-4a2a-a916-991b5510b603", + "networkResourceId": 100, + "created": 1484943975000, + "networkResource": { + "version": "1", + "id": 100, + "networkType": "VIPR_TENANT_OAM_NET", + "orchestrationMode": "HEAT", + "description": "manual record pointing to existing CONTRAIL30_BASIC template", + "templateId": 1, + "neutronNetworkType": "BASIC", + "aicVersionMin": "3.0", + "aicVersionMax": null, + "created": 1484936027000 + }, + "networkType": "VIPR_TENANT_OAM_NET" + } + ] +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesData.json new file mode 100644 index 0000000000..be0dfc8954 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesData.json @@ -0,0 +1,93 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "6ea0b528-e303-4686-aa77-aa2fcbdccb96", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "f5696ec0-ec71-4916-bf3b-93a654efcba4", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [ + { + "modelInfo" : { + "modelName" : "CONTRAIL_BASIC", + "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", + "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", + "modelVersion" : null, + "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", + "modelInstanceName" : "CONTRAIL_BASIC 5" + }, + "toscaNodeType" : null, + "networkType" : null, + "networkTechnology" : null, + "networkRole" : null, + "networkScope" : null + } + ], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "IP_MUX_Demux", + "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName" : "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType" : null, + "allottedResourceType" : "ContrailRoute", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + }, + { + "modelInfo" : { + "modelName" : "Service_Admin", + "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName" : "Pri_Service_Admin 5" + }, + "toscaNodeType" : null, + "allottedResourceType" : "SecurityZone", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ] + }} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetwork.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetwork.json new file mode 100644 index 0000000000..2003acf9ea --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetwork.json @@ -0,0 +1,62 @@ +{ "serviceResources" : { + "modelName" : "CMW_Service", + "modelUuid" : "Cmw_123", + "modelInvariantUuid" : "cmw-123-456-789", + "modelVersion" : null, + "serviceVnfs": [ + { "vnf" : { + "modelName" : "MANUAL RECORD", + "modelUuid" : null, + "modelInvariantUuid" : "miu-vnf-15190", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "123456-789012-cmwabd", + "modelInstanceName" : null, + "vfModules": [ + { "vfModule" : { + "modelName" : "vSAMP12::base::module-0", + "modelUuid" : null, + "modelInvariantUuid" : "miu-1001", + "modelVersion" : "1", + "modelCustomizationUuid" : "1001", + "vfModuleType" : "Test/vSAMP12::vSAMP12::base::module-0", + "isBase" : true, + "vfModuleLabel" : "base", + "initialCount" : 1 + }}, + { "vfModule" : { + "modelName" : "base::module-0", + "modelUuid" : null, + "modelInvariantUuid" : "miu-1002", + "modelVersion" : "1", + "modelCustomizationUuid" : "1002", + "vfModuleType" : "Test/vSAMP12::base::module-0", + "isBase" : true, + "vfModuleLabel" : "module-0", + "initialCount" : 1 + }}, + { "vfModule" : { + "modelName" : "vSAMP12DEV::base::module-0", + "modelUuid" : null, + "modelInvariantUuid" : "miu-1003", + "modelVersion" : "1", + "modelCustomizationUuid" : "f86e8800-7629-427f-b284-3dbfd04db01f", + "vfModuleType" : "Test/vSAMP12::vSAMP12DEV::base::module-0", + "isBase" : true, + "vfModuleLabel" : "base", + "initialCount" : 0 + }} + ] + }} + ], + "serviceNetworks": [], + "serviceAllottedResources": [ + { "allottedResource" : { + "modelName" : "Bruce Wayne", + "modelUuid" : "123-123", + "modelInvariantUuid" : "not yet implemented", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "ar-mod-custid-456-456", + "modelInstanceName" : "Clark Kent" + }} + ] + }} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json new file mode 100644 index 0000000000..4364eaf594 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json @@ -0,0 +1,26 @@ +{ + "serviceResources": { + "modelName": "CMW_Service", + "modelUuid": "Cmw_123", + "modelInvariantUuid": "cmw-123-456-789", + "modelVersion": null, + "serviceVnfs": [], + "serviceNetworks": [], + "serviceAllottedResources": [ + { + "allottedResource": { + "modelName": "Bruce Wayne", + "modelUuid": "123-123", + "modelInvariantUuid": "not yet implemented", + "modelVersion": "1.0", + "modelCustomizationUuid": "ar-mod-custid-456-456", + "modelInstanceName": "Clark Kent", + "toscaModelType": "undefined", + "allottedResourceType": "ContrailRoute", + "allottedResourceRole": "ALLOTTED_RESROUCE_ROLE", + "providingServiceModelInvariantUuid": "PROVIDING_SERVICE_MODEL_INVARIANT_UUID" + } + } + ] + } +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceAllotted.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceAllotted.json new file mode 100644 index 0000000000..e865210713 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceAllotted.json @@ -0,0 +1,84 @@ +{ + "serviceResources": { + "modelInfo": { + "modelName": "SD-WAN", + "modelUuid": "ee9807ef-9814-4067-b997-5eee54c9e719", + "modelInvariantUuid": "7b0fafc1-83df-4590-9460-b5a8d9f9f277", + "modelVersion": null + }, + "serviceVnfs": [], + "serviceNetworks": [], + "serviceAllottedResources": [ + { + "modelInfo": { + "modelName": "IP_MUX_Demux", + "modelUuid": "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid": "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion": "2.0", + "modelCustomizationUuid": "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName": "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType": null, + "allottedResourceType": "ContrailRoute", + "allottedResourceRole": "ContrailRoute", + "providingServiceModelInvariantUuid": null, + "nfFunction": null, + "nfType": null, + "nfRole": null, + "nfNamingCode": null, + "homingSolution": { + "inventoryType": "service", + "serviceInstanceId": "c763d462-dfe4-4577-9706-fa3a9db640be", + "vnfHostname": "MDTNJ01", + "cloudOwner": "aic", + "cloudRegionId": "dfwtx", + "aicClli": "KDTNJ01", + "aicVersion": "3.0", + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ] + } + }, + { + "modelInfo": { + "modelName": "Service_Admin", + "modelUuid": "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid": "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion": "2.0", + "modelCustomizationUuid": "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName": "Pri_Service_Admin 5" + }, + "toscaNodeType": null, + "allottedResourceType": "SecurityZone", + "allottedResourceRole": "SecurityZone", + "providingServiceModelInvariantUuid": null, + "nfFunction": null, + "nfType": null, + "nfRole": null, + "nfNamingCode": null, + "homingSolution": { + "inventoryType": "service", + "serviceInstanceId": "c763d462-dfe4-4577-9706-fa3a9db640be", + "vnfHostname": "MDTNJ01", + "cloudOwner": "aic", + "cloudRegionId": "dfwtx", + "aicClli": "KDTNJ01", + "aicVersion": "3.0", + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ] + } + } + ] + } +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceInstanceOnly.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceInstanceOnly.json new file mode 100644 index 0000000000..56af494d49 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceInstanceOnly.json @@ -0,0 +1,13 @@ +{ + "serviceResources": { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [], + "serviceNetworks": [], + "serviceAllottedResources": [] + } +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceNetwork.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceNetwork.json new file mode 100644 index 0000000000..821bd04c19 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceNetwork.json @@ -0,0 +1,27 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [], + "serviceNetworks": [ + { + "modelInfo" : { + "modelName" : "CONTRAIL_BASIC", + "modelUuid" : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc", + "modelInvariantUuid" : "ab07fbd8-185a-45ac-be45-db3eb02e98d5", + "modelVersion" : null, + "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9", + "modelInstanceName" : "CONTRAIL_BASIC 5" + }, + "toscaNodeType" : null, + "networkType" : null, + "networkTechnology" : null, + "networkRole" : null, + "networkScope" : null + } + ], + "serviceAllottedResources": [] + }} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceVnf.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceVnf.json new file mode 100644 index 0000000000..7893aff693 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceVnf.json @@ -0,0 +1,40 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "6ea0b528-e303-4686-aa77-aa2fcbdccb96", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "f5696ec0-ec71-4916-bf3b-93a654efcba4", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceNetworks": [], + "serviceAllottedResources": [] + }} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVcpe.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVcpe.json new file mode 100644 index 0000000000..b95e45ac46 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVcpe.json @@ -0,0 +1,76 @@ +{ "serviceResources" : { + "modelInfo" : { + "modelName" : "MSO Test Network", + "modelUuid" : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e", + "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelVersion" : null + }, + "serviceVnfs": [ + { "modelInfo" : { + "modelName" : "vHNF for DHV Test", + "modelUuid" : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332", + "modelInvariantUuid" : "6ea0b528-e303-4686-aa77-aa2fcbdccb96", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5", + "modelInstanceName" : "vHNF for DHV Test 17" + }, + "toscaNodeType" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null, + "vfModules": [ + { + "modelInfo" : { + "modelName" : "VhnfForDhvTest..base_TEST..module-0", + "modelUuid" : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a", + "modelInvariantUuid" : "f5696ec0-ec71-4916-bf3b-93a654efcba4", + "modelVersion" : "1", + "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787" + }, "isBase" : true, + "vfModuleLabel" : "base_TEST", + "initialCount" : 1, + "hasVolumeGroup" : true + } + ] + } + ], + "serviceAllottedResources": [ + { + "modelInfo" : { + "modelName" : "IP_MUX_Demux", + "modelUuid" : "64a1a718-556b-48ce-b3b7-ed3237ccc94f", + "modelInvariantUuid" : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93", + "modelInstanceName" : "Pri_IP_MUX_Demux 1" + }, + "toscaNodeType" : null, + "allottedResourceType" : "TunnelXConn", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + }, + { + "modelInfo" : { + "modelName" : "Service_Admin", + "modelUuid" : "73501e03-ee76-4509-a8ce-96d2a9f33ee9", + "modelInvariantUuid" : "462edf71-1a3c-487b-bf55-497460ab7de3", + "modelVersion" : "2.0", + "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6", + "modelInstanceName" : "Pri_Service_Admin 5" + }, + "toscaNodeType" : null, + "allottedResourceType" : "BRG", + "allottedResourceRole" : null, + "providingServiceModelInvariantUuid" : null, + "nfFunction" : null, + "nfType" : null, + "nfRole" : null, + "nfNamingCode" : null + } + ] + }} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVnfData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVnfData.json new file mode 100644 index 0000000000..d95b313583 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVnfData.json @@ -0,0 +1 @@ +{"serviceVnfs":[]} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCustomer.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCustomer.xml new file mode 100644 index 0000000000..6e35f24205 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCustomer.xml @@ -0,0 +1,7 @@ + + MCBH-1610 + MCBH-1610 + 1465943440 + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getNetwork.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getNetwork.xml new file mode 100644 index 0000000000..32a01b6973 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getNetwork.xml @@ -0,0 +1,92 @@ + + cf82a73f-de7f-4f84-8dfc-16a487c63a36 + Dev_NoBinding-2001 + CONTRAIL30_BASIC + GN_EVPN_direct + contrail + 968a47e3-e238-4158-af87-6be7f508a6c0 + false + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + 1476384388 + active + Dev_NoBinding-2001/11c429ac-eab3-4566-a9d3-d8ca6fb4e803 + default-domain:IST_Automation_AAI_updated:Dev_NoBinding-2001 + + false + false + false + + + 5c559cd8-1ef2-45a8-b342-b4c9307d33ff + + 48267a65-2209-4e10-ad44-fc30d4fcb508 + 218.210.11.1 + 218.210.11.0 + 24 + 4 + pending-update + true + 218.210.11.3 + 218.210.11.64 + 1476384386 + + + + + tenant + https://aai-int1.test.openecomp.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/fe4400a8e96e4caa85ccdca8a850255b + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + tenant.tenant-id + fe4400a8e96e4caa85ccdca8a850255b + + + tenant.tenant-name + IST_Automation_AAI_updated + + + + cloud-region + https://aai-int1.test.openecomp.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6 + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + cloud-region.owner-defined-type + + + + service-instance + https://aai-int1.test.openecomp.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/ffdfebef-9cf0-4be4-ab29-0380f0da0341 + + customer.global-customer-id + MSO_1610_dev + + + service-subscription.service-type + MSO-dev-service-type + + + service-instance.service-instance-id + ffdfebef-9cf0-4be4-ab29-0380f0da0341 + + + service-instance.service-instance-name + dm4251_SERVICE1 + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentSIUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentSIUrlById.xml new file mode 100644 index 0000000000..c29133e539 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0027%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentServiceInstance.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentServiceInstance.xml new file mode 100644 index 0000000000..bc810c6014 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentServiceInstance.xml @@ -0,0 +1,30 @@ + + MIS/1604/0027/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/request.json new file mode 100644 index 0000000000..9141d5074a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/request.json @@ -0,0 +1,40 @@ +{ + "requestDetails": + { + "modelInfo": + { + "modelType":"service", + "modelInvariantUuid":"uuid-miu-svc-011-abcdef", + "modelVersionId":"ASDC_TOSCA_UUID", + "modelName":"SIModelName1", + "modelVersion":"2" + }, + "subscriberInfo": + { + "globalSubscriberId":"MCBH-1610", + "subscriberName":"Kaneohe" + }, + "requestInfo": + { + "instanceName":"VCPE1", + "source":"VID", + "suppressRollback":"false", + "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration": + { + "lcpCloudRegionId":"mdt1", + "tenantId":"8b1df54faa3b49078e3416e21370a3ba" + }, + "requestParameters": + { + "subscriptionServiceType":"vcpesvc", + "aLaCarte":"false", + "userParams": + { + "BRG_WAN_MAC_Address" : "brgmac" + } + } + + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/serviceDecompositionATMFW.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/serviceDecompositionATMFW.json new file mode 100644 index 0000000000..bc54c557e1 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/serviceDecompositionATMFW.json @@ -0,0 +1,110 @@ +{ +"serviceResources" : { + "modelInfo" : { + "modelName" : "CMW_Service", + "modelUuid" : "", + "modelInvariantId" : "cmw-123-456-789", + "modelVersion" : "", + "modelCustomizationUuid" : "", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "Cmw_123", + "modelType" : "" + }, + "serviceInstanceData" : { + "instanceId" : "ff5256d2-5a33-55df-13ab-12abad84e7ff" + }, + "serviceNetworks" : [ { + "modelInfo" : { + "modelName" : "CONTRAIL30_BASIC", + "modelUuid" : "", + "modelInvariantId" : "not yet implemented", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "z_network_123", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "mod-inst-uuid-123", + "modelType" : "network" + }, + "instanceData" : { }, + "networkType" : "CONTRAIL30_BASIC" + } ], + "serviceVnfs" : [ { + "modelInfo" : { + "modelName" : "vSAMP12", + "modelUuid" : "", + "modelInvariantId" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelType" : "vnf" + }, + "instanceData" : { }, + "vfModules" : [ { + "modelInfo" : { + "modelName" : "vSAMP12::base::module-0", + "modelUuid" : "", + "modelInvariantId" : "miu-1001", + "modelVersion" : "1", + "modelCustomizationUuid" : "1001", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "", + "modelType" : "vfModule" + }, + "instanceData" : { }, + "hasVolumeGroup" : false, + "isBase" : true, + "initialCount" : 1 + }, { + "modelInfo" : { + "modelName" : "base::module-0", + "modelUuid" : "", + "modelInvariantId" : "miu-1002", + "modelVersion" : "1", + "modelCustomizationUuid" : "1002", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "", + "modelType" : "vfModule" + }, + "instanceData" : { }, + "hasVolumeGroup" : false, + "isBase" : true, + "initialCount" : 1 + }, { + "modelInfo" : { + "modelName" : "vSAMP12DEV::base::module-0", + "modelUuid" : "", + "modelInvariantId" : "miu-1003", + "modelVersion" : "1", + "modelCustomizationUuid" : "f86e8800-7629-427f-b284-3dbfd04db01f", + "modelInstanceName" : "", + "modelCustomizationName" : "", + "modelVersionId" : "", + "modelType" : "vfModule" + }, + "instanceData" : { }, + "hasVolumeGroup" : false, + "isBase" : true, + "initialCount" : 0 + } ] + } ], + "serviceAllottedResources" : [ { + "modelInfo" : { + "modelName" : "Bruce Wayne", + "modelUuid" : "", + "modelInvariantId" : "not yet implemented", + "modelVersion" : "1.0", + "modelCustomizationUuid" : "ar-mod-custid-456-456", + "modelInstanceName" : "Clark Kent", + "modelCustomizationName" : "", + "modelVersionId" : "123-123", + "modelType" : "allottedResource" + }, + "instanceData" : { } + } ] + } +} \ No newline at end of file -- cgit 1.2.3-korg