NSMF Functionality improvements - NSI Termination 71/112471/1
authordeepikasatheesh <deepika.s84@wipro.com>
Thu, 10 Sep 2020 10:24:13 +0000 (03:24 -0700)
committerdeepikasatheesh <deepika.s84@wipro.com>
Thu, 10 Sep 2020 10:24:13 +0000 (03:24 -0700)
Issue-ID: SO-3231
Signed-off-by: deepikasatheesh <deepika.s84@wipro.com>
Change-Id: I5ebeea9e7e79ba1c7c236478f4acf34af674eb77

bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn

index 547cb6c..0c795b3 100644 (file)
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
 import org.camunda.bpm.engine.delegate.DelegateExecution
 import org.onap.logging.filter.base.ONAPComponents
 import org.onap.so.beans.nsmf.DeAllocateNssi
+import org.onap.so.beans.nsmf.ServiceInfo
 import org.onap.so.beans.nsmf.EsrInfo
 import org.onap.so.beans.nsmf.JobStatusRequest
 import org.onap.so.beans.nsmf.JobStatusResponse
@@ -44,7 +45,7 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 import org.onap.so.db.request.beans.OperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
-
+import org.json.JSONObject
 import javax.ws.rs.core.Response
 
 
@@ -126,7 +127,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
         }
         LOGGER.debug("*****${PREFIX} Exit processDecomposition *****")
     }
-
+    
     /**
      * send deallocate request to nssmf
      * @param execution
@@ -140,61 +141,106 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
         String nssiId = currentNSSI['nssiServiceInstanceId']
         String nsiId = currentNSSI['nsiServiceInstanceId']
         String scriptName = execution.getVariable("scriptName")
+        boolean modifyAction = execution.getVariable("terminateNSI")
 
+        String serviceInvariantUuid = currentNSSI['modelInvariantId']
+        String serviceUuid = currentNSSI['modelVersionId']
+        String globalSubscriberId = currentNSSI['globalSubscriberId']
+        String subscriptionServiceType = execution.getVariable("serviceType")
+        
         DeAllocateNssi deAllocateNssi = new DeAllocateNssi()
         deAllocateNssi.setNsiId(nsiId)
         deAllocateNssi.setNssiId(nssiId)
         deAllocateNssi.setTerminateNssiOption(0)
         deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
         deAllocateNssi.setScriptName(scriptName)
-
-        NssiDeAllocateRequest deAllocateRequest = new NssiDeAllocateRequest()
-        deAllocateRequest.setDeAllocateNssi(deAllocateNssi)
-        deAllocateRequest.setEsrInfo(getEsrInfo(currentNSSI))
-
-        ObjectMapper mapper = new ObjectMapper()
-        String nssmfRequest = mapper.writeValueAsString(deAllocateRequest)
-
-        String urlStr = String.format("/api/rest/provMns/v1/NSS/SliceProfiles/%s",profileId)
+        deAllocateNssi.setSliceProfileId(profileId)
+        deAllocateNssi.setModifyAction(modifyAction)
+        
+        ServiceInfo serviceInfo = new ServiceInfo()
+        serviceInfo.setServiceInvariantUuid(serviceInvariantUuid)
+        serviceInfo.setServiceUuid(serviceUuid)
+        serviceInfo.setGlobalSubscriberId(globalSubscriberId)
+        serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+        
+        EsrInfo esrInfo = getEsrInfo(currentNSSI)
+        
+        execution.setVariable("deAllocateNssi",deAllocateNssi)
+        execution.setVariable("esrInfo",esrInfo)
+        execution.setVariable("serviceInfo",serviceInfo)
+        String nssmfRequest = """
+                {
+                  "deAllocateNssi": "${execution.getVariable("deAllocateNssi") as JSONObject}",
+                  "esrInfo":  ${execution.getVariable("esrInfo") as JSONObject},
+                  "serviceInfo": ${execution.getVariable("serviceInfo") as JSONObject}
+                }
+              """
+
+        String urlStr = String.format("/api/rest/provMns/v1/NSS/nssi/%s",nssiId)
 
         NssiResponse nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlStr, nssmfRequest, NssiResponse.class)
         if (nssmfResponse != null) {
-            currentNSSI['jobId']= nssmfResponse.getJobId() ?: ""
-            currentNSSI['jobProgress'] = 0
-            execution.setVariable("currentNSSI", currentNSSI)
-
-            LOGGER.debug("*****${PREFIX} Exit sendRequestToNSSMF *****")
-        } else {
+            currentNSSI['jobId']= nssmfResponse.getJobId() ?: "" 
+            currentNSSI['jobProgress'] = 0            
+            execution.setVariable("currentNSSI", currentNSSI)    
+            } 
+            else {
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.")
         }
-
+        LOGGER.debug("*****${PREFIX} Exit sendRequestToNSSMF *****")
     }
 
-    /**
+/**
      * send to nssmf query progress
      * @param execution
      */
