From 75a86282d2ec71f53ca4e078762f0fae25dac8cd Mon Sep 17 00:00:00 2001
From: hetengjiao <hetengjiao@chinamobile.com>
Date: Fri, 13 Nov 2020 15:18:59 +0800
Subject: fixed cs profile trans to ss profile

Issue-ID: SO-2963

Signed-off-by: hetengjiao <hetengjiao@chinamobile.com>
Change-Id: Ia5a40ac9126641479047a0a76c7d2fefc1d6f07d
---
 .../scripts/CreateCommunicationService.groovy      | 62 ++++++++++++---------
 .../scripts/CreateSliceService.groovy              |  2 +
 .../scripts/DoAllocateNSIandNSSI.groovy            | 39 +++++++------
 .../scripts/DoCreateSliceServiceOption.groovy      | 65 ++++++++++++----------
 4 files changed, 94 insertions(+), 74 deletions(-)

(limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy')

diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
index 67845910eb..bb6fe212b3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
@@ -43,6 +43,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
 import org.onap.so.db.request.beans.OperationStatus
 import org.slf4j.Logger
 import org.slf4j.LoggerFactory
+import org.springframework.util.StringUtils
 import org.springframework.web.util.UriUtils
 
 import static org.apache.commons.lang3.StringUtils.isBlank
@@ -317,14 +318,9 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
 
             Map<String, ?> csInputMap = new HashMap<>()
             for (String csInput : csInputs) {
-                def value
-                if (jsonUtil.getJsonValue(csInput, "type") == "integer") {
-                    value = jsonUtil.getJsonValue(csInput, "default")
-                    csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), isBlank(value) ? 0 : (value as Integer))
-                } else if (jsonUtil.getJsonValue(csInput, "type") == "string") {
-                    csInputMap.put(jsonUtil.getJsonValue(csInput, "name"),
-                            jsonUtil.getJsonValue(csInput, "default"))
-                }
+                String key = jsonUtil.getJsonValue(csInput, "name")
+                def value = jsonUtil.getJsonValue(csInput, "default")
+                csInputMap.put(key, getDefaultPropertiesByType(value, key))
             }
             csInputMap.put("expDataRateDL", expDataRateDL)
             csInputMap.put("expDataRateUL", expDataRateUL)
@@ -336,6 +332,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
             csInputMap.put("useInterval", useInterval)
 
             execution.setVariable("csInputMap", csInputMap)
