Merge "Fix issues in AN NSSMF for modify & Deallocate flow"
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
index 993fb02..07a2348 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
@@ -193,7 +193,7 @@
 	ANNF_sliceProfileInstance.setServiceType(serviceType)
 	String serviceStatus = "deactivated"
 	ANNF_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
-	String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
+	String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "pLMNIdList")
         ANNF_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
 	String serviceRole = "slice-profile-instance"
 	ANNF_sliceProfileInstance.setServiceRole(serviceRole)
@@ -213,7 +213,7 @@
 	serviceType = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "sST")
 	TNFH_sliceProfileInstance.setServiceType(serviceType)
 	TNFH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
-	serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "plmnIdList")
+	serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "pLMNIdList")
         TNFH_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
 	TNFH_sliceProfileInstance.setServiceRole(serviceRole)
 	TNFH_sliceProfileInstance.setEnvironmentContext(snssai)
@@ -230,7 +230,7 @@
 	serviceType = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "sST")
 	TNMH_sliceProfileInstance.setServiceType(serviceType)
 	TNMH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
-	serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "plmnIdList")
+	serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "pLMNIdList")
         TNMH_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
 	TNMH_sliceProfileInstance.setServiceRole(serviceRole)
 	TNMH_sliceProfileInstance.setEnvironmentContext(snssai)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
index 44270db..d5c1320 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
@@ -102,7 +102,7 @@
 			}
 			String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
 			def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "snssaiList"))
-			def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "plmnIdList"))
+			def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "pLMNIdList"))
                         String jsonArray = jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList")
                         List<Integer> list = new ArrayList<>();
                         JSONArray arr = new JSONArray(jsonArray);
@@ -121,7 +121,7 @@
 			} else {
 				execution.setVariable("sliceProfileId", sliceProfileId)
 				execution.setVariable("snssaiList", snssaiList)
-				execution.setVariable("plmnIdList", plmnIdList)
+				execution.setVariable("pLMNIdList", plmnIdList)
 				execution.setVariable("coverageAreaTAList", coverageAreaTAList)
 			}
 			String nsiName = jsonUtil.getJsonValue(sliceParams, "nsiInfo.nsiName")
@@ -388,7 +388,7 @@
 		serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
 		serviceInfo.addProperty("nssiName", execution.getVariable("servicename"))
                 serviceInfo.addProperty("sST", execution.getVariable("sst"))
-		serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
+		serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("pLMNIdList")))
 		serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
 		serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
 		serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("modelInvariantUuid"))
@@ -558,7 +558,7 @@
                 ANServiceInstance.setServiceType(execution.getVariable("sst"))
 		String serviceStatus = "deactivated"
 		ANServiceInstance.setOrchestrationStatus(serviceStatus)
-		String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
+		String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "pLMNIdList")
                 ANServiceInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
 		String serviceRole = "nssi"
 		ANServiceInstance.setServiceRole(serviceRole)
@@ -625,7 +625,7 @@
                 ANServiceInstance.setServiceType(execution.getVariable("sst"))
 		String serviceStatus = "deactivated"
 		ANServiceInstance.setOrchestrationStatus(serviceStatus)
-		String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
+		String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "pLMNIdList")
 		ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
 		String serviceRole = "nssi"
 		ANServiceInstance.setServiceRole(serviceRole)
@@ -648,7 +648,7 @@
 		ANNFServiceInstance.setServiceInstanceName(sliceInstanceName)
 		ANNFServiceInstance.setServiceType(execution.getVariable("sst"))
 		ANNFServiceInstance.setOrchestrationStatus(serviceStatus)
-		serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
+		serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "pLMNIdList")
                 ANNFServiceInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
 		ANNFServiceInstance.setServiceRole(serviceRole)
 		snssaiList = execution.getVariable("snssaiList")
@@ -736,7 +736,7 @@
 		JsonObject serviceInfo = new JsonObject()
 		serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
                 serviceInfo.addProperty("sST", execution.getVariable("sst"))