-    void getJobStatus(DelegateExecution execution)
+    void prepareJobStatusRequest(DelegateExecution execution)
     {
         def currentNSSI = execution.getVariable("currentNSSI")
         String jobId = currentNSSI['jobId']
         String nssiId = currentNSSI['nssiServiceInstanceId']
         String nsiId = currentNSSI['nsiServiceInstanceId']
+        String serviceInvariantUuid = currentNSSI['modelInvariantId']
+        String serviceUuid = currentNSSI['modelVersionId']
+        String globalSubscriberId = currentNSSI['globalSubscriberId']
+        String subscriptionServiceType = execution.getVariable("serviceType")
+        String sST =  currentNSSI['sST']
+        String PLMNIdList = currentNSSI['PLMNIdList']
+        String nssiName = currentNSSI['nssiName']
+        
+        execution.setVariable("responseId", "3")
+        execution.setVariable("esrInfo", getEsrInfo(currentNSSI))
+        execution.setVariable("jobId", jobId)
+        
+        Map<String, ?> serviceInfoMap = new HashMap<>()
+        serviceInfoMap.put("nssiId", nssiId)
+        serviceInfoMap.put("nsiId", nsiId)
+        serviceInfoMap.put("nssiName", nssiName)
+        serviceInfoMap.put("sST", sST)
+        serviceInfoMap.put("PLMNIdList", PLMNIdList)
+        serviceInfoMap.put("globalSubscriberId", globalSubscriberId)
+        serviceInfoMap.put("subscriptionServiceType", subscriptionServiceType)
+        serviceInfoMap.put("serviceInvariantUuid", serviceInvariantUuid)
+        serviceInfoMap.put("serviceUuid", serviceUuid)
+    
+        execution.setVariable("serviceInfo", serviceInfoMap)
+    }
 
