AT&T 1712 and 1802 release code
[so.git] / bpmn / MSOInfrastructureBPMN / src / main / groovy / org / openecomp / mso / bpmn / infrastructure / scripts / DoCustomDeleteE2EServiceInstance.groovy
index 85261ee..a32fd7b 100644 (file)
@@ -18,7 +18,9 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-package org.openecomp.mso.bpmn.infrastructure.scripts;
+package org.openecomp.mso.bpmn.infrastructure.scripts
+
+import org.json.JSONArray;
 
 import static org.apache.commons.lang3.StringUtils.*;
 import groovy.xml.XmlUtil
@@ -33,12 +35,13 @@ import org.openecomp.mso.rest.APIResponse;
 import org.openecomp.mso.rest.RESTClient
 import org.openecomp.mso.rest.RESTConfig
 
+import java.util.List;
 import java.util.UUID;
 import javax.xml.parsers.DocumentBuilder
 import javax.xml.parsers.DocumentBuilderFactory
 
 import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.json.JSONObject;
 import org.apache.commons.lang3.*
 import org.apache.commons.codec.binary.Base64;
@@ -49,6 +52,8 @@ import org.w3c.dom.Node
 import org.w3c.dom.NodeList
 import org.xml.sax.InputSource
 
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP.Def;
+
 /**
  * This groovy class supports the <class>DoDeleteE2EServiceInstance.bpmn</class> process.
  * 
@@ -74,9 +79,9 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
        ExceptionUtil exceptionUtil = new ExceptionUtil()
        JsonUtils jsonUtil = new JsonUtils()
 
-       public void preProcessRequest (Execution execution) {
+       public void preProcessRequest (DelegateExecution execution) {
                def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** preProcessRequest *****",  isDebugEnabled)
+               utils.log("INFO"," ***** preProcessRequest *****",  isDebugEnabled)
                String msg = ""
 
                try {
@@ -92,28 +97,28 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
                        }
 
                        //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
-                       String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
-                       if (subscriptionServiceType == null)
+                       String serviceType = execution.getVariable("serviceType")
+                       if (serviceType == null)
                        {
-                               execution.setVariable("subscriptionServiceType", "")
+                               execution.setVariable("serviceType", "")
                        }
 
                        //Generated in parent for AAI PUT
                        String serviceInstanceId = execution.getVariable("serviceInstanceId")
                        if (isBlank(serviceInstanceId)){
                                msg = "Input serviceInstanceId is null"
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                               utils.log("INFO", msg, isDebugEnabled)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        }
 
                        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)
+                               utils.log("INFO", msg, isDebugEnabled)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        }
                        execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
-                       utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
+                       utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
 
                        StringBuilder sbParams = new StringBuilder()
                        Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
@@ -143,22 +148,22 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
                        throw e;
                } catch (Exception ex){
                        msg = "Exception in preProcessRequest " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               utils.log("DEBUG"," ***** Exit preProcessRequest *****",  isDebugEnabled)
+               utils.log("INFO"," ***** Exit preProcessRequest *****",  isDebugEnabled)
        }
        
 
-       public void preProcessVFCDelete (Execution execution) {
+       public void preProcessVFCDelete (DelegateExecution execution) {
        }
        
-       public void postProcessVFCDelete(Execution execution, String response, String method) {
+       public void postProcessVFCDelete(DelegateExecution execution, String response, String method) {
        }
        
-       public void preProcessSDNCDelete (Execution execution) {
+       public void preProcessSDNCDelete (DelegateExecution execution) {
                def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled)
+               utils.log("INFO"," ***** preProcessSDNCDelete *****", isDebugEnabled)
                String msg = ""
 
                try {
@@ -235,12 +240,12 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
                                        <service-information>
                                                <service-id>${serviceId}</service-id>
                                                <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
-                                               <ecomp-model-information>
+                                               <onap-model-information>
                                                 <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
                                                 <model-uuid>${modelUuid}</model-uuid>
                                                 <model-version>${modelVersion}</model-version>
                                                 <model-name>${modelName}</model-name>
-                                           </ecomp-model-information>
+                                           </onap-model-information>
                                                <service-instance-id>${serviceInstanceId}</service-instance-id>
                                                <subscriber-name/>
                                                <global-customer-id>${globalSubscriberId}</global-customer-id>
@@ -257,173 +262,158 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
                        String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
                        execution.setVariable("sdncDelete", sdncDelete)
                        execution.setVariable("sdncDeactivate", sdncDeactivate)
-                       utils.log("DEBUG","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled)
-                       utils.log("DEBUG","sdncDelete:\n" + sdncDelete, isDebugEnabled)
+                       utils.log("INFO","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled)
+                       utils.log("INFO","sdncDelete:\n" + sdncDelete, isDebugEnabled)
 
                } catch (BpmnError e) {
                        throw e;
                } catch(Exception ex) {
                        msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage())
                }
-               utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled)
+               utils.log("INFO"," *****Exit preProcessSDNCDelete *****", isDebugEnabled)
        }
 
-       public void postProcessSDNCDelete(Execution execution, String response, String method) {
+       public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) {
 
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** postProcessSDNC " + method + " *****", isDebugEnabled)
+               utils.log("INFO"," ***** postProcessSDNC " + method + " *****", isDebugEnabled)
                String msg = ""
 
-               try {
+               /*try {
                        WorkflowException workflowException = execution.getVariable("WorkflowException")
                        boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
-                       utils.log("DEBUG", "SDNCResponse: " + response, isDebugEnabled)
-                       utils.log("DEBUG", "workflowException: " + workflowException, isDebugEnabled)
+                       utils.log("INFO", "SDNCResponse: " + response, isDebugEnabled)
+                       utils.log("INFO", "workflowException: " + workflowException, isDebugEnabled)
 
                        SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
                        sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
-
-                       if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
-                               utils.log("DEBUG","Good response from SDNC Adapter for service-instance " + method + "response:\n" + response, isDebugEnabled)
+                       if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){
+                               utils.log("INFO","Good response from SDNC Adapter for service-instance " + method + "response:\n" + response, isDebugEnabled)
 
                        }else{
                                msg = "Bad Response from SDNC Adapter for service-instance " + method
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                               utils.log("INFO", msg, isDebugEnabled)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
                        }
                } catch (BpmnError e) {
                        throw e;
                } catch(Exception ex) {
                        msg = "Exception in postProcessSDNC " + method + " Exception:" + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-               }
-               utils.log("DEBUG"," *** Exit postProcessSDNC " + method + " ***", isDebugEnabled)
+               }*/
+               utils.log("INFO"," *** Exit postProcessSDNC " + method + " ***", isDebugEnabled)
        }
 