-		serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
+		serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("pLMNIdList")))
 		serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
 		serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
 		if(domainType.equals("TN_FH")) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
index 0d64d78..0088ed4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
@@ -691,6 +691,7 @@
 
         allocateTnNssi.setNetworkSliceInfos()
         allocateTnNssi.setSliceProfile(sliceTaskInfo.sliceProfile.trans2TnProfile())
+        allocateTnNssi.getSliceProfile().setDomainType(sliceTaskInfo.subnetType.subnetType)
         NsiInfo nsiInfo = new NsiInfo()
         nsiInfo.setNsiId(sliceParams.suggestNsiId)
         nsiInfo.setNsiName(sliceParams.suggestNsiName)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
index 67e4b92..b07f5c9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
@@ -121,6 +121,7 @@
             currentNSSI['S-NSSAI'] = sNssai
         }
 
+        LOGGER.debug("S-NSSAI=" + currentNSSI['S-NSSAI'])
 
         // Slice Profile id
         String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
@@ -381,9 +382,10 @@
 
         }
 
+        LOGGER.debug("${getPrefix()} Exit callPUTServiceInstance")
+
         return response
 
-        LOGGER.debug("${getPrefix()} Exit callPUTServiceInstance")
     }
 
 
@@ -742,6 +744,8 @@
         // Supported S-NSSAI
         List<String> snssais = (List<String>) currentNSSI['S-NSSAIs']
 
+        LOGGER.debug("prepareInstanceParams: snssais size = " + snssais.size())
+
         ServiceInstance nssi = (ServiceInstance) currentNSSI['nssi']
 
         String orchStatus = nssi.getOrchestrationStatus()
@@ -750,6 +754,7 @@
         List<Map<String, String>> snssaiList = new ArrayList<>()
 
         for(String snssai:snssais) {
+            LOGGER.debug("prepareInstanceParams: snssai = " + snssai)
             Map<String, String> snssaisMap = new HashMap<>()
             snssaisMap.put("snssai", snssai)
             snssaisMap.put("status", orchStatus)
@@ -761,12 +766,15 @@
 
         ObjectMapper mapper = new ObjectMapper()
 
-        String supportedNssaiDetailsStr = mapper.writeValueAsString(snssaiList)
+        Map<String, Object> nSsai= new LinkedHashMap<>()
+        nSsai.put("sNssai", snssaiList)
 
+       // String supportedsNssaiJson = mapper.writeValueAsString(snssaiList)
+        String supportedsNssaiJson = mapper.writeValueAsString(nSsai)
 
         instanceParamsMap.put("k8s-rb-profile-name", "default") // ???
         instanceParamsMap.put("config-type", "day2") // ???
-        instanceParamsMap.put("supportedNssai", supportedNssaiDetailsStr)
+        instanceParamsMap.put("supportedsNssai", supportedsNssaiJson)
         instanceParams.add(instanceParamsMap)
 
         LOGGER.debug("${getPrefix()} Exit prepareInstanceParams")
@@ -1177,9 +1185,8 @@
                 sliceProfileInstanceUri = (AAIResourceUri)spURI
             }
             else {
-                String msg = "Slice Profile URI not found"
-                LOGGER.error(msg)
-                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+                String msg = "Slice Profile association with NSSI was already removed"
+                LOGGER.info(msg)
             }
         }
 
@@ -1220,13 +1227,12 @@
                 sliceProfileInstanceUri = (AAIResourceUri)spURI
             }
             else {
-                String msg = "Slice Profile URI not found"
-                LOGGER.error(msg)
-                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+                String msg = "Slice Profile instance was already deleted"
+                LOGGER.info(msg)
             }
         }
 
