Enrich Deallocate and Modify Core NSSI sub-processes 22/113122/2
authoralexanb <alexander.borovitzky@guest.telecomitalia.it>
Thu, 24 Sep 2020 18:20:49 +0000 (21:20 +0300)
committeralexanb <alexander.borovitzky@guest.telecomitalia.it>
Sun, 27 Sep 2020 14:40:47 +0000 (17:40 +0300)
Issue-ID: SO-3267
Change-Id: Iffcc8f0d12ed75683d8a1e2e80e5608b1271f7d6
Signed-off-by: alexanb <alexander.borovitzky@guest.telecomitalia.it>
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSITest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSITest.groovy
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyCoreNSSI.bpmn

index e225c36..5677252 100644 (file)
@@ -22,15 +22,9 @@ package org.onap.so.bpmn.infrastructure.scripts
 
 import com.fasterxml.jackson.databind.ObjectMapper
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.CloudRegion
-import org.onap.aai.domain.yang.GenericVnf
-import org.onap.aai.domain.yang.ModelVer
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.ServiceSubscription
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aai.domain.yang.Tenant
-import org.onap.aai.domain.yang.VfModule
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.json.JSONArray
+import org.json.JSONObject
+import org.onap.aai.domain.yang.v19.*
 import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 import org.onap.aaiclient.client.aai.entities.Relationships
@@ -39,35 +33,20 @@ 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.onap.logging.filter.base.ONAPComponents
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.common.scripts.*
 import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.client.HttpClient
-import org.onap.so.db.request.beans.OperationStatus
-import org.onap.so.requestsdb.RequestsDbConstant
-import org.onap.so.serviceinstancebeans.CloudConfiguration
-import org.onap.so.serviceinstancebeans.LineOfBusiness
-import org.onap.so.serviceinstancebeans.ModelInfo
-import org.onap.so.serviceinstancebeans.ModelType
-import org.onap.so.serviceinstancebeans.OwningEntity
-import org.onap.so.serviceinstancebeans.Project
-import org.onap.so.serviceinstancebeans.RequestDetails
-import org.onap.so.serviceinstancebeans.RequestInfo
-import org.onap.so.serviceinstancebeans.RequestParameters
-import org.onap.so.serviceinstancebeans.Resources
-import org.onap.so.serviceinstancebeans.Service
-import org.onap.so.serviceinstancebeans.SubscriberInfo
-import org.onap.so.serviceinstancebeans.VfModules
-import org.onap.so.serviceinstancebeans.Vnfs
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.onap.so.serviceinstancebeans.*
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
 import javax.ws.rs.core.Response
 
+import static org.apache.commons.lang3.StringUtils.isBlank
 
- class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
+class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
 
     private final String PREFIX ="DoCommonCoreNSSI"
 
@@ -83,10 +62,54 @@ import javax.ws.rs.core.Response
 
         def currentNSSI = execution.getVariable("currentNSSI")
         if (!currentNSSI) {
-            String msg = "currentNSSI is null"
+            currentNSSI = [:]
+        }
+
+        // NSSI ID
+        String nssiId = execution.getVariable("serviceInstanceID")
+        if (isBlank(nssiId)) {
+            String msg = "NSSI service instance id is null"
             LOGGER.error(msg)
             exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
         }
+        else {
+            currentNSSI['nssiId'] = nssiId
+        }
+
+        // NSI ID
+        String nsiId = execution.getVariable("nsiId")
+        if (isBlank(nsiId)) {
+            String msg = "nsiId is null"
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        }
+        else {
+            currentNSSI['nsiId'] = nsiId
+        }
+
+
+        // Slice Profile
+        String sliceProfile = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "sliceProfile")
+        if (isBlank(sliceProfile)) {
+            String msg = "Slice Profile is null"
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        } else {
+            currentNSSI['sliceProfile'] = sliceProfile
+        }
+
+        // S-NSSAI
+        def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "snssaiList"))
+
+        String sNssai = snssaiList.get(0)
+        currentNSSI['S-NSSAI'] = sNssai
+
+
+        // Slice Profile id
+        String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
+        currentNSSI['sliceProfileId'] = sliceProfileId
+
+        execution.setVariable("currentNSSI", currentNSSI)
+
 
         LOGGER.trace("***** ${getPrefix()} Exit preProcessRequest")
     }
@@ -257,7 +280,7 @@ import javax.ws.rs.core.Response
 
         List<String> snssais = new ArrayList<>()
 
-        String isCreateSliceProfileInstanceVar = execution.getVariable("isCreateSliceProfileInstance" )
+        String isCreateSliceProfileInstanceVar = execution.getVariable("isCreateSliceProfileInstance" ) // Not exist in case of Deallocate
 
         boolean isCreateSliceProfileInstance = Boolean.parseBoolean(isCreateSliceProfileInstanceVar)
 
@@ -294,14 +317,14 @@ import javax.ws.rs.core.Response
         def currentNSSI = execution.getVariable("currentNSSI")
 
         try {
-            //url:/onap/so/infra/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}/vnfs/{vnfId}"
-            def nsmfЕndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) // ???
+            //url:/onap/so/infra/serviceInstantiation/v7/serviceInstances/{serviceInstanceId}"
+            def nsmfЕndPoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) // ???
 
             ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance']
 
-            GenericVnf constituteVnf = (GenericVnf)currentNSSI['constituteVnf']
+            String url = String.format("${nsmfЕndPoint}/serviceInstantiation/v7/serviceInstances/%s", networkServiceInstance.getServiceInstanceId())
 
-            String url = String.format("${nsmfЕndpoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId())
+            currentNSSI['putServiceInstanceURL'] = url
 
             String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
             String basicAuth =  UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
@@ -332,7 +355,7 @@ import javax.ws.rs.core.Response
             String putServiceInstanceResponse = ""
 
             if(errorCode == null || errorCode.isEmpty()) { // No error
-                putServiceInstanceResponse = callPUTServiceInstanceResponse // check the response ???
+                putServiceInstanceResponse = callPUTServiceInstanceResponse
             }
             else {
                 LOGGER.error(jsonUtil.getJsonValue(callPUTServiceInstanceResponse, "errorMessage"))
@@ -430,9 +453,9 @@ import javax.ws.rs.core.Response
     SubscriberInfo prepareSubscriberInfo(DelegateExecution execution) {
         def currentNSSI = execution.getVariable("currentNSSI")
 
-        String globalSubscriberId = currentNSSI['globalSubscriberId']
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
 
-        String subscriberName = currentNSSI['subscriberName']
+        String subscriberName = execution.getVariable("subscriberName")
 
         SubscriberInfo subscriberInfo = new SubscriberInfo()
         subscriberInfo.setGlobalSubscriberId(globalSubscriberId)
@@ -484,13 +507,13 @@ import javax.ws.rs.core.Response
     RequestInfo prepareRequestInfo(DelegateExecution execution, ServiceInstance networkServiceInstance) {
         def currentNSSI = execution.getVariable("currentNSSI")
 
-        String serviceId = currentNSSI['serviceId']
+        String productFamilyId = execution.getVariable("productFamilyId")
 
         RequestInfo requestInfo = new RequestInfo()
 
         requestInfo.setInstanceName(networkServiceInstance.getServiceInstanceName())
         requestInfo.setSource("VID")
-        requestInfo.setProductFamilyId(serviceId)
+        requestInfo.setProductFamilyId(productFamilyId)
         requestInfo.setRequestorId("NBI")
 
         return requestInfo
@@ -961,15 +984,15 @@ import javax.ws.rs.core.Response
 
         SliceProfile sliceProfileContainsSNSSAI = (SliceProfile)currentNSSI['sliceProfileS-NSSAI']
 
-        String globalSubscriberId = currentNSSI['globalSubscriberId']
-        String serviceType = currentNSSI['serviceType']
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
         String nssiId = currentNSSI['nssiId']
 
         // global-customer-id, service-type, service-instance-id, profile-id
-        AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileContainsSNSSAI.getProfileId()))
+        AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId).sliceProfile(sliceProfileContainsSNSSAI.getProfileId()))
 
         try {
-            getAAIClient().delete(sliceProfileUri)
+            client.delete(sliceProfileUri)
         }catch(Exception e){
             exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while Slice Profile Instance delete call: " + e.getMessage())
         }
@@ -979,26 +1002,179 @@ import javax.ws.rs.core.Response
 
 
     /**
-     * Updates operation status
+     * Prepares update resource operation status
      * @param execution
      */
-    void updateServiceOperationStatus(DelegateExecution execution) {
+    void prepareUpdateResourceOperationStatus(DelegateExecution execution) {
         LOGGER.trace("${getPrefix()} Start updateServiceOperationStatus")
 
         def currentNSSI = execution.getVariable("currentNSSI")
 
-        OperationStatus operationStatus = new OperationStatus()
-        operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String)
-        operationStatus.setOperationId(currentNSSI['operationId'] as String)
-        operationStatus.setOperation(currentNSSI['operationType'] as String)
-        operationStatus.setResult(RequestsDbConstant.Status.FINISHED)
+        //Prepare Update Status for PUT failure and success
+        String isTimeOutVar = execution.getVariable("isTimeOut")
+        if(!isBlank(isTimeOutVar) && isTimeOutVar.equals("YES")) {
+            LOGGER.error("TIMEOUT - SO PUT Failure")
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure")
+        } else {
+            execution.setVariable("progress", "100")
+            execution.setVariable("status", "finished")
+            execution.setVariable("operationContent", "${getAction()} Core NSSI successful.")
+        }
 
-        requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus)
+        setResourceOperationStatus(execution, "finished", "100", "Core NSSI ${getAction()} successful")
 
         LOGGER.trace("${getPrefix()} Exit updateServiceOperationStatus")
     }
 
 