+            logger.debug(Prefix + "csInputMap is = " + csInputMap.toString())
         } catch (BpmnError e) {
             throw e
         } catch (Exception ex) {
@@ -365,53 +362,45 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
 
             Map<String, ?> csInputMap = execution.getVariable("csInputMap") as Map
             Map<String, ?> e2eInputMap = new HashMap<>()
-            String key
-            def value
-
 
             for (String e2eInput in e2eInputs) {
-                key = jsonUtil.getJsonValue(e2eInput, "name")
+                String key = jsonUtil.getJsonValue(e2eInput, "name")
                 String type = jsonUtil.getJsonValue(e2eInput, "type")
-                if (type == "integer") {
-                    def temp
-                    value = csInputMap.containsKey(key) ? csInputMap.getOrDefault(key, 0) : (isBlank(temp = jsonUtil.getJsonValue(e2eInput, "default")) ? 0 : temp)
-
-                    e2eInputMap.put(key, value as Integer)
-                } else if(type == "string") {
-                    e2eInputMap.put(key, csInputMap.containsKey(key)
-                            ? csInputMap.getOrDefault(key, null) : (jsonUtil.getJsonValue(e2eInput, "default")))
+                def value
+                if (csInputMap.containsKey(key)) {
+                    value = csInputMap.get(key)
+                } else {
+                    value = jsonUtil.getJsonValue(e2eInput, "default")
 
                 }
+                e2eInputMap.put(key, getDefaultPropertiesByType(value, type))
             }
 
             //TODO temp solution
             e2eInputMap.put("sNSSAI", execution.getVariable("sNSSAI_id"))
 	        e2eInputMap.put("sST", execution.getVariable("csServiceType"))
 
-            Integer activityFactor = 60
+            Integer activityFactor = Integer.parseInt(e2eInputMap.get("activityFactor").toString())
             Integer random = new Random().nextInt(5) + 2
             Integer dLThptPerUE = Integer.parseInt(csInputMap.get("expDataRateDL").toString())
             Integer uLThptPerUE = Integer.parseInt(csInputMap.get("expDataRateUL").toString())
-            Integer maxNumberofUEs = Integer.parseInt(csInputMap.get("maxNumberofUEs").toString())
+            Integer maxNumberofUEs = Integer.parseInt(e2eInputMap.get("maxNumberofUEs").toString())
             Integer dLThptPerSlice = dLThptPerUE * maxNumberofUEs * activityFactor * random
             Integer uLThptPerSlice = uLThptPerUE * maxNumberofUEs * activityFactor * random
             Integer maxNumberofConns = maxNumberofUEs * activityFactor * 3
 
             e2eInputMap.put("jitter", 10)
-            e2eInputMap.put("activityFactor", activityFactor)
-            e2eInputMap.put("maxNumberofUEs", maxNumberofUEs)
             e2eInputMap.put("dLThptPerUE", dLThptPerUE)
             e2eInputMap.put("uLThptPerUE", uLThptPerUE)
             e2eInputMap.put("dLThptPerSlice", dLThptPerSlice)
             e2eInputMap.put("uLThptPerSlice", uLThptPerSlice)
             e2eInputMap.put("maxNumberofConns", maxNumberofConns)
-            e2eInputMap.put("coverageAreaTAList", csInputMap.get("coverageAreaList"))
 
             execution.setVariable("e2eInputMap", e2eInputMap)
             execution.setVariable("e2eServiceType", e2eServiceDecomposition.getServiceType())
             execution.setVariable("e2eModelInvariantUuid", e2eServiceDecomposition.getModelInfo().getModelInvariantUuid())
             execution.setVariable("e2eModelUuid", e2eServiceDecomposition.getModelInfo().getModelUuid())
-
+            logger.debug(Prefix + "e2eInputMap is = " + e2eInputMap.toString())
         } catch (BpmnError e) {
             throw e
         } catch (Exception ex) {
@@ -423,6 +412,25 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
         logger.debug(Prefix + "generateE2EServiceProfile Exit")
     }
 
+    static def getDefaultPropertiesByType(def value, String type) {
+
+        def defaultValue
+        switch (type) {
+            case "string":
+                defaultValue = ""
+                break
+            case "integer":
+                defaultValue = 0
+                break
+            case "float":
+                defaultValue = 0.0
+                break
+            default:
+                defaultValue = null
+                break
+        }
+        return StringUtils.isEmpty(value) ? defaultValue : value
+    }
 
     /**
      * call createE2EService get operation id,
@@ -453,7 +461,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
                 }
             """
             execution.setVariable("CSMF_NSMFRequest", payload.replaceAll("\\s+", ""))
-
+            logger.debug(Prefix + "Sent to NSMF Request = " + payload)
         } catch (BpmnError e) {
             throw e
         } catch (Exception ex) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
index c136d52b13..d59c0cf3b2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
@@ -354,6 +354,8 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
             nstInfo.setName(nstSolution.get("NSTName") as String)
 
             sliceTaskParams.setNSTInfo(nstInfo)
+            sliceTaskParams.setNstId(nstSolution.get("UUID") as String)
+            sliceTaskParams.setNstName(nstSolution.get("NSTName") as String)
 
             execution.setVariable("sliceTaskParams", sliceTaskParams)
 
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 1d7acd31c1..4b020c7c7b 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
@@ -20,6 +20,7 @@
 
 package org.onap.so.bpmn.infrastructure.scripts
 
+import org.onap.so.beans.nsmf.SliceProfileAdapter
 import org.onap.so.beans.nsmf.oof.SubnetType
 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 import javax.ws.rs.NotFoundException
@@ -36,15 +37,12 @@ import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
 import org.onap.so.beans.nsmf.AllocateAnNssi
 import org.onap.so.beans.nsmf.AllocateCnNssi
 import org.onap.so.beans.nsmf.AllocateTnNssi
-import org.onap.so.beans.nsmf.AnSliceProfile
-import org.onap.so.beans.nsmf.CnSliceProfile
 import org.onap.so.beans.nsmf.EsrInfo
 import org.onap.so.beans.nsmf.NssiResponse
 import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
 import org.onap.so.beans.nsmf.ServiceInfo
 import org.onap.so.beans.nsmf.SliceTaskInfo
 import org.onap.so.beans.nsmf.SliceTaskParamsAdapter
-import org.onap.so.beans.nsmf.TnSliceProfile
 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 import org.onap.so.bpmn.core.json.JsonUtils
 import org.slf4j.Logger
@@ -239,7 +237,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
 
         SliceTaskParamsAdapter sliceParams =
                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
-        SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
+        SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo
         sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
 
         // create slice profile
@@ -275,15 +273,15 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
 
         SliceTaskParamsAdapter sliceParams =
                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
-        SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
-        AnSliceProfile anSliceProfile = sliceTaskInfo.sliceProfile
+        SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo
+        SliceProfileAdapter anSliceProfile = sliceTaskInfo.sliceProfile
 
         String profileId = UUID.randomUUID().toString()
         anSliceProfile.setSliceProfileId(profileId)
 
         SliceProfile sliceProfile = new SliceProfile()
         sliceProfile.setProfileId(profileId)
-        sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList as String)
+        sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList)
         //todo:...
         AAIResourceUri uri = AAIUriFactory.createResourceUri(
             AAIFluentTypeBuilder.business().customer(globalSubscriberId)
@@ -304,12 +302,16 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
         //todo:
         SliceTaskParamsAdapter sliceParams =
                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
-        SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
+        SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo
 
         NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
 
         AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
-        allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile
+        allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2AnProfile()
+        allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
+        allocateAnNssi.nssiId = sliceTaskInfo.suggestNssiId
+        allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
+        allocateAnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId
 
         EsrInfo esrInfo = new EsrInfo()
         //todo: vendor and network
@@ -354,7 +356,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
 
         SliceTaskParamsAdapter sliceParams =
                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
-        SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+        SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo
         sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
 
         // create slice profile
@@ -392,8 +394,8 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
         SliceTaskParamsAdapter sliceParams =
                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
-        SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
-        CnSliceProfile cnSliceProfile = sliceTaskInfo.sliceProfile
+        SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+        SliceProfileAdapter cnSliceProfile = sliceTaskInfo.sliceProfile
 
         String profileId = UUID.randomUUID().toString()
         cnSliceProfile.setSliceProfileId(profileId)
@@ -416,7 +418,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
         //todo:
         SliceTaskParamsAdapter sliceParams =
                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
-        SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+        SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo
 
         NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
 
@@ -424,7 +426,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
         allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
         allocateCnNssi.nssiId = sliceTaskInfo.suggestNssiId
         allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
-        allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile
+        allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2CnProfile()
         allocateCnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId
 
         EsrInfo esrInfo = new EsrInfo()
@@ -469,7 +471,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
         SliceTaskParamsAdapter sliceParams =
                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
-        SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+        SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
         String serviceInstanceId = UUID.randomUUID().toString()
 
         sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
@@ -510,9 +512,9 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
         SliceTaskParamsAdapter sliceParams =
                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
-        SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+        SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
 
-        TnSliceProfile tnSliceProfile = sliceTaskInfo.sliceProfile
+        SliceProfileAdapter tnSliceProfile = sliceTaskInfo.sliceProfile
         String profileId = UUID.randomUUID().toString()
         tnSliceProfile.setSliceProfileId(profileId)
 
@@ -534,7 +536,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
         //todo:
         SliceTaskParamsAdapter sliceParams =
                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
-        SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+        SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
 
         NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
 
@@ -545,6 +547,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
         allocateTnNssi.setNetworkSliceInfos()
 
 
+
         //allocateTnNssi.networkSliceInfos
 
         EsrInfo esrInfo = new EsrInfo()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
index 2cce68a2b6..9450227467 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
@@ -22,13 +22,12 @@ package org.onap.so.bpmn.infrastructure.scripts
 
 import com.fasterxml.jackson.databind.ObjectMapper
 import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.so.beans.nsmf.AnSliceProfile
-import org.onap.so.beans.nsmf.CnSliceProfile
 import org.onap.so.beans.nsmf.EsrInfo
 import org.onap.so.beans.nsmf.NetworkType
 import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
+import org.onap.so.beans.nsmf.QuerySubnetCapability
+import org.onap.so.beans.nsmf.SliceProfileAdapter
 import org.onap.so.beans.nsmf.SliceTaskParamsAdapter
-import org.onap.so.beans.nsmf.TnSliceProfile
 import org.onap.so.beans.nsmf.oof.SubnetCapability
 import org.onap.so.beans.nsmf.oof.SubnetType
 import org.onap.so.beans.nsmf.oof.TemplateInfo
@@ -45,6 +44,7 @@ import org.slf4j.Logger
 import org.slf4j.LoggerFactory
 import org.springframework.util.StringUtils
 
+
 class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
 
     private static final Logger logger = LoggerFactory.getLogger(DoCreateSliceServiceOption.class)
@@ -185,6 +185,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
 
         execution.setVariable("sliceTaskParams", sliceParams)
         execution.setVariable("subnetCapabilities", subnetCapabilities)
+        execution.setVariable("queryNsiFirst", true)
         logger.debug("sliceTaskParams= " + sliceParams.toString())
     }
 
@@ -290,13 +291,12 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
         NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
 
         List<String> subnetTypes =  new ArrayList<>()
-
         subnetTypes.add(subnetType.subnetType)
 
-        Map<String, Object> paramMap = new  HashMap<>()
-        paramMap.put("subnetTypes", subnetTypes)
+        QuerySubnetCapability req = new QuerySubnetCapability()
+        req.setSubnetTypes(subnetTypes)
 
-        request.setSubnetCapabilityQuery(paramMap)
+        request.setSubnetCapabilityQuery(req)
 
         EsrInfo esrInfo = new EsrInfo()
         esrInfo.setVendor(vendor)
@@ -362,66 +362,73 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
 
         Map<String, Object> resMap = objectMapper.readValue(oofResponse, Map.class)
         String requestStatus = resMap.get("requestStatus")
-        if (StringUtils.isEmpty(requestStatus)) {
+        if (!StringUtils.isEmpty(requestStatus) && requestStatus == "error") {
             exceptionUtil.buildWorkflowException(execution, 7000, "get nsi from oof error: " + oofResponse)
+            return
         }
 
         List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
 
         Map<String, Object> solution = nsiSolutions.get(0)
 
-        String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
-        Boolean isSharable = resourceSharingLevel == "shared"
+        //String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
+        //Boolean isSharable = resourceSharingLevel == "shared"
 
         if (solution != null) {
-            if (isSharable && solution.get("existingNSI")) {
-                //sharedNSISolution
-                processSharedNSI(solution, sliceTaskParams)
-                execution.setVariable("needQuerySliceProfile", true)
-            }
-            else {
-                if(execution.getVariable("needQuerySliceProfile")){
+            if (execution.getVariable("queryNsiFirst")) {
+                if (solution.get("existingNSI")) {
+                    execution.setVariable("needQuerySliceProfile", true)
+                } else {
+                    processNewNSI(solution, sliceTaskParams)
                     execution.setVariable("needQuerySliceProfile", false)
                 }
-                processNewNSI(solution, sliceTaskParams)
+                execution.setVariable("queryNsiFirst", false)
+            } else {
+                processSharedNSI(solution, sliceTaskParams)
+                execution.setVariable("needQuerySliceProfile", false)
             }
         }
         execution.setVariable("sliceTaskParams", sliceTaskParams)
+        logger.debug("after req to oof for nis select, sliceTaskParams = " + sliceTaskParams)
         logger.debug("*** Completed options Call to OOF ***")
     }
 
-    private void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
+    private static void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
         Map<String, Object> sharedNSISolution = solution.get("sharedNSISolution") as Map
-
         String nsiId = sharedNSISolution.get("NSIId")
         String nsiName = sharedNSISolution.get("NSIName")
         sliceParams.setSuggestNsiId(nsiId)
         sliceParams.setSuggestNsiName(nsiName)
 
+        List<Map> sliceProfiles = sharedNSISolution.get("sliceProfiles") as List<Map>
+        handleSliceProfiles(sliceProfiles, sliceParams)
     }
 
-    private void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
+    private static void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
         Map<String, Object> newNSISolution = solution.get("newNSISolution") as Map
         List<Map> sliceProfiles = newNSISolution.get("sliceProfiles") as List<Map>
+        handleSliceProfiles(sliceProfiles, sliceParams)
+    }
+
+    static def handleSliceProfiles(List<Map> sliceProfiles, SliceTaskParamsAdapter sliceParams) {
         for (Map sliceProfile : sliceProfiles) {
             String domainType = sliceProfile.get("domainType")
+            sliceProfile.remove("domainType")
+            SliceProfileAdapter adapter = objectMapper.readValue(objectMapper.writeValueAsString(sliceProfile), SliceProfileAdapter.class)
             switch (domainType.toLowerCase()) {
                 case "tn-bh":
-                    sliceParams.tnBHSliceTaskInfo.sliceProfile = sliceProfile as TnSliceProfile
+                    sliceParams.tnBHSliceTaskInfo.sliceProfile = adapter
                     break
                 case "an-nf":
                 case "an":
-                    sliceParams.anSliceTaskInfo.sliceProfile = sliceProfile as AnSliceProfile
+                    sliceParams.anSliceTaskInfo.sliceProfile = adapter
                     break
                 case "cn":
-                    sliceParams.cnSliceTaskInfo.sliceProfile = sliceProfile as CnSliceProfile
+                    sliceParams.cnSliceTaskInfo.sliceProfile = adapter
                     break
                 default:
                     break
             }
-
-            //todo
-
         }
     }
 
@@ -485,7 +492,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
         String selection = resMap.get("selection")
 
         if ("NSMF".equalsIgnoreCase(selection)) {
-            execution.setVariable("NEED_CN_NSSI_SELECTION", true)
+            //execution.setVariable("NEED_CN_NSSI_SELECTION", true)
         }
     }
 
@@ -597,7 +604,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
 
         TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo
         Map<String, Object> profileInfo = nssiNeedHandlerInfo.get("sliceProfile") as Map
-        profileInfo.remove("profileId")
+        //profileInfo.remove("profileId")
 
         String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
         logger.debug( "get NSI option OOF Url: " + urlString)
-- 
cgit 1.2.3-korg