-        JobStatusRequest jobStatusRequest = new JobStatusRequest()
-        jobStatusRequest.setNssiId(nssiId)
-        jobStatusRequest.setNsiId(nsiId)
-        jobStatusRequest.setEsrInfo(getEsrInfo(currentNSSI))
-
-        ObjectMapper mapper = new ObjectMapper()
-        String nssmfRequest = mapper.writeValueAsString(jobStatusRequest)
-
-        String urlStr = String.format("/api/rest/provMns/v1/NSS/jobs/%s", jobId)
-
-        JobStatusResponse jobStatusResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlStr, nssmfRequest, JobStatusResponse.class)
-
-        if (jobStatusResponse != null) {
-            def progress = jobStatusResponse?.getResponseDescriptor()?.getProgress()
+    
+    /**
+     * send to nssmf query progress
+     * @param execution
+     */
+    void handleJobStatus(DelegateExecution execution)
+    {
+        try 
+        {
+        String jobStatusResponse = execution.getVariable("responseDescriptor")
+        String status = jsonUtil.getJsonValue(jobStatusResponse,"status")
+        def statusDescription = jsonUtil.getJsonValue(jobStatusResponse,"statusDescription")
+        def progress = jsonUtil.getJsonValue(jobStatusResponse,"progress")
+        if(!status.equalsIgnoreCase("failed"))
+        {
             if(!progress)
             {
                 LOGGER.error("job progress is null or empty!")
@@ -206,61 +252,60 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
             execution.setVariable("isNSSIDeAllocated", (currentProgress == 100))
             execution.setVariable("isNeedUpdateDB", (oldProgress != currentProgress))
             currentNSSI['jobProgress'] = currentProgress
-
-            def statusDescription = jobStatusResponse?.getResponseDescriptor()?.getStatusDescription()
+            currentNSSI['status'] = status
             currentNSSI['statusDescription'] = statusDescription
 
             LOGGER.debug("job status result: nsiId = ${nsiId}, nssiId=${nssiId}, oldProgress=${oldProgress}, progress = ${currentProgress}" )
-
-        } else {
+        }
+          else {
+            execution.setVariable("isNeedUpdateDB", "true")
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.")
         }
-
+        }
+        catch (any)
+        {
+            String msg = "Received a Bad Response from NSSMF." cause-"+any.getCause()"
+            LOGGER.error(any.printStackTrace())
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
     }
 
     private EsrInfo getEsrInfo(def currentNSSI)
     {
         String domaintype = currentNSSI['domainType']
         String vendor = currentNSSI['vendor']
-
+        
         EsrInfo info = new EsrInfo()
         info.setNetworkType(NetworkType.fromString(domaintype))
         info.setVendor(vendor)
         return info
     }
 
   /**
+ /**
      * handle job status
      * prepare update requestdb
      * @param execution
      */
-    void handleJobStatus(DelegateExecution execution)
+    void prepareUpdateOperationStatus(DelegateExecution execution)
     {
         def currentNSSI = execution.getVariable("currentNSSI")
         int currentProgress = currentNSSI["jobProgress"]
         def proportion = currentNSSI['proportion']
         def statusDes = currentNSSI["statusDescription"]
         int progress = (currentProgress as int) == 0 ? 0 : (currentProgress as int) / 100 * (proportion as int)
-
+        def status = currentNSSI['status']
+        
         OperationStatus operationStatus = new OperationStatus()
         operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String)
         operationStatus.setOperationId(currentNSSI['operationId'] as String)
         operationStatus.setOperation("DELETE")
-        operationStatus.setResult("processing")
+        operationStatus.setResult(status as String)
         operationStatus.setProgress(progress as String)
         operationStatus.setOperationContent(statusDes as String)
         requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus)
         LOGGER.debug("update operation, currentProgress=${currentProgress}, proportion=${proportion}, progress = ${progress}" )
     }
-
-    void timeDelay(DelegateExecution execution) {
-        try {
-            Thread.sleep(10000);
-        } catch(InterruptedException e) {
-            LOGGER.error("Time Delay exception" + e)
-        }
-    }
-
+    
     /**
      * delete slice profile from aai
      * @param execution
@@ -291,4 +336,4 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
         }
         LOGGER.debug("*****${PREFIX} Exist delSliceProfileFromAAI *****")
     }
-}
\ No newline at end of file
+}
index 5354d52..2f78c3d 100644 (file)
@@ -25,16 +25,20 @@ import org.onap.aai.domain.yang.AllottedResource
 import org.onap.aai.domain.yang.AllottedResources
 import org.onap.aai.domain.yang.Relationship
 import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.SliceProfiles
+import org.onap.aai.domain.yang.ServiceProfile
+import org.onap.aai.domain.yang.ServiceProfiles
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.OofUtils
 import org.onap.aaiclient.client.aai.AAIObjectType
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
-
+import javax.ws.rs.core.Response
 import javax.ws.rs.NotFoundException
 
 import static org.apache.commons.lang3.StringUtils.isBlank
@@ -52,6 +56,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank
 class DoDeleteSliceService extends AbstractServiceTaskProcessor {
     private final String PREFIX ="DoDeleteSliceService"
     ExceptionUtil exceptionUtil = new ExceptionUtil()
+    OofUtils oofUtils = new OofUtils()
     private static final Logger LOGGER = LoggerFactory.getLogger( DoDeleteSliceService.class)
 
     @Override
@@ -96,17 +101,47 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
     {
         LOGGER.trace(" *****${PREFIX} Start queryE2ESliceSeriveFromAAI *****")
         String serviceInstanceId = execution.getVariable("serviceInstanceId")
-
+        try
+        {
         String errorMsg = "query e2e slice service from aai failed"
         AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
         Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class)
         if(si.isPresent())
         {
             String snssai = si.get()?.getEnvironmentContext()
+            ServiceProfiles serviceProfiles = si.get()?.getServiceProfiles()
+            ServiceProfile serviceProfile = serviceProfiles.getServiceProfile().get(0)
+            String serviceProfileId = serviceProfile ? serviceProfile.getProfileId() : ""
             execution.setVariable("snssai", snssai ?: "")
-            LOGGER.info("serviceInstanceId: ${serviceInstanceId}, snssai: ${snssai}")
+            execution.setVariable("serviceProfileId",serviceProfileId)
+            List<ServiceInstance> sliceProfileList = []
+            List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship()
+            for (Relationship relationship : relationshipList) {
+                String relatedTo = relationship.getRelatedTo()
+                if (relatedTo.toLowerCase() == "service-instance") {
+                    String relatioshipurl = relationship.getRelatedLink()
+                    String instanceId = relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+                    AAIResultWrapper wrapper1 = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, instanceId, errorMsg)                           
+                    Optional<ServiceInstance> serviceInstance = wrapper1.asBean(ServiceInstance.class)
+                    if (serviceInstance.isPresent()) {
+                        ServiceInstance instance = serviceInstance.get()
+                        if ("slice-profile-instance".equalsIgnoreCase(instance.getServiceRole())) {
+                            sliceProfileList.add(instance)
+                        }
+                    }
+                }
+            }
+            execution.setVariable("sliceProfileList",sliceProfileList)
+            LOGGER.info("serviceInstanceId: ${serviceInstanceId}, snssai: ${snssai}, sliceProfileList: ${sliceProfileList}")
         }
         LOGGER.trace(" *****${PREFIX} Exit queryE2ESliceSeriveFromAAI *****")
+        }
+        catch (any)
+        {
+            String msg = "query E2E slice service from aai failed! cause-"+any.getCause()
+            LOGGER.error(any.printStackTrace())
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+        }
     }
 
     /**
@@ -169,7 +204,15 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
                     if (relatedTo == "service-instance")
                     {
                         String relatedLink = relationship.getRelatedLink()?:""
-                        String nssiId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : ""
+                        String instanceId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : ""
+                        AAIResultWrapper wrapper1 = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, instanceId, errorMsg)
+                        Optional<ServiceInstance> serviceInstance = wrapper1.asBean(ServiceInstance.class)
+                        if (serviceInstance.isPresent()) {
+                            ServiceInstance instance = serviceInstance.get()
+                            if ("nssi".equalsIgnoreCase(instance.getServiceRole())) {
+                                nssiId = instance.getServiceInstanceId()
+                            }
+                        }
                         nssiIdList.add(nssiId)
                         msg+="${nssiId}, "
                     }
@@ -227,12 +270,24 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
     {
         LOGGER.trace(" *****${PREFIX} Start getCurrentNSSI *****")
         List<ServiceInstance> nssiInstanceList = execution.getVariable("nssiInstanceList")
+        List<ServiceInstance> sliceProfileList = execution.getVariable("sliceProfileList")
         int currentIndex = execution.getVariable("currentNSSIIndex") as int
+        String profileId = ""
         ServiceInstance nssi = nssiInstanceList?.get(currentIndex)
+        for(ServiceInstance sliceProfileInstance : sliceProfileList) {
+            if(sliceProfileInstance.getWorkloadContext().equalsIgnoreCase(nssi.getWorkloadContext()))
+            {
+                profileId = sliceProfileInstance.getServiceInstanceId()
+            }
+        }
         def currentNSSI = [:]
         currentNSSI['nssiServiceInstanceId'] = nssi?.getServiceInstanceId()
         currentNSSI['modelInvariantId'] = nssi?.getModelInvariantId()
         currentNSSI['modelVersionId'] = nssi?.getModelVersionId()
+        currentNSSI['nssiName'] = nssi?.getServiceInstanceName()
+        currentNSSI['sST'] = nssi?.getServiceType()
+        currentNSSI['PLMNIdList'] = nssi?.getServiceInstanceLocationId()
+        currentNSSI['profileId'] =  profileId
         currentNSSI['snssai'] = execution.getVariable("snssai") ?: ""
         currentNSSI['nsiServiceInstanceId'] = execution.getVariable("nsiId") ?: ""
         currentNSSI['operationId'] = execution.getVariable("operationId") ?: ""
@@ -271,30 +326,6 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
         LOGGER.trace(" *****${PREFIX} Exit parseNextNSSI *****")
     }
 
-
-    /**
-     * query sliceProfile from AAI
-     * save profileId
-     * @param execution
-     */
-    void querySliceProfileFromAAI(DelegateExecution execution)
-    {
-        LOGGER.trace(" *****${PREFIX} Start querySliceProfileFromAAI *****")
-        def currentNSSI = execution.getVariable("currentNSSI")
-        String nssiId = currentNSSI['nssiServiceInstanceId']
-        String errorMsg = "query slice profile failed"
-        AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SLICE_PROFILE_ALL, nssiId, errorMsg)
-        Optional<SliceProfiles> sliceProfiles =wrapper.asBean(SliceProfiles.class)
-        if(sliceProfiles.isPresent())
-        {
-            String profileId = sliceProfiles.get().getSliceProfile()?.get(0)?.getProfileId()
-            currentNSSI['profileId'] =  profileId ?: ""
-            LOGGER.info("nssiId: ${nssiId}, profileId: ${profileId}")
-        }
-        execution.setVariable("currentNSSI", currentNSSI)
-        LOGGER.trace(" *****${PREFIX} Exit querySliceProfileFromAAI *****")
-    }
-
     /**
      * query AAI
      * @param execution
@@ -317,4 +348,57 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
         return wrapper
     }
 
+    void terminateNSIQuery(DelegateExecution execution)
+    {
+        logger.debug("Start terminateNSIQuery")
+        
+        String requestId = execution.getVariable("msoRequestId")
+        String nxlId = currentNSSI['nsiServiceInstanceId']
+        String nxlType = "NSI"
+        String messageType = "nsiTerminationResponse"
+        String serviceInstanceId = execution.getVariable("serviceInstanceId")
+        
+        def authHeader = ""
+        String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
+        String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+
+        String basicAuthValue = utils.encrypt(basicAuth, msokey)
+        if (basicAuthValue != null) {
+            logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
+            try {
+                authHeader = utils.getBasicAuth(basicAuthValue, msokey)
+                execution.setVariable("BasicAuthHeaderValue", authHeader)
+            } catch (Exception ex) {
+                logger.debug( "Unable to encode username and password string: " + ex)
+                exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
+                        "encode username and password string")
+            }
+        } else {
+            logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
+                    "value null")
+        }
+
+        URL requestUrl = new URL(oofUrl + "/api/oof/terminate/nxi/v1")
+        String oofRequest = oofUtils.buildTerminateNxiRequest(requestId, nxlId, nxlType, messageType, serviceInstanceId)
+        HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.OOF)
+        httpClient.addAdditionalHeader("Authorization", authHeader)
+        Response httpResponse = httpClient.post(oofRequest)
+
+        int responseCode = httpResponse.getStatus()
+        logger.debug("OOF sync response code is: " + responseCode)
+
+        if(responseCode != 200){
+            exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+        }       
+        try {
+            Map<String, String> resMap = httpResponse.readEntity(Map.class)
+            boolean terminateResponse = resMap.get("terminateResponse")
+            execution.setVariable("terminateNSI", terminateResponse)
+        } catch (Exception ex) {
+            logger.debug( "Failed to get terminate Response suggested by OOF.")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get terminate Response suggested by OOF.")
+        }
+        logger.debug("Finish terminateNSIQuery")
+    }
 }
index db805ec..c107cfb 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0884541" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0884541" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.2">
   <bpmn:process id="DoDeallocateNSSIV1" name="DoDeallocateNSSIV1" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1" name="start">
       <bpmn:outgoing>SequenceFlow_05jfhy6</bpmn:outgoing>
@@ -35,25 +35,15 @@ dnssi.processDecomposition(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_1e7o57n" sourceRef="Task_15ut397" targetRef="Task_0vi4ijv" />
     <bpmn:scriptTask id="Task_0vi4ijv" name="Send deallocate request to NSSMF" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_1e7o57n</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_03b0822</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1wj89r5</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dnssi= new DoDeallocateNSSI()
 dnssi.sendRequestToNSSMF(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_03b0822" sourceRef="Task_0vi4ijv" targetRef="Task_0kl6lcq" />
-    <bpmn:scriptTask id="Task_0kl6lcq" name="Query Job Status" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_03b0822</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_1anlirk</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1jj0p5q</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dnssi= new DoDeallocateNSSI()
-dnssi.getJobStatus(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_1jj0p5q" sourceRef="Task_0kl6lcq" targetRef="ExclusiveGateway_0nhfsui" />
-    <bpmn:exclusiveGateway id="ExclusiveGateway_0nhfsui" name="Is deallocate finish?" default="SequenceFlow_0sfh52b">
-      <bpmn:incoming>SequenceFlow_1jj0p5q</bpmn:incoming>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_0nhfsui" name="Is deallocate finish?">
+      <bpmn:incoming>SequenceFlow_02327ff</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0xq380j</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_0sfh52b</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1wpbkt9</bpmn:outgoing>
     </bpmn:exclusiveGateway>
     <bpmn:scriptTask id="Task_13vaezk" name="Delete Slice Profile From AAI" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0xq380j</bpmn:incoming>
@@ -76,15 +66,6 @@ dnssi.delSliceProfileFromAAI(execution)</bpmn:script>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dnssi= new DoDeallocateNSSI()
 dnssi.preProcessRequest(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_1anlirk" sourceRef="Task_0fxuz4i" targetRef="Task_0kl6lcq" />
-    <bpmn:scriptTask id="Task_0fxuz4i" name="TimeDelay" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_1ugva41</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_1u66wjs</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1anlirk</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dnssi= new DoDeallocateNSSI()
-dnssi.timeDelay(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:serviceTask id="Task_0amt4hu" name="Update Service Operation Status">
       <bpmn:extensionElements>
@@ -105,149 +86,171 @@ dnssi.timeDelay(execution)</bpmn:script>
           <camunda:connectorId>http-connector</camunda:connectorId>
         </camunda:connector>
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_04vg0c2</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1ugva41</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_19cdxhv</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_02327ff</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:exclusiveGateway id="ExclusiveGateway_0y0w592" name="IsNeedUpdateDB?" default="SequenceFlow_1u66wjs">
-      <bpmn:incoming>SequenceFlow_0sfh52b</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0r95j9m</bpmn:outgoing>
-      <bpmn:outgoing>SequenceFlow_1u66wjs</bpmn:outgoing>
-    </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="SequenceFlow_0sfh52b" sourceRef="ExclusiveGateway_0nhfsui" targetRef="ExclusiveGateway_0y0w592" />
-    <bpmn:sequenceFlow id="SequenceFlow_0r95j9m" sourceRef="ExclusiveGateway_0y0w592" targetRef="Task_1renmzf">
-      <bpmn:documentation>#{(execution.getVariable("isNeedUpdateDB" )  == true)}</bpmn:documentation>
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNeedUpdateDB" )  == true)}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_04vg0c2" sourceRef="Task_1renmzf" targetRef="Task_0amt4hu" />
-    <bpmn:sequenceFlow id="SequenceFlow_1ugva41" sourceRef="Task_0amt4hu" targetRef="Task_0fxuz4i" />
-    <bpmn:sequenceFlow id="SequenceFlow_1u66wjs" sourceRef="ExclusiveGateway_0y0w592" targetRef="Task_0fxuz4i" />
     <bpmn:scriptTask id="Task_1renmzf" name="Prepare Update Operation Status" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_0r95j9m</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_04vg0c2</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_0o7qjoo</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_19cdxhv</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.prepareUpdateOperationStatus(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:callActivity id="Task_1x3et9h" name="Query Job Status" calledElement="QueryJobStatus">
+      <bpmn:extensionElements>
+        <camunda:in source="msoRequestId" target="msoRequestId" />
+        <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+        <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+        <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+        <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" />
+      </bpmn:extensionElements>
+      <bpmn:incoming>SequenceFlow_0w01l14</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_10nogqz</bpmn:outgoing>
+    </bpmn:callActivity>
+    <bpmn:sequenceFlow id="SequenceFlow_10nogqz" sourceRef="Task_1x3et9h" targetRef="Task_1v3sdzq" />
+    <bpmn:sequenceFlow id="SequenceFlow_1wj89r5" sourceRef="Task_0vi4ijv" targetRef="Task_1vt5xaa" />
+    <bpmn:scriptTask id="Task_1v3sdzq" name="Handle Job Status" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_10nogqz</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0o7qjoo</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dnssi= new DoDeallocateNSSI()
 dnssi.handleJobStatus(execution)</bpmn:script>
     </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0o7qjoo" sourceRef="Task_1v3sdzq" targetRef="Task_1renmzf" />
+    <bpmn:scriptTask id="Task_1vt5xaa" name="prepare QueryJobStatus Request" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1wj89r5</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0w01l14</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.prepareJobStatusRequest(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0w01l14" sourceRef="Task_1vt5xaa" targetRef="Task_1x3et9h" />
+    <bpmn:sequenceFlow id="SequenceFlow_19cdxhv" sourceRef="Task_1renmzf" targetRef="Task_0amt4hu" />
+    <bpmn:sequenceFlow id="SequenceFlow_02327ff" sourceRef="Task_0amt4hu" targetRef="ExclusiveGateway_0nhfsui" />
+    <bpmn:endEvent id="Event_11u9vp2">
+      <bpmn:incoming>SequenceFlow_1wpbkt9</bpmn:incoming>
+      <bpmn:errorEventDefinition id="ErrorEventDefinition_11pdh1q" errorRef="Error_1o5kb95" />
+    </bpmn:endEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_1wpbkt9" name="no" sourceRef="ExclusiveGateway_0nhfsui" targetRef="Event_11u9vp2" />
   </bpmn:process>
+  <bpmn:error id="Error_1o5kb95" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateNSSIV1">
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
-        <dc:Bounds x="192" y="112" width="36" height="36" />
+      <bpmndi:BPMNEdge id="Flow_1wpbkt9_di" bpmnElement="SequenceFlow_1wpbkt9">
+        <di:waypoint x="1860" y="155" />
+        <di:waypoint x="1860" y="212" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="199" y="155" width="22" height="14" />
+          <dc:Bounds x="1869" y="165" width="13" height="14" />
         </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_02327ff_di" bpmnElement="SequenceFlow_02327ff">
+        <di:waypoint x="1770" y="130" />
+        <di:waypoint x="1835" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_19cdxhv_di" bpmnElement="SequenceFlow_19cdxhv">
+        <di:waypoint x="1610" y="130" />
+        <di:waypoint x="1670" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0w01l14_di" bpmnElement="SequenceFlow_0w01l14">
+        <di:waypoint x="1120" y="130" />
+        <di:waypoint x="1190" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0o7qjoo_di" bpmnElement="SequenceFlow_0o7qjoo">
+        <di:waypoint x="1450" y="130" />
+        <di:waypoint x="1510" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1wj89r5_di" bpmnElement="SequenceFlow_1wj89r5">
+        <di:waypoint x="970" y="130" />
+        <di:waypoint x="1020" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_10nogqz_di" bpmnElement="SequenceFlow_10nogqz">
+        <di:waypoint x="1290" y="130" />
+        <di:waypoint x="1350" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0eug5nv_di" bpmnElement="SequenceFlow_0eug5nv">
+        <di:waypoint x="340" y="130" />
+        <di:waypoint x="390" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0xq380j_di" bpmnElement="SequenceFlow_0xq380j">
+        <di:waypoint x="1885" y="130" />
+        <di:waypoint x="1940" y="130" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1904" y="112" width="17" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ii5002_di" bpmnElement="SequenceFlow_1ii5002">
+        <di:waypoint x="2040" y="130" />
+        <di:waypoint x="2102" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1e7o57n_di" bpmnElement="SequenceFlow_1e7o57n">
+        <di:waypoint x="800" y="130" />
+        <di:waypoint x="870" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1e451y9_di" bpmnElement="SequenceFlow_1e451y9">
+        <di:waypoint x="650" y="130" />
+        <di:waypoint x="700" y="130" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0wlyy5i_di" bpmnElement="SequenceFlow_0wlyy5i">
+        <di:waypoint x="490" y="130" />
+        <di:waypoint x="550" y="130" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_05jfhy6_di" bpmnElement="SequenceFlow_05jfhy6">
-        <di:waypoint x="228" y="130" />
-        <di:waypoint x="310" y="130" />
+        <di:waypoint x="188" y="130" />
+        <di:waypoint x="240" y="130" />
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="152" y="112" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="159" y="155" width="23" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_159g5ey_di" bpmnElement="Task_1m8upus">
-        <dc:Bounds x="490" y="90" width="100" height="80" />
+        <dc:Bounds x="390" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0wlyy5i_di" bpmnElement="SequenceFlow_0wlyy5i">
-        <di:waypoint x="590" y="130" />
-        <di:waypoint x="660" y="130" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_1ep4ama_di" bpmnElement="Task_1giechg">
-        <dc:Bounds x="660" y="90" width="100" height="80" />
+        <dc:Bounds x="550" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1e451y9_di" bpmnElement="SequenceFlow_1e451y9">
-        <di:waypoint x="760" y="130" />
-        <di:waypoint x="820" y="130" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1yt5s46_di" bpmnElement="Task_15ut397">
-        <dc:Bounds x="820" y="90" width="100" height="80" />
+        <dc:Bounds x="700" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1e7o57n_di" bpmnElement="SequenceFlow_1e7o57n">
-        <di:waypoint x="920" y="130" />
-        <di:waypoint x="970" y="130" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_16dxpvz_di" bpmnElement="Task_0vi4ijv">
-        <dc:Bounds x="970" y="90" width="100" height="80" />
+        <dc:Bounds x="870" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_03b0822_di" bpmnElement="SequenceFlow_03b0822">
-        <di:waypoint x="1070" y="130" />
-        <di:waypoint x="1120" y="130" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0arl3j9_di" bpmnElement="Task_0kl6lcq">
-        <dc:Bounds x="1120" y="90" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1jj0p5q_di" bpmnElement="SequenceFlow_1jj0p5q">
-        <di:waypoint x="1220" y="130" />
-        <di:waypoint x="1505" y="130" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_0nhfsui_di" bpmnElement="ExclusiveGateway_0nhfsui" isMarkerVisible="true">
-        <dc:Bounds x="1505" y="105" width="50" height="50" />
+        <dc:Bounds x="1835" y="105" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1501" y="75" width="63" height="27" />
+          <dc:Bounds x="1831" y="75" width="63" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1rfdrw3_di" bpmnElement="Task_13vaezk">
-        <dc:Bounds x="1690" y="90" width="100" height="80" />
+        <dc:Bounds x="1940" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1f579t4_di" bpmnElement="EndEvent_1f579t4">
-        <dc:Bounds x="1862" y="112" width="36" height="36" />
+        <dc:Bounds x="2102" y="112" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1871" y="155" width="19" height="14" />
+          <dc:Bounds x="2111" y="155" width="19" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ii5002_di" bpmnElement="SequenceFlow_1ii5002">
-        <di:waypoint x="1790" y="130" />
-        <di:waypoint x="1862" y="130" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0xq380j_di" bpmnElement="SequenceFlow_0xq380j">
-        <di:waypoint x="1555" y="130" />
-        <di:waypoint x="1690" y="130" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1614" y="112" width="17" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0eug5nv_di" bpmnElement="SequenceFlow_0eug5nv">
-        <di:waypoint x="410" y="130" />
-        <di:waypoint x="490" y="130" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1dytya8_di" bpmnElement="Task_1vste9s">
-        <dc:Bounds x="310" y="90" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1anlirk_di" bpmnElement="SequenceFlow_1anlirk">
-        <di:waypoint x="1170" y="190" />
-        <di:waypoint x="1170" y="170" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0a4zalz_di" bpmnElement="Task_0fxuz4i">
-        <dc:Bounds x="1120" y="190" width="100" height="80" />
+        <dc:Bounds x="240" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_0vegqix_di" bpmnElement="Task_0amt4hu">
-        <dc:Bounds x="1280" y="300" width="100" height="80" />
+        <dc:Bounds x="1670" y="90" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ExclusiveGateway_0y0w592_di" bpmnElement="ExclusiveGateway_0y0w592" isMarkerVisible="true">
-        <dc:Bounds x="1505" y="205" width="50" height="50" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1567" y="216" width="86" height="27" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0sfh52b_di" bpmnElement="SequenceFlow_0sfh52b">
-        <di:waypoint x="1530" y="155" />
-        <di:waypoint x="1530" y="205" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0r95j9m_di" bpmnElement="SequenceFlow_0r95j9m">
-        <di:waypoint x="1530" y="255" />
-        <di:waypoint x="1530" y="300" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_04vg0c2_di" bpmnElement="SequenceFlow_04vg0c2">
-        <di:waypoint x="1480" y="340" />
-        <di:waypoint x="1380" y="340" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1ugva41_di" bpmnElement="SequenceFlow_1ugva41">
-        <di:waypoint x="1280" y="340" />
-        <di:waypoint x="1170" y="340" />
-        <di:waypoint x="1170" y="270" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1u66wjs_di" bpmnElement="SequenceFlow_1u66wjs">
-        <di:waypoint x="1505" y="230" />
-        <di:waypoint x="1220" y="230" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_10pw6ot_di" bpmnElement="Task_1renmzf">
-        <dc:Bounds x="1480" y="300" width="100" height="80" />
+        <dc:Bounds x="1510" y="90" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1x3et9h_di" bpmnElement="Task_1x3et9h">
+        <dc:Bounds x="1190" y="90" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1v3sdzq_di" bpmnElement="Task_1v3sdzq">
+        <dc:Bounds x="1350" y="90" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1vt5xaa_di" bpmnElement="Task_1vt5xaa">
+        <dc:Bounds x="1020" y="90" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_11u9vp2_di" bpmnElement="Event_11u9vp2">
+        <dc:Bounds x="1842" y="212" width="36" height="36" />
       </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
index 5f4816e..5510dcd 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1p1suc9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1p1suc9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.2">
   <bpmn:process id="DoDeleteSliceServiceV1" name="DoDeleteSliceServiceV1" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1" name="start">
       <bpmn:outgoing>SequenceFlow_0ep5het</bpmn:outgoing>
@@ -23,12 +23,11 @@ ddss.getNSIFromAAI(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:scriptTask id="Task_1u755sr" name="Query NSSI List From AAI" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_1rgfzzy</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_05si1me</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1aa2ek0</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def ddss= new DoDeleteSliceService()
 ddss.getNSSIListFromAAI(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="SequenceFlow_05si1me" sourceRef="Task_1u755sr" targetRef="Task_1iomfas" />
     <bpmn:exclusiveGateway id="ExclusiveGateway_1ogbunu" name="Is all NSSI finished?">
       <bpmn:incoming>SequenceFlow_15z9iio</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1c4fjbv</bpmn:outgoing>
@@ -40,7 +39,6 @@ ddss.getNSSIListFromAAI(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_1c4fjbv" name="yes" sourceRef="ExclusiveGateway_1ogbunu" targetRef="EndEvent_0jaitqv">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNSSIFinished" )  == true)}</bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_01o2qpv" sourceRef="Task_1iomfas" targetRef="Task_1qqljvu" />
     <bpmn:sequenceFlow id="SequenceFlow_0c58sw3" sourceRef="Task_1rc7mcw" targetRef="ScriptTask_159855t" />
     <bpmn:sequenceFlow id="SequenceFlow_0926ghe" name="no" sourceRef="ExclusiveGateway_1ogbunu" targetRef="Task_1iomfas">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNSSIFinished" )  == false)}</bpmn:conditionExpression>
@@ -55,8 +53,8 @@ ddss.preProcessRequest(execution)</bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_0npmman" sourceRef="Task_0etki1p" targetRef="Task_13k9usx" />
     <bpmn:scriptTask id="Task_1iomfas" name="Get Current NSSI" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0926ghe</bpmn:incoming>
-      <bpmn:incoming>SequenceFlow_05si1me</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_01o2qpv</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_1252rbf</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_17tvomo</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def ddss= new DoDeleteSliceService()
 ddss.getCurrentNSSI(execution)</bpmn:script>
@@ -69,14 +67,6 @@ def ddss= new DoDeleteSliceService()
 ddss.parseNextNSSI(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_15z9iio" sourceRef="ScriptTask_159855t" targetRef="ExclusiveGateway_1ogbunu" />
-    <bpmn:sequenceFlow id="SequenceFlow_0q83qg3" sourceRef="Task_1qqljvu" targetRef="Task_1rc7mcw" />
-    <bpmn:scriptTask id="Task_1qqljvu" name="Query Slice Profile From AAI" scriptFormat="groovy">
-      <bpmn:incoming>SequenceFlow_01o2qpv</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0q83qg3</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def ddss= new DoDeleteSliceService()
-ddss.querySliceProfileFromAAI(execution)</bpmn:script>
-    </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_029u1wr" sourceRef="Task_13k9usx" targetRef="Task_1ujnqtj" />
     <bpmn:scriptTask id="Task_13k9usx" name="Query E2ESlice Serive From AAI" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0npmman</bpmn:incoming>
@@ -93,30 +83,84 @@ ddss.queryE2ESliceSeriveFromAAI(execution)</bpmn:script>
         <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_0q83qg3</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_17tvomo</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0c58sw3</bpmn:outgoing>
     </bpmn:callActivity>
+    <bpmn:scriptTask id="Task_1iuls9p" name="Terminate NSI Query" scriptFormat="groovy">
+      <bpmn:incoming>SequenceFlow_1aa2ek0</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1252rbf</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dss= new DeleteSliceService()
+dss.terminateNSIQuery(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_17tvomo" sourceRef="Task_1iomfas" targetRef="Task_1rc7mcw" />
+    <bpmn:sequenceFlow id="SequenceFlow_1aa2ek0" sourceRef="Task_1u755sr" targetRef="Task_1iuls9p" />
+    <bpmn:sequenceFlow id="SequenceFlow_1252rbf" sourceRef="Task_1iuls9p" targetRef="Task_1iomfas" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteSliceServiceV1">
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
-        <dc:Bounds x="152" y="122" width="36" height="36" />
+      <bpmndi:BPMNEdge id="Flow_1252rbf_di" bpmnElement="SequenceFlow_1252rbf">
+        <di:waypoint x="1150" y="140" />
+        <di:waypoint x="1200" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1aa2ek0_di" bpmnElement="SequenceFlow_1aa2ek0">
+        <di:waypoint x="1000" y="140" />
+        <di:waypoint x="1050" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_17tvomo_di" bpmnElement="SequenceFlow_17tvomo">
+        <di:waypoint x="1300" y="140" />
+        <di:waypoint x="1370" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_029u1wr_di" bpmnElement="SequenceFlow_029u1wr">
+        <di:waypoint x="530" y="140" />
+        <di:waypoint x="600" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_15z9iio_di" bpmnElement="SequenceFlow_15z9iio">
+        <di:waypoint x="1640" y="140" />
+        <di:waypoint x="1715" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0npmman_di" bpmnElement="SequenceFlow_0npmman">
+        <di:waypoint x="370" y="140" />
+        <di:waypoint x="430" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0926ghe_di" bpmnElement="SequenceFlow_0926ghe">
+        <di:waypoint x="1740" y="165" />
+        <di:waypoint x="1740" y="260" />
+        <di:waypoint x="1250" y="260" />
+        <di:waypoint x="1250" y="180" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="159" y="165" width="22" height="14" />
+          <dc:Bounds x="1489" y="242" width="13" height="14" />
         </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0ep5het_di" bpmnElement="SequenceFlow_0ep5het">
-        <di:waypoint x="188" y="140" />
-        <di:waypoint x="270" y="140" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1qkgvvu_di" bpmnElement="SequenceFlow_1qkgvvu">
-        <di:waypoint x="700" y="140" />
-        <di:waypoint x="750" y="140" />
+      <bpmndi:BPMNEdge id="SequenceFlow_0c58sw3_di" bpmnElement="SequenceFlow_0c58sw3">
+        <di:waypoint x="1470" y="140" />
+        <di:waypoint x="1540" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1c4fjbv_di" bpmnElement="SequenceFlow_1c4fjbv">
+        <di:waypoint x="1765" y="140" />
+        <di:waypoint x="1802" y="140" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1771" y="118" width="17" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1rgfzzy_di" bpmnElement="SequenceFlow_1rgfzzy">
         <di:waypoint x="850" y="140" />
         <di:waypoint x="900" y="140" />
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1qkgvvu_di" bpmnElement="SequenceFlow_1qkgvvu">
+        <di:waypoint x="700" y="140" />
+        <di:waypoint x="750" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ep5het_di" bpmnElement="SequenceFlow_0ep5het">
+        <di:waypoint x="188" y="140" />
+        <di:waypoint x="270" y="140" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="152" y="122" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="159" y="165" width="22" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_1bj6tw4_di" bpmnElement="Task_1ujnqtj">
         <dc:Bounds x="600" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
@@ -126,79 +170,35 @@ ddss.queryE2ESliceSeriveFromAAI(execution)</bpmn:script>
       <bpmndi:BPMNShape id="ScriptTask_01fp1vt_di" bpmnElement="Task_1u755sr">
         <dc:Bounds x="900" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_05si1me_di" bpmnElement="SequenceFlow_05si1me">
-        <di:waypoint x="1000" y="140" />
-        <di:waypoint x="1040" y="140" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_1ogbunu_di" bpmnElement="ExclusiveGateway_1ogbunu" isMarkerVisible="true">
-        <dc:Bounds x="1555" y="115" width="50" height="50" />
+        <dc:Bounds x="1715" y="115" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1560" y="85" width="52" height="27" />
+          <dc:Bounds x="1720" y="85" width="52" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_0jaitqv_di" bpmnElement="EndEvent_0jaitqv">
-        <dc:Bounds x="1692" y="122" width="36" height="36" />
+        <dc:Bounds x="1802" y="122" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1700" y="168" width="20" height="14" />
+          <dc:Bounds x="1810" y="168" width="20" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_1c4fjbv_di" bpmnElement="SequenceFlow_1c4fjbv">
-        <di:waypoint x="1605" y="140" />
-        <di:waypoint x="1692" y="140" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1630" y="118" width="17" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_01o2qpv_di" bpmnElement="SequenceFlow_01o2qpv">
-        <di:waypoint x="1140" y="140" />
-        <di:waypoint x="1170" y="140" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0c58sw3_di" bpmnElement="SequenceFlow_0c58sw3">
-        <di:waypoint x="1400" y="140" />
-        <di:waypoint x="1420" y="140" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0926ghe_di" bpmnElement="SequenceFlow_0926ghe">
-        <di:waypoint x="1580" y="165" />
-        <di:waypoint x="1580" y="260" />
-        <di:waypoint x="1090" y="260" />
-        <di:waypoint x="1090" y="180" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1329" y="242" width="13" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0icszw6_di" bpmnElement="Task_0etki1p">
         <dc:Bounds x="270" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0npmman_di" bpmnElement="SequenceFlow_0npmman">
-        <di:waypoint x="370" y="140" />
-        <di:waypoint x="430" y="140" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1obnwrr_di" bpmnElement="Task_1iomfas">
-        <dc:Bounds x="1040" y="100" width="100" height="80" />
+        <dc:Bounds x="1200" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_159855t_di" bpmnElement="ScriptTask_159855t">
-        <dc:Bounds x="1420" y="100" width="100" height="80" />
+        <dc:Bounds x="1540" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_15z9iio_di" bpmnElement="SequenceFlow_15z9iio">
-        <di:waypoint x="1520" y="140" />
-        <di:waypoint x="1555" y="140" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0q83qg3_di" bpmnElement="SequenceFlow_0q83qg3">
-        <di:waypoint x="1270" y="140" />
-        <di:waypoint x="1300" y="140" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ScriptTask_0y9ppnc_di" bpmnElement="Task_1qqljvu">
-        <dc:Bounds x="1170" y="100" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_029u1wr_di" bpmnElement="SequenceFlow_029u1wr">
-        <di:waypoint x="530" y="140" />
-        <di:waypoint x="600" y="140" />
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0f9rjq4_di" bpmnElement="Task_13k9usx">
         <dc:Bounds x="430" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_18qkiat_di" bpmnElement="Task_1rc7mcw">
-        <dc:Bounds x="1300" y="100" width="100" height="80" />
+        <dc:Bounds x="1370" y="100" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1iuls9p_di" bpmnElement="Task_1iuls9p">
+        <dc:Bounds x="1050" y="100" width="100" height="80" />
       </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>