+    /**
+     * Prepares ResourceOperation status
+     * @param execution
+     * @param operationType
+     */
+    void setResourceOperationStatus(DelegateExecution execution, String status, String progress, String statusDesc) {
+        LOGGER.trace("${getPrefix()} Start setResourceOperationStatus")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String serviceId = currentNSSI['nssiId']
+        String jobId = execution.getVariable("jobId")
+        String nsiId = currentNSSI['nsiId']
+        String operationType = execution.getVariable("operationType")
+
+        ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
+        resourceOperationStatus.setServiceId(serviceId)
+        resourceOperationStatus.setOperationId(jobId)
+        resourceOperationStatus.setResourceTemplateUUID(nsiId)
+        resourceOperationStatus.setOperType(operationType)
+        resourceOperationStatus.setStatus(status)
+        resourceOperationStatus.setProgress(progress)
+        resourceOperationStatus.setStatusDescription(statusDesc)
+        requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
+
+        LOGGER.trace("${getPrefix()} Exit setResourceOperationStatus")
+    }
+
+
+    /**
+     * Prepares failed operation status update
+     * @param execution
+     */
+    void prepareFailedOperationStatusUpdate(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start prepareFailedOperationStatusUpdate")
+
+        setResourceOperationStatus(execution, "failed", "0", "Core NSSI ${getAction()} Failed")
+
+        LOGGER.trace("${getPrefix()} Exit prepareFailedOperationStatusUpdate")
+    }
+
+
+    /**
+     * Gets progress status of ServiceInstance PUT operation
+     * @param execution
+     */
+    public void getPUTServiceInstanceProgress(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start getPUTServiceInstanceProgress")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String url = currentNSSI['putServiceInstanceURL']
+
+        getProgress(execution, url, "putStatus")
+
+        LOGGER.trace("${getPrefix()} Exit getPUTServiceInstanceProgress")
+    }
+
+
+    void getProgress(DelegateExecution execution, String url, String statusVariableName) {
+        String msg=""
+        try {
+
+            ExternalAPIUtil externalAPIUtil = getExternalAPIUtilFactory().create()
+            Response response = externalAPIUtil.executeExternalAPIGetCall(execution, url)
+            int responseCode = response.getStatus()
+            execution.setVariable("GetServiceOrderResponseCode", responseCode)
+            LOGGER.debug("Get ServiceOrder response code is: " + responseCode)
+
+            String extApiResponse = response.readEntity(String.class)
+            JSONObject responseObj = new JSONObject(extApiResponse)
+            execution.setVariable("GetServiceOrderResponse", extApiResponse)
+            LOGGER.debug("Create response body is: " + extApiResponse)
+            //Process Response //200 OK 201 CREATED 202 ACCEPTED
+            if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
+            {
+                LOGGER.debug("Get Create ServiceOrder Received a Good Response")
+                String orderState = responseObj.get("state")
+                if("REJECTED".equalsIgnoreCase(orderState)) {
+                    prepareFailedOperationStatusUpdate(execution)
+                    return
+                }
+
+                JSONArray items = responseObj.getJSONArray("orderItem")
+                JSONObject item = items.get(0)
+                JSONObject service = item.get("service")
+                String networkServiceId = service.get("id")
+                if (networkServiceId == null || networkServiceId.equals("null")) {
+                    prepareFailedOperationStatusUpdate(execution)
+                    return
+                }
+
+                execution.setVariable("networkServiceId", networkServiceId)
+                String serviceOrderState = item.get("state")
+                execution.setVariable("ServiceOrderState", serviceOrderState)
+                // Get serviceOrder State and process progress
+                if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) {
+                    execution.setVariable(statusVariableName, "processing")
+                }
+                else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) {
+                    execution.setVariable(statusVariableName, "processing")
+                }
+                else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) {
+                    execution.setVariable(statusVariableName, "completed")
+                }
+                else if("FAILED".equalsIgnoreCase(serviceOrderState)) {
+                    msg = "ServiceOrder failed"
+                    exceptionUtil.buildAndThrowWorkflowException(execution, 7000,  msg)
+                }
+                else {
+                    msg = "ServiceOrder failed"
+                    exceptionUtil.buildAndThrowWorkflowException(execution, 7000,  msg)
+                }
+            }
+            else{
+                msg = "Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode
+                prepareFailedOperationStatusUpdate(execution)
+            }
+
+        }catch(Exception e){
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000,  e.getMessage())
+        }
+
+    }
+
+
+
+    /**
+     * Delays 5 sec
+     * @param execution
+     */
+    void timeDelay(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start timeDelay")
+
+        try {
+            LOGGER.debug("${getPrefix()} timeDelay going to sleep for 5 sec")
+
+            Thread.sleep(5000)
+
+            LOGGER.debug("${getPrefix()} ::: timeDelay wakeup after 5 sec")
+        } catch(InterruptedException e) {
+            LOGGER.error("${getPrefix()} ::: timeDelay exception" + e)
+        }
+
+        LOGGER.trace("${getPrefix()} Exit timeDelay")
+    }
+
+
     /**
      * Returns AAI client
      * @return AAI client
@@ -1008,7 +1184,16 @@ import javax.ws.rs.core.Response
     }
 
 
+    ExternalAPIUtilFactory getExternalAPIUtilFactory() {
+        return new ExternalAPIUtilFactory()
+    }
+
+
     String getPrefix() {
         return PREFIX
     }
+
+    String getAction() {
+        return ""
+    }
 }
index c94e2dd..055cbfc 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-import com.fasterxml.jackson.databind.ObjectMapper
+
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.CloudRegion
-import org.onap.aai.domain.yang.Customer
-import org.onap.aai.domain.yang.ModelVer
-import org.onap.aai.domain.yang.OwningEntities
-import org.onap.aai.domain.yang.ServiceSubscription
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aai.domain.yang.GenericVnf
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.Tenant
-import org.onap.aai.domain.yang.VfModule
-import org.onap.aaiclient.client.aai.AAIClient
+import org.onap.aai.domain.yang.v19.ServiceInstance
 import org.onap.aaiclient.client.aai.AAIResourcesClient
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.Relationships
 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.onap.logging.filter.base.ONAPComponents
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.common.scripts.RequestDBUtil
@@ -49,22 +35,6 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.client.HttpClient
 import org.onap.so.client.HttpClientFactory
-import org.onap.so.db.request.beans.OperationStatus
-import org.onap.so.requestsdb.RequestsDbConstant
-import org.onap.so.serviceinstancebeans.CloudConfiguration
-import org.onap.so.serviceinstancebeans.LineOfBusiness
-import org.onap.so.serviceinstancebeans.ModelInfo
-import org.onap.so.serviceinstancebeans.ModelType
-import org.onap.so.serviceinstancebeans.OwningEntity
-import org.onap.so.serviceinstancebeans.Project
-import org.onap.so.serviceinstancebeans.RequestDetails
-import org.onap.so.serviceinstancebeans.RequestInfo
-import org.onap.so.serviceinstancebeans.RequestParameters
-import org.onap.so.serviceinstancebeans.Resources
-import org.onap.so.serviceinstancebeans.Service
-import org.onap.so.serviceinstancebeans.SubscriberInfo
-import org.onap.so.serviceinstancebeans.VfModules
-import org.onap.so.serviceinstancebeans.Vnfs
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
@@ -72,6 +42,7 @@ import javax.ws.rs.core.Response
 
 class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
     private final String PREFIX ="DoDeallocateCoreNSSI"
+    private final  String ACTION = "Deallocate"
 
     private ExceptionUtil exceptionUtil = new ExceptionUtil()
     private RequestDBUtil requestDBUtil = new RequestDBUtil()
@@ -80,7 +51,7 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
 
     private static final Logger LOGGER = LoggerFactory.getLogger( DoDeallocateCoreNSSI.class)
 
-/**
+    /**
      * Queries OOF for NSSI termination
      * @param execution
      */
@@ -191,36 +162,6 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
     }
 
 
-    String encryptBasicAuth(String basicAuth, String msoKey) {
-        return utils.encrypt(basicAuth, msoKey)
-    }
-
-
-    String getAuthHeader(DelegateExecution execution, String basicAuthValue, String msokey) {
-        String response = ""
-        String errorCode = ""
-        String errorMessage = ""
-
-        LOGGER.debug("Obtained BasicAuth username and password for OOF: " + basicAuthValue)
-        try {
-            response = utils.getBasicAuth(basicAuthValue, msokey)
-        } catch (Exception ex) {
-            LOGGER.error("Unable to encode username and password string: ", ex)
-
-            errorCode = "401"
-            errorMessage = "Internal Error - Unable to encode username and password string"
-
-            response =  "{\n" +
-                    " \"errorCode\": \"${errorCode}\",\n" +
-                    " \"errorMessage\": \"${errorMessage}\"\n" +
-                    "}"
-        }
-
-        return response
-    }
-
-
-
     /**
      * Builds OOF request
      * @param execution
@@ -263,7 +204,9 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
 
             ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance']
 
-            String url = String.format("${nbiEndpointUrl}/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId()) // Service Order ID = Network Service Instance ID
+            String url = String.format("${nbiEndpointUrl}/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId())
+
+            currentNSSI['deleteServiceOrderURL'] = url
 
             String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
             String basicAuth =  UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
@@ -387,17 +330,36 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
         try {
             getAAIClient().delete(nssiUri)
         }catch(Exception e){
-            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occured while NSSI Service Instance delete call: " + e.getMessage())
+            exceptionUtil.buildAndThrowWorkflowException(execution, 25000, "Exception occurred while NSSI Service Instance delete call: " + e.getMessage())
         }
 
         LOGGER.trace("${PREFIX} Exit deleteNSSIServiceInstance")
     }
 
 
+    /**
+     * Gets Delete Service Order progress
+     * @param execution
+     */
+    void getDeleteServiceOrderProgress(DelegateExecution execution) {
+        LOGGER.trace("${getPrefix()} Start getDeleteServiceOrderProgress")
+
+        def currentNSSI = execution.getVariable("currentNSSI")
+
+        String url = currentNSSI['deleteServiceOrderURL']
+
+        getProgress(execution, url, "deleteStatus")
+
+    }
+
 
     @Override
     String getPrefix() {
         return PREFIX
     }
 
+    @Override
+    String getAction() {
+        return ACTION
+    }
 }
index ebeab3e..4ccea61 100644 (file)
 package org.onap.so.bpmn.infrastructure.scripts
 
 import com.fasterxml.jackson.databind.ObjectMapper
-import org.camunda.bpm.engine.delegate.BpmnError
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.CloudRegion
-import org.onap.aai.domain.yang.Customer
-import org.onap.aai.domain.yang.GenericVnf
-import org.onap.aai.domain.yang.ModelVer
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.ServiceSubscription
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aai.domain.yang.Tenant
-import org.onap.aai.domain.yang.VfModule
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aai.domain.yang.v19.ServiceInstance
+import org.onap.aai.domain.yang.v19.SliceProfile
 import org.onap.aaiclient.client.aai.AAIResourcesClient
 import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel
-import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
-import org.onap.aaiclient.client.aai.entities.Relationships
 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.onap.logging.filter.base.ONAPComponents
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.common.scripts.RequestDBUtil
-import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.client.HttpClient
-import org.onap.so.db.request.beans.OperationStatus
-import org.onap.so.requestsdb.RequestsDbConstant
-import org.onap.so.serviceinstancebeans.CloudConfiguration
-import org.onap.so.serviceinstancebeans.ModelInfo
-import org.onap.so.serviceinstancebeans.ModelType
-import org.onap.so.serviceinstancebeans.OwningEntity
-import org.onap.so.serviceinstancebeans.Project
-import org.onap.so.serviceinstancebeans.RequestDetails
-import org.onap.so.serviceinstancebeans.RequestInfo
-import org.onap.so.serviceinstancebeans.RequestParameters
-import org.onap.so.serviceinstancebeans.Resources
-import org.onap.so.serviceinstancebeans.Service
-import org.onap.so.serviceinstancebeans.SubscriberInfo
-import org.onap.so.serviceinstancebeans.VfModules
-import org.onap.so.serviceinstancebeans.Vnfs
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 
-import javax.ws.rs.core.Response
+import static org.apache.commons.lang3.StringUtils.isBlank
 
 class DoModifyCoreNSSI extends DoCommonCoreNSSI {
 
     private final String PREFIX ="DoModifyCoreNSSI"
+    private final String ACTION = "Modify"
 
     private ExceptionUtil exceptionUtil = new ExceptionUtil()
     private RequestDBUtil requestDBUtil = new RequestDBUtil()
@@ -89,12 +60,11 @@ class DoModifyCoreNSSI extends DoCommonCoreNSSI {
 
         def currentNSSI = execution.getVariable("currentNSSI")
 
-        String sliceProfileID = execution.getVariable("sliceProfileID")
-        Map<String, Object> sliceProfileMap = execution.getVariable("sliceProfileCn")
-        Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
+        String sliceProfileID = currentNSSI['sliceProfileId']
+        Map<String,Object> sliceProfileMap = new ObjectMapper().readValue(currentNSSI['sliceProfile'], Map.class)
 
-        String globalSubscriberId = currentNSSI['globalSubscriberId']
-        String serviceType = currentNSSI['serviceType']
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
         String nssiId = currentNSSI['nssiId']
 
         SliceProfile sliceProfile = new SliceProfile()
@@ -105,21 +75,46 @@ class DoModifyCoreNSSI extends DoCommonCoreNSSI {
         sliceProfile.setExpDataRate(0)
         sliceProfile.setTrafficDensity(0)
         sliceProfile.setConnDensity(0)
-        sliceProfile.setSNssai(sliceProfileMap.get("sNSSAI").toString())
-        sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString()))
-        sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString()))
-        sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
-        sliceProfile.setResourceSharingLevel(sliceProfileMap.get("activityFactor").toString())
-        sliceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString())
-        sliceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString())
-        sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
-        sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString()))
+        sliceProfile.setSNssai(currentNSSI['S-NSSAI'])
+
+        if(!isBlank(sliceProfileMap.get("expDataRateUL"))) {
+            sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString()))
+        }
+
+        if(!isBlank(sliceProfileMap.get("expDataRateDL"))) {
+            sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString()))
+        }
+
+        if(!isBlank(sliceProfileMap.get("activityFactor"))) {
+            sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
+        }
+
+        if(!isBlank(sliceProfileMap.get("resourceSharingLevel"))) {
+            sliceProfile.setResourceSharingLevel(sliceProfileMap.get("resourceSharingLevel").toString())
+        }
+
+        if(!isBlank(sliceProfileMap.get("uEMobilityLevel"))) {
+            sliceProfile.setUeMobilityLevel(sliceProfileMap.get("uEMobilityLevel").toString())
+        }
+
+        if(!isBlank(sliceProfileMap.get("coverageAreaTAList"))) {
+            sliceProfile.setCoverageAreaTAList(sliceProfileMap.get("coverageAreaTAList").toString())
+        }
+
+        if(!isBlank(sliceProfileMap.get("maxNumberofUEs"))) {
+            sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("maxNumberofUEs").toString()))
+        }
+
+        if(!isBlank(sliceProfileMap.get("latency"))) {
+            sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString()))
+        }
+
         sliceProfile.setProfileId(sliceProfileID)
         sliceProfile.setE2ELatency(0)
 
         try {
             AAIResourcesClient client = getAAIClient()
-            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileID))
+            AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId).sliceProfile(sliceProfileID))
             client.create(uri, sliceProfile)
 
             currentNSSI['createdSliceProfile'] = sliceProfile