-        if(sliceProfileInstanceUri != null) { // NSSI should not be terminated
+        if(sliceProfileInstanceUri != null) {
             try {
                 client.delete(sliceProfileInstanceUri)
             } catch (Exception e) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
index c559845..1105874 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
@@ -238,6 +238,22 @@
             exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
         }
 
+
+        // NSI
+        String nsiId = currentNSSI['nsiId']
+        ServiceInstance nsi = null
+        AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nsiId))
+        Optional<ServiceInstance> nsiOpt = client.get(ServiceInstance.class, nsiUri)
+        if (nsiOpt.isPresent()) {
+            nsi = nsiOpt.get()
+        }
+        else {
+            String msg = "NSI service instance not found in AAI for nsi id " + nsiId
+            LOGGER.error(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+        }
+
+
         //Setting correlator as requestId
         String requestId = execution.getVariable("msoRequestId")
         execution.setVariable("NSSI_correlator", requestId)
@@ -257,7 +273,7 @@
 
         String nxlId = nssi.getServiceInstanceId()
         String nxlType = "NSSI"
-        String oofRequest = getOofUtils().buildTerminateNxiRequest(requestId, nxlId, nxlType, messageType, nssi.getServiceInstanceId())
+        String oofRequest = getOofUtils().buildTerminateNxiRequest(requestId, nxlId, nxlType, messageType, nsi.getServiceInstanceId())
         LOGGER.debug("**** Terminate Nxi Request: "+oofRequest)
 
         LOGGER.debug("${PREFIX} Exit buildOOFRequest")
@@ -289,32 +305,31 @@
             // http://so.onap:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances/de6a0aa2-19f2-41fe-b313-a5a9f159acd7/vnfs/3abbb373-8d33-4977-aa4b-2bfee496b6d5
             String url = String.format("${nsmfЕndPoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId())
 
+            LOGGER.debug("url = " + url)
+
             currentNSSI['deleteServiceOrderURL'] = url
 
             String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
             String basicAuth =  UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
 
-            /*String basicAuthValue = encryptBasicAuth(basicAuth, msoKey)
-            def authHeader = ""
-            if (basicAuthValue != null) {
-                String responseAuthHeader = getAuthHeader(execution, basicAuthValue, msoKey)
-                String errorCode = jsonUtil.getJsonValue(responseAuthHeader, "errorCode")
-                if(errorCode == null || errorCode.isEmpty()) { // No error
-                    authHeader = responseAuthHeader
-                }
-                else {
-                    exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(responseAuthHeader, "errorMessage"))
-                }
-            } else {
-                LOGGER.error( "Unable to obtain BasicAuth - BasicAuth value null")
-                exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
-                        "value null")
-            } */
-
             def authHeader = utils.getBasicAuth(basicAuth, msoKey)
 
-            String callDeleteServiceOrderResponse = callDeleteServiceOrder(execution, url, authHeader)
-            String errorCode = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorCode")
+            def requestDetails = ""
+
+            String prepareRequestDetailsResponse = prepareRequestDetails(execution)
+            LOGGER.debug("deleteServiceOrder: prepareRequestDetailsResponse=" + prepareRequestDetailsResponse)
+
+            String errorCode = jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorCode")
+            LOGGER.debug("deleteServiceOrder: errorCode=" + errorCode)
+            if(errorCode == null || errorCode.isEmpty()) { // No error
+                requestDetails = prepareRequestDetailsResponse
+            }
+            else {
+                exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorMessage"))
+            }
+
+            String callDeleteServiceOrderResponse = callDeleteServiceOrder(url, authHeader, requestDetails)
+            errorCode = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorCode")
 
             if(errorCode == null || errorCode.isEmpty()) { // No error
                 String macroOperationId = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "requestReferences.requestId")
@@ -339,21 +354,24 @@
     }
 
 
-    String callDeleteServiceOrder(DelegateExecution execution, String url, String authHeader) {
+    String callDeleteServiceOrder(String url, String authHeader, String requestDetailsStr) {
         LOGGER.debug("${PREFIX} Start callDeleteServiceOrder")
 
         String errorCode = ""
         String errorMessage = ""
         String response = ""
 
+        LOGGER.debug("callDeleteServiceOrder: url = " + url)
+        LOGGER.debug("callDeleteServiceOrder: authHeader = " + authHeader)
+
         try {
             HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
             httpClient.addAdditionalHeader("Authorization", authHeader)
             httpClient.addAdditionalHeader("Accept", "application/json")
-            Response httpResponse = httpClient.delete()
+            Response httpResponse = httpClient.delete(requestDetailsStr)
 
             int soResponseCode = httpResponse.getStatus()
-            LOGGER.debug("callDeleteServiceInstance: soResponseCode = " + soResponseCode)
+            LOGGER.debug("callDeleteServiceOrder: soResponseCode = " + soResponseCode)
 
             if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) {
                 response = httpResponse.readEntity(String.class)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
index 510790e..a08eb57 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
@@ -237,7 +237,7 @@
                 ServiceInstance ranSliceProfileInstance = execution.getVariable("ranSliceProfileInstance")
                 profileInfo.put("sST",ranSliceProfileInstance.getServiceType())
                 profileInfo.put("snssaiList",execution.getVariable("snssaiList"))
-                profileInfo.put("plmnIdList",Arrays.asList(ranSliceProfileInstance.getServiceInstanceLocationId()))
+                profileInfo.put("pLMNIdList",Arrays.asList(ranSliceProfileInstance.getServiceInstanceLocationId()))
                 profileInfo.put("uEMobilityLevel",profileInfo.get("ueMobilityLevel"))
                 profileInfo.put("cSAvailabilityTarget",profileInfo.get("csAvailabilityTarget"))
                 profileInfo.put("maxNumberofPDUSession",profileInfo.get("maxNumberOfPDUSession"))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy
index a52763f..8ae56a3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyCoreNSSI.groovy
@@ -179,7 +179,7 @@
         String serviceStatus = "deactivated"
         sliceProfileInstance.setOrchestrationStatus(serviceStatus)
 
-        String serviceInstanceLocationid = jsonUtil.getJsonValue(currentNSSI['sliceProfile'], "plmnIdList")
+        String serviceInstanceLocationid = jsonUtil.getJsonValue(currentNSSI['sliceProfile'], "pLMNIdList")
         sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
 
         String serviceRole = "slice-profile-instance"
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy
index f60bfa1..c77e6b8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy
@@ -361,7 +361,7 @@
     }
 
     String getFirstPlmnIdFromSliceProfile(String sliceProfileStr) {
-        String plmnListStr = jsonUtil.getJsonValue(sliceProfileStr, "plmnIdList")
+        String plmnListStr = jsonUtil.getJsonValue(sliceProfileStr, "pLMNIdList")
         String res = jsonUtil.StringArrayToList(plmnListStr).get(0)
 
         return res
@@ -666,4 +666,4 @@
 
         return res
     }
-}
\ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
index fc21ed4..08c03b0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
@@ -293,7 +293,7 @@
     }
 
     String getFirstPlmnIdFromSliceProfile(String sliceProfileStr) {
-        String plmnListStr = jsonUtil.getJsonValue(sliceProfileStr, "plmnIdList")
+        String plmnListStr = jsonUtil.getJsonValue(sliceProfileStr, "pLMNIdList")
         String res = jsonUtil.StringArrayToList(plmnListStr).get(0)
 
         return res
@@ -598,4 +598,4 @@
 
         return res
     }
-}
\ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
index 5bf4f40..acace8c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
@@ -95,6 +95,9 @@
         String nssiId = "5G-999"
         currentNSSI.put("nssiId", nssiId)
 