-       public void postProcessAAIGET(Execution execution) {
+       public void postProcessAAIGET(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled)
+               utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled)
                String msg = ""
 
                try {
-                       execution.setVariable("serviceInstanceId","serviceInstanceId")
-                       execution.setVariable("GENGS_FoundIndicator",true)
-                       execution.setVariable("GENGS_siResourceLink","GENGS_siResourceLink")
-                       execution.setVariable("globalSubscriberId","globalSubscriberId")
-                       execution.setVariable("subscriptionServiceType","subscriptionServiceType")
-                       execution.setVariable("GENGS_service","GENGS_service")
-                       execution.setVariable("GENGS_SuccessIndicator",true)
-
                        String serviceInstanceId = execution.getVariable("serviceInstanceId")
                        boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
                        String serviceType = ""
 
-                       if(foundInAAI == true){
-                               utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled)
-
-                               //Extract GlobalSubscriberId
-                               String siRelatedLink = execution.getVariable("GENGS_siResourceLink")
-                               if (isBlank(siRelatedLink))
-                               {
-                                       msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
-                                       utils.log("DEBUG", msg, isDebugEnabled)
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
-                               }
-                               else
-                               {
-                                       utils.log("DEBUG","Found Service-instance in AAI. link: " + siRelatedLink, isDebugEnabled)
-                                       String  globalSubscriberId = execution.getVariable("globalSubscriberId")
-                                       if(isBlank(globalSubscriberId)){
-                                               int custStart = siRelatedLink.indexOf("customer/")
-                                               int custEnd = siRelatedLink.indexOf("/service-subscriptions")
-                                               globalSubscriberId = siRelatedLink.substring(custStart + 9, custEnd)
-                                               execution.setVariable("globalSubscriberId", globalSubscriberId)
-                                       }
-
-                                       //Extract Service Type if not provided on request
-                                       String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
-                                       if(isBlank(subscriptionServiceType)){
-                                               int serviceStart = siRelatedLink.indexOf("service-subscription/")
-                                               int serviceEnd = siRelatedLink.indexOf("/service-instances/")
-                                               String serviceTypeEncoded = siRelatedLink.substring(serviceStart + 21, serviceEnd)
-                                               subscriptionServiceType = UriUtils.decode(serviceTypeEncoded, "UTF-8")
-                                               execution.setVariable("subscriptionServiceType", subscriptionServiceType)
-                                       }
-
-                                       if (isBlank(globalSubscriberId) || isBlank(subscriptionServiceType))
-                                       {
-                                               msg = "Could not retrive global-customer-id & subscription-service-type from AAI to delete id:" + serviceInstanceId
-                                               utils.log("DEBUG", msg, isDebugEnabled)
-                                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
-                                       }
-                               }
+                       if(foundInAAI){
+                               utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
 
                                String siData = execution.getVariable("GENGS_service")
-                               utils.log("DEBUG", "SI Data", isDebugEnabled)
+                               utils.log("INFO", "SI Data", isDebugEnabled)
                                if (isBlank(siData))
                                {
                                        msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId
-                                       utils.log("DEBUG", msg, isDebugEnabled)
+                                       utils.log("INFO", msg, isDebugEnabled)
                                        exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                                }
-                       /*      else
+                               else
                                {
-                                       utils.log("DEBUG", "SI Data" + siData, isDebugEnabled)
-                                       serviceType = utils.getNodeText1(siData,"service-type")
-                                       execution.setVariable("serviceType", serviceType)
-                                       execution.setVariable("serviceRole", utils.getNodeText1(siData,"service-role"))
-                                       String orchestrationStatus =  utils.getNodeText1(siData,"orchestration-status")
-
+                                       utils.log("INFO", "SI Data" + siData, isDebugEnabled)
                                        //Confirm there are no related service instances (vnf/network or volume)
                                        if (utils.nodeExists(siData, "relationship-list")) {
-                                               utils.log("DEBUG", "SI Data relationship-list exists:", isDebugEnabled)
+                                               utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)
                                                InputSource source = new InputSource(new StringReader(siData));
                                                DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
                                                DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
                                                Document serviceXml = docBuilder.parse(source)
-
+                                               serviceXml.getDocumentElement().normalize()
+                                               //test(siData)
                                                NodeList nodeList = serviceXml.getElementsByTagName("relationship")
+                           JSONArray jArray = new JSONArray()
                                                for (int x = 0; x < nodeList.getLength(); x++) {
                                                        Node node = nodeList.item(x)
                                                        if (node.getNodeType() == Node.ELEMENT_NODE) {
                                                                Element eElement = (Element) node
-                                                               def e = eElement.getElementsByTagName("related-to").item(0).getTextContent()
-                                                               if(e.equals("generic-vnf") || e.equals("l3-network") || e.equals("allotted-resource") ){
-                                                                       utils.log("DEBUG", "ServiceInstance still has relationship(s) to generic-vnfs, l3-networks or allotted-resources", isDebugEnabled)
-                                                                       execution.setVariable("siInUse", true)
-                                                                       //there are relationship dependencies to this Service Instance
-                                                                       msg = " Stopped deleting Service Instance, it has dependencies. Service instance id: " + serviceInstanceId
-                                                                       utils.log("DEBUG", msg, isDebugEnabled)
-                                                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
-                                                               }else{
-                                                                       utils.log("DEBUG", "Relationship NOT related to OpenStack", isDebugEnabled)
+                                                               def e = eElement.getElementsByTagName("related-to").item(0).getTextContent()                                                                    //for ns
+                                                               if(e.equals("service-instance")){
+                                                                   def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
+                                                                       utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled)
+                                    NodeList dataList = node.getChildNodes()
+                                    if(null != dataList) {
+                                        JSONObject jObj = new JSONObject()
+                                        for (int i = 0; i < dataList.getLength(); i++) {
+                                            Node dNode = dataList.item(i)
+                                            if(dNode.getNodeName() == "relationship-data") {
+                                                Element rDataEle = (Element)dNode
+                                                def eKey =  rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
+                                                def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
+                                                if(eKey.equals("service-instance.service-instance-id")){
+                                                    jObj.put("resourceInstanceId", eValue)
+                                                }
+                                            }
+                                            else if(dNode.getNodeName() == "related-to-property"){
+                                                 Element rDataEle = (Element)dNode
+                                                 def eKey =  rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
+                                                 def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
+                                                 if(eKey.equals("service-instance.service-instance-name")){
+                                                        jObj.put("resourceType", eValue)
+                                                    }
+                                            }
+                                        }
+                                        utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
+                                        jArray.put(jObj)
+                                    }
+                                                       //for overlay/underlay
+                                                               }else if (e.equals("configuration")){
+                                    def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
+                                    utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled)
+                                                                       NodeList dataList = node.getChildNodes()
+                                                                       if(null != dataList) {
+                                                                               JSONObject jObj = new JSONObject()
+                                                                               for (int i = 0; i < dataList.getLength(); i++) {
+                                                                                       Node dNode = dataList.item(i)
+                                                                                       if(dNode.getNodeName() == "relationship-data") {
+                                                                                               Element rDataEle = (Element)dNode
+                                                                                               def eKey =  rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
+                                                                                               def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
+                                                                                               if(eKey.equals("configuration.configuration-id")){
+                                                                                                   jObj.put("resourceInstanceId", eValue)
+                                                                                               }
+                                                                                       }
+                                                                                       else if(dNode.getNodeName() == "related-to-property"){
+                                                    Element rDataEle = (Element)dNode
+                                                    def eKey =  rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
+                                                    def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
+                                                    if(eKey.equals("configuration.configuration-type")){
+                                                           jObj.put("resourceType", eValue)
+                                                       }
+                                                                                       }
+                                                                               }
+                                                                               utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
+                                        jArray.put(jObj)
+                                                                       }                                                                       
                                                                }
                                                        }
                                                }
+                        execution.setVariable("serviceRelationShip", jArray.toString())
                                        }
-
-                                       if ("TRANSPORT".equalsIgnoreCase(serviceType))
-                                       {
-                                               if ("PendingDelete".equals(orchestrationStatus))
-                                               {
-                                                       execution.setVariable("skipDeactivate", true)
-                                               }
-                                               else
-                                               {
-                                                       msg = "ServiceInstance of type TRANSPORT must in PendingDelete status to allow Delete. Orchestration-status:" + orchestrationStatus
-                                                       utils.log("DEBUG", msg, isDebugEnabled)
-                                                       exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
-                                               }
-
-                                       }
-                               }*/
+                               }
                        }else{
                                boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
-                               if(succInAAI != true){
-                                       utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled)
+                               if(!succInAAI){
+                                       utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled)
                                        WorkflowException workflowException = execution.getVariable("WorkflowException")
                                        utils.logAudit("workflowException: " + workflowException)
                                        if(workflowException != null){
@@ -432,33 +422,33 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
                                        else
                                        {
                                                msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
-                                               utils.log("DEBUG", msg, isDebugEnabled)
+                                               utils.log("INFO", msg, isDebugEnabled)
                                                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
                                        }
                                }
 
-                               utils.log("DEBUG","Service-instance NOT found in AAI. Silent Success", isDebugEnabled)
+                               utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled)
                        }
