summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy
diff options
context:
space:
mode:
authorc00149107 <chenchuanyu@huawei.com>2017-10-13 17:15:30 +0800
committerSeshu Kumar M <seshu.kumar.m@huawei.com>2017-10-13 09:58:32 +0000
commite137c11a9e1f6f62b2f4a4354f097419d4e8ce3f (patch)
tree30ecfa698799391d054525993540c0a9e414be86 /bpmn/MSOInfrastructureBPMN/src/main/groovy
parent64d0ab5ebd9121de878d7932e2469afae74c8a99 (diff)
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 <chenchuanyu@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy9
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy119
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy4
3 files changed, 125 insertions, 7 deletions
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 =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
+ </ns:initResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ 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