diff options
author | deepikasatheesh <deepika.s84@wipro.com> | 2021-02-09 11:33:27 +0000 |
---|---|---|
committer | deepikasatheesh <deepika.s84@wipro.com> | 2021-02-11 09:20:31 +0000 |
commit | 7c5c5bd2614539a39534c0991dbfad8b207c7ba1 (patch) | |
tree | c717e6ad363dc9b5fbb4b2a7aaf9762c53d37ecb | |
parent | 666b56c9241c37b22f631fb88f4a40aedefa2eac (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
4 files changed, 64 insertions, 33 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") diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn index b2b6c031f9..8cafea75f5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/QueryJobStatus.bpmn @@ -31,7 +31,7 @@ qjs.preProcessRequest(execution)</bpmn:script> </camunda:connector> </bpmn:extensionElements> <bpmn:incoming>Flow_0qhl0m8</bpmn:incoming> - <bpmn:incoming>Flow_1qqqckj</bpmn:incoming> + <bpmn:incoming>Flow_0akup2t</bpmn:incoming> <bpmn:outgoing>Flow_18di8yy</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_16nxw2f" sourceRef="StartEvent_1" targetRef="Activity_0cd23fy" /> @@ -64,17 +64,23 @@ qjs.updateJobStatusDetails(execution)</bpmn:script> <bpmn:incoming>Flow_0qqltc9</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="Flow_0qqltc9" sourceRef="Activity_0rtwx97" targetRef="Event_0p00z2s" /> - <bpmn:sequenceFlow id="Flow_1qqqckj" name="No" sourceRef="Gateway_1ruy0j9" targetRef="Activity_1aivult"> + <bpmn:sequenceFlow id="Flow_1qqqckj" name="No" sourceRef="Gateway_1ruy0j9" targetRef="Event_0dp6trf"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("JobStatusCompleted") == "FALSE"}</bpmn:conditionExpression> </bpmn:sequenceFlow> + <bpmn:intermediateCatchEvent id="Event_0dp6trf" name="TimeDelay"> + <bpmn:incoming>Flow_1qqqckj</bpmn:incoming> + <bpmn:outgoing>Flow_0akup2t</bpmn:outgoing> + <bpmn:timerEventDefinition id="TimerEventDefinition_0ncw0aa"> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT10S</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="Flow_0akup2t" sourceRef="Event_0dp6trf" targetRef="Activity_1aivult" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="QueryJobStatus"> <bpmndi:BPMNEdge id="Flow_1qqqckj_di" bpmnElement="Flow_1qqqckj"> <di:waypoint x="880" y="152" /> - <di:waypoint x="880" y="280" /> - <di:waypoint x="550" y="280" /> - <di:waypoint x="550" y="167" /> + <di:waypoint x="880" y="222" /> <bpmndi:BPMNLabel> <dc:Bounds x="892" y="163" width="15" height="14" /> </bpmndi:BPMNLabel> @@ -106,6 +112,11 @@ qjs.updateJobStatusDetails(execution)</bpmn:script> <di:waypoint x="215" y="127" /> <di:waypoint x="310" y="127" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0akup2t_di" bpmnElement="Flow_0akup2t"> + <di:waypoint x="862" y="240" /> + <di:waypoint x="570" y="240" /> + <di:waypoint x="570" y="167" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> <dc:Bounds x="179" y="109" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -136,6 +147,13 @@ qjs.updateJobStatusDetails(execution)</bpmn:script> <dc:Bounds x="1160" y="152" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0wfgoh7_di" bpmnElement="Event_0dp6trf"> + <dc:Bounds x="862" y="222" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="896" y="252" width="53" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> + |