+        String nsiId = "ns-777"
+        currentNSSI.put("nsiId", nsiId)
+
         when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
 
         when(mockExecution.getVariable("mso.oof.endpoint")).thenReturn("http://oof.onap:8088")
@@ -127,6 +130,14 @@
 
         when(client.get(ServiceInstance.class, nssiUri)).thenReturn(nssiOpt)
 
+        AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nsiId))
+
+        ServiceInstance nsi = new ServiceInstance()
+        nsi.setServiceInstanceId("5G-777")
+        Optional<ServiceInstance> nsiOpt = Optional.of(nsi)
+
+        when(client.get(ServiceInstance.class, nsiUri)).thenReturn(nsiOpt)
+
         String urlString = "http://oof.onap:8088"
 
         String httpRequest =    "{\n" +
@@ -143,7 +154,7 @@
         String nxlId = nssi.getServiceInstanceId()
         String nxlType = "NSSI"
         String messageType = "cn"
-        String serviceInstanceId = nssi.getServiceInstanceId()
+        String serviceInstanceId = nsi.getServiceInstanceId()
 
         when(mockExecution.getVariable("msoRequestId")).thenReturn(requestId)
         when(oofUtilsMock.buildTerminateNxiRequest(requestId, nxlId, nxlType, messageType, serviceInstanceId)).thenReturn(httpRequest)
