summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/main/groovy
diff options
context:
space:
mode:
authordeepikasatheesh <deepika.s84@wipro.com>2021-02-09 11:33:27 +0000
committerdeepikasatheesh <deepika.s84@wipro.com>2021-02-11 09:20:31 +0000
commit7c5c5bd2614539a39534c0991dbfad8b207c7ba1 (patch)
treec717e6ad363dc9b5fbb4b2a7aaf9762c53d37ecb /bpmn/so-bpmn-infrastructure-common/src/main/groovy
parent666b56c9241c37b22f631fb88f4a40aedefa2eac (diff)
Fixed issues in AN NSSMF for allocate flow & added timeDelay in QueryJobStatus
Issue-ID: SO-3526 Signed-off-by: deepikasatheesh <deepika.s84@wipro.com> Change-Id: I04fd6adced03c535129cf0d2adfee60f6e2b3407
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy17
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy36
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy16
3 files changed, 41 insertions, 28 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
index da9584771c..75006365f2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
@@ -268,34 +268,39 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
Map<String,Object> profile
switch(domainType) {
case "AN-NF":
- profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, plmnIdList, cSReliabilityMeanTime,
- //msgSizeByte, maxNumberofPDUSessions,overallUserDensity,transferIntervalTarget
+ profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - cSReliabilityMeanTime, cSAvailabilityTarget, terminalDensity, msgSizeByte
result.setJitter(profile.get("jitter"))
result.setLatency(profile.get("latency"))
+ result.setMaxBandwidth(profile.get("maxbandwidth"))
result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
result.setUeMobilityLevel(profile.get("uEMobilityLevel"))
result.setMaxNumberOfUEs(profile.get("maxNumberofUEs"))
result.setActivityFactor(profile.get("activityFactor"))
- result.setCoverageAreaTAList(profile.get("coverageAreaTAList"))
+ result.setCoverageAreaTAList(profile.get("coverageAreaTAList").toString())
result.setExpDataRateDL(profile.get("expDataRateDL"))
result.setExpDataRateUL(profile.get("expDataRateUL"))
result.setSurvivalTime(profile.get("survivalTime"))
+ result.setMaxNumberOfPDUSession(profile.get("maxNumberOfPDUSession"))
result.setAreaTrafficCapDL(profile.get("areaTrafficCapDL"))
result.setAreaTrafficCapUL(profile.get("areaTrafficCapUL"))
+ result.setOverallUserDensity(profile.get("overallUserDensity"))
+ result.setTransferIntervalTarget(profile.get("transferIntervalTarget"))
result.setExpDataRate(profile.get("expDataRate"))
result.setProfileId(execution.getVariable("ANNF_sliceProfileId"))
break
case "TN-FH":
- profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) //pending fields - maxBandwidth, sST, plmnIdList
+ profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class)
result.setJitter(profile.get("jitter"))
result.setLatency(profile.get("latency"))
+ result.setMaxBandwidth(profile.get("maxbandwidth"))
result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
result.setProfileId(execution.getVariable("TNFH_sliceProfileId"))
break
case "TN-MH":
- profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, plmnIdList
+ profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
result.setJitter(profile.get("jitter"))
result.setLatency(profile.get("latency"))
+ result.setMaxBandwidth(profile.get("maxbandwidth"))
result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
result.setProfileId(execution.getVariable("TNMH_sliceProfileId"))
break
@@ -356,6 +361,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
if(domainType.equals("TN_FH")) {
serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid"))
serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid"))
+ serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
allocateTnNssi.addProperty("nsstId", execution.getVariable("TNFH_modelUuid"))
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class)
@@ -367,6 +373,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
}else if(domainType.equals("TN_MH")) {
serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid"))
serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid"))
+ serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
allocateTnNssi.addProperty("nsstId", execution.getVariable("TNMH_modelUuid"))
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
index 33724bd011..567c703496 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
@@ -323,7 +323,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("isRspRanNssi", true)
}else {
JsonObject newNSISolution = sol.get("newNSISolution").getAsJsonObject()
- JsonArray sliceProfiles = newNSISolution.get("slice_profiles").getAsJsonArray()
+ JsonArray sliceProfiles = newNSISolution.get("sliceProfiles").getAsJsonArray()
logger.debug("RanConstituentSliceProfiles list from OOF "+sliceProfiles)
execution.setVariable("RanConstituentSliceProfiles", sliceProfiles.toString())
}
@@ -354,14 +354,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("modifySliceParams", modifySliceParams.toString())
//create operation status in request db
- String serviceId = execution.getVariable("RANServiceInstanceId")
String nsiId = execution.getVariable("nsiId")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + "jobId:" + jobId)
+ String modelUuid = execution.getVariable("modelUuid")
+ logger.debug("Generated new job for Service Instance serviceId:" + nsiId + "jobId:" + jobId)
ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
+ initStatus.setServiceId(nsiId)
initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setResourceTemplateUUID(modelUuid)
initStatus.setOperType("Modify")
requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
}
@@ -613,13 +613,17 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
ANServiceInstance.setServiceType(serviceType)
String serviceStatus = "deactivated"
ANServiceInstance.setOrchestrationStatus(serviceStatus)
- String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "pLMNIdList")
+ String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
String serviceRole = "nssi"
ANServiceInstance.setServiceRole(serviceRole)
List<String> snssaiList = execution.getVariable("snssaiList")
String snssai = snssaiList.get(0)
ANServiceInstance.setEnvironmentContext(snssai)
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+ String modelUuid = execution.getVariable("modelUuid")
+ ANServiceInstance.setModelInvariantId(modelInvariantUuid)
+ ANServiceInstance.setModelVersionId(modelUuid)
ANServiceInstance.setWorkloadContext("AN")
String serviceFunctionAn = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "resourceSharingLevel")
ANServiceInstance.setServiceFunction(serviceFunctionAn)
@@ -630,12 +634,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
ANNFServiceInstance.setServiceInstanceName(sliceInstanceName)
ANNFServiceInstance.setServiceType(serviceType)
ANNFServiceInstance.setOrchestrationStatus(serviceStatus)
- serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "pLMNIdList")
+ serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
ANNFServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
ANNFServiceInstance.setServiceRole(serviceRole)
snssaiList = execution.getVariable("snssaiList")
snssai = snssaiList.get(0)
ANNFServiceInstance.setEnvironmentContext(snssai)
+ ANNFServiceInstance.setModelInvariantId(execution.getVariable("ANNF_modelInvariantUuid"))
+ ANNFServiceInstance.setModelVersionId(execution.getVariable("ANNF_modelUuid"))
ANNFServiceInstance.setWorkloadContext("AN-NF")
String serviceFunctionAnnf = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "resourceSharingLevel")
ANNFServiceInstance.setServiceFunction(serviceFunctionAnnf)
@@ -852,16 +858,16 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
def prepareOperationStatusUpdate = { DelegateExecution execution ->
logger.debug(Prefix + "prepareOperationStatusUpdate Start")
- String serviceId = execution.getVariable("dummyServiceId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
+ String modelUuid = execution.getVariable("modelUuid")
String nssiId = execution.getVariable("RANServiceInstanceId")
- logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+ logger.debug("Service Instance serviceId:" + nsiId + " jobId:" + jobId)
ResourceOperationStatus updateStatus = new ResourceOperationStatus()
- updateStatus.setServiceId(serviceId)
+ updateStatus.setServiceId(nsiId)
updateStatus.setOperationId(jobId)
- updateStatus.setResourceTemplateUUID(nsiId)
+ updateStatus.setResourceTemplateUUID(modelUuid)
updateStatus.setResourceInstanceID(nssiId)
updateStatus.setOperType("Allocate")
updateStatus.setProgress("100")
@@ -874,16 +880,16 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
def prepareFailedOperationStatusUpdate = { DelegateExecution execution ->
logger.debug(Prefix + "prepareFailedOperationStatusUpdate Start")
- String serviceId = execution.getVariable("dummyServiceId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
+ String modelUuid = execution.getVariable("modelUuid")
String nssiId = execution.getVariable("RANServiceInstanceId")
- logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+ logger.debug("Service Instance serviceId:" + nsiId + " jobId:" + jobId)
ResourceOperationStatus updateStatus = new ResourceOperationStatus()
- updateStatus.setServiceId(serviceId)
+ updateStatus.setServiceId(nsiId)
updateStatus.setOperationId(jobId)
- updateStatus.setResourceTemplateUUID(nsiId)
+ updateStatus.setResourceTemplateUUID(modelUuid)
updateStatus.setResourceInstanceID(nssiId)
updateStatus.setOperType("Allocate")
updateStatus.setProgress("0")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy
index 74c9a49911..7bb451164c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy
@@ -20,11 +20,9 @@
package org.onap.so.bpmn.infrastructure.scripts
-import com.fasterxml.jackson.databind.ObjectMapper
import groovy.json.JsonSlurper
import org.json.JSONObject
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.so.beans.nsmf.JobStatusRequest
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
@@ -45,7 +43,8 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{
try{
String requestId = execution.getVariable("msoRequestId")
logger.debug("RequestId :" + requestId)
- String jobId = execution.getVariable("jobId")
+ String responseId = execution.getVariable("responseId")
+ String jobId = execution.getVariable("jobId")
def jsonSlurper = new JsonSlurper()
HashMap<String,?> esrInfo = jsonSlurper.parseText(execution.getVariable("esrInfo"))
@@ -53,7 +52,7 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{
HashMap<String,?> serviceInfo = jsonSlurper.parseText(execution.getVariable("serviceInfo"))
logger.debug("serviceInfo" + serviceInfo.toString())
-
+
execution.setVariable("esrInfo", esrInfo)
execution.setVariable("serviceInfo", serviceInfo)
@@ -61,9 +60,10 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{
String endPoint = String.format("/api/rest/provMns/v1/NSS/jobs/%s", jobId)
String url = nssmfEndpoint + endPoint
execution.setVariable("NSSMF_AdapterEndpoint", url)
-
+
String payload = """
{
+ "responseId": "${responseId}",
"esrInfo": ${execution.getVariable("esrInfo") as JSONObject},
"serviceInfo": ${execution.getVariable("serviceInfo") as JSONObject}
}
@@ -72,7 +72,7 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{
execution.setVariable("NSSMF_AdapterRequest", payload.replaceAll("\\s+", ""))
execution.setVariable("startTime", System.currentTimeMillis())
logger.debug("Outgoing NSSMF_AdapterRequest: \n" + payload)
- }catch(Exception e){
+ }catch(Exception ex){
String msg = "Exception in QueryJobStatus.preProcessRequest " + ex.getMessage()
logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
@@ -107,7 +107,7 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{
responseDescriptorMap.put("statusDescription","Exception while querying job status")
String responseDescriptor = """
{
- "responseDescriptor": "${responseDescriptorMap}",
+ "responseDescriptor": "${responseDescriptorMap as JSONObject}"
}
"""
execution.setVariable("JobStatusCompleted", "TRUE")
@@ -123,7 +123,7 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{
responseDescriptorMap.put("statusDescription","timeout")
String responseDescriptor = """
{
- "responseDescriptor": "${responseDescriptorMap}",
+ "responseDescriptor": ${responseDescriptorMap as JSONObject}
}
"""
execution.setVariable("JobStatusCompleted", "TRUE")