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.PerfReqEmbb
19 import org.onap.so.beans.nsmf.PerfReqUrllc
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.debug("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.debug("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.setSNssai(sliceProfileMap.get("sNSSAI").toString())
328 sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString()))
329 sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString()))
330 sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
331 sliceProfile.setResourceSharingLevel(sliceProfileMap.get("activityFactor").toString())
332 sliceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString())
333 sliceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString())
334 sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
335 sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString()))
336 sliceProfile.setProfileId(nssiProfileID)
337 sliceProfile.setE2ELatency(0)
340 AAIResourcesClient client = new AAIResourcesClient()
341 AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE,
342 execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, nssiProfileID)
343 client.create(uri, sliceProfile)
344 } catch (BpmnError e) {
346 } catch (Exception ex) {
347 String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
349 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
352 def rollbackData = execution.getVariable("RollbackData")
353 if (rollbackData == null) {
354 rollbackData = new RollbackData();
356 //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
357 rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
358 rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", sliceserviceInstanceId)
359 rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("serviceType"))
360 rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
361 execution.setVariable("rollbackData", rollbackData)
362 execution.setVariable("RollbackData", rollbackData)
363 logger.debug("RollbackData:" + rollbackData)
364 logger.trace("Exit createSliceProfile in DoAllocateNSSI()")
368 String buildCreateNSSMFRequest(DelegateExecution execution, String domain) {
370 NssiAllocateRequest request = new NssiAllocateRequest()
371 String strRequest = ""
372 //String uuiRequest = execution.getVariable("uuiRequest")
373 SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
377 EsrInfo esrInfo = new EsrInfo()
378 esrInfo.setNetworkType(execution.getVariable("networkType"))
379 esrInfo.setVendor(execution.getVariable("nsstVendor"))
381 NsiInfo nsiInfo = new NsiInfo()
382 nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
383 nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
385 AnSliceProfile anSliceProfile = new AnSliceProfile()
386 anSliceProfile.setLatency(execution.getVariable("latency"))
387 anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList"))
388 anSliceProfile.setQi(execution.getVariable("qi"))
390 AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
391 allocateAnNssi.setNsstId(execution.getVariable("nsstId"))
392 allocateAnNssi.setNssiName(execution.getVariable("nssiName"))
393 allocateAnNssi.setNsiInfo(nsiInfo)
394 allocateAnNssi.setSliceProfile(anSliceProfile)
395 String anScriptName = sliceTaskParams.getAnScriptName()
396 allocateAnNssi.setScriptName(anScriptName)
398 request.setAllocateAnNssi(allocateAnNssi)
399 request.setEsrInfo(esrInfo)
402 Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn")
403 Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
404 NsiInfo nsiInfo = new NsiInfo()
405 nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId"))
406 nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName"))
408 EsrInfo esrInfo = new EsrInfo()
409 esrInfo.setNetworkType(NetworkType.fromString(domain))
410 esrInfo.setVendor(execution.getVariable("nsstVendor"))
411 execution.setVariable("esrInfo",esrInfo)
414 PerfReqEmbb perfReqEmbb = new PerfReqEmbb()
415 perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor"))
416 perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL"))
417 perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL"))
418 perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL"))
419 perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL"))
421 List<PerfReqEmbb> listPerfReqEmbbList = new ArrayList<>()
422 listPerfReqEmbbList.add(perfReqEmbb)
424 PerfReq perfReq = new PerfReq()
425 perfReq.setPerfReqEmbbList(listPerfReqEmbbList)
427 PerfReqUrllc perfReqUrllc = new PerfReqUrllc()
428 perfReqUrllc.setConnDensity(0)
429 perfReqUrllc.setTrafficDensity(0)
430 perfReqUrllc.setExpDataRate(0)
431 perfReqUrllc.setReliability(0)
432 perfReqUrllc.setCsAvailability(0)
433 perfReqUrllc.setSurvivalTime(0)
434 perfReqUrllc.setJitter(0)
435 perfReqUrllc.setE2eLatency(0)
436 perfReqUrllc.setPayloadSize("0")
437 perfReqUrllc.setServiceAreaDimension("")
439 List<PerfReqUrllc> perfReqUrllcList = new ArrayList<>()
440 perfReqUrllcList.add(perfReqUrllc)
441 perfReq.setPerfReqUrllcList(perfReqUrllcList)
443 CnSliceProfile cnSliceProfile = new CnSliceProfile()
444 cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID"))
445 String plmnStr = serviceProfile.get("plmnIdList")
446 List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|"))
447 cnSliceProfile.setPlmnIdList(plmnIdList)
449 String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString()
450 cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel))
452 String coverageArea = serviceProfile.get("coverageAreaTAList")
453 List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|"))
454 cnSliceProfile.setCoverageAreaTAList(coverageAreaList)
456 String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString()
457 cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel))
459 int latency = serviceProfile.get("latency")
460 cnSliceProfile.setLatency(latency)
462 int maxUE = serviceProfile.get("maxNumberofUEs")
463 cnSliceProfile.setMaxNumberofUEs(maxUE)
465 String snssai = serviceProfile.get("sNSSAI")
466 List<String> snssaiList = Arrays.asList(snssai.split("\\|"))
467 cnSliceProfile.setSnssaiList(snssaiList)
469 cnSliceProfile.setPerfReq(perfReq)
471 AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
472 allocateCnNssi.setNsstId(execution.getVariable("nsstid"))
473 allocateCnNssi.setNssiName(execution.getVariable("nssiName"))
474 allocateCnNssi.setSliceProfile(cnSliceProfile)
475 allocateCnNssi.setNsiInfo(nsiInfo)
476 String cnScriptName = sliceTaskParams.getCnScriptName()
477 allocateCnNssi.setScriptName(cnScriptName)
478 request.setAllocateCnNssi(allocateCnNssi)
479 request.setEsrInfo(esrInfo)
482 EsrInfo esrInfo = new EsrInfo()
483 esrInfo.setNetworkType(execution.getVariable("networkType"))
484 esrInfo.setVendor(execution.getVariable("vendor"))
486 TnSliceProfile tnSliceProfile = new TnSliceProfile()
487 tnSliceProfile.setLatency(execution.getVariable("latency"))
488 tnSliceProfile.setBandwidth(execution.getVariable("bandWidth"))
490 NsiInfo nsiInfo = new NsiInfo()
491 nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
492 nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
494 AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
495 allocateTnNssi.setSliceProfile(tnSliceProfile)
496 allocateTnNssi.setNsiInfo(nsiInfo)
497 allocateTnNssi.setNsstId(execution.getVariable("nsstid"))
498 String tnScriptName = sliceTaskParams.getTnScriptName()
499 allocateTnNssi.setScriptName(tnScriptName)
501 request.setAllocateTnNssi(allocateTnNssi)
502 request.setEsrInfo(esrInfo)
508 strRequest = MAPPER.writeValueAsString(request);
509 } catch (IOException e) {
510 logger.error("Invalid get progress request bean to convert as string");
511 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
517 String buildUpdateNSSMFRequest(DelegateExecution execution, String domain) {
518 NssiAllocateRequest request = new NssiAllocateRequest()
519 String nsstInput = execution.getVariable("nsstInput")
520 String nssiId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId")
521 String strRequest = ""
522 SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
525 EsrInfo esrInfo = new EsrInfo()
526 esrInfo.setNetworkType(execution.getVariable("nsstType"))
527 esrInfo.setVendor(execution.getVariable("vendor"))
529 NsiInfo nsiInfo = new NsiInfo()
530 nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
531 nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
533 AnSliceProfile anSliceProfile = new AnSliceProfile()
534 anSliceProfile.setLatency(execution.getVariable("latency"))
535 anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList"))
536 anSliceProfile.setQi(execution.getVariable("qi"))
538 AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
539 allocateAnNssi.setNsstId(execution.getVariable("nsstId"))
540 allocateAnNssi.setNssiName(execution.getVariable("nssiName"))
541 allocateAnNssi.setNsiInfo(nsiInfo)
542 allocateAnNssi.setSliceProfile(anSliceProfile)
543 String anScriptName = sliceTaskParams.getAnScriptName()
544 allocateAnNssi.setScriptName(anScriptName)
545 request.setAllocateAnNssi(allocateAnNssi)
546 request.setEsrInfo(esrInfo)
549 Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn")
550 Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
551 NsiInfo nsiInfo = new NsiInfo()
552 nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId"))
553 nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName"))
555 EsrInfo esrInfo = new EsrInfo()
556 esrInfo.setNetworkType(NetworkType.fromString(domain))
557 esrInfo.setVendor(execution.getVariable("nsstVendor"))
558 execution.setVariable("esrInfo",esrInfo)
561 PerfReqEmbb perfReqEmbb = new PerfReqEmbb()
562 perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor"))
563 perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL"))
564 perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL"))
565 perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL"))
566 perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL"))
568 List<PerfReqEmbb> listPerfReqEmbbList = new ArrayList<>()
569 listPerfReqEmbbList.add(perfReqEmbb)
571 PerfReq perfReq = new PerfReq()
572 perfReq.setPerfReqEmbbList(listPerfReqEmbbList)
574 PerfReqUrllc perfReqUrllc = new PerfReqUrllc()
575 perfReqUrllc.setConnDensity(0)
576 perfReqUrllc.setTrafficDensity(0)
577 perfReqUrllc.setExpDataRate(0)
578 perfReqUrllc.setReliability(0)
579 perfReqUrllc.setCsAvailability(0)
580 perfReqUrllc.setSurvivalTime(0)
581 perfReqUrllc.setJitter(0)
582 perfReqUrllc.setE2eLatency(0)
583 perfReqUrllc.setPayloadSize("0")
584 perfReqUrllc.setServiceAreaDimension("")
586 List<PerfReqUrllc> perfReqUrllcList = new ArrayList<>()
587 perfReqUrllcList.add(perfReqUrllc)
588 perfReq.setPerfReqUrllcList(perfReqUrllcList)
590 CnSliceProfile cnSliceProfile = new CnSliceProfile()
591 cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID"))
592 String plmnStr = serviceProfile.get("plmnIdList")
593 List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|"))
594 cnSliceProfile.setPlmnIdList(plmnIdList)
596 String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString()
597 cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel))
599 String coverageArea = serviceProfile.get("coverageAreaTAList")
600 List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|"))
601 cnSliceProfile.setCoverageAreaTAList(coverageAreaList)
603 String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString()
604 cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel))
606 int latency = serviceProfile.get("latency")
607 cnSliceProfile.setLatency(latency)
609 int maxUE = serviceProfile.get("maxNumberofUEs")
610 cnSliceProfile.setMaxNumberofUEs(maxUE)
612 String snssai = serviceProfile.get("sNSSAI")
613 List<String> snssaiList = Arrays.asList(snssai.split("\\|"))
614 cnSliceProfile.setSnssaiList(snssaiList)
616 cnSliceProfile.setPerfReq(perfReq)
618 AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
619 allocateCnNssi.setNsstId(execution.getVariable("nsstid"))
620 allocateCnNssi.setNssiName(execution.getVariable("nssiName"))
621 allocateCnNssi.setSliceProfile(cnSliceProfile)
622 allocateCnNssi.setNsiInfo(nsiInfo)
623 allocateCnNssi.setNssiId(nssiId) // need to check this
624 String cnScriptName = sliceTaskParams.getCnScriptName()
625 allocateCnNssi.setScriptName(cnScriptName)
626 request.setAllocateCnNssi(allocateCnNssi)
627 request.setEsrInfo(esrInfo)
630 EsrInfo esrInfo = new EsrInfo()
631 esrInfo.setNetworkType(execution.getVariable("networkType"))
632 esrInfo.setVendor(execution.getVariable("vendor"))
634 TnSliceProfile tnSliceProfile = new TnSliceProfile()
635 tnSliceProfile.setLatency(execution.getVariable("latency"))
636 tnSliceProfile.setBandwidth(execution.getVariable("bandWidth"))
638 NsiInfo nsiInfo = new NsiInfo()
639 nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
640 nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
642 AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
643 allocateTnNssi.setSliceProfile(tnSliceProfile)
644 allocateTnNssi.setNsiInfo(nsiInfo)
645 allocateTnNssi.setNsstId(execution.getVariable("nsstid"))
646 String tnScriptName = sliceTaskParams.getTnScriptName()
647 allocateTnNssi.setScriptName(tnScriptName)
648 request.setAllocateTnNssi(allocateTnNssi)
649 request.setEsrInfo(esrInfo)
655 strRequest = MAPPER.writeValueAsString(request);
656 } catch (IOException e) {
657 logger.error("Invalid get progress request bean to convert as string");
658 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
663 String buildNSSMFProgressRequest(DelegateExecution execution){
664 JobStatusRequest request = new JobStatusRequest()
665 String strRequest = ""
666 EsrInfo esrInfo = execution.getVariable("esrInfo")
667 request.setNsiId(execution.getVariable("nsiServiceInstanceId"))
668 request.setNssiId(execution.getVariable("nssiId"))
669 request.setEsrInfo(esrInfo)
672 strRequest = MAPPER.writeValueAsString(request);
673 } catch (IOException e) {
674 logger.error("Invalid get progress request bean to convert as string");
675 exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
680 public void prepareUpdateOrchestrationTask(DelegateExecution execution) {
681 logger.debug("Start prepareUpdateOrchestrationTask progress")
682 String requestMethod = "PUT"
683 String progress = execution.getVariable("nssmfProgress")
684 String status = execution.getVariable("nssmfStatus")
685 String statusDescription=execution.getVariable("nddmfStatusDescription")
686 SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
687 String domain = execution.getVariable("nsstDomain")
688 switch (domain.toUpperCase()) {
690 sliceTaskParams.setAnProgress(progress)
691 sliceTaskParams.setAnStatus(status)
692 sliceTaskParams.setAnStatusDescription(statusDescription)
695 sliceTaskParams.setCnProgress(progress)
696 sliceTaskParams.setCnStatus(status)
697 sliceTaskParams.setCnStatusDescription(statusDescription)
700 sliceTaskParams.setTnProgress(progress)
701 sliceTaskParams.setTnStatus(status)
702 sliceTaskParams.setTnStatusDescription(statusDescription)
707 String paramJson = sliceTaskParams.convertToJson()
708 execution.setVariable("CSSOT_paramJson", paramJson)
709 execution.setVariable("CSSOT_requestMethod", requestMethod)
710 logger.debug("Finish prepareUpdateOrchestrationTask progress")