@@ -138,16 +133,16 @@ class DoModifyCoreNSSI extends DoCommonCoreNSSI {
     void associateSliceProfileInstanceWithNSSI(DelegateExecution execution) {
         LOGGER.trace("${PREFIX} Start associateSliceProfileInstanceWithNSSI")
 
-        String sliceProfileID = execution.getVariable("sliceProfileID")
-
         def currentNSSI = execution.getVariable("currentNSSI")
 
-        String globalSubscriberId = currentNSSI['globalSubscriberId']
-        String serviceType = currentNSSI['serviceType']
+        String sliceProfileID = currentNSSI['sliceProfileId']
+
+        String globalSubscriberId = execution.getVariable("globalSubscriberId")
+        String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
         String nssiId = currentNSSI['nssiId']
 
         AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
-        AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileID))
+        AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId).sliceProfile(sliceProfileID))
 
         try {
             SliceProfile createdSliceProfile = (SliceProfile)currentNSSI['createdSliceProfile']
@@ -171,4 +166,9 @@ class DoModifyCoreNSSI extends DoCommonCoreNSSI {
         return PREFIX
     }
 
+
+    @Override
+    String getAction() {
+        return ACTION
+    }
 }
index 2c943ff..6ca3937 100644 (file)
@@ -24,19 +24,23 @@ import com.fasterxml.jackson.databind.ObjectMapper
 import org.junit.Before
 import org.junit.Test
 import org.mockito.Mockito
-import org.onap.aai.domain.yang.*
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aai.domain.yang.v19.*
 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
 import org.onap.aaiclient.client.aai.entities.Relationships
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAISimpleUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
+import org.onap.aaiclient.client.aai.entities.uri.ServiceInstanceUri
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
 import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
-import org.onap.aaiclient.client.aai.entities.uri.ServiceInstanceUri
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtil
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
 import org.onap.so.bpmn.common.scripts.MsoGroovyTest
 import org.onap.so.serviceinstancebeans.RequestDetails
 
+import javax.ws.rs.core.Response
+import java.time.Instant
+
 import static org.junit.Assert.assertNotNull
 import static org.junit.Assert.assertTrue
 import static org.mockito.Mockito.*
@@ -50,13 +54,32 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
 
     @Test
     void testPreProcessRequest() {
-        def currentNSSI = [:]
-        currentNSSI.put("nssiId","5G-999")
-        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        String nssiId = "5G-999"
+        when(mockExecution.getVariable("serviceInstanceID")).thenReturn(nssiId)
+
+        String nsiId = "5G-777"
+        when(mockExecution.getVariable("nsiId")).thenReturn(nsiId)
+
+        String snssai = "S-NSSAI"
+        String snssaiList = "[ \"${snssai}\" ]"
+        String sliceProfileId = "slice-profile-id"
+        String sliceParams =  "{\n" +
+                "\"sliceProfile\":{\"sliceProfileId\":\"${sliceProfileId}\",\"snssaiList\":${snssaiList}}\n" +
+                "}"
+        when(mockExecution.getVariable("sliceParams")).thenReturn(sliceParams)
 
         DoCommonCoreNSSI dcnssi = new DoCommonCoreNSSI()
         dcnssi.preProcessRequest(mockExecution)
-        Mockito.verify(mockExecution,times(1)).getVariable("currentNSSI")
+
+        def currentNSSI = [:]
+        currentNSSI.put("nssiId", nssiId)
+        currentNSSI.put("nsiId", nsiId)
+        currentNSSI.put("sliceProfile", "{\"sliceProfileId\":\"slice-profile-id\",\"snssaiList\":[\"S-NSSAI\"]}")
+        currentNSSI.put("S-NSSAI", snssai)
+        currentNSSI.put("sliceProfileId", sliceProfileId)
+        Mockito.verify(mockExecution,times(1)).setVariable("currentNSSI", currentNSSI)
+
     }
 
 
@@ -90,13 +113,13 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
         Relationships rsMock = mock(Relationships.class)
         Optional<Relationships> orsMock = Optional.of(rsMock)
         List<AAIResourceUri> arus = new ArrayList<>()
-        AAIResourceUri aru = new ServiceInstanceUri(networkServiceInstanceUri)
+        AAIResourceUri aru = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstance.getServiceInstanceId()))
         arus.add(aru)
 
         when(client.get(nssiUri)).thenReturn(wrapperMock)
         when(wrapperMock.getRelationships()).thenReturn(orsMock)
 
-        when(rsMockgetRelatedUris(Types.SERVICE_INSTANCE)).thenReturn(arus)
+        when(rsMock.getRelatedUris(Types.SERVICE_INSTANCE)).thenReturn(arus)
         when(client.get(ServiceInstance.class, aru)).thenReturn(networkServiceInstaneOpt)
 
         spy.getNetworkServiceInstance(mockExecution)
@@ -145,7 +168,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
         when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
         when(wrapperMock.getRelationships()).thenReturn(orsMock)
 
-        when(rsMockgetRelatedUris(Types.GENERIC_VNF)).thenReturn(arus)
+        when(rsMock.getRelatedUris(Types.GENERIC_VNF)).thenReturn(arus)
         when(client.get(GenericVnf.class, genericVNFUri)).thenReturn(genericVnfOpt)
 
         spy.getConstituteVNFFromNetworkServiceInst(mockExecution)
@@ -190,13 +213,9 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
         networkServiceInstance.setServiceInstanceId("NS-777")
         networkServiceInstance.setServiceRole("Network Service")
 
-        GenericVnf constituteVnf = new GenericVnf()
-        constituteVnf.setVnfId("VNF-1")
-
         when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
 
         currentNSSI.put("networkServiceInstance", networkServiceInstance)
-        currentNSSI.put("constituteVnf", constituteVnf)
 
         when(mockExecution.getVariable("mso.infra.endpoint.url")).thenReturn("http://mso.onap:8088")
         when(mockExecution.getVariable("mso.msoKey")).thenReturn("mso.msoKey")
@@ -211,7 +230,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
 
         when(spy.getAuthHeader(mockExecution, "auth-value", "mso.msoKey")).thenReturn(authHeaderResponse)
 
-        String urlString = String.format("http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId())
+        String urlString = String.format("http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/%s", networkServiceInstance.getServiceInstanceId())
 
         String callPUTServiceInstanceResponse = "put"
 
@@ -282,11 +301,12 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
         when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
 
         String globalSubscriberId = "global-id"
-        String serviceType = "service"
+        String subscriptionServiceType = "subscription-service-type"
         String nssiId = "5G-999"
 
-        currentNSSI.put("globalSubscriberId", globalSubscriberId)
-        currentNSSI.put("serviceType", serviceType)
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn(globalSubscriberId)
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn(subscriptionServiceType)
+
         currentNSSI.put("nssiId", nssiId)
 
         String theSNSSAI = "theS-NSSAI"
@@ -310,26 +330,6 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
     }
 
 
-    @Test
-    void testUpdateServiceOperationStatus() {
-        def currentNSSI = [:]
-
-        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
-
-        String nssiId = "5G-999"
-
-        currentNSSI.put("nssiId", nssiId)
-        currentNSSI.put("e2eServiceInstanceId", "e2eServiceInstanceId")
-        currentNSSI.put("operationId", "operationId")
-        currentNSSI.put("operationType", "operationType")
-
-        DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
-
-        spy.updateServiceOperationStatus(mockExecution)
-
-    }
-
-
     @Test
     void testPrepareRequestDetails() {
         def currentNSSI = [:]
@@ -431,6 +431,124 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
     }
 
 
+    @Test
+    void testPrepareFailedOperationStatusUpdate() {
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+        when(mockExecution.getVariable("jobId")).thenReturn("job-id")
+        when(mockExecution.getVariable("operationType")).thenReturn("operation-type")
+
+        String nssiId = "5G-999"
+        String nsiId = "5G-777"
+
+        currentNSSI.put("nssiId", nssiId)
+        currentNSSI.put("nsiId", nsiId)
+        currentNSSI.put("e2eServiceInstanceId", "e2eServiceInstanceId")
+        currentNSSI.put("operationId", "operationId")
+        currentNSSI.put("operationType", "operationType")
+
+        DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+
+        spy.prepareFailedOperationStatusUpdate(mockExecution)
+    }
+
+
+    @Test
+    void testPrepareUpdateResourceOperationStatus() {
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+        when(mockExecution.getVariable("jobId")).thenReturn("job-id")
+        when(mockExecution.getVariable("operationType")).thenReturn("operation-type")
+
+        String nssiId = "5G-999"
+        String nsiId = "5G-777"
+
+        currentNSSI.put("nssiId", nssiId)
+        currentNSSI.put("nsiId", nsiId)
+        currentNSSI.put("e2eServiceInstanceId", "e2eServiceInstanceId")
+        currentNSSI.put("operationId", "operationId")
+        currentNSSI.put("operationType", "operationType")
+
+        DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+
+        spy.prepareUpdateResourceOperationStatus(mockExecution)
+
+    }
+
+
+    @Test
+    void testGetPUTServiceInstanceProgressAcknowledged() {
+
+        executePUTServiceInstanceProgress("ACKNOWLEDGED")
+        Mockito.verify(mockExecution,times(1)).setVariable("putStatus", "processing")
+    }
+
+
+    @Test
+    void testGetPUTServiceInstanceProgressInProgress() {
+
+        executePUTServiceInstanceProgress("INPROGRESS")
+        Mockito.verify(mockExecution,times(1)).setVariable("putStatus", "processing")
+    }
+
+
+    @Test
+    void testGetPUTServiceInstanceProgressCompleted() {
+
+        executePUTServiceInstanceProgress("COMPLETED")
+        Mockito.verify(mockExecution,times(1)).setVariable("putStatus", "completed")
+    }
+
+
+    @Test
+    void testTimeDelay() {
+        DoCommonCoreNSSI obj = spy(DoCommonCoreNSSI.class)
+
+        long before = Instant.now().toEpochMilli()
+        obj.timeDelay(mockExecution)
+
+        long after = Instant.now().toEpochMilli()
+
+        long delay = 5L
+
+        assertTrue(String.format("Didn't wait %d sec", delay), ((after - before) >= delay))
+    }
+
+
+    void executePUTServiceInstanceProgress(String state) {
+
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        String url = "http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/5G-777"
+
+        currentNSSI.put("putServiceInstanceURL", url)
+
+        DoCommonCoreNSSI spy = spy(DoCommonCoreNSSI.class)
+
+        ExternalAPIUtilFactory externalAPIUtilFactoryMock = mock(ExternalAPIUtilFactory.class)
+        when(spy.getExternalAPIUtilFactory()).thenReturn(externalAPIUtilFactoryMock)
+
+        ExternalAPIUtil externalAPIUtilMock = mock(ExternalAPIUtil.class)
+
+        when(externalAPIUtilFactoryMock.create()).thenReturn(externalAPIUtilMock)
+
+        Response responseMock = mock(Response.class)
+        when(externalAPIUtilMock.executeExternalAPIGetCall(mockExecution, url)).thenReturn(responseMock)
+
+        when(responseMock.getStatus()).thenReturn(200)
+
+        String entity = "{\"state\":\"ACCEPTED\",\"orderItem\":[{\"service\":{\"id\":\"5G-999\"},\"state\":\"${state}\"}]}"
+        when(responseMock.readEntity(String.class)).thenReturn(entity)
+
+        spy.getPUTServiceInstanceProgress(mockExecution)
+
+    }
+
+
     void prepareProject(AAIResourceUri cloudRegionAAIUri) {
         Project project = new Project()
         project.setProjectName("project-name")
@@ -446,7 +564,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
         AAIResourceUri aru = new AAISimpleUri(cloudRegionAAIUri)
         arus.add(aru)
 
-        when(rsMockgetRelatedUris(Types.PROJECT)).thenReturn(arus)
+        when(rsMock.getRelatedUris(Types.PROJECT)).thenReturn(arus)
 
         Optional<Project> projectOpt = Optional.of(project)
 
@@ -472,7 +590,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
         AAIResourceUri aru = new AAISimpleUri(networkServiceInstanceUri)
         arus.add(aru)
 
-        when(rsMockgetRelatedUris(Types.OWNING_ENTITY)).thenReturn(arus)
+        when(rsMock.getRelatedUris(Types.OWNING_ENTITY)).thenReturn(arus)
 
         Optional<OwningEntity> owningEntityOpt = Optional.of(owningEntity)
 
@@ -494,7 +612,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
         AAIResourceUri aru = new AAISimpleUri(cloudRegionAAIUri)
         arus.add(aru)
 
-        when(rsMockgetRelatedUris(Types.CLOUD_REGION)).thenReturn(arus)
+        when(rsMock.getRelatedUris(Types.CLOUD_REGION)).thenReturn(arus)
 
         CloudRegion cloudRegion = new CloudRegion()
         cloudRegion.setCloudRegionId("cloud-region-id")
@@ -527,7 +645,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
 
         arus.add(serviceSubscriptionUri)
 
-        when(rsMockgetRelatedUris(Types.SERVICE_SUBSCRIPTION)).thenReturn(arus)
+        when(rsMock.getRelatedUris(Types.SERVICE_SUBSCRIPTION)).thenReturn(arus)
 
         ServiceSubscription serviceSubscription = new ServiceSubscription()
         serviceSubscription.setServiceType("service-type")
@@ -537,7 +655,7 @@ class DoCommonCoreNSSITest extends MsoGroovyTest {
 
         when(client.get(networkServiceInstanceUri)).thenReturn(wrapperMock)
 
-        when(rsMockgetRelatedUris(Types.CUSTOMER)).thenReturn(arus)
+        when(rsMock.getRelatedUris(Types.CUSTOMER)).thenReturn(arus)
 
         Customer customer = new Customer()
         customer.setSubscriberName("subscriber-name")
index eae7886..c6e8745 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-
 import org.junit.Before
 import org.junit.Test
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aai.domain.yang.SliceProfiles
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.mockito.Mockito
+import org.onap.aai.domain.yang.v19.*
 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.onap.so.bpmn.common.scripts.ExternalAPIUtil
+import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory
 import org.onap.so.bpmn.common.scripts.MsoGroovyTest
 
+import javax.ws.rs.core.Response
+
 import static org.junit.Assert.assertNotNull
 import static org.junit.Assert.assertTrue
 import static org.mockito.Mockito.*
@@ -263,4 +263,56 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
     }
 
 
+    @Test
+    void testDeleteServiceOrderProgressAcknowledged() {
+
+        executeDeleteServiceOrderProgress("ACKNOWLEDGED")
+        Mockito.verify(mockExecution,times(1)).setVariable("deleteStatus", "processing")
+    }
+
+    @Test
+    void testDeleteServiceOrderProgressInProgress() {
+
+        executeDeleteServiceOrderProgress("INPROGRESS")
+        Mockito.verify(mockExecution,times(1)).setVariable("deleteStatus", "processing")
+    }
+
+
+    @Test
+    void testDeleteServiceOrderProgressCompleted() {
+
+        executeDeleteServiceOrderProgress("COMPLETED")
+        Mockito.verify(mockExecution,times(1)).setVariable("deleteStatus", "completed")
+    }
+
+
+    void executeDeleteServiceOrderProgress(String state) {
+        def currentNSSI = [:]
+
+        when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+        String url = "http://nbi.onap:8088/api/v4/serviceOrder/NS-777"
+
+        currentNSSI.put("deleteServiceOrderURL", url)
+
+        DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class)
+
+        ExternalAPIUtilFactory externalAPIUtilFactoryMock = mock(ExternalAPIUtilFactory.class)
+        when(spy.getExternalAPIUtilFactory()).thenReturn(externalAPIUtilFactoryMock)
+
+        ExternalAPIUtil externalAPIUtilMock = mock(ExternalAPIUtil.class)
+
+        when(externalAPIUtilFactoryMock.create()).thenReturn(externalAPIUtilMock)
+
+        Response responseMock = mock(Response.class)
+        when(externalAPIUtilMock.executeExternalAPIGetCall(mockExecution, url)).thenReturn(responseMock)
+
+        when(responseMock.getStatus()).thenReturn(200)
+
+        String entity = "{\"state\":\"ACCEPTED\",\"orderItem\":[{\"service\":{\"id\":\"5G-999\"},\"state\":\"${state}\"}]}"
+        when(responseMock.readEntity(String.class)).thenReturn(entity)
+
+        spy.getDeleteServiceOrderProgress(mockExecution)
+    }
+
 }
