From e137c11a9e1f6f62b2f4a4354f097419d4e8ce3f Mon Sep 17 00:00:00 2001 From: c00149107 Date: Fri, 13 Oct 2017 17:15:30 +0800 Subject: Fix wrong work flow for service delete Fix wrong work flow for service delete bpmn logic Change-Id: I86287cc484b85ed0a31fcf70bea9049d896ade91 Issue-ID:SO-218 Signed-off-by: c00149107 --- .../scripts/DoCreateE2EServiceInstance.groovy | 9 +- .../DoCustomDeleteE2EServiceInstance.groovy | 119 ++++++ .../DoDeleteVFCNetworkServiceInstance.groovy | 4 +- .../subprocess/DoCreateE2EServiceInstance.bpmn | 125 ++++--- .../DoCustomDeleteE2EServiceInstance.bpmn | 398 ++++++++++++++------- 5 files changed, 476 insertions(+), 179 deletions(-) (limited to 'bpmn/MSOInfrastructureBPMN/src/main') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index b053b4e7d8..a2be3035a6 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -619,7 +619,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { String progress = "0" String reason = "" String operationContent = "Prepare service creation" - utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) + utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + oprationType, isDebugEnabled) serviceId = UriUtils.encode(serviceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) @@ -669,7 +669,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { /** * prepare resource create request */ - public void preResourceRequest(execution, resourceName){ + public void preResourceRequest(execution, resourceType){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String serviceInstanceName = execution.getVariable("serviceInstanceName") String nsServiceName = nsName + "_" + serviceInstanceName @@ -687,11 +687,10 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { def segmentList = serviceReq.service.parameters.segments if (segmentList != null) { segmentList.each { - if(StringUtils.containsIgnoreCase(it.resourceName, nsName)){ - String resourceActualName = it.resourceName + if(StringUtils.containsIgnoreCase(it.resourceName, resourceType)){ String resourceUUID = it.resourceUUID String resourceParameters = it.nsParameters - execution.setVariable("resourceName", resourceActualName) + execution.setVariable("resourceType", resourceType) execution.setVariable("resourceUUID", resourceUUID) execution.setVariable("resourceParameters", resourceParameters) } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index 041ff62aca..b7aaef097a 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -473,4 +473,123 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } utils.log("DEBUG"," *** Exit postProcessAAIDEL *** ", isDebugEnabled) } + + public void preInitResourcesOperStatus(Execution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String resourceTemplateUUIDs = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service creation" + utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + oprationType, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + // we use resource instance ids for delete flow as resourceTemplateUUIDs + /*[ + { + "resourceInstanceId":"1111", + "resourceType":"vIMS" + }, + { + "resourceInstanceId":"222", + "resourceType":"vEPC" + }, + { + "resourceInstanceId":"3333", + "resourceType":"overlay" + }, + { + "resourceInstanceId":"4444", + "resourceType":"underlay" + } + ]*/ + String serviceRelationShip = execution.getVariable("serviceRelationShip") + + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + List relationShipList = jsonSlurper.parseText(serviceRelationShip) + + if (relationShipList != null) { + relationShipList.each { + resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" + } + } + + def dbAdapterEndpoint = execution.getVariable("URN_mso_openecomp_adapters_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """ + + + + ${serviceId} + ${operationId} + ${operationType} + ${resourceTemplateUUIDs} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + } + + /** + * prepare delete parameters + */ + public void preResourceDelete(execution, resourceName){ + // we use resource instance ids for delete flow as resourceTemplateUUIDs + /*[ + { + "resourceInstanceId":"1111", + "resourceType":"vIMS" + }, + { + "resourceInstanceId":"222", + "resourceType":"vEPC" + }, + { + "resourceInstanceId":"3333", + "resourceType":"overlay" + }, + { + "resourceInstanceId":"4444", + "resourceType":"underlay" + } + ]*/ + String serviceRelationShip = execution.getVariable("serviceRelationShip") + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + List relationShipList = jsonSlurper.parseText(serviceRelationShip) + + if (relationShipList != null) { + relationShipList.each { + if(resouceName.equals(it.resouceType)) + String resouceTemplateUUID = it.resourceInstanceId + String resouceInstanceUUID = it.resouceInstanceId + execution.setVariable("resouceTemplateUUID", resouceTemplateUUID) + execution.setVariable("resouceInstanceId", resouceInstanceUUID) + execution.setResourceType("resourceType", resouceName) + } + } + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index f3659ed52c..bec12906ad 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -75,9 +75,9 @@ public class DODeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces utils.log("DEBUG", "serviceId:" + serviceId, isDebugEnabled) String operationId = execution.getVariable("operationId") utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled) - String nodeTemplateUUID = execution.getVariable("nodeTemplateUUID") + String nodeTemplateUUID = execution.getVariable("resourceTemplateUUID") utils.log("DEBUG", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled) - String nsInstanceId = execution.getVariable("nsInstanceId") + String nsInstanceId = execution.getVariable("resourceInstanceId") utils.log("DEBUG", "nsInstanceId:" + nsInstanceId, isDebugEnabled) String nsOperationKey = "{\"globalSubscriberId\":\"" + globalSubscriberId + "\",\"serviceType:\"" + serviceType + "\",\"serviceId\":\"" + serviceId + "\",\"operationId\":\"" + operationId diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index a76036668c..109cf69b92 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -127,12 +127,13 @@ def ddsi = new DoCreateE2EServiceInstance() ddsi.postProcessAAIPUT(execution)]]> - - SequenceFlow_1hgiln0 + + SequenceFlow_1pjr82f SequenceFlow_0ofqw6v +csi.preResourceRequest(execution, nsName)]]> SequenceFlow_05gdjox @@ -142,19 +143,6 @@ String resourceName= "vEPC" def csi = new DoCreateE2EServiceInstance() csi.preResourceRequest(execution, resourceName)]]> - - - - - - - - - - - SequenceFlow_0ofqw6v - SequenceFlow_1vvdkcs - @@ -163,9 +151,10 @@ csi.preResourceRequest(execution, resourceName)]]> - + + SequenceFlow_15zgrcq SequenceFlow_0k4q7jm @@ -226,7 +215,7 @@ String nsName = "vIMS" def csi = new DoCreateE2EServiceInstance() csi.preResourceRequest(execution, nsName)]]> - + @@ -235,13 +224,37 @@ csi.preResourceRequest(execution, nsName)]]> - + + SequenceFlow_0ua1bbk SequenceFlow_1hgiln0 + + + SequenceFlow_1hgiln0 + SequenceFlow_1vo0235 + + + + + SequenceFlow_1vo0235 + SequenceFlow_17i1ors + + + + SequenceFlow_17i1ors + SequenceFlow_1pjr82f + + + SequenceFlow_0ofqw6v + SequenceFlow_1vvdkcs + @@ -417,25 +430,22 @@ csi.preResourceRequest(execution, nsName)]]> - + - - - - + - - + + - + @@ -446,17 +456,17 @@ csi.preResourceRequest(execution, nsName)]]> - - + + - + - - + + - + @@ -467,9 +477,9 @@ csi.preResourceRequest(execution, nsName)]]> - + - + @@ -502,23 +512,56 @@ csi.preResourceRequest(execution, nsName)]]> - + - + - - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn index c354ef6932..91f5404c9b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0vz7cd9 @@ -26,8 +26,8 @@ ddsi.preProcessRequest(execution) - SequenceFlow_0ph3iin SequenceFlow_0uhpfcl + SequenceFlow_0vg4q7x SequenceFlow_0g6bxqw @@ -98,46 +98,34 @@ ex.processJavaException(execution)]]> - + - - - - - - - + + + + + + + + SequenceFlow_1wmjau1 SequenceFlow_0qquvgc - - - - - - - - - - - - SequenceFlow_1dza4q4 - SequenceFlow_0rpu756 - + - - - SequenceFlow_1av166w + + SequenceFlow_1931m8u SequenceFlow_1wmjau1 +ddsi.preResourceDelete(execution, resourceName )]]> SequenceFlow_0qquvgc - SequenceFlow_01o68xa + SequenceFlow_0vg4q7x - SequenceFlow_0rpu756 - SequenceFlow_0ph3iin + SequenceFlow_0uc2beq + SequenceFlow_1m7tont - - SequenceFlow_01o68xa + + SequenceFlow_13sc98g SequenceFlow_1dza4q4 +ddsi.preResourceDelete(execution, resourceName )]]> - - + + + + SequenceFlow_1av166w + SequenceFlow_030y6yz + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + ${CVFMI_initResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_030y6yz + SequenceFlow_13sc98g + + + + + SequenceFlow_1m7tont + SequenceFlow_1wnkgpx + + + + + + + + + + + + + + + + SequenceFlow_1wnkgpx + SequenceFlow_1931m8u + + + + SequenceFlow_1dza4q4 + SequenceFlow_0rpu756 + + + + + + SequenceFlow_0rpu756 + SequenceFlow_0d9lmlv + + + + SequenceFlow_0d9lmlv + SequenceFlow_1g4djgh + + + SequenceFlow_1g4djgh + SequenceFlow_0uc2beq + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - + - + - - + + - + - - + + - + - + - - + + - + - - - - - + + - - - - - - - - + - + - - + + - + - + - + - + - - - - - - - - - + + - + - - + + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg