Add nssiId for AllocateTNNSSI request
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / groovy / org / onap / so / bpmn / infrastructure / scripts / DoCreateServiceInstance.groovy
index b44940e..94aca5f 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 package org.onap.so.bpmn.infrastructure.scripts;
 
 import static org.apache.commons.lang3.StringUtils.*;
-
-import org.apache.commons.lang3.*
 import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.aai.domain.yang.OwningEntity
-import org.onap.so.bpmn.common.scripts.AaiUtil
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
@@ -40,12 +40,14 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
 import org.onap.so.bpmn.core.domain.ServiceInstance
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
-import org.onap.so.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-import groovy.json.*
+import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
 
 /**
  * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
@@ -75,20 +77,26 @@ import groovy.json.*
  */
 public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
 
-       private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateServiceInstance.class);
+    private static final Logger logger = LoggerFactory.getLogger( DoCreateServiceInstance.class);
        String Prefix="DCRESI_"
        ExceptionUtil exceptionUtil = new ExceptionUtil()
        JsonUtils jsonUtil = new JsonUtils()
-       CatalogDbUtils cutils = new CatalogDbUtils()
+       CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
 
-       public void preProcessRequest (DelegateExecution execution) {
+       void preProcessRequest (DelegateExecution execution) {
                def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
                String msg = ""
-               msoLogger.trace("preProcessRequest")
+               logger.trace("preProcessRequest")
 
                try {
                        String requestId = execution.getVariable("msoRequestId")
                        execution.setVariable("prefix", Prefix)
+                       
+                       def rollbackData = execution.getVariable("rollbackData")
+                       if (rollbackData == null) {
+                               rollbackData = new RollbackData()
+                       }
+                       execution.setVariable("rollbackData", rollbackData)
 
                        setBasicDBAuthHeader(execution, isDebugEnabled)
                        //Inputs
@@ -103,13 +111,13 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
 
                        if (isBlank(globalSubscriberId)) {
                                msg = "Input globalSubscriberId is null"
-                               msoLogger.debug(msg)
+                               logger.debug(msg)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        }
 
                        if (isBlank(subscriptionServiceType)) {
                                msg = "Input subscriptionServiceType is null"
-                               msoLogger.debug(msg)
+                               logger.debug(msg)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        }
 
@@ -120,11 +128,11 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution)
                        if (isBlank(sdncCallbackUrl)) {
                                msg = "mso.workflow.sdncadapter.callback is null"
-                               msoLogger.debug(msg)
+                               logger.debug(msg)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        }
                        execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
-                       msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl)
+                       logger.debug("SDNC Callback URL: " + sdncCallbackUrl)
 
                        //requestDetails.modelInfo.for AAI PUT servieInstanceData & SDNC assignTopology
                        String modelInvariantUuid = ""
@@ -141,7 +149,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        if (serviceDecomp != null)
                        {
                                serviceType = serviceDecomp.getServiceType() ?: ""
-                               msoLogger.debug("serviceType:" + serviceType)
+                               logger.debug("serviceType:" + serviceType)
                                serviceRole = serviceDecomp.getServiceRole() ?: ""
 
                                ServiceInstance serviceInstance = serviceDecomp.getServiceInstance()
@@ -164,7 +172,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                                else
                                {
                                        msg = "Input serviceModelInfo is null"
-                                       msoLogger.debug(msg)
+                                       logger.debug(msg)
                                        exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                                }
                        }
@@ -177,7 +185,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                                String serviceModelInfo = execution.getVariable("serviceModelInfo")
                                if (isBlank(serviceModelInfo)) {
                                        msg = "Input serviceModelInfo is null"
-                                       msoLogger.debug(msg)
+                                       logger.debug(msg)
                                        exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                                }
                                modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: ""
@@ -199,7 +207,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
 
                        //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable
                        String svcTypes = UrnPropertiesReader.getVariable("sdnc.si.svc.types",execution) ?: ""
-                       msoLogger.debug("SDNC SI serviceTypes:" + svcTypes)
+                       logger.debug("SDNC SI serviceTypes:" + svcTypes)
                        List<String> svcList = Arrays.asList(svcTypes.split("\\s*,\\s*"));
                        boolean isSdncService= false
                        for (String listEntry : svcList){
@@ -220,15 +228,15 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                                        if (isBlank(execution.getVariable("serviceInstanceName" )))
                                        {
                                                msg = "Input serviceInstanceName must be provided for alacarte"
-                                               msoLogger.debug(msg)
+                                               logger.debug(msg)
                                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                                        }
                                }
                        }
 
-                       msoLogger.debug("isSdncService: " + isSdncService)
-                       msoLogger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC"))
-                       msoLogger.debug("Service Type: " + execution.getVariable("serviceType"))
+                       logger.debug("isSdncService: " + isSdncService)
+                       logger.debug("Send To SDNC: " + execution.getVariable("sendToSDNC"))
+                       logger.debug("Service Type: " + execution.getVariable("serviceType"))
 
                        //macro may provide name and alacarte-portm may provide name
                        execution.setVariable("checkAAI", false)
@@ -239,7 +247,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
 
                        if (isBlank(serviceInstanceId)){
                                msg = "Input serviceInstanceId is null"
-                               msoLogger.debug(msg)
+                               logger.debug(msg)
                                exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
                        }
 
@@ -268,179 +276,114 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                                siParamsXml = ""
                        execution.setVariable("siParamsXml", siParamsXml)
 
-                       //AAI PUT
-                       String oStatus = execution.getVariable("initialStatus") ?: "Active"
-                       if ("TRANSPORT".equalsIgnoreCase(serviceType))
-                       {
-                               oStatus = "Created"
-                       }
-
-                       String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${MsoUtils.xmlEscape(oStatus)}</orchestration-status>"
-                       String serviceTypeLine = isBlank(serviceType) ? "" : "<service-type>${MsoUtils.xmlEscape(serviceType)}</service-type>"
-                       String serviceRoleLine = isBlank(serviceRole) ? "" : "<service-role>${MsoUtils.xmlEscape(serviceRole)}</service-role>"
-
-                       //QUERY CATALOG DB AND GET WORKLOAD / ENVIRONMENT CONTEXT
-                       String environmentContext = ""
-                       String workloadContext =""
-
-                       try{
-                                String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
-
-                                msoLogger.debug("JSON IS: "+json)
-
-                                environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: ""
-                                workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: ""
-                                msoLogger.debug("Env Context is: "+ environmentContext)
-                                msoLogger.debug("Workload Context is: "+ workloadContext)
-                       }catch(BpmnError e){
-                               throw e
-                       } catch (Exception ex){
-                               msg = "Exception in preProcessRequest " + ex.getMessage()
-                               msoLogger.debug(msg)
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-                       }
-
-                       //Create AAI Payload
-                       AaiUtil aaiUriUtil = new AaiUtil(this)
-                       String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
-                       String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
-                       String serviceInstanceData =
-                                       """<service-instance xmlns=\"${namespace}\">
-                                       <service-instance-name>${MsoUtils.xmlEscape(serviceInstanceName)}</service-instance-name>
-                                       ${serviceTypeLine}
-                                       ${serviceRoleLine}
-                                       ${statusLine}
-                                   <model-invariant-id>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-id>
-                                   <model-version-id>${MsoUtils.xmlEscape(modelUuid)}</model-version-id>
-                                       <environment-context>${MsoUtils.xmlEscape(environmentContext)}</environment-context>
-                                       <workload-context>${MsoUtils.xmlEscape(workloadContext)}</workload-context>
-                                       </service-instance>""".trim()
-
-                       execution.setVariable("serviceInstanceData", serviceInstanceData)
-                       msoLogger.debug(" 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData)
-
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception ex){
                        msg = "Exception in preProcessRequest " + ex.getMessage()
-                       msoLogger.debug(msg)
+                       logger.debug(msg)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               msoLogger.trace("Exit preProcessRequest")
+               logger.trace("Exit preProcessRequest")
        }
 
-       public void getAAICustomerById (DelegateExecution execution) {
+       void getAAICustomerById (DelegateExecution execution) {
                // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId}
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-               String msg = ""
                try {
 
                        String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map
-                       msoLogger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId)
+                       logger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId)
 
-                       String aai_endpoint = UrnPropertiesReader.getVariable("aai.endpoint", execution)
-                       AaiUtil aaiUriUtil = new AaiUtil(this)
-                       String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
-                       if (isBlank(aai_endpoint) || isBlank(aai_uri))
-                       {
-                               msg = "AAI URL is invalid. Endpoint:" + aai_endpoint + aai_uri
-                               msoLogger.debug(msg)
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustomerId))
+                       if(!getAAIClient().exists(uri)){
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI")
                        }
-                       String getAAICustomerUrl = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8")
-
-                       msoLogger.debug("getAAICustomerById Url:" + getAAICustomerUrl)
-                       APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getAAICustomerUrl)
-                       String returnCode = response.getStatusCode()
-                       String aaiResponseAsString = response.getResponseBodyAsString()
-
-                       msg = "getAAICustomerById ResponseCode:" + returnCode + " ResponseString:" + aaiResponseAsString
-                       msoLogger.debug(msg)
-
-                       if (returnCode=='200') {
-                               // Customer found by ID. FLow to proceed.
-                               msoLogger.debug(msg)
-
-                               //TODO Deferred
-                               //we might verify that service-subscription with matching name exists
-                               //and throw error if not. If not checked, we will get exception in subsequent step on Create call
-                               //in 1610 we assume both customer & service subscription were pre-created
-
-                       } else {
-                               if (returnCode=='404') {
-                                       msg = "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI"
-                                       msoLogger.debug(msg)
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
-
-                               } else {
-                                       if (aaiResponseAsString.contains("RESTFault")) {
-                                               msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, aaiResponseAsString, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
-                                               WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution)
-                                               execution.setVariable("WorkflowException", workflowException)
-                                               throw new BpmnError("MSOWorkflowException")
-
-                                       } else {
-                                               // aai all errors
-                                               msg = "Error in getAAICustomerById ResponseCode:" + returnCode
-                                               msoLogger.debug(msg)
-                                               exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
-                                       }
-                               }
-                       }
-
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception ex) {
-                       msg = "Exception in getAAICustomerById. " + ex.getMessage()
-                       msoLogger.debug(msg)
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in getAAICustomerById. " + ex.getMessage())
                }
-               msoLogger.trace("Exit getAAICustomerById")
+               logger.trace("Exit getAAICustomerById")
 
        }
 