index bbc237f..32c4c1a 100644 (file)
 
 package org.onap.so.bpmn.infrastructure.scripts
 
-
+import com.fasterxml.jackson.databind.ObjectMapper
 import org.junit.Before
 import org.junit.Test
-import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aai.domain.yang.SliceProfiles
-import org.onap.aaiclient.client.aai.AAIObjectType
+import org.onap.aai.domain.yang.v19.ServiceInstance
+import org.onap.aai.domain.yang.v19.SliceProfile
+import org.onap.aai.domain.yang.v19.SliceProfiles
 import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel
 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
@@ -155,34 +154,22 @@ class DoModifyCoreNSSITest extends MsoGroovyTest  {
 
         String sliceProfileId = "sliceProfileId"
 
-        when(mockExecution.getVariable("sliceProfileID")).thenReturn(sliceProfileId)
-
-        Map<String, Object> sliceProfileMap = new HashMap<>()
-        sliceProfileMap.put("expDataRateUL", "12")
-        sliceProfileMap.put("expDataRateDL", 5)
-        sliceProfileMap.put("activityFactor", 2)
-        sliceProfileMap.put("latency", 10)
-
-        when(mockExecution.getVariable("sliceProfileCn")).thenReturn(sliceProfileMap)
-
-
-        Map<String, Object> serviceProfileMap = new HashMap<>()
-        when(mockExecution.getVariable("serviceProfile")).thenReturn(serviceProfileMap)
-
+        currentNSSI.put("sliceProfile", "{\"sliceProfileId\":\"slice-profile-id\",\"snssaiList\":[\"S-NSSAI\"],\"expDataRateUL\":\"12\"}")
+        currentNSSI.put("sliceProfileId", sliceProfileId)
 
         DoModifyCoreNSSI spy = spy(DoModifyCoreNSSI.class)
         when(spy.getAAIClient()).thenReturn(client)
 
         String globalSubscriberId = "globalSubscriberId"
-        String serviceType = "serviceType"
+        String subscriptionServiceType = "subscription-service-type"
         String nssiId = "nssiId"
 
-        currentNSSI.put("globalSubscriberId", globalSubscriberId)
-        currentNSSI.put("serviceType", serviceType)
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn(globalSubscriberId)
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn(subscriptionServiceType)
+
         currentNSSI.put("nssiId", nssiId)
-        currentNSSI.put("sliceProfileId", sliceProfileId)
 
-        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileId))
+        AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId).sliceProfile(sliceProfileId))
 
         SliceProfile sliceProfile = new SliceProfile()
         sliceProfile.setProfileId(sliceProfileId)
@@ -213,13 +200,14 @@ class DoModifyCoreNSSITest extends MsoGroovyTest  {
         currentNSSI.put("nssiId", nssiId)
 
         String globalSubscriberId = "globalSubscriberId"
-        String serviceType = "serviceType"
+        String subscriptionServiceType = "subscriptionServiceType"
 
         AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId))
-        AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiId).sliceProfile(sliceProfileId))
+        AAIResourceUri sliceProfileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId).sliceProfile(sliceProfileId))
+
+        when(mockExecution.getVariable("globalSubscriberId")).thenReturn(globalSubscriberId)
+        when(mockExecution.getVariable("subscriptionServiceType")).thenReturn(subscriptionServiceType)
 
-        currentNSSI.put("globalSubscriberId", globalSubscriberId)
-        currentNSSI.put("serviceType", serviceType)
         currentNSSI.put("sliceProfileId", sliceProfileId)
 
         SliceProfile sliceProfile = new SliceProfile()
@@ -240,5 +228,4 @@ class DoModifyCoreNSSITest extends MsoGroovyTest  {
         assertTrue("Wrong number of associated slice profiles", ((ServiceInstance)currentNSSI.get("nssi")).getSliceProfiles().getSliceProfile().size() == (sizeBelore + 1))
     }
 
-
 }
index 81ed921..b55b7c4 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" id="Definitions_1v4vnwb" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.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_1v4vnwb" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
   <bpmn:process id="Process_02hqnsq" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1" name="Deallocate Core NSSI Flow">
       <bpmn:outgoing>Flow_0xxq2h8</bpmn:outgoing>
@@ -83,11 +83,11 @@ def dcnssi= new DoDeallocateCoreNSSI()
     </bpmn:scriptTask>
     <bpmn:exclusiveGateway id="Gateway_07ygtxz" name="Is terminateNSSI=true?" default="Flow_12nxpx6">
       <bpmn:incoming>Flow_009x8vn</bpmn:incoming>
-      <bpmn:outgoing>Flow_1r39237</bpmn:outgoing>
       <bpmn:outgoing>Flow_12nxpx6</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1r39237</bpmn:outgoing>
     </bpmn:exclusiveGateway>
     <bpmn:endEvent id="Event_1vgebg2" name="End">
-      <bpmn:incoming>Flow_15rk73d</bpmn:incoming>
+      <bpmn:incoming>Flow_095vvrk</bpmn:incoming>
     </bpmn:endEvent>
     <bpmn:scriptTask id="Activity_1gcmlps" name=" Delete the NSSI service instance\r" scriptFormat="groovy">
       <bpmn:incoming>Flow_1r39237</bpmn:incoming>
