From 6258c7a3dea0340ff2b82db82875e04fee777c33 Mon Sep 17 00:00:00 2001 From: deepikasatheesh Date: Tue, 13 Apr 2021 15:12:08 +0000 Subject: Fix issues in AN NSSMF for allocate &modify flow Issue-ID: SO-3624 Signed-off-by: deepikasatheesh Change-Id: Iaeca92aee45a2e0e920c12b0ed407b9fd5514f09 --- .../infrastructure/scripts/AnNssmfutils.groovy | 54 ++++++++----- .../scripts/DoAllocateAccessNSSI.groovy | 75 ++++++++++-------- .../scripts/DoModifyAccessNSSI.groovy | 91 +++++++++++++++++++--- .../scripts/DoModifyRanNfNssi.groovy | 10 ++- .../resources/process/AllocateSliceSubnet.bpmn | 6 +- .../resources/subprocess/DoAllocateAccessNSSI.bpmn | 4 +- .../resources/subprocess/DoModifyAccessNSSI.bpmn | 2 +- 7 files changed, 173 insertions(+), 69 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 2c1fa64609..540358fde7 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 @@ -176,9 +176,9 @@ public void createSliceProfilesInAai(DelegateExecution execution) { org.onap.aai.domain.yang.SliceProfile ANNF_SliceProfile = new SliceProfile() org.onap.aai.domain.yang.SliceProfile TNFH_SliceProfile = new SliceProfile() org.onap.aai.domain.yang.SliceProfile TNMH_SliceProfile = new SliceProfile() - ANNF_SliceProfile = createSliceProfile("AN-NF", execution) - TNFH_SliceProfile = createSliceProfile("TN-FH",execution) - TNMH_SliceProfile = createSliceProfile("TN-MH",execution) + ANNF_SliceProfile = createSliceProfile("AN_NF", execution) + TNFH_SliceProfile = createSliceProfile("TN_FH",execution) + TNMH_SliceProfile = createSliceProfile("TN_MH",execution) ANNF_SliceProfiles.getSliceProfile().add(ANNF_SliceProfile) TNFH_SliceProfiles.getSliceProfile().add(TNFH_SliceProfile) @@ -194,13 +194,13 @@ public void createSliceProfilesInAai(DelegateExecution execution) { String serviceStatus = "deactivated" ANNF_sliceProfileInstance.setOrchestrationStatus(serviceStatus) String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList") - ANNF_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid) + ANNF_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0)) String serviceRole = "slice-profile-instance" ANNF_sliceProfileInstance.setServiceRole(serviceRole) ArrayList snssaiList = execution.getVariable("snssaiList") String snssai = snssaiList.get(0) ANNF_sliceProfileInstance.setEnvironmentContext(snssai) - ANNF_sliceProfileInstance.setWorkloadContext("AN-NF") + ANNF_sliceProfileInstance.setWorkloadContext("AN_NF") ANNF_sliceProfileInstance.setSliceProfiles(ANNF_SliceProfiles) String serviceFunctionAnnf = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "resourceSharingLevel") ANNF_sliceProfileInstance.setServiceFunction(serviceFunctionAnnf) @@ -214,10 +214,10 @@ public void createSliceProfilesInAai(DelegateExecution execution) { TNFH_sliceProfileInstance.setServiceType(serviceType) TNFH_sliceProfileInstance.setOrchestrationStatus(serviceStatus) serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "plmnIdList") - TNFH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid) + TNFH_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0)) TNFH_sliceProfileInstance.setServiceRole(serviceRole) TNFH_sliceProfileInstance.setEnvironmentContext(snssai) - TNFH_sliceProfileInstance.setWorkloadContext("TN-FH") + TNFH_sliceProfileInstance.setWorkloadContext("TN_FH") TNFH_sliceProfileInstance.setSliceProfiles(TNFH_SliceProfiles) String serviceFunctionTnFH = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "resourceSharingLevel") TNFH_sliceProfileInstance.setServiceFunction(serviceFunctionTnFH) @@ -231,10 +231,10 @@ public void createSliceProfilesInAai(DelegateExecution execution) { TNMH_sliceProfileInstance.setServiceType(serviceType) TNMH_sliceProfileInstance.setOrchestrationStatus(serviceStatus) serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "plmnIdList") - TNMH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid) + TNMH_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0)) TNMH_sliceProfileInstance.setServiceRole(serviceRole) TNMH_sliceProfileInstance.setEnvironmentContext(snssai) - TNMH_sliceProfileInstance.setWorkloadContext("TN-MH") + TNMH_sliceProfileInstance.setWorkloadContext("TN_MH") TNMH_sliceProfileInstance.setSliceProfiles(TNMH_SliceProfiles) String serviceFunctionTnMH = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "resourceSharingLevel") TNMH_sliceProfileInstance.setServiceFunction(serviceFunctionTnMH) @@ -267,7 +267,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe SliceProfile result = new SliceProfile() Map profile switch(domainType) { - case "AN-NF": + case "AN_NF": profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - cSReliabilityMeanTime, cSAvailabilityTarget, terminalDensity, msgSizeByte result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) @@ -288,7 +288,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe result.setExpDataRate(profile.get("expDataRate")) result.setProfileId(execution.getVariable("ANNF_sliceProfileId")) break - case "TN-FH": + case "TN_FH": profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) @@ -296,7 +296,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe result.setResourceSharingLevel(profile.get("resourceSharingLevel")) result.setProfileId(execution.getVariable("TNFH_sliceProfileId")) break - case "TN-MH": + case "TN_MH": profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class) result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) @@ -361,7 +361,8 @@ 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")) + serviceInfo.addProperty("nssiName", "nssi_"+execution.getVariable("TNFH_modelName")) + serviceInfo.addProperty("sst", execution.getVariable("sst")) allocateTnNssi.addProperty("nsstId", execution.getVariable("TNFH_modelUuid")) allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName")) Map sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) @@ -373,7 +374,8 @@ 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")) + serviceInfo.addProperty("nssiName", "nssi_"+execution.getVariable("TNMH_modelName")) + serviceInfo.addProperty("sst", execution.getVariable("sst")) allocateTnNssi.addProperty("nsstId", execution.getVariable("TNMH_modelUuid")) allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName")) Map sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class) @@ -383,26 +385,40 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN")) connectionLinksList.add(endpoints) } - - //Connection links - connectionLinks.add("connectionLinks", connectionLinksList) - transportSliceNetworksList.add(connectionLinks) - allocateTnNssi.add("transportSliceNetworks", transportSliceNetworksList) }else if(action.equals("modify-allocate")) { + JsonObject endpoints = new JsonObject() if(domainType.equals("TN_FH")) { allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_nssiName")) allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId")) allocateTnNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI")) serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI")) serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_nssiName")) + Map sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) + sliceProfile.put("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId")) + allocateTnNssi.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile)) + endpoints.addProperty("transportEndpointA", execution.getVariable("tranportEp_ID_RU")) + endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_DUIN")) + connectionLinksList.add(endpoints) }else if(domainType.equals("TN_MH")) { allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_nssiName")) allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId")) allocateTnNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI")) serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI")) serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_nssiName")) + Map sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class) + sliceProfile.put("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId")) + allocateTnNssi.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile)) + endpoints.addProperty("transportEndpointA", execution.getVariable("tranportEp_ID_DUEG")) + endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN")) + connectionLinksList.add(endpoints) } } + + //Connection links + connectionLinks.add("connectionLinks", connectionLinksList) + transportSliceNetworksList.add(connectionLinks) + allocateTnNssi.add("transportSliceNetworks", transportSliceNetworksList) + JsonParser parser = new JsonParser() String nsiInfo = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "nsiInfo") allocateTnNssi.add("nsiInfo",(JsonObject) parser.parse(nsiInfo)) 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 567c703496..f3fca050a2 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 @@ -53,6 +53,7 @@ import org.onap.aaiclient.client.aai.AAINamespaceConstants import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aai.domain.yang.NetworkPolicy import org.onap.aai.domain.yang.NetworkRoute +import org.json.JSONArray class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { @@ -85,7 +86,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { " subscriptionServiceType - "+execution.getVariable("subscriptionServiceType")+ " jobId - "+execution.getVariable("jobId")+ " sliceParams - "+execution.getVariable("sliceParams")+ - " servicename - "+ execution.getVariable("servicename")) + " servicename - "+ execution.getVariable("servicename")+ + " sst - "+ execution.getVariable("sst")) //validate slice subnet inputs @@ -101,7 +103,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId") def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "snssaiList")) def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "plmnIdList")) - def coverageAreaTAList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList")) + String jsonArray = jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList") + List list = new ArrayList<>(); + JSONArray arr = new JSONArray(jsonArray); + for (int i = 0; i < arr.length(); i++) { + int s = (int) arr.get(i); + list.add(s); + } + def coverageAreaTAList = list; if (isBlank(sliceProfileId) || (snssaiList.empty) || (plmnIdList.empty) || (coverageAreaTAList.empty)) { @@ -131,16 +140,16 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { execution.setVariable("job_timeout", 10) //set BH end point - List BH_endPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints")) - logger.debug("BH end points list : "+BH_endPoints) - if(BH_endPoints.empty) { - msg = "End point info is empty" - logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - }else { - execution.setVariable("bh_endpoint", BH_endPoints.get(0)) - } - + def BH_endPoints = jsonUtil.getJsonValue(sliceParams, "endPoint") + logger.debug("BH end points list : "+BH_endPoints) + if(isBlank(BH_endPoints)) { + msg = "End point info is empty" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + }else { + execution.setVariable("bh_endpoint", BH_endPoints) + } + } catch(BpmnError e) { throw e } catch(Exception ex) { @@ -261,6 +270,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { String requestId = execution.getVariable("msoRequestId") String messageType = "NSISelectionResponse" Map profileInfo = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class) + profileInfo.put("sST",execution.getVariable("sst")) String modelUuid = execution.getVariable("modelUuid") String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelName = execution.getVariable("ranModelName") @@ -377,8 +387,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { serviceInfo.addProperty("nssiId", execution.getVariable("RANServiceInstanceId")) serviceInfo.addProperty("nsiId", execution.getVariable("nsiId")) serviceInfo.addProperty("nssiName", execution.getVariable("servicename")) - String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST") - serviceInfo.addProperty("sST", sST) + serviceInfo.addProperty("sST", execution.getVariable("sst")) serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList"))) serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId")) serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType")) @@ -475,6 +484,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { List ranConstituentSliceProfiles = jsonUtil.StringArrayToList(execution.getVariable("RanConstituentSliceProfiles")) anNssmfUtils.createDomainWiseSliceProfiles(ranConstituentSliceProfiles, execution) Map profileInfo = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class) + profileInfo.put("sST",execution.getVariable("sst")) String modelUuid = execution.getVariable("ANNF_modelUuid") String modelInvariantUuid = execution.getVariable("ANNF_modelInvariantUuid") String modelName = execution.getVariable("ANNF_modelName") @@ -518,6 +528,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { ServiceDecomposition serviceDecomposition = execution.getVariable("ANNF_ServiceDecomposition") serviceDecomposition.setServiceInstance(serviceInstance); execution.setVariable("ANNF_ServiceDecomposition", serviceDecomposition) + execution.setVariable("modifyAction","allocate") execution.setVariable("isRspRanNfNssi", true) }else { logger.debug("No solutions returned from OOF .. Create new RAN NF NSSI") @@ -544,17 +555,18 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { String sliceInstanceName = execution.getVariable("servicename") ANServiceInstance.setServiceInstanceName(sliceInstanceName) String serviceType = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST") - ANServiceInstance.setServiceType(serviceType) + ANServiceInstance.setServiceType(execution.getVariable("sst")) String serviceStatus = "deactivated" ANServiceInstance.setOrchestrationStatus(serviceStatus) String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList") - ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid) + ANServiceInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0)) String serviceRole = "nssi" ANServiceInstance.setServiceRole(serviceRole) - List snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class) + List snssaiList = execution.getVariable("snssaiList") String snssai = snssaiList.get(0) - ANServiceInstance.setEnvironmentContext(snssai) - ANServiceInstance.setWorkloadContext("AN") + //ANServiceInstance.setEnvironmentContext(snssai) + ANServiceInstance.setEnvironmentContext("an") //Network Type + ANServiceInstance.setWorkloadContext("AN") //domain Type logger.debug("completed AN service instance build "+ ANServiceInstance.toString()) String msg = "" @@ -610,7 +622,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { String sliceInstanceName = execution.getVariable("servicename") ANServiceInstance.setServiceInstanceName(sliceInstanceName) String serviceType = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST") - ANServiceInstance.setServiceType(serviceType) + ANServiceInstance.setServiceType(execution.getVariable("sst")) String serviceStatus = "deactivated" ANServiceInstance.setOrchestrationStatus(serviceStatus) String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList") @@ -630,19 +642,19 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.debug("completed AN service instance build "+ ANServiceInstance.toString()) //create RAN NF NSSI ANNFServiceInstance.setServiceInstanceId(execution.getVariable("RANNFServiceInstanceId")) - sliceInstanceName = execution.getVariable("ANNF_modelName") + sliceInstanceName = "nssi_"+execution.getVariable("ANNF_modelName") ANNFServiceInstance.setServiceInstanceName(sliceInstanceName) - ANNFServiceInstance.setServiceType(serviceType) + ANNFServiceInstance.setServiceType(execution.getVariable("sst")) ANNFServiceInstance.setOrchestrationStatus(serviceStatus) serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList") - ANNFServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid) + ANNFServiceInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0)) 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") + ANNFServiceInstance.setWorkloadContext("AN_NF") String serviceFunctionAnnf = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "resourceSharingLevel") ANNFServiceInstance.setServiceFunction(serviceFunctionAnnf) logger.debug("completed AN service instance build "+ ANNFServiceInstance.toString()) @@ -720,8 +732,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { execution.setVariable("esrInfo", esrInfo.toString()) JsonObject serviceInfo = new JsonObject() serviceInfo.addProperty("nsiId", execution.getVariable("nsiId")) - String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST") - serviceInfo.addProperty("sST", sST) + serviceInfo.addProperty("sST", execution.getVariable("sst")) serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList"))) serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId")) serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType")) @@ -902,7 +913,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { String requestId = execution.getVariable("msoRequestId") Map sliceProfile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class) sliceProfile.put("sliceProfileId", execution.getVariable("ANNF_sliceProfileInstanceId")) - sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions")) + sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSession")) sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL")) sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL")) @@ -912,11 +923,11 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { JsonObject commonHeader = new JsonObject() JsonObject payload = new JsonObject() JsonObject payloadInput = new JsonObject() - commonHeader.addProperty("TimeStamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault())) + commonHeader.addProperty("timeStamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault())) commonHeader.addProperty("api-ver", "1.0") + commonHeader.addProperty("originator-id", "testing") commonHeader.addProperty("request-id", requestId) commonHeader.addProperty("sub-request-id", "1") - commonHeader.add("request-track", new JsonObject()) commonHeader.add("flags", new JsonObject()) Gson jsonConverter = new Gson() payloadInput.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile)) @@ -924,6 +935,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { payloadInput.addProperty("NSIID", execution.getVariable("nsiId")) payloadInput.addProperty("RANNFNSSIId", execution.getVariable("RANNFServiceInstanceId")) payloadInput.addProperty("callbackURL", callbackUrl) + payloadInput.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId")) + payloadInput.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType")) payloadInput.add("additionalproperties", new JsonObject()) payload.add("input", payloadInput) input.add("common-header", commonHeader) @@ -948,8 +961,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { String bh_routeId = UUID.randomUUID().toString() execution.setVariable("tranportEp_ID_bh", bh_routeId) String role = "CU" - String CU_IpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress") - String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId") + String CU_IpAddress = jsonUtil.getJsonValue(bh_endpoint, "ipAddress") + String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "logicInterfaceId") String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo") NetworkRoute bh_ep = new NetworkRoute() bh_ep.setRouteId(bh_routeId) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy index 8695946fd6..8859af25f6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy @@ -28,6 +28,8 @@ import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils import org.onap.so.bpmn.common.scripts.OofUtils import org.onap.so.bpmn.common.scripts.RequestDBUtil import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.beans.nsmf.PerfReqEmbb +import org.onap.so.beans.nsmf.PerfReq import org.onap.so.db.request.beans.ResourceOperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -47,6 +49,9 @@ import org.onap.aai.domain.yang.Relationship import org.onap.aai.domain.yang.ServiceInstance import org.onap.aai.domain.yang.SliceProfile import org.onap.aai.domain.yang.SliceProfiles +import org.onap.aai.domain.yang.AllottedResource +import org.onap.aai.domain.yang.AllottedResources +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth import org.onap.aaiclient.client.aai.entities.uri.AAISimplePluralUri import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.databind.SerializationFeature @@ -231,8 +236,28 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { Map profileInfo = objectMapper.readValue(execution.getVariable("RANSliceProfile"), Map.class) ServiceInstance ranSliceProfileInstance = execution.getVariable("ranSliceProfileInstance") profileInfo.put("sST",ranSliceProfileInstance.getServiceType()) - profileInfo.put("snssaiList",ranSliceProfileInstance.getEnvironmentContext()) - profileInfo.put("plmnIdList",ranSliceProfileInstance.getServiceInstanceLocationId()) + profileInfo.put("snssaiList",execution.getVariable("snssaiList")) + profileInfo.put("plmnIdList",Arrays.asList(ranSliceProfileInstance.getServiceInstanceLocationId())) + profileInfo.put("uEMobilityLevel",profileInfo.get("ueMobilityLevel")) + profileInfo.put("cSAvailabilityTarget",profileInfo.get("csAvailabilityTarget")) + profileInfo.put("maxNumberofPDUSession",profileInfo.get("maxNumberOfPDUSession")) + profileInfo.put("maxNumberofUEs",profileInfo.get("maxNumberOfUEs")) + + PerfReq perfReq = new PerfReq(); + List perfReqEmbbs = new ArrayList<>(); + PerfReqEmbb perfReqEmbb = new PerfReqEmbb(); + perfReqEmbb.setExpDataRateDL(profileInfo.get("expDataRateDL")); + perfReqEmbb.setExpDataRateUL(profileInfo.get("expDataRateUL")); + perfReqEmbbs.add(perfReqEmbb); + perfReq.setPerfReqEmbbList(perfReqEmbbs); + profileInfo.put("perfReq",perfReq) + + profileInfo.remove("maxNumberOfUEs") + profileInfo.remove("resourceVersion") + profileInfo.remove("csAvailabilityTarget") + profileInfo.remove("ueMobilityLevel") + profileInfo.remove("maxNumberOfPDUSession") + profileInfo.remove("profileId") String modelUuid = ranSliceProfileInstance.getModelVersionId() String modelInvariantUuid = ranSliceProfileInstance.getModelInvariantId() String modelName = execution.getVariable("servicename") @@ -308,23 +333,25 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { logger.debug("getNssisFromAai ranConstituentNssis : "+ranConstituentNssis.toString()) ranConstituentNssis.each { key, val -> switch(key) { - case "AN-NF": + case "AN_NF": execution.setVariable("ANNF_NSSI", val.getServiceInstanceId()) execution.setVariable("ANNF_nssiName", val.getServiceInstanceName()) execution.setVariable("ANNF_modelInvariantUuid", val.getModelInvariantId()) execution.setVariable("ANNF_modelUuid", val.getModelVersionId()) break - case "TN-FH": + case "TN_FH": execution.setVariable("TNFH_NSSI", val.getServiceInstanceId()) execution.setVariable("TNFH_nssiName", val.getServiceInstanceName()) execution.setVariable("TNFH_modelInvariantUuid", val.getModelInvariantId()) execution.setVariable("TNFH_modelUuid", val.getModelVersionId()) + getConnectionLinks(execution, key, val) break - case "TN-MH": + case "TN_MH": execution.setVariable("TNMH_NSSI", val.getServiceInstanceId()) execution.setVariable("TNMH_nssiName", val.getServiceInstanceName()) execution.setVariable("TNMH_modelInvariantUuid", val.getModelInvariantId()) execution.setVariable("TNMH_modelUuid", val.getModelVersionId()) + getConnectionLinks(execution, key, val) break default: logger.error("No expected match found for current domainType "+ key) @@ -333,6 +360,50 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { } } + + private void getConnectionLinks(DelegateExecution execution, String domainType, ServiceInstance instance) { + AllottedResources allottedResources = instance.getAllottedResources() + if(allottedResources == null) { + String msg = "AllottedResourceFromAAI doesn't exist. " + instance + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + List AllottedResourceList = allottedResources.getAllottedResource() + for(AllottedResource allottedResource : AllottedResourceList) { + List relationshipList = allottedResource.getRelationshipList().getRelationship() + for (Relationship relationship : relationshipList) { + String relatedTo = relationship.getRelatedTo() + if (relatedTo.toLowerCase() == "logical-link") { + String relatioshipurl = relationship.getRelatedLink() + String logicalLinkId= + relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId)) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Resource was not found in aai: ${logicalLinkId}") + } + AAIResultWrapper wrapper01 = client.get(uri, NotFoundException.class) + Optional resource = wrapper01.asBean(org.onap.aai.domain.yang.LogicalLink.class) + if (resource.isPresent()) { + org.onap.aai.domain.yang.LogicalLink logicalLinkInstance = resource.get() + if(domainType.equalsIgnoreCase("TN-FH")) + { + execution.setVariable("tranportEp_ID_RU",logicalLinkInstance.getLinkName()) + execution.setVariable("tranportEp_ID_DUIN",logicalLinkInstance.getLinkName2()) + } + else if(domainType.equalsIgnoreCase("TN-MH")) + { + execution.setVariable("tranportEp_ID_DUEG",logicalLinkInstance.getLinkName()) + execution.setVariable("tranportEp_ID_CUIN",logicalLinkInstance.getLinkName2()) + } + } + } + } + } + } + def createSliceProfiles = { DelegateExecution execution -> logger.debug(Prefix+"createSliceProfiles method start") anNssmfUtils.createSliceProfilesInAai(execution) @@ -446,8 +517,6 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { JsonObject serviceInfo = new JsonObject() serviceInfo.addProperty("nsiId", execution.getVariable("nsiId")) - String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST") - serviceInfo.addProperty("sST", sST) serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList"))) serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId")) serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType")) @@ -506,13 +575,13 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { logger.debug("getSliceProfilesFromAai ranConstituentSliceProfiles : "+ranConstituentSliceProfiles.toString()) ranConstituentSliceProfiles.each { key, val -> switch(key) { - case "AN-NF": + case "AN_NF": execution.setVariable("ANNF_sliceProfileInstanceId", val.getServiceInstanceId()) break - case "TN-FH": + case "TN_FH": execution.setVariable("TNFH_sliceProfileInstanceId", val.getServiceInstanceId()) break - case "TN-MH": + case "TN_MH": execution.setVariable("TNMH_sliceProfileInstanceId", val.getServiceInstanceId()) break default: @@ -655,7 +724,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}") } - AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class) + AAIResultWrapper wrapper01 = client01.get(uri01.depth(Depth.TWO), NotFoundException.class) Optional serviceInstance = wrapper01.asBean(ServiceInstance.class) if (serviceInstance.isPresent()) { ServiceInstance instance = serviceInstance.get() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy index bb8e516c3b..10846d4cfa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy @@ -28,6 +28,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import com.fasterxml.jackson.databind.ObjectMapper +import com.google.gson.Gson import com.google.gson.JsonObject import com.google.gson.JsonParser import java.time.Instant @@ -114,7 +115,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { logger.debug(Prefix+"createSdnrRequest method start") String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId") String modifyAction = execution.getVariable("modifyAction") - String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "InstantiateRANSlice", callbackUrl) + String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "instantiateRANSlice", callbackUrl) execution.setVariable("createNSSI_sdnrRequest", sdnrRequest) execution.setVariable("createNSSI_timeout", "PT10M") execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId")) @@ -152,7 +153,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { if(action.equals("allocate")) { sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class) sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId")) - sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions")) + sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSession")) sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL")) sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL")) action = "modify-"+action @@ -174,9 +175,12 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { commonHeader.addProperty("request-id", requestId) commonHeader.addProperty("sub-request-id", "1") commonHeader.add("flags", new JsonObject()) - payloadInput.addProperty("sliceProfile", sliceProfile.toString()) + Gson jsonConverter = new Gson() + payloadInput.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile)) payloadInput.addProperty("RANNFNSSIId", execution.getVariable("serviceInstanceID")) payloadInput.addProperty("callbackURL", callbackUrl) + payloadInput.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId")) + payloadInput.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType")) payload.add("input", payloadInput) input.add("common-header", commonHeader) input.addProperty("action", action) diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn index 07077a1cab..4012467df9 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn @@ -77,7 +77,8 @@ nss.sendSyncResponse(execution) - + + Flow_1kk0exp Flow_09b50tn @@ -105,7 +106,8 @@ nss.prepareInitOperationStatus(execution) - + + Flow_1fij4ds Flow_1coedjo diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn index 9b449013b1..9df7398f8c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn @@ -353,7 +353,7 @@ nss.createModifyNssiQueryJobStatus(execution) - + Flow_10j50jb Flow_05s0wso @@ -500,7 +500,7 @@ nss.prepareFailedOperationStatusUpdate(execution) - + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn index c346097c70..3844770023 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn @@ -73,7 +73,7 @@ nss.getNssisFromAai(execution) - + Flow_05cl21h Flow_1jwk3jy import org.onap.so.bpmn.infrastructure.scripts.* -- cgit 1.2.3-korg