aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
blob: 161b92080b06646a050aab16ded336c57a08a864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
/*-
 * ============LICENSE_START=======================================================
 * ONAP - SO
 * ================================================================================
 # Copyright (c) 2020, CMCC Technologies Co., Ltd.
 #
 # Licensed under the Apache License, Version 2.0 (the "License")
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
 #
 #       http://www.apache.org/licenses/LICENSE-2.0
 #
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
 * ============LICENSE_END=========================================================
 */

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.SliceTaskParams
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
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
import org.onap.so.bpmn.common.scripts.OofUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.domain.AllottedResource
import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
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.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.http.ResponseEntity

class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{

    private static final Logger logger = LoggerFactory.getLogger(DoCreateSliceServiceOption.class)

    ExceptionUtil exceptionUtil = new ExceptionUtil()

    JsonUtils jsonUtil = new JsonUtils()

    OofUtils oofUtils = new OofUtils()

    private static final ObjectMapper objectMapper = new ObjectMapper()

    private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)

    private static final String QUERY_SUB_NET_CAPABILITY = "/api/rest/provMns/v1/NSS/subnetCapabilityQuery"

    private static final String QUERY_NSSI_SELECTION_CAPABILITY = "/api/rest/provMns/v1/NSS/NSSISelectionCapability"

    void preProcessRequest (DelegateExecution execution) {
    }

    /**
     * prepare the params for decompose nst
     * @param execution
     */
    public void prepareDecomposeNST(DelegateExecution execution) {

        SliceTaskParamsAdapter sliceTaskParams =
                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter

        String modelUuid = sliceTaskParams.getNSTInfo().getUUID()
        String modelInvariantUuid = sliceTaskParams.getNSTInfo().getInvariantUUID()

        String serviceModelInfo = """{
            "modelInvariantUuid":"${modelInvariantUuid}",
            "modelUuid":"${modelUuid}",
            "modelVersion":""
             }"""
        execution.setVariable("nstServiceModelInfo", serviceModelInfo)
    }

    /**
     * process the result of NST Decomposition
     * @param execution
     */
    public void processDecompositionNST(DelegateExecution execution) {

        List<TemplateInfo> nsstInfos = new ArrayList<>()
        ServiceDecomposition nstServiceDecomposition =
                execution.getVariable("nstServiceDecomposition") as ServiceDecomposition
        //todo:
        List<AllottedResource> allottedResources = nstServiceDecomposition.getAllottedResources()
        for (AllottedResource allottedResource : allottedResources) {
            TemplateInfo nsstInfo = new TemplateInfo()
            nsstInfo.setUUID(allottedResource.getProvidingServiceModelUuid())
            nsstInfo.setInvariantUUID(allottedResource.getProvidingServiceModelInvariantUuid())
            nsstInfo.setName(allottedResource.getProvidingServiceModelName())
            nsstInfos.add(nsstInfo)
        }
        execution.setVariable("nsstInfos", nsstInfos)

        execution.setVariable("maxNsstIndex", allottedResources.size() - 1)
        execution.setVariable("currentNsstIndex", 0)

        List<ServiceDecomposition> nsstServiceDecompositions = new ArrayList<>()
        execution.setVariable("nsstServiceDecompositions", nsstServiceDecompositions)
    }

    /**
     * prepare the params for decompose nsst
     * @param execution
     */
    public void prepareDecomposeNSST(DelegateExecution execution) {

        List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo>
        int index = execution.getVariable("currentNsstIndex") as Integer

        String modelUuid = nsstInfos.get(index).getUUID()
        String modelInvariantUuid = nsstInfos.get(index).getInvariantUUID()

        String serviceModelInfo = """{
            "modelInvariantUuid":"${modelInvariantUuid}",
            "modelUuid":"${modelUuid}",
            "modelVersion":""
             }"""
        execution.setVariable("nsstServiceModelInfo", serviceModelInfo)

    }

    /**
     * process the result of NSST Decomposition
     * @param execution
     */
    public void processDecompositionNSST(DelegateExecution execution) {

        List<ServiceDecomposition> nsstServiceDecompositions =
                execution.getVariable("nsstServiceDecompositions") as List<ServiceDecomposition>

        ServiceDecomposition nsstServiceDecomposition =
                execution.getVariable("nsstServiceDecomposition") as ServiceDecomposition

        nsstServiceDecompositions.add(nsstServiceDecomposition)

        execution.setVariable("nsstServiceDecompositions", nsstServiceDecompositions)




        int num = execution.getVariable("maxNsstIndex") as Integer
        int index = execution.getVariable("currentNsstIndex") as Integer

        execution.setVariable("currentNsstIndex", index + 1)

        if (index >= num) {
            execution.setVariable("nsstHandleContinue", false)
        } else {
            execution.setVariable("nsstHandleContinue", true)
        }

    }

    /**
     * set nsst info to sliceTaskParams by type
     * @param execution
     */
    public void handleNsstByType(DelegateExecution execution) {
        //todo: set to sliceTaskParams by type

        SliceTaskParamsAdapter sliceParams =
                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter

        List<ServiceDecomposition> nsstServiceDecompositions =
                execution.getVariable("nsstServiceDecompositions") as List<ServiceDecomposition>

        List<SubnetCapability> subnetCapabilities = new ArrayList<>()



        for (ServiceDecomposition serviceDecomposition : nsstServiceDecompositions) {
            //todo:
            SubnetCapability subnetCapability = new SubnetCapability()

            handleByType(execution, serviceDecomposition, sliceParams, subnetCapability)

            subnetCapabilities.add(subnetCapability)
        }

        execution.setVariable("sliceTaskParams", sliceParams)
        execution.setVariable("subnetCapabilities", subnetCapabilities)
    }

    private void handleByType(DelegateExecution execution, ServiceDecomposition serviceDecomposition,
                              SliceTaskParamsAdapter sliceParams, SubnetCapability subnetCapability) {
        //todo:
        String domainType = ""
        ModelInfo modelInfo = serviceDecomposition.getModelInfo()
        String vendor = serviceDecomposition.getServiceRole()
        SubnetType subnetType

        switch (domainType) {
            case "tn_bh":
                subnetType = SubnetType.TN_BH
                sliceParams.tnBHSliceTaskInfo.vendor = vendor
                sliceParams.tnBHSliceTaskInfo.subnetType = subnetType
                sliceParams.tnBHSliceTaskInfo.networkType = subnetType.networkType
                sliceParams.tnBHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
                sliceParams.tnBHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
                sliceParams.tnBHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()

                break
            case "tn_mh":
                subnetType = SubnetType.TN_MH
                sliceParams.tnMHSliceTaskInfo.vendor = vendor
                sliceParams.tnMHSliceTaskInfo.subnetType = subnetType
                sliceParams.tnMHSliceTaskInfo.networkType = subnetType.networkType
                sliceParams.tnMHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
                sliceParams.tnMHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
                sliceParams.tnMHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()

                break
            case "an_nf":
                subnetType = SubnetType.AN_NF
                sliceParams.anSliceTaskInfo.vendor = vendor
                sliceParams.anSliceTaskInfo.subnetType = subnetType
                sliceParams.anSliceTaskInfo.networkType = subnetType.networkType
                sliceParams.anSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
                sliceParams.anSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
                sliceParams.anSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
                break
            case "cn":
                subnetType = SubnetType.CN
                sliceParams.cnSliceTaskInfo.vendor = vendor
                sliceParams.cnSliceTaskInfo.subnetType = subnetType
                sliceParams.cnSliceTaskInfo.networkType = subnetType.networkType
                sliceParams.cnSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
                sliceParams.cnSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
                sliceParams.cnSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
                break
            default:
                subnetType = null
                break

        //todo

        }
        if (subnetType == null) {
            //todo: throw error
            return
        }
        String response = querySubnetCapability(execution, vendor, subnetType)
        ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)

        Map<String, Object> result = responseEntity.getBody() as Map
        for (Map.Entry<String, Object> entry : result.entrySet()) {
            subnetCapability.setDomainType(entry.getKey())
            subnetCapability.setCapabilityDetails(entry.getValue())
        }
    }

    /**
     * query Subnet Capability of TN AN CN
     * @param execution
     */
    private String querySubnetCapability(DelegateExecution execution, String vendor, SubnetType subnetType) {

        String strRequest = objectMapper.writeValueAsString(buildQuerySubnetCapRequest(vendor, subnetType))

        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_SUB_NET_CAPABILITY, strRequest)
        return response
    }

    /**
     * build request body for querying Subnet Capability
     * @param vendor
     * @param subnetTypes
     * @param networkType
     * @return
     */
    private static String buildQuerySubnetCapRequest(String vendor, SubnetType subnetType) {
        NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()

        List<String> subnetTypes =  new ArrayList<>()
        subnetTypes.add(subnetType.subnetType)
        Map<String, Object> paramMap = new HashMap()
        paramMap.put("subnetTypes", subnetTypes)

        request.setSubnetCapabilityQuery(objectMapper.writeValueAsString(paramMap))

        EsrInfo esrInfo = new EsrInfo()
        esrInfo.setVendor(vendor)
        esrInfo.setNetworkType(subnetType.networkType)

        request.setEsrInfo(esrInfo)

        String strRequest = objectMapper.writeValueAsString(request)

        return strRequest
    }

    /**
     * todo: need rewrite
     * prepare select nsi request
     * @param execution
     */
    public void preNSIRequest(DelegateExecution execution) {

        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
        logger.debug( "get NSI option OOF Url: " + urlString)


        String requestId = execution.getVariable("msoRequestId")
        String messageType = "NSISelectionResponse"

        execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
        execution.setVariable("nsiSelection_messageType", messageType)
        execution.setVariable("nsiSelection_correlator", requestId)
        String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution)
        execution.setVariable("nsiSelection_timeout", timeout)

        SliceTaskParamsAdapter sliceParams =
                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter

        Map<String, Object> profileInfo = sliceParams.getServiceProfile()
        TemplateInfo nstInfo = sliceParams.getNSTInfo()

        List<TemplateInfo> nsstInfos = execution.getVariable("nsstInfos") as List<TemplateInfo>

        List<SubnetCapability> subnetCapabilities =
                execution.getVariable("subnetCapabilities") as List<SubnetCapability>

        String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, nsstInfos,
                messageType, profileInfo, subnetCapabilities, timeout as Integer)

        execution.setVariable("nsiSelection_oofRequest", oofRequest)
        logger.debug("Sending request to OOF: " + oofRequest)
    }

    /**
     * todo: need rewrite
     * process select nsi response
     * @param execution
     */
    public void processNSIResp(DelegateExecution execution) {

        SliceTaskParamsAdapter sliceTaskParams =
                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter

        String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
        logger.debug("NSI OOFResponse is: " + OOFResponse)
        execution.setVariable("OOFResponse", OOFResponse)
        //This needs to be changed to derive a value when we add policy to decide the solution options.

        Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
        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"

        if (solution != null) {
            if (isSharable && solution.get("existingNSI")) {
                //sharedNSISolution
                processSharedNSI(solution, sliceTaskParams)
            }
            else if(solution.containsKey("newNSISolution")) {
                processNewNSI(solution, sliceTaskParams)
            }
        }
        execution.setVariable("sliceTaskParams", sliceTaskParams)
        //logger.debug("sliceTaskParams: " + sliceTaskParams.convertToJson())
        logger.debug("*** Completed options Call to OOF ***")
    }

    private 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)
    }

    private 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>
        for (Map sliceProfile : sliceProfiles) {
            String domainType = sliceProfile.get("domainType")
            switch (domainType.toLowerCase()) {
                case "tn-bh":
                    sliceParams.tnBHSliceTaskInfo.sliceProfile = sliceProfile as TnSliceProfile
                    break
                case "an-nf":
                    sliceParams.anSliceTaskInfo.sliceProfile = sliceProfile as AnSliceProfile
                    break
                case "cn":
                    sliceParams.cnSliceTaskInfo.sliceProfile = sliceProfile as CnSliceProfile
                    break
                default:
                    break
            }

            //todo

        }
    }

    /**
     * get NSSI Selection Capability for AN
     * @param execution
     */
    public void getNSSISelectionCap4AN(DelegateExecution execution) {

        def vendor = execution.getVariable("vendor") as String

        String strRequest = buildNSSISelectionReq(vendor, NetworkType.ACCESS)

        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)

        Map<String, Object> resMap = objectMapper.readValue(response, Map.class)

        String selection = resMap.get("selection")


        if ("NSMF".equalsIgnoreCase(selection)) {
            execution.setVariable("NEED_AN_NSSI_SELECTION", true)
        }
    }

    /**
     * get NSSI Selection Capability for TN
     * @param execution
     */
    public void getNSSISelectionCap4TN(DelegateExecution execution) {

        def vendor = execution.getVariable("vendor") as String

        String strRequest = buildNSSISelectionReq(vendor, NetworkType.TRANSPORT)

        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)

        Map<String, Object> resMap = objectMapper.readValue(response, Map.class)

        String selection = resMap.get("selection")

        if ("NSMF".equalsIgnoreCase(selection)) {
            execution.setVariable("NEED_TN_NSSI_SELECTION", true)
        }
    }

    /**
     * get NSSI Selection Capability for CN
     * @param execution
     */
    public void getNSSISelectionCap4CN(DelegateExecution execution) {

        def vendor = execution.getVariable("vendor") as String

        String strRequest = buildNSSISelectionReq(vendor, NetworkType.CORE)

        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, QUERY_NSSI_SELECTION_CAPABILITY, strRequest)

        Map<String, Object> resMap = objectMapper.readValue(response, Map.class)

        String selection = resMap.get("selection")

        if ("NSMF".equalsIgnoreCase(selection)) {
            execution.setVariable("NEED_CN_NSSI_SELECTION", true)
        }
    }

    /**
     * build NSSI Selection Capability Request body to nssmf adapter
     * @param vendor
     * @param networkType
     * @return
     */
    private static String buildNSSISelectionReq(String vendor, NetworkType networkType) {
        NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
        EsrInfo esrInfo = new EsrInfo()
        esrInfo.setVendor(vendor)
        esrInfo.setNetworkType(networkType)
        request.setEsrInfo(esrInfo)

        return objectMapper.writeValueAsString(request)
    }

    /**
     * if exist nssi need to select?
     * @param execution
     */
    public void handleNssiSelect(DelegateExecution execution) {

        SliceTaskParamsAdapter sliceTaskParams =
                execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter

        //todo
    }

    /**
     * todo: need rewrite
     * prepare select nssi request
     * @param execution
     */
    public void preNSSIRequest(DelegateExecution execution) {

        String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
        logger.debug( "get NSI option OOF Url: " + urlString)

        boolean isNSISuggested = true
        execution.setVariable("isNSISuggested", isNSISuggested)
        String requestId = execution.getVariable("msoRequestId")
        String messageType = "NSISelectionResponse"

        Map<String, Object> profileInfo = execution.getVariable("serviceProfile") as Map
        Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map
        logger.debug("Get NST selection from OOF: " + nstSolution.toString())
        String nstInfo = """{
            "modelInvariantId":"${nstSolution.invariantUUID}",
            "modelVersionId":"${nstSolution.UUID}",
            "modelName":"${nstSolution.NSTName}"
         }"""

        execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
        execution.setVariable("nsiSelection_messageType", messageType)
        execution.setVariable("nsiSelection_correlator", requestId)
        String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution)
        execution.setVariable("nsiSelection_timeout", timeout)

        //todo
        String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, messageType, profileInfo)

        execution.setVariable("nsiSelection_oofRequest", oofRequest)
        logger.debug("Sending request to OOF: " + oofRequest)
    }

    /**
     * process select nssi response
     * todo: unfinished
     * @param execution
     */
    public void processNSSIResp(DelegateExecution execution) {

        SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParams
        String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
        logger.debug("NSI OOFResponse is: " + OOFResponse)
        execution.setVariable("OOFResponse", OOFResponse)
        //This needs to be changed to derive a value when we add policy to decide the solution options.

        Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class)
        List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
        Map<String, Object> solutions = nsiSolutions.get(0)

        String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
        Boolean isSharable = resourceSharingLevel == "shared"

        if (solutions != null) {
            if (isSharable && solutions.get("existingNSI")) {
                //sharedNSISolution
                //processSharedNSISolutions(solutions, execution)
            }
            else if(solutions.containsKey("newNSISolution")) {
                //processNewNSISolutions(solutions, execution)
            }
        }
        execution.setVariable("sliceTaskParams", sliceTaskParams)
        logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson())
        logger.debug("*** Completed options Call to OOF ***")

        logger.debug("start parseServiceProfile")
        //parseServiceProfile(execution)
        logger.debug("end parseServiceProfile")
    }


}