@@ -96,18 +96,15 @@ def dcnssi= new DoDeallocateCoreNSSI()
 def dcnssi= new DoDeallocateCoreNSSI()
         dcnssi.deleteNSSIServiceInstance(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="Flow_1r39237" name="yes" sourceRef="Gateway_07ygtxz" targetRef="Activity_1gcmlps">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTerminateNSSI" )  == true)}</bpmn:conditionExpression>
-    </bpmn:sequenceFlow>
-    <bpmn:scriptTask id="Activity_0gs71qq" name="Update Service Operation Status" scriptFormat="groovy">
-      <bpmn:incoming>Flow_12nxpx6</bpmn:incoming>
+    <bpmn:scriptTask id="Activity_0gs71qq" name="Prepare Update Operation Status" scriptFormat="groovy">
       <bpmn:incoming>Flow_04hswb4</bpmn:incoming>
+      <bpmn:incoming>Flow_12nxpx6</bpmn:incoming>
       <bpmn:outgoing>Flow_15rk73d</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
 def dcnssi= new DoDeallocateCoreNSSI()
-        dcnssi.updateServiceOperationStatus(execution)</bpmn:script>
+        dcnssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:intermediateThrowEvent id="Event_016dxue" name="Goto no terminate NSSI Subflow">
+    <bpmn:intermediateThrowEvent id="Event_016dxue" name="Goto No terminate NSSI Subflow">
       <bpmn:incoming>Flow_0e3yvck</bpmn:incoming>
       <bpmn:linkEventDefinition id="LinkEventDefinition_0l191e1" name="NoTerminateNSSISubflow" />
     </bpmn:intermediateThrowEvent>
@@ -125,12 +122,12 @@ def dcnssi= new DoDeallocateCoreNSSI()
     <bpmn:sequenceFlow id="Flow_1qwi2ka" sourceRef="Activity_0es9or8" targetRef="Activity_0mnkgd6" />
     <bpmn:sequenceFlow id="Flow_0e3yvck" name="no" sourceRef="Gateway_1dqw1bg" targetRef="Event_016dxue" />
     <bpmn:intermediateThrowEvent id="Event_062ulql" name="Goto Common Subflow">
-      <bpmn:incoming>Flow_178myd8</bpmn:incoming>
-      <bpmn:incoming>Flow_1b14can</bpmn:incoming>
+      <bpmn:incoming>Flow_1mrr969</bpmn:incoming>
+      <bpmn:incoming>Flow_1gxcve5</bpmn:incoming>
       <bpmn:linkEventDefinition id="LinkEventDefinition_017h179" name="CommonSubflow" />
     </bpmn:intermediateThrowEvent>
-    <bpmn:sequenceFlow id="Flow_178myd8" sourceRef="Activity_0mnkgd6" targetRef="Event_062ulql" />
-    <bpmn:sequenceFlow id="Flow_1b14can" sourceRef="Activity_1kne6ot" targetRef="Event_062ulql" />
+    <bpmn:sequenceFlow id="Flow_178myd8" sourceRef="Activity_0mnkgd6" targetRef="Activity_07qrjro" />
+    <bpmn:sequenceFlow id="Flow_1b14can" sourceRef="Activity_1kne6ot" targetRef="Activity_1a5fd5v" />
     <bpmn:intermediateCatchEvent id="Event_027jirg" name="Common Subflow">
       <bpmn:outgoing>Flow_16j7pjk</bpmn:outgoing>
       <bpmn:linkEventDefinition id="LinkEventDefinition_1fn4t8h" name="CommonSubflow" />
@@ -139,8 +136,7 @@ def dcnssi= new DoDeallocateCoreNSSI()
     <bpmn:sequenceFlow id="Flow_0j8gu83" sourceRef="Activity_1mbtpe6" targetRef="Activity_0tanqh5" />
     <bpmn:sequenceFlow id="Flow_009x8vn" sourceRef="Activity_0tanqh5" targetRef="Gateway_07ygtxz" />
     <bpmn:sequenceFlow id="Flow_12nxpx6" name="no" sourceRef="Gateway_07ygtxz" targetRef="Activity_0gs71qq" />
-    <bpmn:sequenceFlow id="Flow_04hswb4" sourceRef="Activity_1gcmlps" targetRef="Activity_0gs71qq" />
-    <bpmn:sequenceFlow id="Flow_15rk73d" sourceRef="Activity_0gs71qq" targetRef="Event_1vgebg2" />
+    <bpmn:sequenceFlow id="Flow_15rk73d" sourceRef="Activity_0gs71qq" targetRef="Activity_1npwfvi" />
     <bpmn:scriptTask id="Activity_13qnpcn" name="Execute terminate NSSI query" scriptFormat="groovy">
       <bpmn:incoming>Flow_0g84uy5</bpmn:incoming>
       <bpmn:outgoing>Flow_189j30m</bpmn:outgoing>
@@ -150,46 +146,180 @@ def dcnssi= new DoDeallocateCoreNSSI()
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="Flow_0g84uy5" sourceRef="Activity_0u06qij" targetRef="Activity_13qnpcn" />
     <bpmn:sequenceFlow id="Flow_189j30m" sourceRef="Activity_13qnpcn" targetRef="Activity_0wswwhj" />
+    <bpmn:subProcess id="Activity_14l5j2f" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_1blx2tk">
+        <bpmn:outgoing>Flow_0z51qfz</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_06njwcg" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_1umlj38">
+        <bpmn:incoming>Flow_139pcs3</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_1hh3qh1" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1vq4jz8</bpmn:incoming>
+        <bpmn:outgoing>Flow_139pcs3</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:scriptTask id="Activity_009mpgu" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+        <bpmn:incoming>Flow_0z51qfz</bpmn:incoming>
+        <bpmn:outgoing>Flow_1cl22g1</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoDeallocateCoreNSSI()
+dcnssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_0ckr2ke" name="Update Resource Operation Status">
+        <bpmn:extensionElements>
+          <camunda:connector>
+            <camunda:inputOutput>
+              <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+              <camunda:inputParameter name="headers">
+                <camunda:map>
+                  <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                  <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+                </camunda:map>
+              </camunda:inputParameter>
+              <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+              <camunda:inputParameter name="method">POST</camunda:inputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+            </camunda:inputOutput>
+            <camunda:connectorId>http-connector</camunda:connectorId>
+          </camunda:connector>
+        </bpmn:extensionElements>
+        <bpmn:incoming>Flow_1cl22g1</bpmn:incoming>
+        <bpmn:outgoing>Flow_1vq4jz8</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_1vq4jz8" sourceRef="Activity_0ckr2ke" targetRef="Activity_1hh3qh1" />
+      <bpmn:sequenceFlow id="Flow_1cl22g1" sourceRef="Activity_009mpgu" targetRef="Activity_0ckr2ke" />
+      <bpmn:sequenceFlow id="Flow_0z51qfz" sourceRef="Event_1blx2tk" targetRef="Activity_009mpgu" />
+      <bpmn:sequenceFlow id="Flow_139pcs3" sourceRef="Activity_1hh3qh1" targetRef="Event_1umlj38" />
+    </bpmn:subProcess>
+    <bpmn:serviceTask id="Activity_1npwfvi" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_15rk73d</bpmn:incoming>
+      <bpmn:outgoing>Flow_095vvrk</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_095vvrk" sourceRef="Activity_1npwfvi" targetRef="Event_1vgebg2" />
+    <bpmn:scriptTask id="Activity_1a5fd5v" name="Call Get Delete ServiceOrder Progress" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1b14can</bpmn:incoming>
+      <bpmn:incoming>Flow_1qej57v</bpmn:incoming>
+      <bpmn:outgoing>Flow_1h8q1h1</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+dcnssi.getDeleteServiceOrderProgress(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1h8q1h1" sourceRef="Activity_1a5fd5v" targetRef="Gateway_13cwisg" />
+    <bpmn:exclusiveGateway id="Gateway_13cwisg" name="Status = processing" default="Flow_1mrr969">
+      <bpmn:incoming>Flow_1h8q1h1</bpmn:incoming>
+      <bpmn:outgoing>Flow_1mrr969</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1j1en2h</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1mrr969" name="No" sourceRef="Gateway_13cwisg" targetRef="Event_062ulql" />
+    <bpmn:scriptTask id="Activity_1ym1op6" name="Time Delay" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1j1en2h</bpmn:incoming>
+      <bpmn:outgoing>Flow_1qej57v</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+dcnssi.timeDelay(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1j1en2h" name="Yes" sourceRef="Gateway_13cwisg" targetRef="Activity_1ym1op6">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("deleteStatus" ) == "processing" )}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1qej57v" sourceRef="Activity_1ym1op6" targetRef="Activity_1a5fd5v" />
+    <bpmn:scriptTask id="Activity_07qrjro" name="Call Get PUT Service Instance Progress" scriptFormat="groovy">
+      <bpmn:incoming>Flow_178myd8</bpmn:incoming>
+      <bpmn:incoming>Flow_0att74c</bpmn:incoming>
+      <bpmn:outgoing>Flow_0pvh1x9</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+dcnssi.getPUTServiceInstanceProgress(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0pvh1x9" sourceRef="Activity_07qrjro" targetRef="Gateway_1yftwt8" />
+    <bpmn:sequenceFlow id="Flow_04hswb4" sourceRef="Activity_1gcmlps" targetRef="Activity_0gs71qq" />
+    <bpmn:sequenceFlow id="Flow_1r39237" name="yes" sourceRef="Gateway_07ygtxz" targetRef="Activity_1gcmlps">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTerminateNSSI" )  == true)}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:exclusiveGateway id="Gateway_1yftwt8" name="Status = processing" default="Flow_1gxcve5">
+      <bpmn:incoming>Flow_0pvh1x9</bpmn:incoming>
+      <bpmn:outgoing>Flow_1gxcve5</bpmn:outgoing>
+      <bpmn:outgoing>Flow_0afgah7</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_1gxcve5" name="No" sourceRef="Gateway_1yftwt8" targetRef="Event_062ulql" />
+    <bpmn:scriptTask id="Activity_1lafl76" name="Time Delay" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0afgah7</bpmn:incoming>
+      <bpmn:outgoing>Flow_0att74c</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi= new DoDeallocateCoreNSSI()
+dcnssi.timeDelay(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0afgah7" name="Yes" sourceRef="Gateway_1yftwt8" targetRef="Activity_1lafl76">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("putStatus" ) == "processing" )}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_0att74c" sourceRef="Activity_1lafl76" targetRef="Activity_07qrjro" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_02hqnsq">
+      <bpmndi:BPMNEdge id="Flow_189j30m_di" bpmnElement="Flow_189j30m">
+        <di:waypoint x="510" y="117" />
+        <di:waypoint x="580" y="117" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0g84uy5_di" bpmnElement="Flow_0g84uy5">
+        <di:waypoint x="360" y="117" />
+        <di:waypoint x="410" y="117" />
+      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_15rk73d_di" bpmnElement="Flow_15rk73d">
-        <di:waypoint x="1220" y="600" />
-        <di:waypoint x="1282" y="600" />
+        <di:waypoint x="1220" y="670" />
+        <di:waypoint x="1270" y="670" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_04hswb4_di" bpmnElement="Flow_04hswb4">
-        <di:waypoint x="980" y="600" />
-        <di:waypoint x="1120" y="600" />
+        <di:waypoint x="980" y="750" />
+        <di:waypoint x="1170" y="750" />
+        <di:waypoint x="1170" y="710" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_12nxpx6_di" bpmnElement="Flow_12nxpx6">
-        <di:waypoint x="790" y="625" />
-        <di:waypoint x="790" y="680" />
-        <di:waypoint x="1170" y="680" />
-        <di:waypoint x="1170" y="640" />
+        <di:waypoint x="795" y="670" />
+        <di:waypoint x="1120" y="670" />
         <bpmndi:BPMNLabel>
           <dc:Bounds x="814" y="663" width="13" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_009x8vn_di" bpmnElement="Flow_009x8vn">
-        <di:waypoint x="680" y="600" />
-        <di:waypoint x="765" y="600" />
+        <di:waypoint x="670" y="670" />
+        <di:waypoint x="745" y="670" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0j8gu83_di" bpmnElement="Flow_0j8gu83">
-        <di:waypoint x="510" y="600" />
-        <di:waypoint x="580" y="600" />
+        <di:waypoint x="510" y="670" />
+        <di:waypoint x="570" y="670" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_16j7pjk_di" bpmnElement="Flow_16j7pjk">
-        <di:waypoint x="208" y="600" />
-        <di:waypoint x="260" y="600" />
+        <di:waypoint x="215" y="670" />
+        <di:waypoint x="260" y="670" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1b14can_di" bpmnElement="Flow_1b14can">
         <di:waypoint x="800" y="240" />
-        <di:waypoint x="975" y="240" />
-        <di:waypoint x="975" y="382" />
+        <di:waypoint x="910" y="240" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_178myd8_di" bpmnElement="Flow_178myd8">
-        <di:waypoint x="840" y="400" />
-        <di:waypoint x="957" y="400" />
+        <di:waypoint x="820" y="450" />
+        <di:waypoint x="880" y="450" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0e3yvck_di" bpmnElement="Flow_0e3yvck">
         <di:waypoint x="775" y="117" />
@@ -199,20 +329,20 @@ def dcnssi= new DoDeallocateCoreNSSI()
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1qwi2ka_di" bpmnElement="Flow_1qwi2ka">
-        <di:waypoint x="680" y="400" />
-        <di:waypoint x="740" y="400" />
+        <di:waypoint x="680" y="450" />
+        <di:waypoint x="720" y="450" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0xrq94a_di" bpmnElement="Flow_0xrq94a">
-        <di:waypoint x="510" y="400" />
-        <di:waypoint x="580" y="400" />
+        <di:waypoint x="510" y="450" />
+        <di:waypoint x="580" y="450" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1eev81t_di" bpmnElement="Flow_1eev81t">
-        <di:waypoint x="360" y="400" />
-        <di:waypoint x="410" y="400" />
+        <di:waypoint x="360" y="450" />
+        <di:waypoint x="410" y="450" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1v68jns_di" bpmnElement="Flow_1v68jns">
-        <di:waypoint x="208" y="400" />
-        <di:waypoint x="260" y="400" />
+        <di:waypoint x="215" y="450" />
+        <di:waypoint x="260" y="450" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_15ew9rs_di" bpmnElement="Flow_15ew9rs">
         <di:waypoint x="750" y="142" />
@@ -222,14 +352,15 @@ def dcnssi= new DoDeallocateCoreNSSI()
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0nvtepd_di" bpmnElement="Flow_0nvtepd">
-        <di:waypoint x="360" y="600" />
-        <di:waypoint x="410" y="600" />
+        <di:waypoint x="360" y="670" />
+        <di:waypoint x="410" y="670" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1r39237_di" bpmnElement="Flow_1r39237">
-        <di:waypoint x="815" y="600" />
-        <di:waypoint x="880" y="600" />
+        <di:waypoint x="770" y="695" />
+        <di:waypoint x="770" y="750" />
+        <di:waypoint x="880" y="750" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="823" y="582" width="17" height="14" />
+          <dc:Bounds x="772" y="701" width="17" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_16192dm_di" bpmnElement="Flow_16192dm">
@@ -240,13 +371,55 @@ def dcnssi= new DoDeallocateCoreNSSI()
         <di:waypoint x="215" y="117" />
         <di:waypoint x="260" y="117" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0g84uy5_di" bpmnElement="Flow_0g84uy5">
-        <di:waypoint x="360" y="117" />
-        <di:waypoint x="410" y="117" />
+      <bpmndi:BPMNEdge id="Flow_095vvrk_di" bpmnElement="Flow_095vvrk">
+        <di:waypoint x="1370" y="670" />
+        <di:waypoint x="1432" y="670" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_189j30m_di" bpmnElement="Flow_189j30m">
-        <di:waypoint x="510" y="117" />
-        <di:waypoint x="580" y="117" />
+      <bpmndi:BPMNEdge id="Flow_1h8q1h1_di" bpmnElement="Flow_1h8q1h1">
+        <di:waypoint x="1010" y="240" />
+        <di:waypoint x="1130" y="240" />
+        <di:waypoint x="1130" y="325" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1mrr969_di" bpmnElement="Flow_1mrr969">
+        <di:waypoint x="1130" y="375" />
+        <di:waypoint x="1130" y="432" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1138" y="393" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1j1en2h_di" bpmnElement="Flow_1j1en2h">
+        <di:waypoint x="1105" y="350" />
+        <di:waypoint x="1010" y="350" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1026" y="352" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1qej57v_di" bpmnElement="Flow_1qej57v">
+        <di:waypoint x="960" y="310" />
+        <di:waypoint x="960" y="280" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0pvh1x9_di" bpmnElement="Flow_0pvh1x9">
+        <di:waypoint x="980" y="450" />
+        <di:waypoint x="1015" y="450" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1gxcve5_di" bpmnElement="Flow_1gxcve5">
+        <di:waypoint x="1065" y="450" />
+        <di:waypoint x="1112" y="450" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1083" y="432" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0afgah7_di" bpmnElement="Flow_0afgah7">
+        <di:waypoint x="1040" y="475" />
+        <di:waypoint x="1040" y="520" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1046" y="482" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0att74c_di" bpmnElement="Flow_0att74c">
+        <di:waypoint x="990" y="560" />
+        <di:waypoint x="930" y="560" />
+        <di:waypoint x="930" y="490" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
         <dc:Bounds x="179" y="99" width="36" height="36" />
@@ -257,83 +430,144 @@ def dcnssi= new DoDeallocateCoreNSSI()
       <bpmndi:BPMNShape id="Activity_0u06qij_di" bpmnElement="Activity_0u06qij">
         <dc:Bounds x="260" y="77" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0wswwhj_di" bpmnElement="Activity_0wswwhj">
+        <dc:Bounds x="580" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_1dqw1bg_di" bpmnElement="Gateway_1dqw1bg" isMarkerVisible="true">
+        <dc:Bounds x="725" y="92" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="708" y="53" width="85" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_1kne6ot_di" bpmnElement="Activity_1kne6ot">
         <dc:Bounds x="700" y="200" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_016dxue_di" bpmnElement="Event_016dxue">
+        <dc:Bounds x="832" y="99" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="821" y="140" width="74" height="40" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_13qnpcn_di" bpmnElement="Activity_13qnpcn">
+        <dc:Bounds x="410" y="77" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1mk9pgp_di" bpmnElement="Event_1mk9pgp">
+        <dc:Bounds x="179" y="432" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="169" y="475" width="69" height="27" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_1anr9ry_di" bpmnElement="Activity_1anr9ry">
-        <dc:Bounds x="260" y="360" width="100" height="80" />
+        <dc:Bounds x="260" y="410" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_16wfqhu_di" bpmnElement="Activity_16wfqhu">
-        <dc:Bounds x="410" y="360" width="100" height="80" />
+        <dc:Bounds x="410" y="410" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0es9or8_di" bpmnElement="Activity_0es9or8">
-        <dc:Bounds x="580" y="360" width="100" height="80" />
+        <dc:Bounds x="580" y="410" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0mnkgd6_di" bpmnElement="Activity_0mnkgd6">
-        <dc:Bounds x="740" y="360" width="100" height="80" />
+        <dc:Bounds x="720" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1a5fd5v_di" bpmnElement="Activity_1a5fd5v">
+        <dc:Bounds x="910" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1ym1op6_di" bpmnElement="Activity_1ym1op6">
+        <dc:Bounds x="910" y="310" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_07qrjro_di" bpmnElement="Activity_07qrjro">
+        <dc:Bounds x="880" y="410" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_027jirg_di" bpmnElement="Event_027jirg">
+        <dc:Bounds x="179" y="652" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="160" y="695" width="88" height="14" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_19z90sm_di" bpmnElement="Activity_19z90sm">
-        <dc:Bounds x="260" y="560" width="100" height="80" />
+        <dc:Bounds x="260" y="630" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_1mbtpe6_di" bpmnElement="Activity_1mbtpe6">
-        <dc:Bounds x="410" y="560" width="100" height="80" />
+        <dc:Bounds x="410" y="630" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0tanqh5_di" bpmnElement="Activity_0tanqh5">
-        <dc:Bounds x="580" y="560" width="100" height="80" />
+        <dc:Bounds x="570" y="630" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Gateway_07ygtxz_di" bpmnElement="Gateway_07ygtxz" isMarkerVisible="true">
-        <dc:Bounds x="765" y="575" width="50" height="50" />
+        <dc:Bounds x="745" y="645" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="737" y="529" width="86" height="40" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1vgebg2_di" bpmnElement="Event_1vgebg2">
-        <dc:Bounds x="1282" y="582" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1290" y="558" width="20" height="14" />
+          <dc:Bounds x="717" y="599" width="86" height="40" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_1gcmlps_di" bpmnElement="Activity_1gcmlps">
-        <dc:Bounds x="880" y="560" width="100" height="80" />
+        <dc:Bounds x="880" y="710" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0gs71qq_di" bpmnElement="Activity_0gs71qq">
-        <dc:Bounds x="1120" y="560" width="100" height="80" />
+        <dc:Bounds x="1120" y="630" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1mk9pgp_di" bpmnElement="Event_1mk9pgp">
-        <dc:Bounds x="172" y="382" width="36" height="36" />
+      <bpmndi:BPMNShape id="Activity_1npwfvi_di" bpmnElement="Activity_1npwfvi">
+        <dc:Bounds x="1270" y="630" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1vgebg2_di" bpmnElement="Event_1vgebg2">
+        <dc:Bounds x="1432" y="652" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="162" y="425" width="69" height="27" />
+          <dc:Bounds x="1440" y="698" width="20" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_062ulql_di" bpmnElement="Event_062ulql">
-        <dc:Bounds x="957" y="382" width="36" height="36" />
+        <dc:Bounds x="1112" y="432" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="947" y="423" width="72" height="27" />
+          <dc:Bounds x="1102" y="473" width="72" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_027jirg_di" bpmnElement="Event_027jirg">
-        <dc:Bounds x="172" y="582" width="36" height="36" />
+      <bpmndi:BPMNShape id="Gateway_13cwisg_di" bpmnElement="Gateway_13cwisg" isMarkerVisible="true">
+        <dc:Bounds x="1105" y="325" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="153" y="625" width="88" height="14" />
+          <dc:Bounds x="1165" y="336" width="54" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_13qnpcn_di" bpmnElement="Activity_13qnpcn">
-        <dc:Bounds x="410" y="77" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0wswwhj_di" bpmnElement="Activity_0wswwhj">
-        <dc:Bounds x="580" y="77" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_1dqw1bg_di" bpmnElement="Gateway_1dqw1bg" isMarkerVisible="true">
-        <dc:Bounds x="725" y="92" width="50" height="50" />
+      <bpmndi:BPMNShape id="Gateway_1yftwt8_di" bpmnElement="Gateway_1yftwt8" isMarkerVisible="true">
+        <dc:Bounds x="1015" y="425" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="708" y="53" width="85" height="40" />
+          <dc:Bounds x="1028" y="396" width="54" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_016dxue_di" bpmnElement="Event_016dxue">
-        <dc:Bounds x="832" y="99" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="820" y="140" width="74" height="40" />
-        </bpmndi:BPMNLabel>
+      <bpmndi:BPMNShape id="Activity_1lafl76_di" bpmnElement="Activity_1lafl76">
+        <dc:Bounds x="990" y="520" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_14l5j2f_di" bpmnElement="Activity_14l5j2f" isExpanded="true">
+        <dc:Bounds x="250" y="910" width="781" height="196" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_1vq4jz8_di" bpmnElement="Flow_1vq4jz8">
+        <di:waypoint x="640" y="1014" />
+        <di:waypoint x="710" y="1014" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1cl22g1_di" bpmnElement="Flow_1cl22g1">
+        <di:waypoint x="480" y="1014" />
+        <di:waypoint x="540" y="1014" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0z51qfz_di" bpmnElement="Flow_0z51qfz">
+        <di:waypoint x="316" y="1014" />
+        <di:waypoint x="380" y="1014" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_139pcs3_di" bpmnElement="Flow_139pcs3">
+        <di:waypoint x="810" y="1014" />
+        <di:waypoint x="918" y="1014" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_1blx2tk_di" bpmnElement="Event_1blx2tk">
+        <dc:Bounds x="280" y="996" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Event_1umlj38_di" bpmnElement="Event_1umlj38">
+        <dc:Bounds x="918" y="996" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1hh3qh1_di" bpmnElement="Activity_1hh3qh1">
+        <dc:Bounds x="710" y="974" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_009mpgu_di" bpmnElement="Activity_009mpgu">
+        <dc:Bounds x="380" y="974" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0ckr2ke_di" bpmnElement="Activity_0ckr2ke">
+        <dc:Bounds x="540" y="974" width="100" height="80" />
       </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
index 1f1fe4e..e0c0b9a 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1ejx57e" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1ejx57e" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
   <bpmn:process id="Process_1nmtzzp" isExecutable="true">
     <bpmn:startEvent id="Event_0fbqt56" name="Modify Core NSSI Flow">
       <bpmn:outgoing>Flow_0e007rx</bpmn:outgoing>
@@ -28,11 +28,11 @@ def mcnssi= new DoModifyCoreNSSI()
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="Flow_184tfp7" sourceRef="Activity_1ce41n6" targetRef="Activity_02skgkj" />
     <bpmn:exclusiveGateway id="Gateway_1hadnun" name="Is Slice Profile Instance has to be created" default="Flow_03gf14v">
-      <bpmn:incoming>Flow_0s31teg</bpmn:incoming>
+      <bpmn:incoming>Flow_1hm2xps</bpmn:incoming>
       <bpmn:outgoing>Flow_1pls2hu</bpmn:outgoing>
       <bpmn:outgoing>Flow_03gf14v</bpmn:outgoing>
     </bpmn:exclusiveGateway>
-    <bpmn:sequenceFlow id="Flow_0s31teg" sourceRef="Activity_02skgkj" targetRef="Gateway_1hadnun" />
+    <bpmn:sequenceFlow id="Flow_0s31teg" sourceRef="Activity_02skgkj" targetRef="Activity_0wdaul0" />
     <bpmn:intermediateThrowEvent id="Event_1243wg1" name="Goto Slice Profile Instance has to be created">
       <bpmn:incoming>Flow_1pls2hu</bpmn:incoming>
       <bpmn:linkEventDefinition id="LinkEventDefinition_14qnw6y" name="SliceProfileInstanceHasToBeCreated" />
@@ -45,87 +45,54 @@ def mcnssi= new DoModifyCoreNSSI()
       <bpmn:linkEventDefinition id="LinkEventDefinition_0ecwvhj" name="SliceProfileInstanceHasToBeDeleted" />
     </bpmn:intermediateThrowEvent>
     <bpmn:sequenceFlow id="Flow_03gf14v" name="no" sourceRef="Gateway_1hadnun" targetRef="Event_1gjhrcq" />
-    <bpmn:scriptTask id="Activity_0oph5am" name="Update Service Operation Status" scriptFormat="groovy">
+    <bpmn:scriptTask id="Activity_0oph5am" name="Prepare Update Operation Status" scriptFormat="groovy">
       <bpmn:incoming>Flow_0l7hcnf</bpmn:incoming>
       <bpmn:incoming>Flow_0lrenyo</bpmn:incoming>
       <bpmn:outgoing>Flow_0yq24um</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new DoDeallocateCoreNSSI()
-        mcnssi.updateServiceOperationStatus(execution)</bpmn:script>
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:endEvent id="Event_1p0mogo" name="End">
-      <bpmn:incoming>Flow_0yq24um</bpmn:incoming>
+      <bpmn:incoming>Flow_1yphs5r</bpmn:incoming>
     </bpmn:endEvent>
-    <bpmn:sequenceFlow id="Flow_0yq24um" sourceRef="Activity_0oph5am" targetRef="Event_1p0mogo" />
+    <bpmn:sequenceFlow id="Flow_0yq24um" sourceRef="Activity_0oph5am" targetRef="Activity_0d1kk7f" />
     <bpmn:intermediateCatchEvent id="Event_0z9mer1" name="Slice Profile Instance has to be created">
-      <bpmn:outgoing>Flow_1xysykm</bpmn:outgoing>
+      <bpmn:outgoing>Flow_1twqfsc</bpmn:outgoing>
       <bpmn:linkEventDefinition id="LinkEventDefinition_0fbskyk" name="SliceProfileInstanceHasToBeCreated" />
     </bpmn:intermediateCatchEvent>
     <bpmn:intermediateCatchEvent id="Event_0m2jn7c" name="Slice profile instance has to be deleted">
       <bpmn:outgoing>Flow_11vf6ik</bpmn:outgoing>
       <bpmn:linkEventDefinition id="LinkEventDefinition_1lptuqv" name="SliceProfileInstanceHasToBeDeleted" />
     </bpmn:intermediateCatchEvent>
-    <bpmn:scriptTask id="Activity_0ouov98" name="Calculate S-NSSAI" scriptFormat="groovy">
-      <bpmn:incoming>Flow_1xysykm</bpmn:incoming>
-      <bpmn:outgoing>Flow_1nxaeez</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new DoModifyCoreNSSI()
-        mcnssi.calculateSNSSAI(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="Flow_1xysykm" sourceRef="Event_0z9mer1" targetRef="Activity_0ouov98" />
-    <bpmn:scriptTask id="Activity_00t4mmi" name="Invoke PUT Service Instance API" scriptFormat="groovy">
-      <bpmn:incoming>Flow_1nxaeez</bpmn:incoming>
-      <bpmn:outgoing>Flow_0ccqmju</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
-        mcnssi.invokePUTServiceInstance(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="Flow_1nxaeez" sourceRef="Activity_0ouov98" targetRef="Activity_00t4mmi" />
     <bpmn:scriptTask id="Activity_1q02wiz" name="Create a slice profile instance\r" scriptFormat="groovy">
-      <bpmn:incoming>Flow_0ccqmju</bpmn:incoming>
+      <bpmn:incoming>Flow_1twqfsc</bpmn:incoming>
       <bpmn:outgoing>Flow_1fdpbsx</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
+def mcnssi= new DoModifyCoreNSSI()
         mcnssi.createSliceProfileInstance(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="Flow_0ccqmju" sourceRef="Activity_00t4mmi" targetRef="Activity_1q02wiz" />
     <bpmn:scriptTask id="Activity_1josmor" name="Associate slice profile instance the same with the NSSI\r" scriptFormat="groovy">
       <bpmn:incoming>Flow_1fdpbsx</bpmn:incoming>
       <bpmn:outgoing>Flow_0l7hcnf</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
+def mcnssi= new DoModifyCoreNSSI()
         mcnssi.associateSliceProfileInstanceWithNSSI(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="Flow_1fdpbsx" sourceRef="Activity_1q02wiz" targetRef="Activity_1josmor" />
-    <bpmn:scriptTask id="Activity_0j4c22q" name="Calculate S-NSSAI" scriptFormat="groovy">
-      <bpmn:incoming>Flow_11vf6ik</bpmn:incoming>
-      <bpmn:outgoing>Flow_1oeokwy</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new DoModifyCoreNSSI()
-        mcnssi.calculateSNSSAI(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="Flow_11vf6ik" sourceRef="Event_0m2jn7c" targetRef="Activity_0j4c22q" />
-    <bpmn:scriptTask id="Activity_0c4wmiz" name="Invoke PUT Service Instance API" scriptFormat="groovy">
-      <bpmn:incoming>Flow_1oeokwy</bpmn:incoming>
-      <bpmn:outgoing>Flow_15fi92t</bpmn:outgoing>
-      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
-        mcnssi.invokePUTServiceInstance(execution)</bpmn:script>
-    </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="Flow_1oeokwy" sourceRef="Activity_0j4c22q" targetRef="Activity_0c4wmiz" />
+    <bpmn:sequenceFlow id="Flow_11vf6ik" sourceRef="Event_0m2jn7c" targetRef="Activity_1iegufd" />
     <bpmn:scriptTask id="Activity_1iegufd" name="Remove the NSSI to slice instance association\r" scriptFormat="groovy">
-      <bpmn:incoming>Flow_15fi92t</bpmn:incoming>
+      <bpmn:incoming>Flow_11vf6ik</bpmn:incoming>
       <bpmn:outgoing>Flow_1wtv1zj</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
+def mcnssi= new DoModifyCoreNSSI()
         mcnssi.removeSPAssociationWithNSSI(execution)</bpmn:script>
     </bpmn:scriptTask>
-    <bpmn:sequenceFlow id="Flow_15fi92t" sourceRef="Activity_0c4wmiz" targetRef="Activity_1iegufd" />
     <bpmn:scriptTask id="Activity_010nkjp" name="Delete the slice profile instance\r" scriptFormat="groovy">
       <bpmn:incoming>Flow_1wtv1zj</bpmn:incoming>
       <bpmn:outgoing>Flow_0lrenyo</bpmn:outgoing>
       <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def mcnssi= new ModifyCoreNSSI()
+def mcnssi= new DoModifyCoreNSSI()
         mcnssi.deleteSliceProfileInstance(execution)</bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="Flow_1wtv1zj" sourceRef="Activity_1iegufd" targetRef="Activity_010nkjp" />
@@ -140,90 +107,223 @@ def mcnssi= new ModifyCoreNSSI()
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="Flow_0e007rx" sourceRef="Event_0fbqt56" targetRef="Activity_0klj7y1" />
     <bpmn:sequenceFlow id="Flow_06j2avj" sourceRef="Activity_0klj7y1" targetRef="Activity_0tf735w" />
+    <bpmn:subProcess id="Activity_1u4xfuz" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+      <bpmn:startEvent id="Event_0xhp6c7">
+        <bpmn:outgoing>Flow_1i9kph3</bpmn:outgoing>
+        <bpmn:errorEventDefinition id="ErrorEventDefinition_0auvylm" />
+      </bpmn:startEvent>
+      <bpmn:endEvent id="Event_05xctbx">
+        <bpmn:incoming>Flow_00tfsrn</bpmn:incoming>
+      </bpmn:endEvent>
+      <bpmn:scriptTask id="Activity_0opij79" name="Handle Unexpected Error" scriptFormat="groovy">
+        <bpmn:incoming>Flow_07ftouz</bpmn:incoming>
+        <bpmn:outgoing>Flow_00tfsrn</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:scriptTask id="Activity_099prfj" name="Prepare Resource Operation Status Update" scriptFormat="groovy">
+        <bpmn:incoming>Flow_1i9kph3</bpmn:incoming>
+        <bpmn:outgoing>Flow_14kgrjc</bpmn:outgoing>
+        <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi = new DoModifyCoreNSSI()
+mcnssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script>
+      </bpmn:scriptTask>
+      <bpmn:serviceTask id="Activity_1feavwd" name="Update Resource Operation Status">
+        <bpmn:extensionElements>
+          <camunda:connector>
+            <camunda:inputOutput>
+              <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+              <camunda:inputParameter name="headers">
+                <camunda:map>
+                  <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                  <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+                </camunda:map>
+              </camunda:inputParameter>
+              <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+              <camunda:inputParameter name="method">POST</camunda:inputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+              <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+            </camunda:inputOutput>
+            <camunda:connectorId>http-connector</camunda:connectorId>
+          </camunda:connector>
+        </bpmn:extensionElements>
+        <bpmn:incoming>Flow_14kgrjc</bpmn:incoming>
+        <bpmn:outgoing>Flow_07ftouz</bpmn:outgoing>
+      </bpmn:serviceTask>
+      <bpmn:sequenceFlow id="Flow_07ftouz" sourceRef="Activity_1feavwd" targetRef="Activity_0opij79" />
+      <bpmn:sequenceFlow id="Flow_14kgrjc" sourceRef="Activity_099prfj" targetRef="Activity_1feavwd" />
+      <bpmn:sequenceFlow id="Flow_1i9kph3" sourceRef="Event_0xhp6c7" targetRef="Activity_099prfj" />
+      <bpmn:sequenceFlow id="Flow_00tfsrn" sourceRef="Activity_0opij79" targetRef="Event_05xctbx" />
+    </bpmn:subProcess>
+    <bpmn:serviceTask id="Activity_0d1kk7f" name="Update Resource Operation Status">
+      <bpmn:extensionElements>
+        <camunda:connector>
+          <camunda:inputOutput>
+            <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+            <camunda:inputParameter name="headers">
+              <camunda:map>
+                <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+                <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+              </camunda:map>
+            </camunda:inputParameter>
+            <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+            <camunda:inputParameter name="method">POST</camunda:inputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+            <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+          </camunda:inputOutput>
+          <camunda:connectorId>http-connector</camunda:connectorId>
+        </camunda:connector>
+      </bpmn:extensionElements>
+      <bpmn:incoming>Flow_0yq24um</bpmn:incoming>
+      <bpmn:outgoing>Flow_1yphs5r</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="Flow_1yphs5r" sourceRef="Activity_0d1kk7f" targetRef="Event_1p0mogo" />
+    <bpmn:scriptTask id="Activity_0wdaul0" name="Calculate S-NSSAI" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0s31teg</bpmn:incoming>
+      <bpmn:outgoing>Flow_0fj4doc</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.calculateSNSSAI(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_0fj4doc" sourceRef="Activity_0wdaul0" targetRef="Activity_0rvt126" />
+    <bpmn:scriptTask id="Activity_0rvt126" name="Invoke PUT Service Instance API" scriptFormat="groovy">
+      <bpmn:incoming>Flow_0fj4doc</bpmn:incoming>
+      <bpmn:outgoing>Flow_1y0m22h</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+        mcnssi.invokePUTServiceInstance(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1y0m22h" sourceRef="Activity_0rvt126" targetRef="Activity_1gojm1c" />
+    <bpmn:scriptTask id="Activity_1gojm1c" name="Call Get PUT Service Instance Progress" scriptFormat="groovy">
+      <bpmn:incoming>Flow_1y0m22h</bpmn:incoming>
+      <bpmn:incoming>Flow_1jm7045</bpmn:incoming>
+      <bpmn:outgoing>Flow_0nxwq7b</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+mcnssi.getPUTServiceInstanceProgress(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="Gateway_13w96z9" name="Status = processing" default="Flow_1hm2xps">
+      <bpmn:incoming>Flow_0nxwq7b</bpmn:incoming>
+      <bpmn:outgoing>Flow_1hm2xps</bpmn:outgoing>
+      <bpmn:outgoing>Flow_06or8oz</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="Flow_0nxwq7b" sourceRef="Activity_1gojm1c" targetRef="Gateway_13w96z9" />
+    <bpmn:sequenceFlow id="Flow_1hm2xps" name="No" sourceRef="Gateway_13w96z9" targetRef="Gateway_1hadnun" />
+    <bpmn:scriptTask id="Activity_15kjs2a" name="Time Delay" scriptFormat="groovy">
+      <bpmn:incoming>Flow_06or8oz</bpmn:incoming>
+      <bpmn:outgoing>Flow_1jm7045</bpmn:outgoing>
+      <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def mcnssi= new DoModifyCoreNSSI()
+mcnssi.timeDelay(execution)</bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="Flow_1jm7045" sourceRef="Activity_15kjs2a" targetRef="Activity_1gojm1c" />
+    <bpmn:sequenceFlow id="Flow_06or8oz" name="Yes" sourceRef="Gateway_13w96z9" targetRef="Activity_15kjs2a">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("putStatus" ) == "processing" )}</bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="Flow_1twqfsc" sourceRef="Event_0z9mer1" targetRef="Activity_1q02wiz" />
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1nmtzzp">
       <bpmndi:BPMNEdge id="Flow_06j2avj_di" bpmnElement="Flow_06j2avj">
-        <di:waypoint x="380" y="150" />
-        <di:waypoint x="440" y="150" />
+        <di:waypoint x="360" y="150" />
+        <di:waypoint x="400" y="150" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0e007rx_di" bpmnElement="Flow_0e007rx">
         <di:waypoint x="218" y="150" />
-        <di:waypoint x="280" y="150" />
+        <di:waypoint x="260" y="150" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0lrenyo_di" bpmnElement="Flow_0lrenyo">
-        <di:waypoint x="890" y="600" />
-        <di:waypoint x="930" y="600" />
-        <di:waypoint x="930" y="540" />
-        <di:waypoint x="970" y="540" />
+        <di:waypoint x="540" y="570" />
+        <di:waypoint x="540" y="530" />
+        <di:waypoint x="660" y="530" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0l7hcnf_di" bpmnElement="Flow_0l7hcnf">
-        <di:waypoint x="890" y="430" />
-        <di:waypoint x="930" y="430" />
-        <di:waypoint x="930" y="500" />
-        <di:waypoint x="970" y="500" />
+        <di:waypoint x="530" y="470" />
+        <di:waypoint x="530" y="490" />
+        <di:waypoint x="660" y="490" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1wtv1zj_di" bpmnElement="Flow_1wtv1zj">
-        <di:waypoint x="730" y="600" />
-        <di:waypoint x="790" y="600" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_15fi92t_di" bpmnElement="Flow_15fi92t">
-        <di:waypoint x="560" y="600" />
-        <di:waypoint x="630" y="600" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1oeokwy_di" bpmnElement="Flow_1oeokwy">
-        <di:waypoint x="380" y="600" />
-        <di:waypoint x="460" y="600" />
+        <di:waypoint x="430" y="610" />
+        <di:waypoint x="490" y="610" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_11vf6ik_di" bpmnElement="Flow_11vf6ik">
-        <di:waypoint x="218" y="600" />
-        <di:waypoint x="280" y="600" />
+        <di:waypoint x="248" y="610" />
+        <di:waypoint x="330" y="610" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1fdpbsx_di" bpmnElement="Flow_1fdpbsx">
-        <di:waypoint x="730" y="430" />
-        <di:waypoint x="790" y="430" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_0ccqmju_di" bpmnElement="Flow_0ccqmju">
-        <di:waypoint x="560" y="430" />
-        <di:waypoint x="630" y="430" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1nxaeez_di" bpmnElement="Flow_1nxaeez">
-        <di:waypoint x="390" y="430" />
-        <di:waypoint x="460" y="430" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Flow_1xysykm_di" bpmnElement="Flow_1xysykm">
-        <di:waypoint x="218" y="430" />
-        <di:waypoint x="290" y="430" />
+        <di:waypoint x="430" y="430" />
+        <di:waypoint x="480" y="430" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0yq24um_di" bpmnElement="Flow_0yq24um">
-        <di:waypoint x="1070" y="520" />
-        <di:waypoint x="1132" y="520" />
+        <di:waypoint x="760" y="510" />
+        <di:waypoint x="820" y="510" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_03gf14v_di" bpmnElement="Flow_03gf14v">
-        <di:waypoint x="1010" y="175" />
-        <di:waypoint x="1010" y="252" />
+        <di:waypoint x="1430" y="235" />
+        <di:waypoint x="1430" y="282" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1019" y="190" width="13" height="14" />
+          <dc:Bounds x="1439" y="254" width="13" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1pls2hu_di" bpmnElement="Flow_1pls2hu">
-        <di:waypoint x="1035" y="150" />
-        <di:waypoint x="1132" y="150" />
+        <di:waypoint x="1455" y="210" />
+        <di:waypoint x="1622" y="210" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1049" y="132" width="17" height="14" />
+          <dc:Bounds x="1458" y="182" width="17" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_0s31teg_di" bpmnElement="Flow_0s31teg">
-        <di:waypoint x="910" y="150" />
-        <di:waypoint x="985" y="150" />
+        <di:waypoint x="780" y="150" />
+        <di:waypoint x="810" y="150" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_184tfp7_di" bpmnElement="Flow_184tfp7">
-        <di:waypoint x="720" y="150" />
-        <di:waypoint x="810" y="150" />
+        <di:waypoint x="640" y="150" />
+        <di:waypoint x="680" y="150" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="Flow_1mqjtfk_di" bpmnElement="Flow_1mqjtfk">
+        <di:waypoint x="500" y="150" />
         <di:waypoint x="540" y="150" />
-        <di:waypoint x="620" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1yphs5r_di" bpmnElement="Flow_1yphs5r">
+        <di:waypoint x="920" y="510" />
+        <di:waypoint x="962" y="510" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0fj4doc_di" bpmnElement="Flow_0fj4doc">
+        <di:waypoint x="910" y="150" />
+        <di:waypoint x="940" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1y0m22h_di" bpmnElement="Flow_1y0m22h">
+        <di:waypoint x="1040" y="150" />
+        <di:waypoint x="1070" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_0nxwq7b_di" bpmnElement="Flow_0nxwq7b">
+        <di:waypoint x="1170" y="150" />
+        <di:waypoint x="1215" y="150" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1hm2xps_di" bpmnElement="Flow_1hm2xps">
+        <di:waypoint x="1265" y="150" />
+        <di:waypoint x="1430" y="150" />
+        <di:waypoint x="1430" y="185" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1273" y="130" width="15" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1jm7045_di" bpmnElement="Flow_1jm7045">
+        <di:waypoint x="1120" y="240" />
+        <di:waypoint x="1120" y="190" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_06or8oz_di" bpmnElement="Flow_06or8oz">
+        <di:waypoint x="1240" y="175" />
+        <di:waypoint x="1240" y="280" />
+        <di:waypoint x="1170" y="280" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1246" y="225" width="18" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1twqfsc_di" bpmnElement="Flow_1twqfsc">
+        <di:waypoint x="248" y="430" />
+        <di:waypoint x="330" y="430" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="Event_0fbqt56_di" bpmnElement="Event_0fbqt56">
         <dc:Bounds x="182" y="132" width="36" height="36" />
@@ -231,80 +331,123 @@ def mcnssi= new ModifyCoreNSSI()
           <dc:Bounds x="158" y="175" width="89" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0klj7y1_di" bpmnElement="Activity_0klj7y1">
+        <dc:Bounds x="260" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_0tf735w_di" bpmnElement="Activity_0tf735w">
-        <dc:Bounds x="440" y="110" width="100" height="80" />
+        <dc:Bounds x="400" y="110" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_1ce41n6_di" bpmnElement="Activity_1ce41n6">
-        <dc:Bounds x="620" y="110" width="100" height="80" />
+        <dc:Bounds x="540" y="110" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Activity_02skgkj_di" bpmnElement="Activity_02skgkj">
+        <dc:Bounds x="680" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0wdaul0_di" bpmnElement="Activity_0wdaul0">
         <dc:Bounds x="810" y="110" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Gateway_1hadnun_di" bpmnElement="Gateway_1hadnun" isMarkerVisible="true">
-        <dc:Bounds x="985" y="125" width="50" height="50" />
+      <bpmndi:BPMNShape id="Activity_0rvt126_di" bpmnElement="Activity_0rvt126">
+        <dc:Bounds x="940" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1gojm1c_di" bpmnElement="Activity_1gojm1c">
+        <dc:Bounds x="1070" y="110" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Gateway_13w96z9_di" bpmnElement="Gateway_13w96z9" isMarkerVisible="true">
+        <dc:Bounds x="1215" y="125" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="974" y="86" width="75" height="40" />
+          <dc:Bounds x="1213" y="87" width="54" height="27" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_1243wg1_di" bpmnElement="Event_1243wg1">
-        <dc:Bounds x="1132" y="132" width="36" height="36" />
+        <dc:Bounds x="1622" y="192" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1113" y="173" width="90" height="40" />
+          <dc:Bounds x="1603" y="233" width="90" height="40" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1gjhrcq_di" bpmnElement="Event_1gjhrcq">
-        <dc:Bounds x="992" y="252" width="36" height="36" />
+      <bpmndi:BPMNShape id="Gateway_1hadnun_di" bpmnElement="Gateway_1hadnun" isMarkerVisible="true">
+        <dc:Bounds x="1405" y="185" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="973" y="293" width="90" height="40" />
+          <dc:Bounds x="1305" y="190" width="90" height="40" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0oph5am_di" bpmnElement="Activity_0oph5am">
-        <dc:Bounds x="970" y="480" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Event_1p0mogo_di" bpmnElement="Event_1p0mogo">
-        <dc:Bounds x="1132" y="502" width="36" height="36" />
+      <bpmndi:BPMNShape id="Event_1gjhrcq_di" bpmnElement="Event_1gjhrcq">
+        <dc:Bounds x="1412" y="282" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1140" y="478" width="20" height="14" />
+          <dc:Bounds x="1393" y="323" width="90" height="40" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_15kjs2a_di" bpmnElement="Activity_15kjs2a">
+        <dc:Bounds x="1070" y="240" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1q02wiz_di" bpmnElement="Activity_1q02wiz">
+        <dc:Bounds x="330" y="390" width="100" height="80" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_0z9mer1_di" bpmnElement="Event_0z9mer1">
-        <dc:Bounds x="182" y="412" width="36" height="36" />
+        <dc:Bounds x="212" y="412" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="162" y="455" width="90" height="40" />
+          <dc:Bounds x="192" y="455" width="90" height="40" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_0oph5am_di" bpmnElement="Activity_0oph5am">
+        <dc:Bounds x="660" y="470" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1iegufd_di" bpmnElement="Activity_1iegufd">
+        <dc:Bounds x="330" y="570" width="100" height="80" />
+      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Event_0m2jn7c_di" bpmnElement="Event_0m2jn7c">
-        <dc:Bounds x="182" y="582" width="36" height="36" />
+        <dc:Bounds x="212" y="592" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="155" y="625" width="90" height="40" />
+          <dc:Bounds x="185" y="635" width="90" height="40" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0ouov98_di" bpmnElement="Activity_0ouov98">
-        <dc:Bounds x="290" y="390" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_010nkjp_di" bpmnElement="Activity_010nkjp">
+        <dc:Bounds x="490" y="570" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_00t4mmi_di" bpmnElement="Activity_00t4mmi">
-        <dc:Bounds x="460" y="390" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_1josmor_di" bpmnElement="Activity_1josmor">
+        <dc:Bounds x="480" y="390" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1q02wiz_di" bpmnElement="Activity_1q02wiz">
-        <dc:Bounds x="630" y="390" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_0d1kk7f_di" bpmnElement="Activity_0d1kk7f">
+        <dc:Bounds x="820" y="470" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1josmor_di" bpmnElement="Activity_1josmor">
-        <dc:Bounds x="790" y="390" width="100" height="80" />
+      <bpmndi:BPMNShape id="Event_1p0mogo_di" bpmnElement="Event_1p0mogo">
+        <dc:Bounds x="962" y="492" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="970" y="538" width="20" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1u4xfuz_di" bpmnElement="Activity_1u4xfuz" isExpanded="true">
+        <dc:Bounds x="190" y="790" width="781" height="196" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0j4c22q_di" bpmnElement="Activity_0j4c22q">
-        <dc:Bounds x="280" y="560" width="100" height="80" />
+      <bpmndi:BPMNEdge id="Flow_07ftouz_di" bpmnElement="Flow_07ftouz">
+        <di:waypoint x="580" y="894" />
+        <di:waypoint x="650" y="894" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_14kgrjc_di" bpmnElement="Flow_14kgrjc">
+        <di:waypoint x="420" y="894" />
+        <di:waypoint x="480" y="894" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_1i9kph3_di" bpmnElement="Flow_1i9kph3">
+        <di:waypoint x="256" y="894" />
+        <di:waypoint x="320" y="894" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_00tfsrn_di" bpmnElement="Flow_00tfsrn">
+        <di:waypoint x="750" y="894" />
+        <di:waypoint x="858" y="894" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="Event_0xhp6c7_di" bpmnElement="Event_0xhp6c7">
+        <dc:Bounds x="220" y="876" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0c4wmiz_di" bpmnElement="Activity_0c4wmiz">
-        <dc:Bounds x="460" y="560" width="100" height="80" />
+      <bpmndi:BPMNShape id="Event_05xctbx_di" bpmnElement="Event_05xctbx">
+        <dc:Bounds x="858" y="876" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_1iegufd_di" bpmnElement="Activity_1iegufd">
-        <dc:Bounds x="630" y="560" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_0opij79_di" bpmnElement="Activity_0opij79">
+        <dc:Bounds x="650" y="854" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_010nkjp_di" bpmnElement="Activity_010nkjp">
-        <dc:Bounds x="790" y="560" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_099prfj_di" bpmnElement="Activity_099prfj">
+        <dc:Bounds x="320" y="854" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="Activity_0klj7y1_di" bpmnElement="Activity_0klj7y1">
-        <dc:Bounds x="280" y="110" width="100" height="80" />
+      <bpmndi:BPMNShape id="Activity_1feavwd_di" bpmnElement="Activity_1feavwd">
+        <dc:Bounds x="480" y="854" width="100" height="80" />
       </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>