1 package org.onap.so.bpmn.infrastructure.scripts
3 import org.camunda.bpm.engine.delegate.BpmnError
4 import org.camunda.bpm.engine.delegate.DelegateExecution
5 import org.onap.aai.domain.yang.ServiceInstance
6 import org.onap.aai.domain.yang.SliceProfile
7 import org.onap.so.beans.nsmf.AllocateAnNssi
8 import org.onap.so.beans.nsmf.AllocateCnNssi
9 import org.onap.so.beans.nsmf.AllocateTnNssi
10 import org.onap.so.beans.nsmf.AnSliceProfile
11 import org.onap.so.beans.nsmf.CnSliceProfile
12 import org.onap.so.beans.nsmf.EsrInfo
13 import org.onap.so.beans.nsmf.JobStatusRequest
14 import org.onap.so.beans.nsmf.NetworkType
15 import org.onap.so.beans.nsmf.NsiInfo
16 import org.onap.so.beans.nsmf.NssiAllocateRequest
17 import org.onap.so.beans.nsmf.PerfReq
18 import org.onap.so.beans.nsmf.PerfReqEmbbList
19 import org.onap.so.beans.nsmf.PerfReqUrllcList
20 import org.onap.so.beans.nsmf.ResourceSharingLevel
21 import org.onap.so.beans.nsmf.SliceTaskParams
22 import org.onap.so.beans.nsmf.TnSliceProfile
23 import org.onap.so.beans.nsmf.UeMobilityLevel
24 import org.onap.so.bpmn.common.scripts.ExceptionUtil
25 import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
26 import org.onap.so.bpmn.core.RollbackData
27 import org.onap.so.bpmn.core.domain.ModelInfo
28 import org.onap.so.bpmn.core.domain.ServiceDecomposition
29 import org.onap.so.bpmn.core.json.JsonUtils
30 import org.onap.aaiclient.client.aai.AAIObjectType
31 import org.onap.aaiclient.client.aai.AAIResourcesClient
32 import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel
33 import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
34 import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
35 import org.slf4j.Logger
36 import org.slf4j.LoggerFactory
37 import com.fasterxml.jackson.databind.ObjectMapper;
39 import static org.apache.commons.lang3.StringUtils.isBlank
42 class DoAllocateNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{
44 private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSSI.class);
45 private static final ObjectMapper MAPPER = new ObjectMapper();
47 ExceptionUtil exceptionUtil = new ExceptionUtil()
49 JsonUtils jsonUtil = new JsonUtils()
51 private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
54 * Pre Process the BPMN Flow Request
56 * generate the nsOperationKey
57 * generate the nsParameters
59 void preProcessRequest (DelegateExecution execution) {
60 logger.trace("Enter preProcessRequest()")
62 String nssmfOperation = ""
63 String msoRequestId = execution.getVariable("msoRequestId")
64 String nsstInput = execution.getVariable("nsstInput")
65 String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid")
66 //modelUuid="2763777c-27bd-4df7-93b8-c690e23f4d3f"
67 String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId")
68 String serviceModelInfo = """{
69 "modelInvariantUuid":"",
70 "modelUuid":"${modelUuid}",
73 execution.setVariable("serviceModelInfo",serviceModelInfo)
74 execution.setVariable("nssiInstanceId",nssiInstanceId)
75 String nssiProfileID = UUID.randomUUID().toString()
76 execution.setVariable("nssiProfileID",nssiProfileID)
77 if(isBlank(nssiInstanceId))
79 nssmfOperation="create"
80 nssiInstanceId = UUID.randomUUID().toString()
82 nssmfOperation = "update"
84 execution.setVariable("nssmfOperation",nssmfOperation)
85 execution.setVariable("nssiInstanceId",nssiInstanceId)
87 def isDebugLogEnabled ="false"
88 def isNSSICreated = false
89 execution.setVariable("isNSSICreated",isNSSICreated)
92 execution.setVariable("currentCycle", currentCycle)
94 logger.trace("Exit preProcessRequest")
98 void getNSSTInfo(DelegateExecution execution){
99 logger.trace("Enter getNSSTInfo in DoAllocateNSSI()")
100 ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
101 ModelInfo modelInfo = serviceDecomposition.getModelInfo()
102 String serviceRole = "nssi"
103 String nssiServiceInvariantUuid = serviceDecomposition.modelInfo.getModelInvariantUuid()
104 String nssiServiceUuid = serviceDecomposition.modelInfo.getModelUuid()
105 String nssiServiceType = serviceDecomposition.getServiceType()
106 String uuiRequest = execution.getVariable("uuiRequest")
107 String nssiServiceName = "nssi_"+jsonUtil.getJsonValue(uuiRequest, "service.name")
108 execution.setVariable("nssiServiceName",nssiServiceName)
109 execution.setVariable("nssiServiceType",nssiServiceType)
110 execution.setVariable("nssiServiceInvariantUuid",nssiServiceInvariantUuid)
111 execution.setVariable("nssiServiceUuid",nssiServiceUuid)
112 execution.setVariable("serviceRole",serviceRole)
114 String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent()
115 String nsstID = jsonUtil.getJsonValue(content, "metadata.id")
116 String nsstVendor = jsonUtil.getJsonValue(content, "metadata.vendor")
117 String nsstDomain = jsonUtil.getJsonValue(content, "metadata.domainType")
118 String nsstType = jsonUtil.getJsonValue(content, "metadata.type")
120 execution.setVariable("nsstID",nsstID)
121 execution.setVariable("nsstVendor",nsstVendor)
122 execution.setVariable("nsstDomain",nsstDomain)
123 execution.setVariable("nssiServiceUuid",nssiServiceUuid)
124 execution.setVariable("nsstType",nsstType)
126 String nsstContentInfo = """{
127 "NsstID":"${nsstID}",
128 "Vendor":"${nsstVendor}",
132 logger.trace("Exit getNSSTInfo in DoAllocateNSSI()")
135 void timeDelay(DelegateExecution execution) {
136 logger.trace("Enter timeDelay in DoAllocateNSSI()")
139 int currentCycle = execution.getVariable("currentCycle")
140 currentCycle=currentCycle+1
143 logger.trace("Completed all the retry times... but still nssmf havent completed the creation process...")
144 exceptionUtil.buildAndThrowWorkflowException(execution, 500, "NSSMF creation didnt complete by time...")
146 execution.setVariable("currentCycle",currentCycle)
147 } catch(InterruptedException e) {
148 logger.info("Time Delay exception" + e)
150 logger.trace("Exit timeDelay in DoAllocateNSSI()")
154 void sendUpdateRequestNSSMF(DelegateExecution execution) {
155 logger.debug("Enter sendUpdateRequestNSSMF in DoAllocateNSSI()")
156 String domain = execution.getVariable("nsstDomain")
157 String nssmfRequest = buildUpdateNSSMFRequest(execution, domain.toUpperCase())
159 String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
161 String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
163 if (nssmfResponse != null) {
164 execution.setVariable("nssmfResponse", nssmfResponse)
165 String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId")
166 String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
167 execution.setVariable("nssiId",nssiId)
168 execution.setVariable("jobId",jobId)
171 logger.error("received error message from NSSMF : "+ nssmfResponse)
172 exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
174 logger.trace("Exit sendUpdateRequestNSSMF in DoAllocateNSSI()")
177 void sendCreateRequestNSSMF(DelegateExecution execution) {
178 logger.debug("Enter sendCreateRequestNSSMF in DoAllocateNSSI()")
179 //Prepare auth for NSSMF - Begin
180 String domain = execution.getVariable("nsstDomain")
181 String nssmfRequest = buildCreateNSSMFRequest(execution, domain.toUpperCase())
183 String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles"
185 String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
187 if (nssmfResponse != null) {
188 execution.setVariable("nssmfResponse", nssmfResponse)
189 String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId")
190 String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
191 execution.setVariable("nssiId",nssiId)
192 execution.setVariable("jobId",jobId)
195 logger.error("received error message from NSSMF : "+ nssmfResponse)
196 exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
199 logger.debug("Exit sendCreateRequestNSSMF in DoAllocateNSSI()")
202 void getNSSMFProgresss(DelegateExecution execution) {
203 logger.debug("Enter getNSSMFProgresss in DoAllocateNSSI()")
205 String nssmfRequest = buildNSSMFProgressRequest(execution)
206 String strUrl="/api/rest/provMns/v1/NSS/jobs/" + execution.getVariable("jobId")
208 String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, strUrl, nssmfRequest)
210 if(nssmfResponse != null){
211 Boolean isNSSICreated = false
212 execution.setVariable("nssmfResponse", nssmfResponse)
213 Integer progress = Integer.parseInt(jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.progress"))
214 String status = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.status")
215 String statusDescription = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.statusDescription")
216 execution.setVariable("nssmfProgress",progress)
217 execution.setVariable("nssmfStatus",status)
218 execution.setVariable("nddmfStatusDescription",statusDescription)
221 execution.setVariable("isNSSICreated",isNSSICreated)
223 logger.error("received error message from NSSMF : "+ nssmfResponse)
224 exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"Received a Bad Sync Response from NSSMF.")
226 logger.debug("Exit getNSSMFProgresss in DoAllocateNSSI()")
229 void updateRelationship(DelegateExecution execution) {
230 logger.trace("Enter updateRelationship in DoAllocateNSSI()")
231 String nssiInstanceId = execution.getVariable("nssiInstanceId")
232 String nsiInstanceId = execution.getVariable("nsiServiceInstanceId")
234 AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nsiInstanceId);
235 AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId)
236 getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF);
237 }catch(Exception ex) {
238 String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage()
240 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
242 logger.trace("Exit updateRelationship in DoAllocateNSSI()")
246 void instantiateNSSIService(DelegateExecution execution) {
247 logger.trace("Enter instantiateNSSIService in DoAllocateNSSI()")
248 //String nssiInstanceId = execution.getVariable("nssiInstanceId")
249 String nssiInstanceId = execution.getVariable("nssiId")
250 execution.setVariable("nssiInstanceId",nssiInstanceId)
251 String sliceInstanceId = execution.getVariable("nsiServiceInstanceId")
253 org.onap.aai.domain.yang.ServiceInstance nssi = new ServiceInstance();
254 Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
256 nssi.setServiceInstanceId(nssiInstanceId)
257 nssi.setServiceInstanceName(execution.getVariable("nssiServiceName"))
258 //nssi.setServiceType(execution.getVariable("nssiServiceType"))
259 nssi.setServiceType(serviceProfileMap.get("sST").toString())
260 String serviceStatus = "deactivated"
261 nssi.setOrchestrationStatus(serviceStatus)
262 String modelInvariantUuid = execution.getVariable("nssiServiceInvariantUuid")
263 String modelUuid = execution.getVariable("nssiServiceUuid")
264 nssi.setModelInvariantId(modelInvariantUuid)
265 nssi.setModelVersionId(modelUuid)
266 String uuiRequest = execution.getVariable("uuiRequest")
267 String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList")
268 nssi.setServiceInstanceLocationId(serviceInstanceLocationid)
269 //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.sNSSAI")
270 String envContext=execution.getVariable("nsstDomain")
271 nssi.setEnvironmentContext(envContext)
272 nssi.setServiceRole(execution.getVariable("serviceRole"))
273 AAIResourcesClient client = new AAIResourcesClient()
274 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), nssiInstanceId)
275 client.create(uri, nssi)
276 } catch (BpmnError e) {
278 } catch (Exception ex) {
279 String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
281 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
284 AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, sliceInstanceId);
285 AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId)
286 getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF);
287 }catch(Exception ex) {
288 String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage()
290 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
295 def rollbackData = execution.getVariable("RollbackData")
296 if (rollbackData == null) {
297 rollbackData = new RollbackData();
299 //rollbackData.put("SERVICEINSTANCE", "disableRollback", idisableRollback.toStrng())
300 rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
301 rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", nssiInstanceId)
302 rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
303 rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
304 execution.setVariable("rollbackData", rollbackData)
305 execution.setVariable("RollbackData", rollbackData)
306 logger.debug("RollbackData:" + rollbackData)
307 logger.trace("Exit instantiateNSSIService in DoAllocateNSSI()")
311 void createSliceProfile(DelegateExecution execution) {
312 logger.trace("Enter createSliceProfile in DoAllocateNSSI()")
313 String sliceserviceInstanceId = execution.getVariable("nssiInstanceId")
314 String nssiProfileID = execution.getVariable("nssiProfileID")
315 Map<String, Object> sliceProfileMap = execution.getVariable("sliceProfileCn")
316 Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
317 SliceProfile sliceProfile = new SliceProfile()
318 sliceProfile.setServiceAreaDimension("")
319 sliceProfile.setPayloadSize(0)
320 sliceProfile.setJitter(0)
321 sliceProfile.setSurvivalTime(0)
322 //sliceProfile.setCsAvailability()
323 //sliceProfile.setReliability()
324 sliceProfile.setExpDataRate(0)
325 sliceProfile.setTrafficDensity(0)
326 sliceProfile.setConnDensity(0)
327 sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString()))
328 sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString()))
329 sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
330 sliceProfile.setResourceSharingLevel(sliceProfileMap.get("activityFactor").toString())
331 sliceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString())
332 sliceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString())
333 sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
334 sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString()))
335 sliceProfile.setProfileId(nssiProfileID)
336 sliceProfile.setE2ELatency(0)
339 AAIResourcesClient client = new AAIResourcesClient()
340 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE,
341 execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, nssiProfileID)
342 client.create(uri, sliceProfile)
343 } catch (BpmnError e) {
345 } catch (Exception ex) {
346 String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
348 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
351 def rollbackData = execution.getVariable("RollbackData")
352 if (rollbackData == null) {
353 rollbackData = new RollbackData();
355 //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
356 rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
357 rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", sliceserviceInstanceId)
358 rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("serviceType"))
359 rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
360 execution.setVariable("rollbackData", rollbackData)
361 execution.setVariable("RollbackData", rollbackData)
362 logger.debug("RollbackData:" + rollbackData)
363 logger.trace("Exit createSliceProfile in DoAllocateNSSI()")
367 String buildCreateNSSMFRequest(DelegateExecution execution, String domain) {
369 NssiAllocateRequest request = new NssiAllocateRequest()
370 String strRequest = ""
371 //String uuiRequest = execution.getVariable("uuiRequest")
372 SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
376 EsrInfo esrInfo = new EsrInfo()
377 esrInfo.setNetworkType(execution.getVariable("networkType"))
378 esrInfo.setVendor(execution.getVariable("nsstVendor"))
380 NsiInfo nsiInfo = new NsiInfo()
381 nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
382 nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
384 AnSliceProfile anSliceProfile = new AnSliceProfile()
385 anSliceProfile.setLatency(execution.getVariable("latency"))
386 anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList"))
387 anSliceProfile.setQi(execution.getVariable("qi"))
389 AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
390 allocateAnNssi.setNsstId(execution.getVariable("nsstId"))
391 allocateAnNssi.setNssiName(execution.getVariable("nssiName"))
392 allocateAnNssi.setNsiInfo(nsiInfo)
393 allocateAnNssi.setSliceProfile(anSliceProfile)
394 String anScriptName = sliceTaskParams.getAnScriptName()
395 allocateAnNssi.setScriptName(anScriptName)
397 request.setAllocateAnNssi(allocateAnNssi)
398 request.setEsrInfo(esrInfo)
401 Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn")
402 Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
403 NsiInfo nsiInfo = new NsiInfo()
404 nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId"))
405 nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName"))
407 EsrInfo esrInfo = new EsrInfo()
408 esrInfo.setNetworkType(NetworkType.fromString(domain))
409 esrInfo.setVendor(execution.getVariable("nsstVendor"))
410 execution.setVariable("esrInfo",esrInfo)
413 PerfReqEmbbList perfReqEmbb = new PerfReqEmbbList()
414 perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor"))
415 perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL"))
416 perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL"))
417 perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL"))
418 perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL"))
420 List<PerfReqEmbbList> listPerfReqEmbbList = new ArrayList<>()
421 listPerfReqEmbbList.add(perfReqEmbb)
423 PerfReq perfReq = new PerfReq()
424 perfReq.setPerfReqEmbbList(listPerfReqEmbbList)
426 PerfReqUrllcList perfReqUrllc = new PerfReqUrllcList()
427 perfReqUrllc.setConnDensity(0)
428 perfReqUrllc.setTrafficDensity(0)
429 perfReqUrllc.setExpDataRate(0)
430 perfReqUrllc.setReliability(0)
431 perfReqUrllc.setCsAvailability(0)
432 perfReqUrllc.setSurvivalTime(0)
433 perfReqUrllc.setJitter(0)
434 perfReqUrllc.setE2eLatency(0)
435 perfReqUrllc.setPayloadSize("0")
436 perfReqUrllc.setServiceAreaDimension("")
438 List<PerfReqUrllcList> perfReqUrllcList = new ArrayList<>()
439 perfReqUrllcList.add(perfReqUrllc)
440 perfReq.setPerfReqUrllcList(perfReqUrllcList)
442 CnSliceProfile cnSliceProfile = new CnSliceProfile()
443 cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID"))
444 String plmnStr = serviceProfile.get("plmnIdList")
445 List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|"))
446 cnSliceProfile.setPlmnIdList(plmnIdList)
448 String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString()
449 cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel))
451 String coverageArea = serviceProfile.get("coverageAreaTAList")
452 List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|"))
453 cnSliceProfile.setCoverageAreaTAList(coverageAreaList)
455 String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString()
456 cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel))
458 int latency = serviceProfile.get("latency")
459 cnSliceProfile.setLatency(latency)
461 int maxUE = serviceProfile.get("maxNumberofUEs")
462 cnSliceProfile.setMaxNumberofUEs(maxUE)
464 String snssai = serviceProfile.get("sNSSAI")
465 List<String> snssaiList = Arrays.asList(snssai.split("\\|"))
466 cnSliceProfile.setSnssaiList(snssaiList)
468 cnSliceProfile.setPerfReq(perfReq)
470 AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
471 allocateCnNssi.setNsstId(execution.getVariable("nsstid"))
472 allocateCnNssi.setNssiName(execution.getVariable("nssiName"))
473 allocateCnNssi.setSliceProfile(cnSliceProfile)
474 allocateCnNssi.setNsiInfo(nsiInfo)
475 String cnScriptName = sliceTaskParams.getCnScriptName()
476 allocateCnNssi.setScriptName(cnScriptName)
477 request.setAllocateCnNssi(allocateCnNssi)
478 request.setEsrInfo(esrInfo)
481 EsrInfo esrInfo = new EsrInfo()
482 esrInfo.setNetworkType(execution.getVariable("networkType"))
483 esrInfo.setVendor(execution.getVariable("vendor"))
485 TnSliceProfile tnSliceProfile = new TnSliceProfile()
486 tnSliceProfile.setLatency(execution.getVariable("latency"))
487 tnSliceProfile.setBandwidth(execution.getVariable("bandWidth"))
489 NsiInfo nsiInfo = new NsiInfo()
490 nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
491 nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
493 AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
494 allocateTnNssi.setSliceProfile(tnSliceProfile)
495 allocateTnNssi.setNsiInfo(nsiInfo)
496 allocateTnNssi.setNsstId(execution.getVariable("nsstid"))
497 String tnScriptName = sliceTaskParams.getTnScriptName()
498 allocateTnNssi.setScriptName(tnScriptName)
500 request.setAllocateTnNssi(allocateTnNssi)
501 request.setEsrInfo(esrInfo)
507 strRequest = MAPPER.writeValueAsString(request);
508 } catch (IOException e) {
509 logger.error("Invalid get progress request bean to convert as string");
510 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
516 String buildUpdateNSSMFRequest(DelegateExecution execution, String domain) {
517 NssiAllocateRequest request = new NssiAllocateRequest()
518 String nsstInput = execution.getVariable("nsstInput")
519 String nssiId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId")
520 String strRequest = ""
521 SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
524 EsrInfo esrInfo = new EsrInfo()
525 esrInfo.setNetworkType(execution.getVariable("nsstType"))
526 esrInfo.setVendor(execution.getVariable("vendor"))
528 NsiInfo nsiInfo = new NsiInfo()
529 nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
530 nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
532 AnSliceProfile anSliceProfile = new AnSliceProfile()
533 anSliceProfile.setLatency(execution.getVariable("latency"))
534 anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList"))
535 anSliceProfile.setQi(execution.getVariable("qi"))
537 AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
538 allocateAnNssi.setNsstId(execution.getVariable("nsstId"))
539 allocateAnNssi.setNssiName(execution.getVariable("nssiName"))
540 allocateAnNssi.setNsiInfo(nsiInfo)
541 allocateAnNssi.setSliceProfile(anSliceProfile)
542 String anScriptName = sliceTaskParams.getAnScriptName()
543 allocateAnNssi.setScriptName(anScriptName)
544 request.setAllocateAnNssi(allocateAnNssi)
545 request.setEsrInfo(esrInfo)
548 Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn")
549 Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
550 NsiInfo nsiInfo = new NsiInfo()
551 nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId"))
552 nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName"))
554 EsrInfo esrInfo = new EsrInfo()
555 esrInfo.setNetworkType(NetworkType.fromString(domain))
556 esrInfo.setVendor(execution.getVariable("nsstVendor"))
557 execution.setVariable("esrInfo",esrInfo)
560 PerfReqEmbbList perfReqEmbb = new PerfReqEmbbList()
561 perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor"))
562 perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL"))
563 perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL"))
564 perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL"))
565 perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL"))
567 List<PerfReqEmbbList> listPerfReqEmbbList = new ArrayList<>()
568 listPerfReqEmbbList.add(perfReqEmbb)
570 PerfReq perfReq = new PerfReq()
571 perfReq.setPerfReqEmbbList(listPerfReqEmbbList)
573 PerfReqUrllcList perfReqUrllc = new PerfReqUrllcList()
574 perfReqUrllc.setConnDensity(0)
575 perfReqUrllc.setTrafficDensity(0)
576 perfReqUrllc.setExpDataRate(0)
577 perfReqUrllc.setReliability(0)
578 perfReqUrllc.setCsAvailability(0)
579 perfReqUrllc.setSurvivalTime(0)
580 perfReqUrllc.setJitter(0)
581 perfReqUrllc.setE2eLatency(0)
582 perfReqUrllc.setPayloadSize("0")
583 perfReqUrllc.setServiceAreaDimension("")
585 List<PerfReqUrllcList> perfReqUrllcList = new ArrayList<>()
586 perfReqUrllcList.add(perfReqUrllc)
587 perfReq.setPerfReqUrllcList(perfReqUrllcList)
589 CnSliceProfile cnSliceProfile = new CnSliceProfile()
590 cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID"))
591 String plmnStr = serviceProfile.get("plmnIdList")
592 List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|"))
593 cnSliceProfile.setPlmnIdList(plmnIdList)
595 String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString()
596 cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel))
598 String coverageArea = serviceProfile.get("coverageAreaTAList")
599 List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|"))
600 cnSliceProfile.setCoverageAreaTAList(coverageAreaList)
602 String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString()
603 cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel))
605 int latency = serviceProfile.get("latency")
606 cnSliceProfile.setLatency(latency)
608 int maxUE = serviceProfile.get("maxNumberofUEs")
609 cnSliceProfile.setMaxNumberofUEs(maxUE)
611 String snssai = serviceProfile.get("sNSSAI")
612 List<String> snssaiList = Arrays.asList(snssai.split("\\|"))
613 cnSliceProfile.setSnssaiList(snssaiList)
615 cnSliceProfile.setPerfReq(perfReq)
617 AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
618 allocateCnNssi.setNsstId(execution.getVariable("nsstid"))
619 allocateCnNssi.setNssiName(execution.getVariable("nssiName"))
620 allocateCnNssi.setSliceProfile(cnSliceProfile)
621 allocateCnNssi.setNsiInfo(nsiInfo)
622 allocateCnNssi.setNssiId(nssiId) // need to check this
623 String cnScriptName = sliceTaskParams.getCnScriptName()
624 allocateCnNssi.setScriptName(cnScriptName)
625 request.setAllocateCnNssi(allocateCnNssi)
626 request.setEsrInfo(esrInfo)
629 EsrInfo esrInfo = new EsrInfo()
630 esrInfo.setNetworkType(execution.getVariable("networkType"))
631 esrInfo.setVendor(execution.getVariable("vendor"))
633 TnSliceProfile tnSliceProfile = new TnSliceProfile()
634 tnSliceProfile.setLatency(execution.getVariable("latency"))
635 tnSliceProfile.setBandwidth(execution.getVariable("bandWidth"))
637 NsiInfo nsiInfo = new NsiInfo()
638 nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
639 nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
641 AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
642 allocateTnNssi.setSliceProfile(tnSliceProfile)
643 allocateTnNssi.setNsiInfo(nsiInfo)
644 allocateTnNssi.setNsstId(execution.getVariable("nsstid"))
645 String tnScriptName = sliceTaskParams.getTnScriptName()
646 allocateTnNssi.setScriptName(tnScriptName)
647 request.setAllocateTnNssi(allocateTnNssi)
648 request.setEsrInfo(esrInfo)
654 strRequest = MAPPER.writeValueAsString(request);
655 } catch (IOException e) {
656 logger.error("Invalid get progress request bean to convert as string");
657 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
662 String buildNSSMFProgressRequest(DelegateExecution execution){
663 JobStatusRequest request = new JobStatusRequest()
664 String strRequest = ""
665 EsrInfo esrInfo = execution.getVariable("esrInfo")
666 request.setNsiId(execution.getVariable("nsiServiceInstanceId"))
667 request.setNssiId(execution.getVariable("nssiId"))
668 request.setEsrInfo(esrInfo)
671 strRequest = MAPPER.writeValueAsString(request);
672 } catch (IOException e) {
673 logger.error("Invalid get progress request bean to convert as string");
674 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
679 public void prepareUpdateOrchestrationTask(DelegateExecution execution) {
680 logger.debug("Start prepareUpdateOrchestrationTask progress")
681 String requestMethod = "PUT"
682 String progress = execution.getVariable("nssmfProgress")
683 String status = execution.getVariable("nssmfStatus")
684 String statusDescription=execution.getVariable("nddmfStatusDescription")
685 SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
686 String domain = execution.getVariable("nsstDomain")
687 switch (domain.toUpperCase()) {
689 sliceTaskParams.setAnProgress(progress)
690 sliceTaskParams.setAnStatus(status)
691 sliceTaskParams.setAnStatusDescription(statusDescription)
694 sliceTaskParams.setCnProgress(progress)
695 sliceTaskParams.setCnStatus(status)
696 sliceTaskParams.setCnStatusDescription(statusDescription)
699 sliceTaskParams.setTnProgress(progress)
700 sliceTaskParams.setTnStatus(status)
701 sliceTaskParams.setTnStatusDescription(statusDescription)
706 String paramJson = sliceTaskParams.convertToJson()
707 execution.setVariable("CSSOT_paramJson", paramJson)
708 execution.setVariable("CSSOT_requestMethod", requestMethod)
709 logger.debug("Finish prepareUpdateOrchestrationTask progress")