-       public void postProcessAAIPUT(DelegateExecution execution) {
+       void putServiceInstance(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               msoLogger.trace("postProcessAAIPUT")
+               logger.trace("putServiceInstance")
                String msg = ""
+               String serviceInstanceId = execution.getVariable("serviceInstanceId")
                try {
-                       String serviceInstanceId = execution.getVariable("serviceInstanceId")
-                       boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
-                       if(!succInAAI){
-                               msoLogger.debug("Error putting Service-instance in AAI", + serviceInstanceId)
-                               WorkflowException workflowException = execution.getVariable("WorkflowException")
-                               msoLogger.debug("workflowException: " + workflowException)
-                               if(workflowException != null){
-                                       exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
-                               }
-                       }
-                       else
+
+                       String serviceType = execution.getVariable("serviceType")
+                       //AAI PUT
+                       String oStatus = execution.getVariable("initialStatus") ?: "Active"
+                       if ("TRANSPORT".equalsIgnoreCase(serviceType))
                        {
-                               //start rollback set up
-                               RollbackData rollbackData = new RollbackData()
-                               def disableRollback = execution.getVariable("disableRollback")
-                               rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
-                               rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
-                               rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
-                               rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
-                               rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
-                               execution.setVariable("rollbackData", rollbackData)
+                               oStatus = "Created"
                        }
 
+                       //QUERY CATALOG DB AND GET WORKLOAD / ENVIRONMENT CONTEXT
+                       String environmentContext = ""
+                       String workloadContext =""
+                       String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+
+                       try{
+                                String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
+
+                                logger.debug("JSON IS: "+json)
+
+                                environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: ""
+                                workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: ""
+                                logger.debug("Env Context is: "+ environmentContext)
+                                logger.debug("Workload Context is: "+ workloadContext)
+                       }catch(BpmnError e){
+                               throw e
+                       } catch (Exception ex){
+                               msg = "Exception in preProcessRequest " + ex.getMessage()
+                               logger.debug(msg)
+                               exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+                       }
+
+                       org.onap.aai.domain.yang.ServiceInstance si = new org.onap.aai.domain.yang.ServiceInstance()
+                       si.setServiceInstanceName(execution.getVariable("serviceInstanceName"))
+                       si.setServiceType(serviceType)
+                       si.setServiceRole(execution.getVariable("serviceRole"))
+                       si.setOrchestrationStatus(oStatus)
+                       si.setModelInvariantId(modelInvariantUuid)
+                       si.setModelVersionId(execution.getVariable("modelUuid"))
+                       si.setEnvironmentContext(environmentContext)
+                       si.setWorkloadContext(workloadContext)
+
+                       AAIResourcesClient client = new AAIResourcesClient()
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(serviceInstanceId))
+                       client.create(uri, si)
+
                } catch (BpmnError e) {
                        throw e;
                } catch (Exception ex) {
-                       msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
-                       msoLogger.debug(msg)
+                       //start rollback set up
+                       def rollbackData = execution.getVariable("rollbackData")
+                       if (rollbackData == null) {
+                               rollbackData = new RollbackData()
+                       }                       
+                       def disableRollback = execution.getVariable("disableRollback")
+                       rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
+                       rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
+                       rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
+                       rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+                       rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
+                       execution.setVariable("rollbackData", rollbackData)
+
+                       msg = "Exception in DoCreateServiceInstance.putServiceInstance. " + ex.getMessage()
+                       logger.debug(msg)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               msoLogger.trace("Exit postProcessAAIPUT")
+               logger.trace("Exit putServiceInstance")
        }
 
-       public void preProcessSDNCAssignRequest(DelegateExecution execution) {
+       void preProcessSDNCAssignRequest(DelegateExecution execution) {
                def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
                String msg = ""
-               msoLogger.trace("preProcessSDNCAssignRequest")
+               logger.trace("preProcessSDNCAssignRequest")
 
                try {
                        def serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -508,56 +451,60 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                                </sdncadapterworkflow:SDNCRequestData>
                                </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
 
-                       msoLogger.debug("sdncAssignRequest:\n" + sdncAssignRequest)
+                       logger.debug("sdncAssignRequest:\n" + sdncAssignRequest)
                        sdncAssignRequest = utils.formatXml(sdncAssignRequest)
                        execution.setVariable("sdncAssignRequest", sdncAssignRequest)
-                       msoLogger.debug("sdncAssignRequest:  " + sdncAssignRequest)
+                       logger.debug("sdncAssignRequest:  " + sdncAssignRequest)
 
                        def sdncRequestId2 = UUID.randomUUID().toString()
                        String sdncDelete = sdncAssignRequest.replace(">assign<", ">delete<").replace(">CreateServiceInstance<", ">DeleteServiceInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
                        def sdncRequestId3 = UUID.randomUUID().toString()
                        String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId2}<", ">${sdncRequestId3}<")
                        def rollbackData = execution.getVariable("rollbackData")
-                       rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate)
-                       rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete)
-                       execution.setVariable("rollbackData", rollbackData)
+                       if (rollbackData != null) {
+                               rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate)
+                               rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete)
+                               execution.setVariable("rollbackData", rollbackData)             
 
-                       msoLogger.debug("rollbackData:\n" + rollbackData.toString())
+                               logger.debug("rollbackData:\n" + rollbackData.toString())
+                       }
 
                } catch (BpmnError e) {
                        throw e;
                } catch(Exception ex) {
                        msg = "Exception in preProcessSDNCAssignRequest. " + ex.getMessage()
-                       msoLogger.debug(msg)
+                       logger.debug(msg)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               msoLogger.trace("Exit preProcessSDNCAssignRequest")
+               logger.trace("Exit preProcessSDNCAssignRequest")
        }
 
-       public void postProcessSDNCAssign (DelegateExecution execution) {
+       void postProcessSDNCAssign (DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               msoLogger.trace("postProcessSDNCAssign")
+               logger.trace("postProcessSDNCAssign")
                try {
                        WorkflowException workflowException = execution.getVariable("WorkflowException")
-                       msoLogger.debug("workflowException: " + workflowException)
+                       logger.debug("workflowException: " + workflowException)
 
                        boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
 
                        String response = execution.getVariable("sdncAdapterResponse")
-                       msoLogger.debug("SDNCResponse: " + response)
+                       logger.debug("SDNCResponse: " + response)
 
-                       SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
+                       SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
                        sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
 
                        if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
-                               msoLogger.debug("Good response from SDNC Adapter for service-instance  topology assign: \n" + response)
+                               logger.debug("Good response from SDNC Adapter for service-instance  topology assign: \n" + response)
 
                                def rollbackData = execution.getVariable("rollbackData")
-                               rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true")
-                               execution.setVariable("rollbackData", rollbackData)
+                               if (rollbackData != null) {
+                                       rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true")
+                                       execution.setVariable("rollbackData", rollbackData)
+                               }
 
                        }else{
-                               msoLogger.debug("Bad Response from SDNC Adapter for service-instance assign")
+                               logger.debug("Bad Response from SDNC Adapter for service-instance assign")
                                throw new BpmnError("MSOWorkflowException")
                        }
 
@@ -565,31 +512,31 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        throw e;
                } catch(Exception ex) {
                        msg = "Exception in postProcessSDNCAssign. " + ex.getMessage()
-                       msoLogger.debug(msg)
+                       logger.debug(msg)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               msoLogger.trace("Exit postProcessSDNCAssign")
+               logger.trace("Exit postProcessSDNCAssign")
        }
 
-       public void postProcessAAIGET2(DelegateExecution execution) {
+       void postProcessAAIGET2(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               msoLogger.trace("postProcessAAIGET2")
+               logger.trace("postProcessAAIGET2")
                String msg = ""
 
                try {
                        String serviceInstanceName = execution.getVariable("serviceInstanceName")
                        boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
                        if(!succInAAI){
-                               msoLogger.debug("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName)
+                               logger.debug("Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName)
                                WorkflowException workflowException = execution.getVariable("WorkflowException")
-                               msoLogger.debug("workflowException: " + workflowException)
+                               logger.debug("workflowException: " + workflowException)
                                if(workflowException != null){
                                        exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
                                }
                                else
                                {
                                        msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
-                                       msoLogger.debug(msg)
+                                       logger.debug(msg)
                                        exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
                                }
                        }
@@ -600,7 +547,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                                        String aaiService = execution.getVariable("GENGS_service")
                                        if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
                                                execution.setVariable("serviceInstanceName",  utils.getNodeText(aaiService, "service-instance-name"))
-                                               msoLogger.debug("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"))
+                                               logger.debug("Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"))
                                        }
                                }
                        }
@@ -608,94 +555,94 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                        throw e;
                } catch (Exception ex) {
                        msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
-                       msoLogger.debug(msg)
+                       logger.debug(msg)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               msoLogger.trace("Exit postProcessAAIGET2")
+               logger.trace("Exit postProcessAAIGET2")
        }
 
-       public void preProcessRollback (DelegateExecution execution) {
+       void preProcessRollback (DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               msoLogger.trace("preProcessRollback")
+               logger.trace("preProcessRollback")
                try {
 
                        Object workflowException = execution.getVariable("WorkflowException");
 
                        if (workflowException instanceof WorkflowException) {
-                               msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage())
+                               logger.debug("Prev workflowException: " + workflowException.getErrorMessage())
                                execution.setVariable("prevWorkflowException", workflowException);
                                //execution.setVariable("WorkflowException", null);
                        }
                } catch (BpmnError e) {
-                       msoLogger.debug("BPMN Error during preProcessRollback")
+                       logger.debug("BPMN Error during preProcessRollback")
                } catch(Exception ex) {
                        String msg = "Exception in preProcessRollback. " + ex.getMessage()
-                       msoLogger.debug(msg)
+                       logger.debug(msg)
                }
-               msoLogger.trace("Exit preProcessRollback")
+               logger.trace("Exit preProcessRollback")
        }
 
