ec9596e7f3993a47bf3df7f5b9fb0913c609b591
[so.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  # Copyright (c) 2019, CMCC Technologies Co., Ltd.
6  #
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
10  #
11  #       http://www.apache.org/licenses/LICENSE-2.0
12  #
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=========================================================
19  */
20
21 package org.onap.so.bpmn.infrastructure.scripts
22
23 import com.fasterxml.jackson.core.type.TypeReference
24 import com.fasterxml.jackson.databind.ObjectMapper
25 import groovy.json.JsonSlurper
26 import org.camunda.bpm.engine.delegate.DelegateExecution
27 import org.onap.logging.filter.base.ONAPComponents
28 import org.onap.so.beans.nsmf.SliceTaskParams
29 import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
30 import org.onap.so.bpmn.common.scripts.ExceptionUtil
31 import org.onap.so.bpmn.common.scripts.OofUtils
32 import org.onap.so.bpmn.core.UrnPropertiesReader
33 import org.onap.so.bpmn.core.domain.ServiceDecomposition
34 import org.onap.so.bpmn.core.domain.ServiceProxy
35 import org.onap.so.bpmn.core.json.JsonUtils
36 import org.onap.so.client.HttpClient
37 import org.onap.so.client.HttpClientFactory
38 import org.onap.aaiclient.client.aai.AAIObjectType
39 import org.onap.aaiclient.client.aai.AAIResourcesClient
40 import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
41 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
42 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
43 import org.slf4j.Logger
44 import org.slf4j.LoggerFactory
45
46 import javax.ws.rs.NotFoundException
47 import javax.ws.rs.core.Response
48
49 import static org.apache.commons.lang3.StringUtils.isBlank
50
51 class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
52
53     private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceOption.class)
54
55     ExceptionUtil exceptionUtil = new ExceptionUtil()
56
57     JsonUtils jsonUtil = new JsonUtils()
58
59     OofUtils oofUtils = new OofUtils()
60
61     ObjectMapper objectMapper = new ObjectMapper()
62
63     void preProcessRequest (DelegateExecution execution) {
64     }
65
66
67     void getNSIOptionfromOOF(DelegateExecution execution) {
68
69         String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
70         logger.debug( "get NSI option OOF Url: " + urlString)
71
72         boolean isNSISuggested = true
73         execution.setVariable("isNSISuggested",isNSISuggested)
74
75         //Prepare auth for OOF - Begin
76         def authHeader = ""
77         String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
78         String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
79
80         String basicAuthValue = utils.encrypt(basicAuth, msokey)
81         if (basicAuthValue != null) {
82             logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
83             try {
84                 authHeader = utils.getBasicAuth(basicAuthValue, msokey)
85                 execution.setVariable("BasicAuthHeaderValue", authHeader)
86             } catch (Exception ex) {
87                 logger.debug( "Unable to encode username and password string: " + ex)
88                 exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
89                         "encode username and password string")
90             }
91         } else {
92             logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
93             exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
94                     "value null")
95         }
96         //Prepare auth for OOF - End
97
98         String requestId = execution.getVariable("msoRequestId")
99         Map<String, Object> profileInfo = execution.getVariable("serviceProfile")
100         Map<String, Object> nstSolution = execution.getVariable("nstSolution")
101         logger.debug("Get NST selection from OOF: " + nstSolution.toString())
102         String nstInfo = """{
103             "modelInvariantId":"${nstSolution.invariantUUID}",
104             "modelVersionId":"${nstSolution.UUID}",
105             "modelName":"${nstSolution.NSTName}"
106          }"""
107
108         String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, profileInfo)
109         logger.debug("Sending request to OOF: " + oofRequest)
110
111         //send request to get NSI option - Begin
112         URL url = new URL(urlString+"/api/oof/selection/nsi/v1")
113         HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
114         httpClient.addAdditionalHeader("Authorization", authHeader)
115         Response httpResponse = httpClient.post(oofRequest)
116
117         processOOFResponse(httpResponse, execution)
118
119         //解析sliceProfile
120         logger.debug("start parseServiceProfile")
121         parseServiceProfile(execution)
122         logger.debug("end parseServiceProfile")
123     }
124
125     private void processOOFResponse(Response httpResponse, DelegateExecution execution) {
126         int responseCode = httpResponse.getStatus()
127         logger.debug("OOF sync response code is: " + responseCode)
128
129         if (responseCode != 200) {
130             exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
131             logger.debug("Info: No NSI suggested by OOF")
132         }
133
134         SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
135         if (httpResponse.hasEntity()) {
136             String OOFResponse = httpResponse.readEntity(String.class)
137             logger.debug("NSI OOFResponse is: " + OOFResponse)
138             execution.setVariable("OOFResponse", OOFResponse)
139             //This needs to be changed to derive a value when we add policy to decide the solution options.
140             Map OOFResponseObject = new JsonSlurper().parseText(OOFResponse)
141             Map solutions = OOFResponseObject.get("solutions")
142
143             String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
144             Boolean isSharable = resourceSharingLevel.equals("shared")
145
146             if (solutions != null) {
147                 if (isSharable && hasSharedNSIsolutions(solutions)) {
148                     //sharedNSISolution
149                     processSharedNSISolutions(solutions, execution)
150                 }
151                 else if(solutions.containsKey("newNSISolutions")) {
152                     processNewNSISolutions(solutions, execution)
153                 }
154             }
155             execution.setVariable("sliceTaskParams", sliceTaskParams)
156             logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson())
157         }
158         logger.debug("*** Completed options Call to OOF ***")
159     }
160
161     private boolean hasSharedNSIsolutions( Map solutions){
162         if(solutions.containsKey("sharedNSISolutions")){
163             List sharedNSIsolutions = solutions.get("sharedNSISolutions")
164             if (sharedNSIsolutions != null && !sharedNSIsolutions.isEmpty()) {
165                 return  true
166             }
167         }
168         return false
169     }
170
171     private void processNewNSISolutions(Map solutions, DelegateExecution execution) {
172         int index = 0
173         List<Map> newNSISolutions = solutions.get("newNSISolutions")
174         List<Map> NSSImap = new ArrayList<>()
175         if (newNSISolutions != null && newNSISolutions.size() > 0) {
176             NSSImap = newNSISolutions.get(index).get("NSSISolutions") as List<Map>
177             for (Map nssi : NSSImap) {
178                 Map oofSliceProfile = nssi.get("sliceProfile")
179                 String domain = oofSliceProfile.getOrDefault("domainType","")
180                 logger.debug("OOF newNSISolutions SliceProfile: " +oofSliceProfile.toString()+",domain:${domain}")
181                 if(null != domain){
182                     //TODO
183 //                    def nssiSolution = nssi.get("NSSISolution") as Map<String, ?>
184 //                    String nssiName = nssiSolution.getOrDefault("NSSIName", "")
185 //                    String nssiId = nssiSolution.getOrDefault("NSSIId", "")
186 //                    saveNSSIId(nssi, sliceTaskParams)
187                     Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile)
188                     saveSliceProfile(execution, domain, sliceProfile)
189
190                 }
191             }
192         }
193     }
194
195     private void processSharedNSISolutions(Map solutions, DelegateExecution execution) {
196         String nsiName, nsiInstanceId, nssiId, nssiName
197         SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
198
199         Map sharedNSIsolution = ((List) solutions.get("sharedNSISolutions"))?.get(0)
200         nsiInstanceId = sharedNSIsolution.getOrDefault("NSIId", "")
201         nsiName = sharedNSIsolution.getOrDefault("NSIName", "")
202         sliceTaskParams.setSuggestNsiId(nsiInstanceId)
203         sliceTaskParams.setSuggestNsiName(nsiName)
204
205         //Temporary modification
206         List NSSIs = sharedNSIsolution.get("NSSIs")
207         for(Map nssi : NSSIs){
208             Map oofSliceProfile = ((List)nssi.get("sliceProfile"))?.get(0)
209             String domain = oofSliceProfile.getOrDefault("domainType","")
210             nssiId = nssi.getOrDefault("NSSIId","")
211             nssiName = nssi.getOrDefault("NSSIName","")
212             saveNSSIId(domain, nssiId, nssiName,execution)
213             Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile)
214             saveSliceProfile(execution, domain, sliceProfile)
215             logger.debug("OOF sharedNSISolution SliceProfile:"+oofSliceProfile.toString()+",domain:${domain}")
216             logger.debug("OOF sharedNSISolution nsiInstanceId:${nsiInstanceId}, nsiName:${nsiName}, nssiId:${nssiId}, nssiName:${nssiName}")
217         }
218     }
219
220     private void parseServiceProfile(DelegateExecution execution) {
221         logger.debug("Start parseServiceProfile")
222         String serviceType = execution.getVariable("serviceType")
223         Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
224         SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
225         // set sliceProfile for three domains
226         if(!sliceTaskParams.getSliceProfileAn()){
227             Map<String, Object> sliceProfileAn = getSliceProfile( "AN", execution,null)
228             saveSliceProfile(execution,"AN",sliceProfileAn)
229         }
230
231         if(!sliceTaskParams.getSliceProfileTn()){
232             Map<String, Object> sliceProfileTn = getSliceProfile( "TN", execution,null)
233             saveSliceProfile(execution,"TN",sliceProfileTn)
234         }
235
236         if(!sliceTaskParams.getSliceProfileCn()){
237             Map<String, Object> sliceProfileCn = getSliceProfile( "CN", execution,null, )
238            saveSliceProfile(execution,"CN",sliceProfileCn)
239         }
240
241         logger.debug("Finish parseServiceProfile")
242     }
243
244     private void saveSliceProfile(DelegateExecution execution, String domain, Map<String, Object> sliceProfile){
245         SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
246         if(domain.equalsIgnoreCase("AN")){
247             execution.setVariable("sliceProfileAn", sliceProfile)
248             sliceTaskParams.setSliceProfileAn(sliceProfile)
249             logger.debug("sliceProfileAn: " + sliceProfile)
250         }
251         else if(domain.equalsIgnoreCase("TN")){
252             execution.setVariable("sliceProfileTn", sliceProfile)
253             sliceTaskParams.setSliceProfileTn(sliceProfile)
254             logger.debug("sliceProfileTn: " + sliceProfile)
255         }
256         else if(domain.equalsIgnoreCase("CN")){
257             execution.setVariable("sliceProfileCn", sliceProfile)
258             sliceTaskParams.setSliceProfileCn(sliceProfile)
259             logger.debug("sliceProfileCn: " + sliceProfile)
260         }
261     }
262
263     private void saveNSSIId(String domain, String nssiId, String nssiName, DelegateExecution execution) {
264         SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
265         if(domain.equalsIgnoreCase("AN")){
266             sliceTaskParams.setAnSuggestNssiId(nssiId)
267             sliceTaskParams.setAnSuggestNssiName(nssiName)
268         }
269         else if(domain.equalsIgnoreCase("CN")){
270             sliceTaskParams.setCnSuggestNssiId(nssiId)
271             sliceTaskParams.setCnSuggestNssiName(nssiName)
272         }
273         else if(domain.equalsIgnoreCase("TN")){
274             sliceTaskParams.setTnSuggestNssiId(nssiId)
275             sliceTaskParams.setTnSuggestNssiName(nssiName)
276         }
277     }
278
279     private Map getSliceProfile(String domain, DelegateExecution execution, Map<String, Object> oofSliceProfile) {
280         String profileMapStr
281         Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
282         Integer domainLatency = (Integer) serviceProfile.get("latency")/3
283
284         if(domain.equalsIgnoreCase("AN")){
285             profileMapStr = """ {
286                     "latency": ${domainLatency}, 
287                     "sNSSAI": "sNSSAI", 
288                     "uEMobilityLevel": "uEMobilityLevel", 
289                     "coverageAreaTAList": "coverageAreaTAList", 
290                     "5QI": 100
291                 }"""
292         }
293         else if(domain.equalsIgnoreCase("TN")){
294             profileMapStr =""" {
295                     "latency":${domainLatency},
296                     "sNSSAI":"sNSSAI", 
297                     "e2eLatency":"latency", 
298                     "bandwidth": 100
299                 }"""
300         }
301         else if(domain.equalsIgnoreCase("CN")){
302             profileMapStr = """ {
303                     "areaTrafficCapDL":"areaTrafficCapDL",
304                     "maxNumberofUEs":"maxNumberofUEs",
305                     "latency":${domainLatency},
306                     "expDataRateUL":"expDataRateUL", 
307                     "sNSSAI":"sNSSAI", 
308                     "areaTrafficCapUL":"areaTrafficCapUL",
309                     "uEMobilityLevel":"uEMobilityLevel", 
310                     "expDataRateDL":"expDataRateDL",  
311                     "activityFactor":"activityFactor",
312                     "resourceSharingLevel":"resourceSharingLevel"
313                 }"""
314         }
315
316             logger.debug("Profile map for " + domain + " : " + profileMapStr)
317         Map<String, Object> profileMaps = objectMapper.readValue(profileMapStr.trim().replaceAll(" ", ""), new TypeReference<Map<String, String>>(){})
318         Map<String, Object> sliceProfile = [:]
319         for (Map.Entry<String, String> profileMap : profileMaps) {
320             String key = profileMap.key
321             String value = profileMaps.get(key)
322             if(null != oofSliceProfile && oofSliceProfile.keySet().contains(key)){
323                 sliceProfile.put(key, oofSliceProfile.get(key))
324                 logger.debug("Get from oof, key:${key}, value: ${oofSliceProfile.get(key)}")
325             }
326             else if(serviceProfile.keySet().contains(value)){
327                 sliceProfile.put(key, serviceProfile.get(value))
328             }
329             else{
330                 sliceProfile.put(key, profileMaps.get(key))
331             }
332         }
333         return sliceProfile
334     }
335
336     void processDecomposition(DelegateExecution execution){
337         logger.debug("Start processDecomposition")
338
339         ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
340         SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
341         String nstName = serviceDecomposition.getModelInfo().getModelName()
342         String nstId = serviceDecomposition.getModelInfo().getModelUuid()
343         sliceTaskParams.setNstName(nstName)
344         sliceTaskParams.setNstId(nstId)
345
346         logger.debug("End processDecomposition")
347     }
348
349
350     void prepareNSTDecompose(DelegateExecution execution) {
351
352         String modelUuid = execution.getVariable("nstModelUuid")
353         String modelInvariantUuid = execution.getVariable("nstModelInvariantUuid")
354
355         String serviceModelInfo = """{
356             "modelInvariantUuid":"${modelInvariantUuid}",
357             "modelUuid":"${modelUuid}",
358             "modelVersion":""
359              }"""
360         execution.setVariable("serviceModelInfo", serviceModelInfo)
361     }
362
363     void prepareNSSTDecompose(DelegateExecution execution) {
364         Boolean isMoreNSSTtoProcess = false
365         Integer maxNSST = execution.getVariable("maxNSST")
366         Integer currentNSST=execution.getVariable("currentNSST")
367         List<String> nsstModelUUIDList = new ArrayList<>()
368         nsstModelUUIDList = execution.getVariable("nsstModelUUIDList")
369         String modelUuid = nsstModelUUIDList.get(currentNSST)
370         String serviceModelInfo = """{
371             "modelInvariantUuid":"",
372             "modelUuid":"${modelUuid}",
373             "modelVersion":""
374              }"""
375         execution.setVariable("serviceModelInfo", serviceModelInfo)
376         currentNSST=currentNSST+1
377         if(currentNSST<maxNSST)
378             isMoreNSSTtoProcess=true
379         execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess)
380         execution.setVariable("maxNSST",maxNSST)
381         execution.setVariable("currentNSST",currentNSST)
382     }
383
384
385     void prepareNSSTlistfromNST(DelegateExecution execution) {
386         //Need to update this part from decomposition.
387         logger.trace("Enter prepareNSSTlistfromNST()")
388         Boolean isMoreNSSTtoProcess = false
389         ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
390         SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
391         String nstName = serviceDecomposition.getModelInfo().getModelName()
392         sliceTaskParams.setNstName(nstName)
393         String nstId = serviceDecomposition.getModelInfo().getModelUuid()
394         sliceTaskParams.setNstId(nstId)
395         execution.setVariable("sliceTaskParams",sliceTaskParams)
396
397         List<ServiceProxy> proxyList = serviceDecomposition.getServiceProxy()
398         List<String> nsstModelUUIDList = new ArrayList<>()
399         for(ServiceProxy serviceProxy:proxyList)
400             nsstModelUUIDList.add(serviceProxy.getSourceModelUuid())
401         execution.setVariable("nsstModelUUIDList",nsstModelUUIDList)
402         Integer maxNSST = nsstModelUUIDList.size()
403         Integer currentNSST=0
404         execution.setVariable("maxNSST",maxNSST)
405         execution.setVariable("currentNSST",currentNSST)
406         if(currentNSST<maxNSST)
407             isMoreNSSTtoProcess=true
408         execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess)
409         logger.trace("Exit prepareNSSTlistfromNST()")
410
411     }
412
413     void getNSSTOption(DelegateExecution execution) {
414         ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
415         String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
416         String globalSubscriberId = execution.getVariable("globalSubscriberId")
417         String serviceType = execution.getVariable("subscriptionServiceType")
418         String nssiInstanceId =""
419         String nssiName =""
420         SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
421         logger.debug( "get NSI option OOF Url: " + urlString)
422         boolean isNSISuggested = false
423         execution.setVariable("isNSISuggested",isNSISuggested)
424
425         //Prepare auth for OOF - Begin
426         def authHeader = ""
427         String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
428         String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
429
430         String basicAuthValue = utils.encrypt(basicAuth, msokey)
431         if (basicAuthValue != null) {
432             logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
433             try {
434                 authHeader = utils.getBasicAuth(basicAuthValue, msokey)
435                 execution.setVariable("BasicAuthHeaderValue", authHeader)
436             } catch (Exception ex) {
437                 logger.debug( "Unable to encode username and password string: " + ex)
438                 exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
439                         "encode username and password string")
440             }
441         } else {
442             logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
443             exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
444                     "value null")
445         }
446         //Prepare auth for OOF - End
447         //Prepare send request to OOF - Begin
448         String requestId = execution.getVariable("msoRequestId")
449         Map<String, Object> profileInfo = execution.getVariable("serviceProfile")
450         String nsstModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid()
451         String nsstModelUuid = serviceDecomposition.getModelInfo().getModelUuid()
452         String nsstInfo = """"NSSTInfo": {
453         "invariantUUID":"${nsstModelInvariantUuid}",
454         "UUID":"${nsstModelUuid}"
455          }"""
456         String oofRequest = oofUtils.buildSelectNSSIRequest(execution, requestId, nsstInfo ,profileInfo)
457
458
459         URL url = new URL(urlString+"/api/oof/v1/selectnssi")
460         HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
461         httpClient.addAdditionalHeader("Authorization", authHeader)
462         Response httpResponse = httpClient.post(oofRequest)
463
464         int responseCode = httpResponse.getStatus()
465         logger.debug("OOF sync response code is: " + responseCode)
466
467         if(responseCode != 200){
468             exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
469         }
470
471         if(httpResponse.hasEntity()){
472             String OOFResponse = httpResponse.readEntity(String.class)
473             execution.setVariable("OOFResponse", OOFResponse)
474             nssiInstanceId = jsonUtil.getJsonValue(OOFResponse, "NSSIIInfo.NSSIID")
475             nssiName = jsonUtil.getJsonValue(OOFResponse, "NSSIInfo.NSSIName")
476             execution.setVariable("nssiInstanceId",nssiInstanceId)
477             execution.setVariable("nssiName",nssiName)
478         }
479         if(isBlank(nssiInstanceId)){
480             logger.debug( "There is no valid NSST suggested by OOF.")
481         }else
482         {
483             try {
484                 AAIResourcesClient resourceClient = new AAIResourcesClient()
485                 AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiInstanceId)
486                 AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
487                 Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class)
488                 org.onap.aai.domain.yang.ServiceInstance nssi = si.get()
489
490                 String domain = nssi.getEnvironmentContext().toString().toUpperCase()
491                 switch (domain) {
492                     case "AN":
493                         sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId())
494                         sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName())
495                         break
496                     case "CN":
497                         sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId())
498                         sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName())
499                         break
500                     case "TN":
501                         sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId())
502                         sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName())
503                         break
504                     default:
505                         break
506                 }
507             }catch(NotFoundException e)
508             {
509                 logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId)
510             }catch(Exception e)
511             {
512                 logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId)
513             }
514         }
515         logger.debug("Prepare NSSI option completed ")
516     }
517 }