2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  # Copyright (c) 2020, CMCC Technologies Co., Ltd.
 
   7  # Licensed under the Apache License, Version 2.0 (the "License")
 
   8  # you may not use this file except in compliance with the License.
 
   9  # You may obtain a copy of the License at
 
  11  #       http://www.apache.org/licenses/LICENSE-2.0
 
  13  # Unless required by applicable law or agreed to in writing, software
 
  14  # distributed under the License is distributed on an "AS IS" BASIS,
 
  15  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  # See the License for the specific language governing permissions and
 
  17  # limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  21 package org.onap.so.bpmn.infrastructure.scripts
 
  23 import com.fasterxml.jackson.databind.ObjectMapper
 
  24 import org.camunda.bpm.engine.delegate.DelegateExecution
 
  25 import org.onap.so.beans.nsmf.AnSliceProfile
 
  26 import org.onap.so.beans.nsmf.CnSliceProfile
 
  27 import org.onap.so.beans.nsmf.EsrInfo
 
  28 import org.onap.so.beans.nsmf.NetworkType
 
  29 import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
 
  30 import org.onap.so.beans.nsmf.SliceTaskParamsAdapter
 
  31 import org.onap.so.beans.nsmf.TnSliceProfile
 
  32 import org.onap.so.beans.nsmf.oof.SubnetCapability
 
  33 import org.onap.so.beans.nsmf.oof.SubnetType
 
  34 import org.onap.so.beans.nsmf.oof.TemplateInfo
 
  35 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
 
  36 import org.onap.so.bpmn.common.scripts.ExceptionUtil
 
  37 import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
 
  38 import org.onap.so.bpmn.common.scripts.OofUtils
 
  39 import org.onap.so.bpmn.core.UrnPropertiesReader
 
  40 import org.onap.so.bpmn.core.domain.AllottedResource
 
  41 import org.onap.so.bpmn.core.domain.ModelInfo
 
  42 import org.onap.so.bpmn.core.domain.ServiceDecomposition
 
  43 import org.onap.so.bpmn.core.json.JsonUtils
 
  44 import org.slf4j.Logger
 
  45 import org.slf4j.LoggerFactory
 
  46 import org.springframework.http.ResponseEntity
 
  48 class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
 
  50     private static final Logger logger = LoggerFactory.getLogger(DoCreateSliceServiceOption.class)
 
  52     ExceptionUtil exceptionUtil = new ExceptionUtil()
 
  54     JsonUtils jsonUtil = new JsonUtils()
 
  56     OofUtils oofUtils = new OofUtils()
 
  58     private static final ObjectMapper objectMapper = new ObjectMapper()
 
  60     private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
 
  62     private static final String QUERY_SUB_NET_CAPABILITY = "/api/rest/provMns/v1/NSS/subnetCapabilityQuery"
 
  64     private static final String QUERY_NSSI_SELECTION_CAPABILITY = "/api/rest/provMns/v1/NSS/NSSISelectionCapability"
 
  66     void preProcessRequest (DelegateExecution execution) {
 
  70      * prepare the params for decompose nst
 
  73     public void prepareDecomposeNST(DelegateExecution execution) {
 
  75         SliceTaskParamsAdapter sliceTaskParams =
 
  76                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
  78         String modelUuid = sliceTaskParams.getNSTInfo().getUUID()
 
  79         String modelInvariantUuid = sliceTaskParams.getNSTInfo().getInvariantUUID()
 
  81         String serviceModelInfo = """{
 
  82             "modelInvariantUuid":"${modelInvariantUuid}",
 
  83             "modelUuid":"${modelUuid}",
 
  86         execution.setVariable("nstServiceModelInfo", serviceModelInfo)
 
  90      * process the result of NST Decomposition
 
  93     public void processDecompositionNST(DelegateExecution execution) {
 
  95         List<TemplateInfo> nsstInfos = new ArrayList<>()
 
  96         ServiceDecomposition nstServiceDecomposition =
 
  97                 execution.getVariable("nstServiceDecomposition") as ServiceDecomposition
 
  99         List<AllottedResource> allottedResources = nstServiceDecomposition.getAllottedResources()
 
 100         for (AllottedResource allottedResource : allottedResources) {
 
 101             TemplateInfo nsstInfo = new TemplateInfo()
 
 102             nsstInfo.setUUID(allottedResource.getProvidingServiceModelUuid())
 
 103             nsstInfo.setInvariantUUID(allottedResource.getProvidingServiceModelInvariantUuid())
 
 104             nsstInfo.setName(allottedResource.getProvidingServiceModelName())
 
 105             nsstInfos.add(nsstInfo)
 
 107         execution.setVariable("nsstInfos", nsstInfos)
 
 109         execution.setVariable("maxNsstIndex", allottedResources.size() - 1)
 
 110         execution.setVariable("currentNsstIndex", 0)
 
 112         List<ServiceDecomposition> nsstServiceDecompositions = new ArrayList<>()
 
 113         execution.setVariable("nsstServiceDecompositions", nsstServiceDecompositions)
 
 117      * prepare the params for decompose nsst
 
 120     public void prepareDecomposeNSST(DelegateExecution execution) {
 
 122         List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo>
 
 123         int index = execution.getVariable("currentNsstIndex") as Integer
 
 125         String modelUuid = nsstInfos.get(index).getUUID()
 
 126         String modelInvariantUuid = nsstInfos.get(index).getInvariantUUID()
 
 128         String serviceModelInfo = """{
 
 129             "modelInvariantUuid":"${modelInvariantUuid}",
 
 130             "modelUuid":"${modelUuid}",
 
 133         execution.setVariable("nsstServiceModelInfo", serviceModelInfo)
 
 138      * process the result of NSST Decomposition
 
 141     public void processDecompositionNSST(DelegateExecution execution) {
 
 143         List<ServiceDecomposition> nsstServiceDecompositions =
 
 144                 execution.getVariable("nsstServiceDecompositions") as List<ServiceDecomposition>
 
 146         ServiceDecomposition nsstServiceDecomposition =
 
 147                 execution.getVariable("nsstServiceDecomposition") as ServiceDecomposition
 
 149         nsstServiceDecompositions.add(nsstServiceDecomposition)
 
 151         execution.setVariable("nsstServiceDecompositions", nsstServiceDecompositions)
 
 156         int num = execution.getVariable("maxNsstIndex") as Integer
 
 157         int index = execution.getVariable("currentNsstIndex") as Integer
 
 159         execution.setVariable("currentNsstIndex", index + 1)
 
 162             execution.setVariable("nsstHandleContinue", false)
 
 164             execution.setVariable("nsstHandleContinue", true)
 
 170      * set nsst info to sliceTaskParams by type
 
 173     public void handleNsstByType(DelegateExecution execution) {
 
 175         SliceTaskParamsAdapter sliceParams =
 
 176                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
 178         List<ServiceDecomposition> nsstServiceDecompositions =
 
 179                 execution.getVariable("nsstServiceDecompositions") as List<ServiceDecomposition>
 
 181         List<SubnetCapability> subnetCapabilities = new ArrayList<>()
 
 185         for (ServiceDecomposition serviceDecomposition : nsstServiceDecompositions) {
 
 186             SubnetCapability subnetCapability = new SubnetCapability()
 
 187             handleByType(execution, serviceDecomposition, sliceParams, subnetCapability)
 
 188             subnetCapabilities.add(subnetCapability)
 
 191         execution.setVariable("sliceTaskParams", sliceParams)
 
 192         execution.setVariable("subnetCapabilities", subnetCapabilities)
 
 195     private void handleByType(DelegateExecution execution, ServiceDecomposition serviceDecomposition,
 
 196                               SliceTaskParamsAdapter sliceParams, SubnetCapability subnetCapability) {
 
 198         String domainType = ""
 
 199         ModelInfo modelInfo = serviceDecomposition.getModelInfo()
 
 200         String vendor = serviceDecomposition.getServiceRole()
 
 201         SubnetType subnetType
 
 203         switch (domainType) {
 
 205                 subnetType = SubnetType.TN_BH
 
 206                 sliceParams.tnBHSliceTaskInfo.vendor = vendor
 
 207                 sliceParams.tnBHSliceTaskInfo.subnetType = subnetType
 
 208                 sliceParams.tnBHSliceTaskInfo.networkType = subnetType.networkType
 
 209                 sliceParams.tnBHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
 
 210                 sliceParams.tnBHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
 
 211                 sliceParams.tnBHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
 
 215                 subnetType = SubnetType.TN_MH
 
 216                 sliceParams.tnMHSliceTaskInfo.vendor = vendor
 
 217                 sliceParams.tnMHSliceTaskInfo.subnetType = subnetType
 
 218                 sliceParams.tnMHSliceTaskInfo.networkType = subnetType.networkType
 
 219                 sliceParams.tnMHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
 
 220                 sliceParams.tnMHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
 
 221                 sliceParams.tnMHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
 
 225                 subnetType = SubnetType.AN_NF
 
 226                 sliceParams.anSliceTaskInfo.vendor = vendor
 
 227                 sliceParams.anSliceTaskInfo.subnetType = subnetType
 
 228                 sliceParams.anSliceTaskInfo.networkType = subnetType.networkType
 
 229                 sliceParams.anSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
 
 230                 sliceParams.anSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
 
 231                 sliceParams.anSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
 
 234                 subnetType = SubnetType.CN
 
 235                 sliceParams.cnSliceTaskInfo.vendor = vendor
 
 236                 sliceParams.cnSliceTaskInfo.subnetType = subnetType
 
 237                 sliceParams.cnSliceTaskInfo.networkType = subnetType.networkType
 
 238                 sliceParams.cnSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
 
 239                 sliceParams.cnSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
 
 240                 sliceParams.cnSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
 
 249         if (subnetType == null) {
 
 253         String response = querySubnetCapability(execution, vendor, subnetType)
 
 254         ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
 
 256         Map<String, Object> result = responseEntity.getBody() as Map
 
 257         for (Map.Entry<String, Object> entry : result.entrySet()) {
 
 258             subnetCapability.setDomainType(entry.getKey())
 
 259             subnetCapability.setCapabilityDetails(entry.getValue())
 
 264      * query Subnet Capability of TN AN CN
 
 267     private String querySubnetCapability(DelegateExecution execution, String vendor, SubnetType subnetType) {
 
 269         String strRequest = objectMapper.writeValueAsString(buildQuerySubnetCapRequest(vendor, subnetType))
 
 271         String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest)
 
 276      * build request body for querying Subnet Capability
 
 282     private static String buildQuerySubnetCapRequest(String vendor, SubnetType subnetType) {
 
 283         NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
 
 285         List<String> subnetTypes =  new ArrayList<>()
 
 286         subnetTypes.add(subnetType.subnetType)
 
 287         Map<String, Object> paramMap = new HashMap()
 
 288         paramMap.put("subnetTypes", subnetTypes)
 
 290         request.setSubnetCapabilityQuery(objectMapper.writeValueAsString(paramMap))
 
 292         EsrInfo esrInfo = new EsrInfo()
 
 293         esrInfo.setVendor(vendor)
 
 294         esrInfo.setNetworkType(subnetType.networkType)
 
 296         request.setEsrInfo(esrInfo)
 
 298         String strRequest = objectMapper.writeValueAsString(request)
 
 305      * prepare select nsi request
 
 308     public void preNSIRequest(DelegateExecution execution) {
 
 310         String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
 
 311         logger.debug( "get NSI option OOF Url: " + urlString)
 
 314         String requestId = execution.getVariable("msoRequestId")
 
 315         String messageType = "NSISelectionResponse"
 
 317         execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
 
 318         execution.setVariable("nsiSelection_messageType", messageType)
 
 319         execution.setVariable("nsiSelection_correlator", requestId)
 
 320         String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution)
 
 321         execution.setVariable("nsiSelection_timeout", timeout)
 
 323         SliceTaskParamsAdapter sliceParams =
 
 324                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
 326         Map<String, Object> profileInfo = sliceParams.getServiceProfile()
 
 327         TemplateInfo nstInfo = sliceParams.getNSTInfo()
 
 329         List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo>
 
 331         List<SubnetCapability> subnetCapabilities =
 
 332                 execution.getVariable("subnetCapabilities") as List<SubnetCapability>
 
 334         String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, nsstInfos,
 
 335                 messageType, profileInfo, subnetCapabilities, timeout as Integer)
 
 337         execution.setVariable("nsiSelection_oofRequest", oofRequest)
 
 338         logger.debug("Sending request to OOF: " + oofRequest)
 
 343      * process select nsi response
 
 346     public void processNSIResp(DelegateExecution execution) {
 
 348         SliceTaskParamsAdapter sliceTaskParams =
 
 349                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
 351         String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
 
 352         logger.debug("NSI OOFResponse is: " + OOFResponse)
 
 353         execution.setVariable("OOFResponse", OOFResponse)
 
 354         //This needs to be changed to derive a value when we add policy to decide the solution options.
 
 356         Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
 
 357         List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
 
 358         Map<String, Object> solution = nsiSolutions.get(0)
 
 360         String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
 
 361         Boolean isSharable = resourceSharingLevel == "shared"
 
 363         if (solution != null) {
 
 364             if (isSharable && solution.get("existingNSI")) {
 
 366                 processSharedNSI(solution, sliceTaskParams)
 
 368             else if(solution.containsKey("newNSISolution")) {
 
 369                 processNewNSI(solution, sliceTaskParams)
 
 372         execution.setVariable("sliceTaskParams", sliceTaskParams)
 
 373         //logger.debug("sliceTaskParams: " + sliceTaskParams.convertToJson())
 
 374         logger.debug("*** Completed options Call to OOF ***")
 
 377     private void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
 
 378         Map<String, Object> sharedNSISolution = solution.get("sharedNSISolution") as Map
 
 380         String nsiId = sharedNSISolution.get("NSIId")
 
 381         String nsiName = sharedNSISolution.get("NSIName")
 
 382         sliceParams.setSuggestNsiId(nsiId)
 
 383         sliceParams.setSuggestNsiName(nsiName)
 
 386     private void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
 
 387         Map<String, Object> newNSISolution = solution.get("newNSISolution") as Map
 
 388         List<Map> sliceProfiles = newNSISolution.get("sliceProfiles") as List<Map>
 
 389         for (Map sliceProfile : sliceProfiles) {
 
 390             String domainType = sliceProfile.get("domainType")
 
 391             switch (domainType.toLowerCase()) {
 
 393                     sliceParams.tnBHSliceTaskInfo.sliceProfile = sliceProfile as TnSliceProfile
 
 396                     sliceParams.anSliceTaskInfo.sliceProfile = sliceProfile as AnSliceProfile
 
 399                     sliceParams.cnSliceTaskInfo.sliceProfile = sliceProfile as CnSliceProfile
 
 411      * get NSSI Selection Capability for AN
 
 414     public void getNSSISelectionCap4AN(DelegateExecution execution) {
 
 416         def vendor = execution.getVariable("vendor") as String
 
 418         String strRequest = buildNSSISelectionReq(vendor, NetworkType.ACCESS)
 
 420         String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)
 
 422         Map<String, Object> resMap = objectMapper.readValue(response, Map.class)
 
 424         String selection = resMap.get("selection")
 
 427         if ("NSMF".equalsIgnoreCase(selection)) {
 
 428             execution.setVariable("NEED_AN_NSSI_SELECTION", true)
 
 433      * get NSSI Selection Capability for TN
 
 436     public void getNSSISelectionCap4TN(DelegateExecution execution) {
 
 438         def vendor = execution.getVariable("vendor") as String
 
 440         String strRequest = buildNSSISelectionReq(vendor, NetworkType.TRANSPORT)
 
 442         String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)
 
 444         Map<String, Object> resMap = objectMapper.readValue(response, Map.class)
 
 446         String selection = resMap.get("selection")
 
 448         if ("NSMF".equalsIgnoreCase(selection)) {
 
 449             execution.setVariable("NEED_TN_NSSI_SELECTION", true)
 
 454      * get NSSI Selection Capability for CN
 
 457     public void getNSSISelectionCap4CN(DelegateExecution execution) {
 
 459         def vendor = execution.getVariable("vendor") as String
 
 461         String strRequest = buildNSSISelectionReq(vendor, NetworkType.CORE)
 
 463         String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)
 
 465         Map<String, Object> resMap = objectMapper.readValue(response, Map.class)
 
 467         String selection = resMap.get("selection")
 
 469         if ("NSMF".equalsIgnoreCase(selection)) {
 
 470             execution.setVariable("NEED_CN_NSSI_SELECTION", true)
 
 475      * build NSSI Selection Capability Request body to nssmf adapter
 
 480     private static String buildNSSISelectionReq(String vendor, NetworkType networkType) {
 
 481         NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
 
 482         EsrInfo esrInfo = new EsrInfo()
 
 483         esrInfo.setVendor(vendor)
 
 484         esrInfo.setNetworkType(networkType)
 
 485         request.setEsrInfo(esrInfo)
 
 487         return objectMapper.writeValueAsString(request)
 
 491      * if exist nssi need to select?
 
 494     public void handleNssiSelect(DelegateExecution execution) {
 
 496         SliceTaskParamsAdapter sliceTaskParams =
 
 497                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
 500         boolean needCnNssiSelection = execution.getVariable("NEED_CN_NSSI_SELECTION") as Boolean
 
 501         boolean needAnNssiSelection = execution.getVariable("NEED_AN_NSSI_SELECTION") as Boolean
 
 502         boolean needTnNssiSelection = execution.getVariable("NEED_TN_NSSI_SELECTION") as Boolean
 
 507          *           "subType":  subtype,
 
 508          *           "nsstInfo": object,
 
 509          *           "sliceProfile": object
 
 512          *          "subType":  subtype,
 
 513          *          "nsstInfo": object,
 
 514          *          "sliceProfile": object
 
 518         List<Map> nssiNeedHandlerInfos = new ArrayList<>()
 
 519         Map<String, Object> nssiNeedHandlerMap = new HashMap()
 
 521         //List<TemplateInfo> nssiNeedHandlers = new ArrayList<>()
 
 522         //List<Object> nssiProfileNeedHandlers = new ArrayList<>()
 
 523         if (needCnNssiSelection) {
 
 524             nssiNeedHandlerMap.put("subnetType", sliceTaskParams.cnSliceTaskInfo.subnetType)
 
 525             nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.cnSliceTaskInfo.NSSTInfo)
 
 526             nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.cnSliceTaskInfo.sliceProfile)
 
 527             nssiNeedHandlerInfos.add(nssiNeedHandlerMap)
 
 529         if (needAnNssiSelection) {
 
 530             nssiNeedHandlerMap.clear()
 
 531             nssiNeedHandlerMap.put("subnetType", sliceTaskParams.anSliceTaskInfo.subnetType)
 
 532             nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.anSliceTaskInfo.NSSTInfo)
 
 533             nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.anSliceTaskInfo.sliceProfile)
 
 534             nssiNeedHandlerInfos.add(nssiNeedHandlerMap)
 
 536         if (needTnNssiSelection) {
 
 537             nssiNeedHandlerMap.clear()
 
 538             nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnBHSliceTaskInfo.subnetType)
 
 539             nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnBHSliceTaskInfo.NSSTInfo)
 
 540             nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnBHSliceTaskInfo.sliceProfile)
 
 541             nssiNeedHandlerInfos.add(nssiNeedHandlerMap)
 
 543             nssiNeedHandlerMap.clear()
 
 544             nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnMHSliceTaskInfo.subnetType)
 
 545             nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnMHSliceTaskInfo.NSSTInfo)
 
 546             nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnMHSliceTaskInfo.sliceProfile)
 
 547             nssiNeedHandlerInfos.add(nssiNeedHandlerMap)
 
 549             nssiNeedHandlerMap.clear()
 
 550             nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnFHSliceTaskInfo.subnetType)
 
 551             nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnFHSliceTaskInfo.NSSTInfo)
 
 552             nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnFHSliceTaskInfo.sliceProfile)
 
 553             nssiNeedHandlerInfos.add(nssiNeedHandlerMap)
 
 557         if (nssiNeedHandlerInfos.size() > 0) {
 
 558             execution.setVariable("needSelectNssi", true)
 
 559             execution.setVariable("currNssiIndex", 0)
 
 560             execution.setVariable("nssiNeedHandlerInfos", nssiNeedHandlerInfos)
 
 562             execution.setVariable("needSelectNssi", false)
 
 565         execution.setVariable("sliceTaskParams", sliceTaskParams)
 
 569      * prepare select nssi request
 
 572     public void preNSSIRequest(DelegateExecution execution) {
 
 574         List<Map> nssiNeedHandlerInfos =
 
 575                 execution.getVariable("nssiNeedHandlerInfos") as List<Map>
 
 577         int currNssiIndex = execution.getVariable("currNssiIndex") as Integer
 
 578         Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map
 
 580         TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo
 
 581         Object profileInfo = nssiNeedHandlerInfo.get("sliceProfile")
 
 583         String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
 
 584         logger.debug( "get NSI option OOF Url: " + urlString)
 
 586         String requestId = execution.getVariable("msoRequestId")
 
 587         String messageType = "NSSISelectionResponse"
 
 589         execution.setVariable("nssiSelectionUrl", "/api/oof/selection/nssi/v1")
 
 590         execution.setVariable("nssiSelection_messageType", messageType)
 
 591         execution.setVariable("nssiSelection_correlator", requestId)
 
 592         String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution)
 
 593         execution.setVariable("nssiSelection_timeout", timeout)
 
 595         String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, nsstInfo, messageType,
 
 596                 profileInfo, timeout as Integer)
 
 598         execution.setVariable("nssiSelection_oofRequest", oofRequest)
 
 599         logger.debug("Sending request to OOF: " + oofRequest)
 
 603      * process select nssi response
 
 606     public void processNSSIResp(DelegateExecution execution) {
 
 608         List<Map> nssiNeedHandlerInfos =
 
 609                 execution.getVariable("nssiNeedHandlerInfos") as List<Map>
 
 611         int currNssiIndex = execution.getVariable("currNssiIndex") as Integer
 
 612         Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map
 
 613         SubnetType subnetType = nssiNeedHandlerInfo.get("subnetType") as SubnetType
 
 615         SliceTaskParamsAdapter sliceTaskParams =
 
 616                 execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
 
 619         String OOFResponse = execution.getVariable("nssiSelection_oofResponse")
 
 620         logger.debug("NSI OOFResponse is: " + OOFResponse)
 
 621         execution.setVariable("OOFResponse", OOFResponse)
 
 622         //This needs to be changed to derive a value when we add policy to decide the solution options.
 
 624         Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
 
 625         List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
 
 626         Map<String, Object> solution = nsiSolutions.get(0)
 
 628         String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
 
 629         Boolean isSharable = resourceSharingLevel == "shared"   //todo
 
 631         if (isSharable && solution != null) {
 
 632             processNssiResult(sliceTaskParams, subnetType, solution)
 
 635         execution.setVariable("sliceTaskParams", sliceTaskParams)
 
 636         //logger.debug("sliceTaskParams: "+ sliceTaskParams.convertToJson())
 
 637         logger.debug("*** Completed options Call to OOF ***")
 
 639         logger.debug("start parseServiceProfile")
 
 640         //parseServiceProfile(execution)
 
 641         logger.debug("end parseServiceProfile")
 
 643         if (currNssiIndex >= nssiNeedHandlerInfos.size() - 1) {
 
 644             execution.setVariable("needSelectNssi", false)
 
 646             execution.setVariable("currNssiIndex", currNssiIndex + 1)
 
 647             execution.setVariable("needSelectNssi", true)
 
 652     private void processNssiResult(SliceTaskParamsAdapter sliceTaskParams, SubnetType subnetType,
 
 653                                    Map<String, Object> solution) {
 
 654         switch (subnetType) {
 
 656                 sliceTaskParams.cnSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
 
 657                 sliceTaskParams.cnSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
 
 659             case SubnetType.AN_NF:
 
 660                 sliceTaskParams.anSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
 
 661                 sliceTaskParams.anSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
 
 663             case SubnetType.TN_BH:
 
 664                 sliceTaskParams.tnBHSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
 
 665                 sliceTaskParams.tnBHSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
 
 667             case SubnetType.TN_FH:
 
 668                 sliceTaskParams.tnFHSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
 
 669                 sliceTaskParams.tnFHSliceTaskInfo.suggestNssiName = solution.get("NSSIName")
 
 671             case SubnetType.TN_MH:
 
 672                 sliceTaskParams.tnMHSliceTaskInfo.suggestNssiId = solution.get("NSSIId")
 
 673                 sliceTaskParams.tnMHSliceTaskInfo.suggestNssiName = solution.get("NSSIName")