-       public void postProcessRollback (DelegateExecution execution) {
+       void postProcessRollback (DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               msoLogger.trace("postProcessRollback")
+               logger.trace("postProcessRollback")
                String msg = ""
                try {
                        Object workflowException = execution.getVariable("prevWorkflowException");
                        if (workflowException instanceof WorkflowException) {
-                               msoLogger.debug("Setting prevException to WorkflowException: ")
+                               logger.debug("Setting prevException to WorkflowException: ")
                                execution.setVariable("WorkflowException", workflowException);
                        }
                        execution.setVariable("rollbackData", null)
                } catch (BpmnError b) {
-                       msoLogger.debug("BPMN Error during postProcessRollback")
+                       logger.debug("BPMN Error during postProcessRollback")
                        throw b;
                } catch(Exception ex) {
                        msg = "Exception in postProcessRollback. " + ex.getMessage()
-                       msoLogger.debug(msg)
+                       logger.debug(msg)
                }
-               msoLogger.trace("Exit postProcessRollback")
+               logger.trace("Exit postProcessRollback")
        }
 
-       public void createProject(DelegateExecution execution) {
+       void createProject(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               msoLogger.trace("createProject")
+               logger.trace("createProject")
 
                String bpmnRequest = execution.getVariable("requestJson")
                String projectName = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.project.projectName")
                String serviceInstance = execution.getVariable("serviceInstanceId")
 
-               msoLogger.debug("BPMN REQUEST IS: "+ bpmnRequest)
-               msoLogger.debug("PROJECT NAME: " + projectName)
-               msoLogger.debug("Service Instance: " + serviceInstance)
+               logger.debug("BPMN REQUEST IS: "+ bpmnRequest)
+               logger.debug("PROJECT NAME: " + projectName)
+               logger.debug("Service Instance: " + serviceInstance)
 
                if(projectName == null||projectName.equals("")){
-                       msoLogger.debug("Project Name was not found in input. Skipping task...")
+                       logger.debug("Project Name was not found in input. Skipping task...")
                }else{
                        try{
                                AAICreateResources aaiCR = new AAICreateResources()
                                aaiCR.createAAIProject(projectName, serviceInstance)
                        }catch(Exception ex){
                                String msg = "Exception in createProject. " + ex.getMessage();
-                               msoLogger.debug(msg)
-                               msoLogger.error(ex);
+                               logger.debug(msg)
+                               logger.error(ex);
                                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                        }
                }
-               msoLogger.trace("Exit createProject")
+               logger.trace("Exit createProject")
        }
 
-       public void createOwningEntity(DelegateExecution execution) {
+       void createOwningEntity(DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-               msoLogger.trace("createOwningEntity")
+               logger.trace("createOwningEntity")
                String msg = "";
                String bpmnRequest = execution.getVariable("requestJson")
                String owningEntityId = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.owningEntity.owningEntityId")
                String owningEntityName = jsonUtil.getJsonValue(bpmnRequest,"requestDetails.owningEntity.owningEntityName");
                String serviceInstance = execution.getVariable("serviceInstanceId")
 
-               msoLogger.debug("owningEntity: " + owningEntityId)
-               msoLogger.debug("OwningEntityName: "+ owningEntityName)
-               msoLogger.debug("Service Instance: " + serviceInstance)
+               logger.debug("owningEntity: " + owningEntityId)
+               logger.debug("OwningEntityName: "+ owningEntityName)
+               logger.debug("Service Instance: " + serviceInstance)
 
                try{
                        AAICreateResources aaiCR = new AAICreateResources()
@@ -721,33 +668,33 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
                                }
                        }
                }catch(Exception ex){
-                       msoLogger.debug(msg)
-                       msoLogger.error(ex);
+                       logger.debug(msg)
+                       logger.error(ex);
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
-               msoLogger.trace("Exit createOwningEntity")
+               logger.trace("Exit createOwningEntity")
        }
 
        // *******************************
        //     Build Error Section
        // *******************************
 
-       public void processJavaException(DelegateExecution execution){
+       void processJavaException(DelegateExecution execution){
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
 
                try{
-                       msoLogger.debug("Caught a Java Exception in DoCreateServiceInstance")
-                       msoLogger.debug("Started processJavaException Method")
-                       msoLogger.debug("Variables List: " + execution.getVariables())
+                       logger.debug("Caught a Java Exception in DoCreateServiceInstance")
+                       logger.debug("Started processJavaException Method")
+                       logger.debug("Variables List: " + execution.getVariables())
                        execution.setVariable("UnexpectedError", "Caught a Java Lang Exception in DoCreateServiceInstance")  // Adding this line temporarily until this flows error handling gets updated
                        exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception in DoCreateServiceInstance")
 
                }catch(Exception e){
-                       msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+                       logger.debug("Caught Exception during processJavaException Method: " + e)
                        execution.setVariable("UnexpectedError", "Exception in processJavaException")  // Adding this line temporarily until this flows error handling gets updated
                        exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method")
                }
-               msoLogger.trace("Completed processJavaException Method in DoCreateServiceInstance")
+               logger.trace("Completed processJavaException Method in DoCreateServiceInstance")
        }
 
 }