From 2479d5fde271fd1296fd4e1ae58a8608991496f8 Mon Sep 17 00:00:00 2001 From: c00149107 Date: Fri, 27 Apr 2018 17:22:59 +0800 Subject: Change to sdncadapter for service call Change to sdncadapter for service call Change-Id: I9011e69fba20d4d0f83705455791b7357e2f5bb0 Issue-ID: SO-587 Signed-off-by: c00149107 --- .../scripts/DoDeleteResourcesV1.groovy | 92 ++++++++++++++++++---- 1 file changed, 78 insertions(+), 14 deletions(-) (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 92e7fdded5..f08a769fb1 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -309,20 +309,84 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { execution.setVariable("CVFMI_updateResOperStatusRequest", body) } - public void prepareServiceTopologyDeletion(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** prepareServiceTopologyDeletion " + " *****", isDebugEnabled) - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - execution.setVariable("modelInvariantUuid", serviceDecomposition.getModelInfo().getModelInvariantUuid()) - execution.setVariable("modelVersion", serviceDecomposition.getModelInfo().getModelVersion()) - execution.setVariable("modelUuid", serviceDecomposition.getModelInfo().getModelUuid()) - execution.setVariable("serviceModelName", serviceDecomposition.getModelInfo().getModelName()) + public void prepareSDNCServiceDeactivateRequest (DelegateExecution execution) { + prepareSDNCServiceRequest (execution, "deactivate") + } + + public void prepareSDNCServiceDeleteRequest (DelegateExecution execution) { + prepareSDNCServiceRequest (execution, "delete") + } + + public void prepareSDNCServiceRequest (DelegateExecution execution, String svcAction) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled) - // set operation type and resource type is required to form request body - execution.setVariable("operationType", "DELETE") - execution.setVariable("resourceType", "SDNC-SERVICE-TOPOLOGY") + try { + // get variables + String sdnc_svcAction = svcAction + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String hdrRequestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + String sdnc_service_id = serviceInstanceId + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String serviceType = execution.getVariable("serviceType") + String globalCustomerId = execution.getVariable("globalSubscriberId") + String serviceModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() + String serviceModelUuid = serviceDecomposition.getModelInfo().getModelUuid() + String serviceModelVersion = serviceDecomposition.getModelInfo().getModelVersion() + String serviceModelName = serviceDecomposition.getModelInfo().getModelName() + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyDeleteRequest = + """ + + ${hdrRequestId} + ${serviceInstanceId} + ${sdnc_svcAction} + service-topology-operation + sdncCallback + generic-resource + + + + ${hdrRequestId} + DeleteServiceInstance + ${source} + + + + + + ${serviceInstanceId} + ${serviceType} + + ${serviceModelInvariantUuid} + ${serviceModelUuid} + ${serviceModelVersion} + ${serviceModelName} + + ${serviceInstanceId} + ${globalCustomerId} + + + + + """.trim() + + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) + utils.logAudit(sndcTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) + utils.log("INFO","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteResourcesV1 flow. prepareSDNCServiceRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - utils.log("INFO"," ***** prepareServiceTopologyDeletion " + " *****", isDebugEnabled) - } + } + utils.log("INFO","***** Exit prepareSDNCServiceRequest for " + svcAction + "*****", isDebugEnabled) + } } -- cgit 1.2.3-korg