-               } catch (BpmnError e) {
+               }catch (BpmnError e) {
                        throw e;
                } catch (Exception ex) {
                        msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
+               utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
        }
 
-       public void postProcessAAIDEL(Execution execution) {
+       public void postProcessAAIDEL(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               utils.log("DEBUG"," ***** postProcessAAIDEL ***** ", isDebugEnabled)
+               utils.log("INFO"," ***** postProcessAAIDEL ***** ", isDebugEnabled)
                String msg = ""
                try {
                        String serviceInstanceId = execution.getVariable("serviceInstanceId")
                        boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator")
-                       if(succInAAI != true){
+                       if(!succInAAI){
                                msg = "Error deleting Service-instance in AAI" + serviceInstanceId
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                               utils.log("INFO", msg, isDebugEnabled)
                                WorkflowException workflowException = execution.getVariable("WorkflowException")
                                utils.logAudit("workflowException: " + workflowException)
                                if(workflowException != null){
@@ -473,16 +463,16 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
                        throw e;
                } catch (Exception ex) {
                        msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIDEL. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("INFO", msg, isDebugEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               utils.log("DEBUG"," *** Exit postProcessAAIDEL *** ", isDebugEnabled)
+               utils.log("INFO"," *** Exit postProcessAAIDEL *** ", isDebugEnabled)
        }
        
-       public void preInitResourcesOperStatus(Execution execution){
+   public void preInitResourcesOperStatus(DelegateExecution execution){
         def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
 
-        utils.log("DEBUG", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+        utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
         try{
             String serviceId = execution.getVariable("serviceInstanceId")
             String operationId = execution.getVariable("operationId")
@@ -492,7 +482,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
             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)
+            utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
             serviceId = UriUtils.encode(serviceId,"UTF-8")
             execution.setVariable("serviceInstanceId", serviceId)
             execution.setVariable("operationId", operationId)
@@ -527,10 +517,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
                     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)
+            execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
 
             String payload =
                 """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
@@ -548,14 +535,14 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
 
             payload = utils.formatXml(payload)
             execution.setVariable("CVFMI_initResOperStatusRequest", payload)
-            utils.log("DEBUG", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
+            utils.log("INFO", "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)  
+        utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)  
     }
     
    /**
@@ -581,6 +568,9 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
             "resourceType":"underlay"
         }
     ]*/
+       def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+
+       utils.log("INFO", " ======== STARTED preResourceDelete Process ======== ", isDebugEnabled)
        String serviceRelationShip = execution.getVariable("serviceRelationShip")       
        def jsonSlurper = new JsonSlurper()
        def jsonOutput = new JsonOutput()         
@@ -588,13 +578,84 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
                
        if (relationShipList != null) {
            relationShipList.each {
-               if(resourceName.equals(it.resourceType))
-               String resouceTemplateUUID = it.resourceInstanceId
-               String resouceInstanceUUID = it.resourceInstanceId
-               execution.setVariable("resouceTemplateUUID", resouceTemplateUUID)
-               execution.setVariable("resouceInstanceId", resouceInstanceUUID)
-               execution.setResourceType("resourceType", resourceName)
+               if(StringUtils.containsIgnoreCase(it.resourceType, resourceName)) {
+                                  String resourceInstanceUUID = it.resourceInstanceId
+                                  String resourceTemplateUUID = it.resourceInstanceId
+                                  execution.setVariable("resourceTemplateId", resourceTemplateUUID)
+                                  execution.setVariable("resourceInstanceId", resourceInstanceUUID)
+                                  execution.setVariable("resourceType", resourceName)
+                              utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + "  resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled)
+                          }
            }
        }    
+       utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled)
+   }
+   
+   public void sequenceResource(execution){
+       def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+
+       utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled)
+       List<String> nsResources = new ArrayList<String>()
+       List<String> wanResources = new ArrayList<String>()
+       List<String> resourceSequence = new  ArrayList<String>()
+       
+       String serviceRelationShip = execution.getVariable("serviceRelationShip")
+               
+       
+       def jsonSlurper = new JsonSlurper()
+       def jsonOutput = new JsonOutput()         
+       List relationShipList =  jsonSlurper.parseText(serviceRelationShip)
+               
+       if (relationShipList != null) {
+           relationShipList.each {
+               if(StringUtils.containsIgnoreCase(it.resourceType, "overlay") || StringUtils.containsIgnoreCase(it.resourceType, "underlay")){
+                   wanResources.add(it.resourceType)
+               }else{
+                   nsResources.add(it.resourceType)
+               }
+           }
+       }     
+       resourceSequence.addAll(wanResources)
+       resourceSequence.addAll(nsResources)
+       String isContainsWanResource = wanResources.isEmpty() ? "false" : "true"
+       execution.setVariable("isContainsWanResource", isContainsWanResource)
+       execution.setVariable("currentResourceIndex", 0)
+       execution.setVariable("resourceSequence", resourceSequence)
+       utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled)  
+       execution.setVariable("wanResources", wanResources)
+       utils.log("INFO", " ======== END sequenceResource Process ======== ", isDebugEnabled)
+   }
+   
+   public void getCurrentResource(execution){
+       def isDebugEnabled=execution.getVariable("isDebugLogEnabled")   
+       utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled)    
+       def currentIndex = execution.getVariable("currentResourceIndex")
+       List<String> resourceSequence = execution.getVariable("resourceSequence")  
+       List<String> wanResources = execution.getVariable("wanResources")  
+       String resourceName =  resourceSequence.get(currentIndex)
+       execution.setVariable("resourceType",resourceName)
+       if(wanResources.contains(resourceName)){
+           execution.setVariable("controllerInfo", "SDN-C")
+       }else{
+           execution.setVariable("controllerInfo", "VF-C")
+       }
+       utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled)  
+   }
+   
+   public void parseNextResource(execution){
+       def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+       utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled)    
+       def currentIndex = execution.getVariable("currentResourceIndex")
+       def nextIndex =  currentIndex + 1
+       execution.setVariable("currentResourceIndex", nextIndex)
+       List<String> resourceSequence = execution.getVariable("resourceSequence")    
+       if(nextIndex >= resourceSequence.size()){
+           execution.setVariable("allResourceFinished", "true")
+       }else{
+           execution.setVariable("allResourceFinished", "false")
+       }
+       utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled)            
    }
+   
 }
\ No newline at end of file