@@ -213,6 +224,7 @@
         genericVnf.setVnfName("vnf-name")
         genericVnf.setVnfId("vnf-id")
 
+
         currentNSSI.put("constituteVnf", genericVnf)
 
         String urlString = String.format("http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), genericVnf.getVnfId())
@@ -235,7 +247,7 @@
 
         when(httpClientFactoryMock.newJsonClient(any(), any())).thenReturn(httpClientMock)
 
-        when(httpClientMock.delete()).thenReturn(responseMock)
+        when(httpClientMock.delete(requestDetailsStr)).thenReturn(responseMock)
 
         when(responseMock.getStatus()).thenReturn(200)
         when(responseMock.hasEntity()).thenReturn(true)
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn
index bfc45f2..3966cae 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn
Binary files differ
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
index be4833a..7ad1d4e 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
@@ -43,7 +43,7 @@
     @JsonProperty(value = "snssaiList", required = true)
     private List<String> sNSSAIList;
 
-    @JsonProperty(value = "plmnIdList", required = true)
+    @JsonProperty(value = "pLMNIdList", required = true)
     private List<String> pLMNIdList;
 
     @JsonProperty(value = "perfReq", required = true)
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
index efb447b..bdb8420 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
@@ -37,7 +37,7 @@
 
     private String sliceProfileId;
 
-    @JsonProperty(value = "plmnIdList", required = true)
+    @JsonProperty(value = "pLMNIdList", required = true)
     private List<String> pLMNIdList;
 
     @JsonProperty(value = "perfReq", required = true)
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
index 50f0e3d..ffce5e9 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
@@ -43,12 +43,15 @@
     @JsonProperty(value = "snssaiList", required = true)
     private List<String> sNSSAIList;
 
-    @JsonProperty(value = "plmnIdList", required = true)
+    @JsonProperty(value = "pLMNIdList", required = true)
     private List<String> pLMNIdList;
 
     @JsonProperty(value = "jitter")
     private int jitter;
 
+    @JsonProperty(value = "domainType")
+    private String domainType;
+
     @JsonProperty(value = "resourceSharingLevel")
     private ResourceSharingLevel resourceSharingLevel;
 }
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
index 90fd8aa..f3b8d45 100644
--- a/docs/release-notes.rst
+++ b/docs/release-notes.rst
@@ -14,6 +14,17 @@
 Release Notes
 =============
 
+Version: 9.0
+==============
+
+Release Purpose
+----------------
+SO Istanbul Release
+
+**Epics**
+
+*  `REQ-627 <https://jira.onap.org/browse/REQ-627>`_ - ONAP CNF orchestration - Istanbul Enhancements
+
 Version: 8.0
 ==============
 
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java
index ab214d8..a624612 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java
@@ -36,7 +36,8 @@
     V20("v20"),
     V21("v21"),
     V22("v22"),
-    V23("v23");
+    V23("v23"),
+    V24("v24");
 
     public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
     private final String value;
diff --git a/pom.xml b/pom.xml
index 5d8825c..c56cd16 100644
--- a/pom.xml
+++ b/pom.xml
@@ -965,7 +965,7 @@
       <dependency>
         <groupId>org.onap.aai.schema-service</groupId>
         <artifactId>aai-schema</artifactId>
-        <version>1.9.1</version>
+        <version>1.9.2</version>
       </dependency>
       <dependency>
         <groupId>org.apache.cxf</groupId>