diff options
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy')
7 files changed, 203 insertions, 80 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 1d8de352fb..da9584771c 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 @@ -55,7 +55,7 @@ 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.Relationship - +import com.google.gson.Gson class AnNssmfUtils { @@ -193,7 +193,7 @@ public void createSliceProfilesInAai(DelegateExecution execution) { ANNF_sliceProfileInstance.setServiceType(serviceType) String serviceStatus = "deactivated" ANNF_sliceProfileInstance.setOrchestrationStatus(serviceStatus) - String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "pLMNIdList") + String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList") ANNF_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid) String serviceRole = "slice-profile-instance" ANNF_sliceProfileInstance.setServiceRole(serviceRole) @@ -213,7 +213,7 @@ public void createSliceProfilesInAai(DelegateExecution execution) { serviceType = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "sST") TNFH_sliceProfileInstance.setServiceType(serviceType) TNFH_sliceProfileInstance.setOrchestrationStatus(serviceStatus) - serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "pLMNIdList") + serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "plmnIdList") TNFH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid) TNFH_sliceProfileInstance.setServiceRole(serviceRole) TNFH_sliceProfileInstance.setEnvironmentContext(snssai) @@ -230,7 +230,7 @@ public void createSliceProfilesInAai(DelegateExecution execution) { serviceType = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "sST") TNMH_sliceProfileInstance.setServiceType(serviceType) TNMH_sliceProfileInstance.setOrchestrationStatus(serviceStatus) - serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "pLMNIdList") + serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "plmnIdList") TNMH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid) TNMH_sliceProfileInstance.setServiceRole(serviceRole) TNMH_sliceProfileInstance.setEnvironmentContext(snssai) @@ -268,7 +268,7 @@ 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, + profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, plmnIdList, cSReliabilityMeanTime, //msgSizeByte, maxNumberofPDUSessions,overallUserDensity,transferIntervalTarget result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) @@ -286,14 +286,14 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe 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) //pending fields - maxBandwidth, sST, plmnIdList result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) 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)//pending fields - maxBandwidth, sST, plmnIdList result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) result.setResourceSharingLevel(profile.get("resourceSharingLevel")) @@ -342,16 +342,17 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe public String buildCreateNSSMFRequest(DelegateExecution execution, String domainType, String action) { JsonObject esrInfo = new JsonObject() - esrInfo.addProperty("networkType", "tn") - esrInfo.addProperty("vendor", "ONAP_internal") + esrInfo.addProperty("networkType", "tn") + esrInfo.addProperty("vendor", "ONAP_internal") JsonObject response = new JsonObject() JsonObject allocateTnNssi = new JsonObject() JsonObject serviceInfo = new JsonObject() JsonArray transportSliceNetworksList = new JsonArray() JsonArray connectionLinksList = new JsonArray() JsonObject connectionLinks = new JsonObject() + Gson jsonConverter = new Gson() if(action.equals("allocate")){ - Map<String, String> endpoints + JsonObject endpoints = new JsonObject() if(domainType.equals("TN_FH")) { serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid")) serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid")) @@ -359,12 +360,10 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName")) Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) sliceProfile.put("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId")) - String sliceProfileString = objectMapper.writeValueAsString(sliceProfile) - allocateTnNssi.addProperty("sliceProfile", sliceProfileString) - endpoints.put("transportEndpointA", execution.getVariable("tranportEp_ID_RU")) - endpoints.put("transportEndpointB", execution.getVariable("tranportEp_ID_DUIN")) - String endpointsString = objectMapper.writeValueAsString(endpoints) - connectionLinksList.add(endpointsString) + 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")) { serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid")) serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid")) @@ -372,41 +371,32 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName")) Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class) sliceProfile.put("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId")) - String sliceProfileString = objectMapper.writeValueAsString(sliceProfile) - allocateTnNssi.addProperty("sliceProfile", sliceProfileString) - endpoints.put("transportEndpointA", execution.getVariable("tranportEp_ID_DUEG")) - endpoints.put("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN")) - String endpointsString = objectMapper.writeValueAsString(endpoints) - connectionLinksList.add(endpointsString) + 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) - allocateTnNssi.addProperty("nssiId", null) - serviceInfo.addProperty("nssiId", null) }else if(action.equals("modify-allocate")) { if(domainType.equals("TN_FH")) { - serviceInfo.addProperty("serviceInvariantUuid", null) - serviceInfo.addProperty("serviceUuid", null) - allocateTnNssi.addProperty("nsstId", null) 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")) }else if(domainType.equals("TN_MH")) { - serviceInfo.addProperty("serviceInvariantUuid", null) - serviceInfo.addProperty("serviceUuid", null) - allocateTnNssi.addProperty("nsstId", null) 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")) } } + JsonParser parser = new JsonParser() String nsiInfo = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "nsiInfo") - allocateTnNssi.addProperty("nsiInfo", nsiInfo) + allocateTnNssi.add("nsiInfo",(JsonObject) parser.parse(nsiInfo)) allocateTnNssi.addProperty("scriptName", "TN1") serviceInfo.addProperty("nsiId", execution.getVariable("nsiId")) serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId")) 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 e1719aa5d6..33724bd011 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 @@ -34,6 +34,7 @@ import org.slf4j.LoggerFactory import java.util.List import static org.apache.commons.lang3.StringUtils.isBlank import com.google.gson.JsonObject +import com.google.gson.Gson import com.fasterxml.jackson.databind.ObjectMapper import com.google.gson.JsonArray import com.google.gson.JsonParser @@ -98,8 +99,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { execution.setVariable("sliceProfile", sliceProfile) } String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId") - def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "sNSSAI")) - def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "pLMNIdList")) + def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "snssaiList")) + def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "plmnIdList")) def coverageAreaTAList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList")) if (isBlank(sliceProfileId) || (snssaiList.empty) || (plmnIdList.empty) @@ -577,7 +578,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { def createSdnrRequest = { DelegateExecution execution -> logger.debug(Prefix+"createSdnrRequest method start") String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId") - String sdnrRequest = buildSdnrAllocateRequest(execution, "allocate", "InstantiateRANSlice", callbackUrl) + String sdnrRequest = buildSdnrAllocateRequest(execution, "allocate", "instantiateRANSlice", callbackUrl) execution.setVariable("createNSSI_sdnrRequest", sdnrRequest) execution.setVariable("createNSSI_timeout", "PT10M") execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId")) @@ -697,12 +698,12 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { } def createFhAllocateNssiJobQuery = { DelegateExecution execution -> - logger.debug(Prefix+"createModifyNssiQueryJobStatus method start") + logger.debug(Prefix+"createFhAllocateNssiJobQuery method start") createTnAllocateNssiJobQuery(execution, "TN_FH") } def createMhAllocateNssiJobQuery = { DelegateExecution execution -> - logger.debug(Prefix+"createModifyNssiQueryJobStatus method start") + logger.debug(Prefix+"createMhAllocateNssiJobQuery method start") createTnAllocateNssiJobQuery(execution, "TN_MH") } @@ -712,7 +713,6 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { esrInfo.addProperty("vendor", "ONAP_internal") execution.setVariable("esrInfo", esrInfo.toString()) JsonObject serviceInfo = new JsonObject() - serviceInfo.addProperty("nssiId", null) serviceInfo.addProperty("nsiId", execution.getVariable("nsiId")) String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST") serviceInfo.addProperty("sST", sST) @@ -736,14 +736,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.debug(Prefix+"processJobStatusRsp method start") String jobResponse = execution.getVariable("TNFH_jobResponse") logger.debug("Job status response "+jobResponse) - String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status") - String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi") + String status = jsonUtil.getJsonValue(jobResponse, "status") + String nssi = jsonUtil.getJsonValue(jobResponse, "nssiId") if(status.equalsIgnoreCase("finished")) { execution.setVariable("TNFH_NSSI", nssi) logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi) } else { - String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription") + String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription") logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription) exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription) } @@ -753,14 +753,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.debug(Prefix+"processJobStatusRsp method start") String jobResponse = execution.getVariable("TNMH_jobResponse") logger.debug("Job status response "+jobResponse) - String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status") - String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi") + String status = jsonUtil.getJsonValue(jobResponse, "status") + String nssi = jsonUtil.getJsonValue(jobResponse, "nssiId") if(status.equalsIgnoreCase("finished")) { execution.setVariable("TNMH_NSSI", nssi) logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi) } else { - String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription") + String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription") logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription) exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription) } @@ -770,13 +770,13 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.debug(Prefix+"processJobStatusRsp method start") String jobResponse = execution.getVariable("jobResponse") logger.debug("Job status response "+jobResponse) - String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status") - String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi") + String status = jsonUtil.getJsonValue(jobResponse, "status") + String nssi = jsonUtil.getJsonValue(jobResponse, "nssiId") if(status.equalsIgnoreCase("finished")) { logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi) } else { - String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription") + String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription") logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription) exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription) } @@ -899,29 +899,30 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions")) sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL")) sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL")) - String sliceProfileString = objectMapper.writeValueAsString(sliceProfile) + JsonObject response = new JsonObject() JsonObject body = new JsonObject() JsonObject input = new JsonObject() 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", TimeZone.getDefault())) - commonHeader.addProperty("APIver", "1.0") - commonHeader.addProperty("RequestID", requestId) - commonHeader.addProperty("SubRequestID", "1") - commonHeader.add("RequestTrack", new JsonObject()) - commonHeader.add("Flags", new JsonObject()) - payloadInput.addProperty("sliceProfile", sliceProfileString) + 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("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)) payloadInput.addProperty("RANNSSIId", execution.getVariable("RANServiceInstanceId")) payloadInput.addProperty("NSIID", execution.getVariable("nsiId")) payloadInput.addProperty("RANNFNSSIId", execution.getVariable("RANNFServiceInstanceId")) payloadInput.addProperty("callbackURL", callbackUrl) payloadInput.add("additionalproperties", new JsonObject()) payload.add("input", payloadInput) - input.add("CommonHeader", commonHeader) - input.addProperty("Action", action) - input.addProperty("Payload", payload.toString()) + input.add("common-header", commonHeader) + input.addProperty("action", action) + input.addProperty("payload", payload.toString()) body.add("input", input) response.add("body", body) response.addProperty("version", "1.0") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy index 1f3cf6ed52..0311c3d856 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.aai.domain.yang.NetworkRoute import org.onap.so.beans.nsmf.ConnectionLink import org.onap.so.beans.nsmf.EndPoint import org.onap.so.beans.nsmf.NsiInfo @@ -125,7 +126,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String sliceInstanceName = "nsi_"+execution.getVariable("sliceServiceInstanceName") - String serviceType = execution.getVariable("serviceType") + String serviceType = sliceParams.serviceProfile.get("sST") String serviceStatus = "deactivated" String modelInvariantUuid = sliceParams.getNSTInfo().invariantUUID String modelUuid = sliceParams.getNSTInfo().UUID @@ -299,7 +300,24 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ SliceProfile sliceProfile = new SliceProfile() sliceProfile.setProfileId(profileId) sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList) - //todo:... + sliceProfile.setMaxNumberOfUEs(anSliceProfile.maxNumberOfUEs) + sliceProfile.setLatency(anSliceProfile.latency) + sliceProfile.setMaxNumberOfPDUSession(anSliceProfile.maxNumberOfPDUSession) + sliceProfile.setExpDataRateDL(anSliceProfile.expDataRateDL) + sliceProfile.setExpDataRateUL(anSliceProfile.expDataRateUL) + sliceProfile.setAreaTrafficCapDL(anSliceProfile.areaTrafficCapDL) + sliceProfile.setAreaTrafficCapUL(anSliceProfile.areaTrafficCapUL) + sliceProfile.setOverallUserDensity(anSliceProfile.overallUserDensity) + sliceProfile.setActivityFactor(anSliceProfile.activityFactor) + sliceProfile.setUeMobilityLevel(anSliceProfile.ueMobilityLevel) + sliceProfile.setResourceSharingLevel(anSliceProfile.resourceSharingLevel) + sliceProfile.setCsAvailabilityTarget(anSliceProfile.csAvailabilityTarget) + sliceProfile.setCsReliabilityMeanTime(anSliceProfile.csReliabilityMeanTime) + sliceProfile.setExpDataRate(anSliceProfile.expDataRate) + sliceProfile.setMsgSizeByte(anSliceProfile.msgSizeByte) + sliceProfile.setTransferIntervalTarget(anSliceProfile.transferIntervalTarget) + sliceProfile.setSurvivalTime(anSliceProfile.survivalTime) + AAIResourceUri uri = AAIUriFactory.createResourceUri( AAIFluentTypeBuilder.business().customer(globalSubscriberId) .serviceSubscription(subscriptionServiceType) @@ -310,6 +328,57 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ execution.setVariable("sliceTaskParams", sliceParams) } + void createANEndpoint(DelegateExecution execution){ + logger.debug("Enter createANEndpoint in DoAllocateNSIandNSSI()") + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo + + NetworkRoute route = new NetworkRoute() + String routeId = UUID.randomUUID().toString() + route.setRouteId(routeId) + route.setType("endpoint") + route.setRole("an") + route.setFunction("3gppTransportEP") + route.setIpAddress( sliceTaskInfo.sliceProfile.ipAddress) + route.setNextHop(sliceTaskInfo.sliceProfile.nextHopInfo) + route.setAddressFamily("ipv4") + route.setPrefixLength(24) + sliceTaskInfo.setEndPointId(routeId) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkRoute(routeId)) + client.create(uri, route) + execution.setVariable("sliceTaskParams", sliceParams) + logger.info("an endpointId:" + sliceParams.anSliceTaskInfo.endPointId) + } + + + void createCNEndpoint(DelegateExecution execution){ + logger.debug("Enter createCNNetworkRoute in DoAllocateNSIandNSSI()") + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo + + NetworkRoute route = new NetworkRoute() + String routeId = UUID.randomUUID().toString() + route.setRouteId(routeId) + route.setType("endpoint") + route.setRole("cn") + route.setFunction("3gppTransportEP") + route.setIpAddress( sliceTaskInfo.sliceProfile.ipAddress) + route.setNextHop(sliceTaskInfo.sliceProfile.nextHopInfo) + route.setAddressFamily("ipv4") + route.setPrefixLength(24) + + sliceTaskInfo.setEndPointId(routeId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkRoute(routeId)) + client.create(uri, route) + + execution.setVariable("cnEndpointId", routeId) + execution.setVariable("sliceTaskParams", sliceParams) + logger.info("cn endpointId:" + sliceParams.cnSliceTaskInfo.endPointId) + } + /** * prepare AllocateAnNssi * @param execution @@ -327,9 +396,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2AnProfile() allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID allocateAnNssi.nssiId = sliceTaskInfo.suggestNssiId - allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name + allocateAnNssi.nssiName = "nssi_an" + execution.getVariable("sliceServiceInstanceName") NsiInfo nsiInfo = new NsiInfo() nsiInfo.nsiId = sliceParams.suggestNsiId + nsiInfo.nsiName = sliceParams.suggestNsiName allocateAnNssi.nsiInfo = nsiInfo //endPoint EndPoint endPoint = new EndPoint() @@ -353,6 +423,8 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ serviceInfo.nsiId = sliceParams.suggestNsiId serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID + serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST") + serviceInfo.nssiName = allocateAnNssi.nssiName nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -420,7 +492,24 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ SliceProfile sliceProfile = new SliceProfile() sliceProfile.setProfileId(profileId) sliceProfile.setCoverageAreaTAList(cnSliceProfile.coverageAreaTAList as String) - //todo:... + sliceProfile.setMaxNumberOfUEs(cnSliceProfile.maxNumberOfUEs) + sliceProfile.setLatency(cnSliceProfile.latency) + sliceProfile.setMaxNumberOfPDUSession(cnSliceProfile.maxNumberOfPDUSession) + sliceProfile.setExpDataRateDL(cnSliceProfile.expDataRateDL) + sliceProfile.setExpDataRateUL(cnSliceProfile.expDataRateUL) + sliceProfile.setAreaTrafficCapDL(cnSliceProfile.areaTrafficCapDL) + sliceProfile.setAreaTrafficCapUL(cnSliceProfile.areaTrafficCapUL) + sliceProfile.setOverallUserDensity(cnSliceProfile.overallUserDensity) + sliceProfile.setActivityFactor(cnSliceProfile.activityFactor) + sliceProfile.setUeMobilityLevel(cnSliceProfile.ueMobilityLevel) + sliceProfile.setResourceSharingLevel(cnSliceProfile.resourceSharingLevel) + sliceProfile.setCsAvailabilityTarget(cnSliceProfile.csAvailabilityTarget) + sliceProfile.setCsReliabilityMeanTime(cnSliceProfile.csReliabilityMeanTime) + sliceProfile.setExpDataRate(cnSliceProfile.expDataRate) + sliceProfile.setMsgSizeByte(cnSliceProfile.msgSizeByte) + sliceProfile.setTransferIntervalTarget(cnSliceProfile.transferIntervalTarget) + sliceProfile.setSurvivalTime(cnSliceProfile.survivalTime) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() .customer(globalSubscriberId) .serviceSubscription(subscriptionServiceType) @@ -446,10 +535,11 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ AllocateCnNssi allocateCnNssi = new AllocateCnNssi() allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID allocateCnNssi.nssiId = sliceTaskInfo.suggestNssiId - allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name + allocateCnNssi.nssiName = "nssi_cn" + execution.getVariable("sliceServiceInstanceName") allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2CnProfile() NsiInfo nsiInfo = new NsiInfo() nsiInfo.nsiId = sliceParams.suggestNsiId + nsiInfo.nsiName = sliceParams.suggestNsiName allocateCnNssi.nsiInfo = nsiInfo // endPoint EndPoint endPoint = new EndPoint() @@ -474,6 +564,8 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID serviceInfo.nssiId = sliceTaskInfo.suggestNssiId //if shared + serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST") + serviceInfo.nssiName = allocateCnNssi.nssiName nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -541,7 +633,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ SliceProfile sliceProfile = new SliceProfile() sliceProfile.setProfileId(profileId) - //todo:... + sliceProfile.setLatency(tnSliceProfile.latency) + sliceProfile.setMaxBandwidth(tnSliceProfile.maxBandwidth) + sliceProfile.setJitter(tnSliceProfile.jitter) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() .customer(globalSubscriberId) .serviceSubscription(subscriptionServiceType) @@ -602,6 +697,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID serviceInfo.nssiId = sliceTaskInfo.suggestNssiId + serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST") nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -631,17 +727,21 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String nsiId = sliceParams.getSuggestNsiId() String sliceProfileInstanceId = sliceParams.anSliceTaskInfo.sliceInstanceId String serviceProfileInstanceId = sliceParams.serviceId + String epId = sliceParams.anSliceTaskInfo.endPointId //nsi id //todo: aai -> nssi -> relationship -> endPointId -> set into tn - String endPointId = getEndpointIdFromAAI(execution, nssiId) - execution.setVariable("endPointIdAn", endPointId) - + //String endPointId = getEndpointIdFromAAI(execution, nssiId) + //execution.setVariable("endPointIdAn", endPointId) updateRelationship(execution, nsiId, nssiId) updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId) updateRelationship(execution, sliceProfileInstanceId, nssiId) + updateEPRelationship(execution, nssiId, epId) + + updateEPRelationship(execution, sliceProfileInstanceId, epId) + sliceParams.anSliceTaskInfo.suggestNssiId = nssiId execution.setVariable("sliceTaskParams", sliceParams) } @@ -665,16 +765,21 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String nsiId = sliceParams.getSuggestNsiId() String sliceProfileInstanceId = sliceParams.cnSliceTaskInfo.sliceInstanceId String serviceProfileInstanceId = sliceParams.serviceId + String epId = sliceParams.cnSliceTaskInfo.endPointId //nsi id //todo: aai -> nssi -> relationship -> endPointId -> set into tn - String endPointId = getEndpointIdFromAAI(execution, nssiId) - execution.setVariable("endPointIdCn", endPointId) +// String endPointId = getEndpointIdFromAAI(execution, nssiId) +// execution.setVariable("endPointIdCn", endPointId) updateRelationship(execution, nsiId, nssiId) updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId) - updateRelationship(execution,sliceProfileInstanceId, nssiId) + updateRelationship(execution, sliceProfileInstanceId, nssiId) + + updateEPRelationship(execution, nssiId, epId) + + updateEPRelationship(execution, sliceProfileInstanceId, epId) sliceParams.cnSliceTaskInfo.suggestNssiId = nssiId execution.setVariable("sliceTaskParams", sliceParams) @@ -779,7 +884,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ .serviceSubscription(execution.getVariable("subscriptionServiceType")) .serviceInstance(targetId)) - logger.info("Creating relationship, targetInstanceUri: " + targetInstanceUri) + logger.debug("Creating relationship, targetInstanceUri: " + targetInstanceUri) relationship.setRelatedLink(targetInstanceUri.build().toString()) @@ -791,6 +896,30 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ client.create(sourceInstanceUri, relationship) } + /** + * update endpoint relationship + * @param execution + * @param sourceId + * @param targetId + */ + void updateEPRelationship(DelegateExecution execution, String sourceId, String endpointId) { + //relation ship + Relationship relationship = new Relationship() + + AAIResourceUri endpointUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkRoute(endpointId)) + + logger.debug("Creating relationship, endpoint Uri: " + endpointUri + ",endpointId: " + endpointId) + + relationship.setRelatedLink(endpointUri.build().toString()) + + AAIResourceUri sourceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(execution.getVariable("globalSubscriberId")) + .serviceSubscription(execution.getVariable("subscriptionServiceType")) + .serviceInstance(sourceId)) + .relationshipAPI() + client.create(sourceInstanceUri, relationship) + } + static def createSliceProfileInstance(SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo, String oStatus) { // create slice profile ServiceInstance rspi = new ServiceInstance() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy index e5c1b56d55..e88b1c747f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy @@ -62,8 +62,10 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor { */ void sendCreateRequestNSSMF(DelegateExecution execution) { NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest - String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL, - objectMapper.writeValueAsString(nbiRequest)) + String nssmfRequest = objectMapper.writeValueAsString(nbiRequest) + logger.debug("sendCreateRequestNSSMF: " + nssmfRequest) + + String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL, nssmfRequest) if (response != null) { NssiResponse nssiResponse = objectMapper.readValue(response, NssiResponse.class) @@ -97,6 +99,8 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor { String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest)) + logger.debug("nssmf response nssiAllocateStatus:" + response) + if (response != null) { JobStatusResponse jobStatusResponse = objectMapper.readValue(response, JobStatusResponse.class) if (StringUtils.isBlank(nssiId)) { @@ -125,7 +129,6 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor { sliceTaskInfo.progress = response.getProgress() sliceTaskInfo.status = response.getStatus().toLowerCase() sliceTaskInfo.statusDescription = response.getStatusDescription() - sliceTaskInfo.endPointId = response.getEndPointId() updateNssiResult(sliceParams, subnetType, sliceTaskInfo) String paramJson = sliceParams.convertToJson() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy index ec70bd3780..ccb04d9440 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy @@ -100,7 +100,6 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ * todo: role */ String serviceRole = "service-profile" - String serviceType = execution.getVariable("serviceType") String globalSubscriberId = execution.getVariable("globalSubscriberId") String subscriptionServiceType = execution.getVariable("subscriptionServiceType") @@ -111,7 +110,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ ss.setServiceInstanceId(ssInstanceId) String sliceInstanceName = execution.getVariable("serviceInstanceName") ss.setServiceInstanceName(sliceInstanceName) - ss.setServiceType(serviceType) + ss.setServiceType(serviceProfile.get("sST")) String serviceStatus = "deactivated" ss.setOrchestrationStatus(serviceStatus) String modelInvariantUuid = modelInfo.getModelInvariantUuid() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy index 9450227467..25a7159264 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy @@ -416,10 +416,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ sliceProfile.remove("domainType") SliceProfileAdapter adapter = objectMapper.readValue(objectMapper.writeValueAsString(sliceProfile), SliceProfileAdapter.class) switch (domainType.toLowerCase()) { - case "tn-bh": + case "tn_bh": sliceParams.tnBHSliceTaskInfo.sliceProfile = adapter break - case "an-nf": + case "an_nf": case "an": sliceParams.anSliceTaskInfo.sliceProfile = adapter break diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy index f20bca9837..4eb70a5302 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy @@ -101,7 +101,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { void createServiceInstance(DelegateExecution execution) { - String serviceRole = "TN" + String serviceRole = "nssi" String serviceType = execution.getVariable("subscriptionServiceType") String ssInstanceId = execution.getVariable("sliceServiceInstanceId") String sliceProfileStr = execution.getVariable("sliceProfile") @@ -111,7 +111,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { String sliceInstanceName = execution.getVariable("sliceServiceInstanceName") ss.setServiceInstanceName(sliceInstanceName) ss.setServiceType(serviceType) - String serviceStatus = "allocated" + String serviceStatus = "activated" ss.setOrchestrationStatus(serviceStatus) String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelUuid = execution.getVariable("modelUuid") @@ -121,7 +121,8 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { String serviceInstanceLocationid = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr) ss.setServiceInstanceLocationId(serviceInstanceLocationid) String snssai = tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr) - ss.setEnvironmentContext(snssai) + //ss.setEnvironmentContext(snssai) + ss.setEnvironmentContext("tn") ss.setServiceRole(serviceRole) AAIResourcesClient client = getAAIClient() AAIResourceUri uri = |