From be42af4e1d79fc7974e1b9fb085bbbd4d873676b Mon Sep 17 00:00:00 2001 From: suzhenyu Date: Wed, 24 Feb 2021 16:45:27 +0800 Subject: 1. Add the code related to connection links 2. It adapts to the structural change of the param of so. Issue-ID: USECASEUI-554 Change-Id: Ic1c469206623436dbb273630e7caac6443dcb5c9 Signed-off-by: suzhenyu --- .../server/controller/nsmf/TaskMgtController.java | 7 + .../server/service/nsmf/TaskMgtService.java | 2 + .../service/nsmf/impl/TaskMgtServiceConvert.java | 455 ++++++++++----------- .../service/nsmf/impl/TaskMgtServiceImpl.java | 105 ++++- .../service/slicingdomain/aai/AAISliceService.java | 67 ++- .../aai/bean/connection/ConnectionLink.java | 46 +++ .../aai/bean/connection/ConnectionLinkList.java | 33 ++ .../aai/bean/connection/EndPointInfoList.java | 36 ++ .../aai/bean/connection/NetworkPolicy.java | 34 ++ .../aai/bean/connection/Relationship.java | 41 ++ .../aai/bean/connection/RelationshipData.java | 32 ++ .../aai/bean/connection/RelationshipList.java | 32 ++ .../aai/bean/connectionvo/ConnectionListVo.java | 35 ++ .../aai/bean/connectionvo/ConnectionVo.java | 31 ++ .../aai/bean/connectionvo/EndPointInfoListVo.java | 32 ++ .../aai/bean/connectionvo/PropertiesVo.java | 35 ++ .../slicingdomain/so/bean/AnSliceTaskInfo.java | 33 ++ .../slicingdomain/so/bean/CnSliceTaskInfo.java | 33 ++ .../service/slicingdomain/so/bean/SOTask.java | 12 +- .../slicingdomain/so/bean/ServiceProfile.java | 50 +++ .../slicingdomain/so/bean/SliceProfile.java | 57 +++ .../slicingdomain/so/bean/SliceTaskParams.java | 37 ++ .../slicingdomain/so/bean/TnBHSliceTaskInfo.java | 34 ++ .../slicingdomain/so/bean/TnFHSliceTaskInfo.java | 27 ++ .../slicingdomain/so/bean/TnMHSliceTaskInfo.java | 27 ++ .../nsmf/impl/TaskMgtServiceConvertTest.java | 135 +++--- .../service/nsmf/impl/TaskMgtServiceImplTest.java | 21 +- .../service/slicingdomain/so/bean/SOTaskTest.java | 2 - 28 files changed, 1182 insertions(+), 309 deletions(-) create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/ConnectionLink.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/ConnectionLinkList.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/EndPointInfoList.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/NetworkPolicy.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/Relationship.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelationshipData.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelationshipList.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionListVo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionVo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/EndPointInfoListVo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/PropertiesVo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/AnSliceTaskInfo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/CnSliceTaskInfo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/ServiceProfile.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SliceProfile.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SliceTaskParams.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnBHSliceTaskInfo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnFHSliceTaskInfo.java create mode 100644 server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnMHSliceTaskInfo.java diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/TaskMgtController.java b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/TaskMgtController.java index 589f6044..44dc0050 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/TaskMgtController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/TaskMgtController.java @@ -83,4 +83,11 @@ public class TaskMgtController { return taskMgtService.queryTaskCreationProgress(taskId); } + @ResponseBody + @GetMapping(value = { + "/connectionLinks/pageNo/{pageNo}/pageSize/{pageSize}"}, produces = "application/json") + public ServiceResult queryConnectionLinks(@PathVariable int pageNo, @PathVariable int pageSize) { + return taskMgtService.queryConnectionLinks(); + } + } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/TaskMgtService.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/TaskMgtService.java index 253367df..b85b15f6 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/TaskMgtService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/TaskMgtService.java @@ -32,4 +32,6 @@ public interface TaskMgtService { ServiceResult queryTaskCreationProgress(String taskId); + ServiceResult queryConnectionLinks(); + } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvert.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvert.java index 1ffe3a1d..b77b3c6c 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvert.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvert.java @@ -21,6 +21,7 @@ import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; +import lombok.Setter; import org.apache.commons.beanutils.BeanUtils; import org.onap.usecaseui.server.bean.nsmf.common.PagedResult; import org.onap.usecaseui.server.bean.nsmf.task.BusinessDemandInfo; @@ -41,9 +42,19 @@ import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.AnSliceTaskInfo; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.CnSliceTaskInfo; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.SliceProfile; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.SliceTaskParams; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.TnBHSliceTaskInfo; +import javax.annotation.Resource; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; @Service("TaskMgtConvertService") @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy +@Setter public class TaskMgtServiceConvert { private static final Logger logger = LoggerFactory.getLogger(TaskMgtServiceConvert.class); @@ -73,11 +84,11 @@ public class TaskMgtServiceConvert { for (SOTask soTask : sourceSoTaskRsp.getTask()) { SlicingTaskInfo slicingTaskInfo = new SlicingTaskInfo(); BeanUtils.copyProperties(slicingTaskInfo, soTask); - JSONObject paramsObject = JSON.parseObject(soTask.getParams()); - slicingTaskInfo.setServiceSnssai(paramsObject.getString("ServiceProfile.sNSSAI")); - slicingTaskInfo.setServiceType(paramsObject.getString("ServiceProfile.sST")); + SliceTaskParams sliceTaskParams = soTask.getSliceTaskParams(); + slicingTaskInfo.setServiceSnssai(sliceTaskParams.getServiceProfile().getSNSSAI()); + slicingTaskInfo.setServiceType(sliceTaskParams.getServiceProfile().getSST()); + slicingTaskInfo.setName(sliceTaskParams.getServiceName()); slicingTaskInfo.setCreateTime(soTask.getCreatedTime()); - slicingTaskInfo.setName(paramsObject.getString("ServiceName")); slicingTaskInfoList.add(slicingTaskInfo); } PagedResult pagedOrderList = NsmfCommonUtil.getPagedList(slicingTaskInfoList, pageNo, pageSize); @@ -91,135 +102,139 @@ public class TaskMgtServiceConvert { targetSlicingTaskAuditInfo.setCreateTime(sourceSoTaskInfo.getCreatedTime()); targetSlicingTaskAuditInfo.setProcessingStatus(sourceSoTaskInfo.getStatus()); - JSONObject paramsObject = JSON.parseObject(sourceSoTaskInfo.getParams()); - if (paramsObject == null) { + SliceTaskParams sliceTaskParams = sourceSoTaskInfo.getSliceTaskParams(); + if (sliceTaskParams == null) { logger.error("convertTaskAuditInfo: paramsObject is null"); return; } BusinessDemandInfo businessDemandInfo = new BusinessDemandInfo(); - convertBusinessDemandInfo(businessDemandInfo, paramsObject); + convertBusinessDemandInfo(businessDemandInfo, sliceTaskParams); targetSlicingTaskAuditInfo.setBusinessDemandInfo(businessDemandInfo); NstInfo nstInfo = new NstInfo(); - convertNstInfo(nstInfo, paramsObject); + convertNstInfo(nstInfo, sliceTaskParams); targetSlicingTaskAuditInfo.setNstInfo(nstInfo); NsiAndSubNssiInfo nsiAndSubNssiInfo = new NsiAndSubNssiInfo(); - convertNsiAndSubNssiInfo(nsiAndSubNssiInfo, paramsObject); + convertNsiAndSubNssiInfo(nsiAndSubNssiInfo, sliceTaskParams); targetSlicingTaskAuditInfo.setNsiAndSubNssiInfo(nsiAndSubNssiInfo); } - void convertBusinessDemandInfo(BusinessDemandInfo targetBusinessDemandInfo, JSONObject paramsObject) { + void convertBusinessDemandInfo(BusinessDemandInfo targetBusinessDemandInfo, SliceTaskParams sliceTaskParams) { - targetBusinessDemandInfo.setServiceName(paramsObject.getString("ServiceName")); - targetBusinessDemandInfo.setServiceSnssai(paramsObject.getString("ServiceProfile.sNSSAI")); - targetBusinessDemandInfo.setExpDataRateDL(paramsObject.getString("ServiceProfile.expDataRateDL")); - targetBusinessDemandInfo.setExpDataRateUL(paramsObject.getString("ServiceProfile.expDataRateUL")); - targetBusinessDemandInfo.setUeMobilityLevel(paramsObject.getString("ServiceProfile.uEMobilityLevel")); - targetBusinessDemandInfo.setLatency(paramsObject.getString("ServiceProfile.latency")); - String useInterval = generalConvert.getUseInterval(paramsObject.getString("ServiceId")); + targetBusinessDemandInfo.setServiceName(sliceTaskParams.getServiceName()); + targetBusinessDemandInfo.setServiceSnssai(sliceTaskParams.getServiceProfile().getSNSSAI()); + targetBusinessDemandInfo.setExpDataRateDL(sliceTaskParams.getServiceProfile().getExpDataRateDL()); + targetBusinessDemandInfo.setExpDataRateUL(sliceTaskParams.getServiceProfile().getExpDataRateUL()); + targetBusinessDemandInfo.setUeMobilityLevel(sliceTaskParams.getServiceProfile().getUEMobilityLevel()); + targetBusinessDemandInfo.setLatency(sliceTaskParams.getServiceProfile().getLatency()); + String useInterval = generalConvert.getUseInterval(sliceTaskParams.getServiceId()); targetBusinessDemandInfo.setUseInterval(useInterval); + targetBusinessDemandInfo.setCoverageAreaTaList(generalConvert.getAreaTaList(sliceTaskParams.getServiceProfile().getCoverageAreaTAList())); + + targetBusinessDemandInfo.setActivityFactor(sliceTaskParams.getServiceProfile().getActivityFactor()); + targetBusinessDemandInfo.setResourceSharingLevel(sliceTaskParams.getServiceProfile().getResourceSharingLevel()); + targetBusinessDemandInfo.setAreaTrafficCapDL(sliceTaskParams.getServiceProfile().getAreaTrafficCapDL()); + targetBusinessDemandInfo.setAreaTrafficCapUL(sliceTaskParams.getServiceProfile().getAreaTrafficCapUL()); + targetBusinessDemandInfo.setMaxNumberOfUEs(sliceTaskParams.getServiceProfile().getMaxNumberofUEs()); + targetBusinessDemandInfo.setServiceProfileAvailability(sliceTaskParams.getServiceProfile().getAvailability()); + targetBusinessDemandInfo.setServiceProfilePLMNIdList(sliceTaskParams.getServiceProfile().getPLMNIdList()); + targetBusinessDemandInfo.setServiceProfileReliability(sliceTaskParams.getServiceProfile().getReliability()); + targetBusinessDemandInfo.setServiceProfileDLThptPerSlice(sliceTaskParams.getServiceProfile().getDLThptPerSlice()); + targetBusinessDemandInfo.setServiceProfileDLThptPerUE(sliceTaskParams.getServiceProfile().getDLThptPerUE()); + targetBusinessDemandInfo.setServiceProfileULThptPerSlice(sliceTaskParams.getServiceProfile().getULThptPerSlice()); + targetBusinessDemandInfo.setServiceProfileULThptPerUE(sliceTaskParams.getServiceProfile().getULThptPerUE()); + targetBusinessDemandInfo.setServiceProfileMaxPktSize(sliceTaskParams.getServiceProfile().getMaxPktSize()); + targetBusinessDemandInfo.setServiceProfileMaxNumberofConns(sliceTaskParams.getServiceProfile().getMaxNumberofConns()); + targetBusinessDemandInfo.setServiceProfileTermDensity(sliceTaskParams.getServiceProfile().getTermDensity()); + targetBusinessDemandInfo.setServiceProfileJitter(sliceTaskParams.getServiceProfile().getJitter()); + targetBusinessDemandInfo.setServiceProfileSurvivalTime(sliceTaskParams.getServiceProfile().getSurvivalTime()); - String coverageAreaTA = paramsObject.getString("ServiceProfile.coverageAreaTAList"); - targetBusinessDemandInfo.setCoverageAreaTaList(generalConvert.getAreaTaList(coverageAreaTA)); - targetBusinessDemandInfo.setActivityFactor(paramsObject.getString("ServiceProfile.activityFactor")); - targetBusinessDemandInfo.setResourceSharingLevel(paramsObject.getString("ServiceProfile.resourceSharingLevel")); - targetBusinessDemandInfo.setAreaTrafficCapDL(paramsObject.getString("ServiceProfile.areaTrafficCapDL")); - targetBusinessDemandInfo.setAreaTrafficCapUL(paramsObject.getString("ServiceProfile.areaTrafficCapUL")); - targetBusinessDemandInfo.setMaxNumberOfUEs(paramsObject.getString("ServiceProfile.maxNumberofUEs")); - targetBusinessDemandInfo.setServiceProfileAvailability(paramsObject.getString("ServiceProfile.availability")); - targetBusinessDemandInfo.setServiceProfilePLMNIdList(paramsObject.getString("ServiceProfile.pLMNIdList")); - targetBusinessDemandInfo.setServiceProfileReliability(paramsObject.getString("ServiceProfile.reliability")); - targetBusinessDemandInfo.setServiceProfileDLThptPerSlice(paramsObject.getString("ServiceProfile.dLThptPerSlice")); - targetBusinessDemandInfo.setServiceProfileDLThptPerUE(paramsObject.getString("ServiceProfile.dLThptPerUE")); - targetBusinessDemandInfo.setServiceProfileULThptPerSlice(paramsObject.getString("ServiceProfile.uLThptPerSlice")); - targetBusinessDemandInfo.setServiceProfileULThptPerUE(paramsObject.getString("ServiceProfile.uLThptPerUE")); - targetBusinessDemandInfo.setServiceProfileMaxPktSize(paramsObject.getString("ServiceProfile.maxPktSize")); - targetBusinessDemandInfo.setServiceProfileMaxNumberofConns(paramsObject.getString("ServiceProfile.maxNumberofConns")); - targetBusinessDemandInfo.setServiceProfileTermDensity(paramsObject.getString("ServiceProfile.termDensity")); - targetBusinessDemandInfo.setServiceProfileJitter(paramsObject.getString("ServiceProfile.jitter")); - targetBusinessDemandInfo.setServiceProfileSurvivalTime(paramsObject.getString("ServiceProfile.survivalTime")); } - void convertNstInfo(NstInfo nstInfo, JSONObject paramsObject) { - nstInfo.setNstId(paramsObject.getString("NSTId")); - nstInfo.setNstName(paramsObject.getString("NSTName")); + void convertNstInfo(NstInfo nstInfo, SliceTaskParams sliceTaskParams) { + nstInfo.setNstId(sliceTaskParams.getNstId()); + nstInfo.setNstName(sliceTaskParams.getNstName()); } - void convertNsiAndSubNssiInfo(NsiAndSubNssiInfo nsiAndSubNssiInfo, JSONObject paramsObject) { - nsiAndSubNssiInfo.setSuggestNsiId(paramsObject.getString("suggestNSIId")); - nsiAndSubNssiInfo.setSuggestNsiName(paramsObject.getString("suggestNSIName")); - nsiAndSubNssiInfo.setAnSuggestNssiId(paramsObject.getString("AN.suggestNSSIId")); - nsiAndSubNssiInfo.setAnSuggestNssiName(paramsObject.getString("AN.suggestNSSIName")); - nsiAndSubNssiInfo.setAn5qi(paramsObject.getString("SliceProfile.AN.5QI")); - - String anCoverageAreaTA = paramsObject.getString("SliceProfile.AN.coverageAreaTAList"); - nsiAndSubNssiInfo.setAnCoverageAreaTaList(generalConvert.getAreaTaList(anCoverageAreaTA)); - nsiAndSubNssiInfo.setAnLatency(paramsObject.getString("SliceProfile.AN.latency")); - nsiAndSubNssiInfo.setAnScriptName(paramsObject.getString("AN.ScriptName")); - nsiAndSubNssiInfo.setAnEnableNSSISelection(paramsObject.getBoolean("AN.enableNSSISelection")); - nsiAndSubNssiInfo.setSliceProfile_AN_sNSSAI(paramsObject.getString("SliceProfile.AN.sNSSAI")); - nsiAndSubNssiInfo.setSliceProfile_AN_maxNumberofUEs(paramsObject.getString("SliceProfile.AN.maxNumberofUEs")); - nsiAndSubNssiInfo.setSliceProfile_AN_maxNumberofPDUSession(paramsObject.getString("SliceProfile.AN.maxNumberofPDUSession")); - nsiAndSubNssiInfo.setSliceProfile_AN_expDataRateDL(paramsObject.getString("SliceProfile.AN.expDataRateDL")); - nsiAndSubNssiInfo.setSliceProfile_AN_expDataRateUL(paramsObject.getString("SliceProfile.AN.expDataRateUL")); - nsiAndSubNssiInfo.setSliceProfile_AN_areaTrafficCapDL(paramsObject.getString("SliceProfile.AN.areaTrafficCapDL")); - nsiAndSubNssiInfo.setSliceProfile_AN_areaTrafficCapUL(paramsObject.getString("SliceProfile.AN.areaTrafficCapUL")); - nsiAndSubNssiInfo.setSliceProfile_AN_overallUserDensity(paramsObject.getString("SliceProfile.AN.overallUserDensity")); - nsiAndSubNssiInfo.setSliceProfile_AN_activityFactor(paramsObject.getString("SliceProfile.AN.activityFactor")); - nsiAndSubNssiInfo.setSliceProfile_AN_uEMobilityLevel(paramsObject.getString("SliceProfile.AN.uEMobilityLevel")); - nsiAndSubNssiInfo.setSliceProfile_AN_resourceSharingLevel(paramsObject.getString("SliceProfile.AN.resourceSharingLevel")); - nsiAndSubNssiInfo.setSliceProfile_AN_sST(paramsObject.getString("SliceProfile.AN.sST")); - nsiAndSubNssiInfo.setSliceProfile_AN_cSAvailabilityTarget(paramsObject.getString("SliceProfile.AN.cSAvailabilityTarget")); - nsiAndSubNssiInfo.setSliceProfile_AN_cSReliabilityMeanTime(paramsObject.getString("SliceProfile.AN.cSReliabilityMeanTime")); - nsiAndSubNssiInfo.setSliceProfile_AN_expDataRate(paramsObject.getString("SliceProfile.AN.expDataRate")); - nsiAndSubNssiInfo.setSliceProfile_AN_msgSizeByte(paramsObject.getString("SliceProfile.AN.msgSizeByte")); - nsiAndSubNssiInfo.setSliceProfile_AN_transferIntervalTarget(paramsObject.getString("SliceProfile.AN.transferIntervalTarget")); - nsiAndSubNssiInfo.setSliceProfile_AN_survivalTime(paramsObject.getString("SliceProfile.AN.survivalTime")); - nsiAndSubNssiInfo.setSliceProfile_AN_ipAddress(paramsObject.getString("SliceProfile.AN.ipAddress")); - nsiAndSubNssiInfo.setSliceProfile_AN_logicInterfaceId(paramsObject.getString("SliceProfile.AN.logicInterfaceId")); - nsiAndSubNssiInfo.setSliceProfile_AN_nextHopInfo(paramsObject.getString("SliceProfile.AN.nextHopInfo")); - - nsiAndSubNssiInfo.setTnBhSuggestNssiId(paramsObject.getString("TN.BH.suggestNSSIId")); - nsiAndSubNssiInfo.setTnBhSuggestNssiName(paramsObject.getString("TN.BH.suggestNSSIName")); - nsiAndSubNssiInfo.setTnBhLatency(paramsObject.getString("SliceProfile.TN.BH.latency")); - nsiAndSubNssiInfo.setTnBhBandwidth(paramsObject.getString("SliceProfile.TN.BH.maxBandwidth")); - nsiAndSubNssiInfo.setTnBhScriptName(paramsObject.getString("TN.BH.ScriptName")); - nsiAndSubNssiInfo.setTnEnableNSSISelection(paramsObject.getBoolean("TN.BH.enableNSSISelection")); - nsiAndSubNssiInfo.setSliceProfile_TN_BH_jitte(paramsObject.getString("SliceProfile.TN.BH.jitter")); - nsiAndSubNssiInfo.setSliceProfile_TN_BH_pLMNIdList(paramsObject.getString("SliceProfile.TN.BH.pLMNIdList")); - nsiAndSubNssiInfo.setSliceProfile_TN_BH_sNSSAI(paramsObject.getString("SliceProfile.TN.BH.sNSSAI")); - nsiAndSubNssiInfo.setSliceProfile_TN_BH_sST(paramsObject.getString("SliceProfile.TN.BH.sST")); - - nsiAndSubNssiInfo.setCnSuggestNssiId(paramsObject.getString("CN.suggestNSSIId")); - nsiAndSubNssiInfo.setCnSuggestNssiName(paramsObject.getString("CN.suggestNSSIName")); - nsiAndSubNssiInfo.setCnServiceSnssai(paramsObject.getString("SliceProfile.CN.sNSSAI")); - nsiAndSubNssiInfo.setCnResourceSharingLevel(paramsObject.getString("SliceProfile.CN.resourceSharingLevel")); - nsiAndSubNssiInfo.setCnUeMobilityLevel(paramsObject.getString("SliceProfile.CN.uEMobilityLevel")); - nsiAndSubNssiInfo.setCnLatency(paramsObject.getString("SliceProfile.CN.latency")); - nsiAndSubNssiInfo.setCnMaxNumberOfUes(paramsObject.getString("SliceProfile.CN.maxNumberofUEs")); - nsiAndSubNssiInfo.setCnActivityFactor(paramsObject.getString("SliceProfile.CN.activityFactor")); - nsiAndSubNssiInfo.setCnExpDataRateDl(paramsObject.getString("SliceProfile.CN.expDataRateDL")); - nsiAndSubNssiInfo.setCnExpDataRateUl(paramsObject.getString("SliceProfile.CN.expDataRateUL")); - nsiAndSubNssiInfo.setCnAreaTrafficCapDl(paramsObject.getString("SliceProfile.CN.areaTrafficCapDL")); - nsiAndSubNssiInfo.setCnAreaTrafficCapUl(paramsObject.getString("SliceProfile.CN.areaTrafficCapUL")); - nsiAndSubNssiInfo.setCnScriptName(paramsObject.getString("CN.ScriptName")); - nsiAndSubNssiInfo.setCnEnableNSSISelection(paramsObject.getBoolean("CN.enableNSSISelection")); - nsiAndSubNssiInfo.setSliceProfile_CN_maxNumberofPDUSession(paramsObject.getString("SliceProfile.CN.maxNumberofPDUSession")); - nsiAndSubNssiInfo.setSliceProfile_CN_overallUserDensity(paramsObject.getString("SliceProfile.CN.overallUserDensity")); - nsiAndSubNssiInfo.setSliceProfile_CN_coverageAreaTAList(paramsObject.getString("SliceProfile.CN.coverageAreaTAList")); - nsiAndSubNssiInfo.setSliceProfile_CN_sST(paramsObject.getString("SliceProfile.CN.sST")); - nsiAndSubNssiInfo.setSliceProfile_CN_cSAvailabilityTarget(paramsObject.getString("SliceProfile.CN.cSAvailabilityTarget")); - nsiAndSubNssiInfo.setSliceProfile_CN_cSReliabilityMeanTime(paramsObject.getString("SliceProfile.CN.cSReliabilityMeanTime")); - nsiAndSubNssiInfo.setSliceProfile_CN_expDataRate(paramsObject.getString("SliceProfile.CN.expDataRate")); - nsiAndSubNssiInfo.setSliceProfile_CN_msgSizeByte(paramsObject.getString("SliceProfile.CN.msgSizeByte")); - nsiAndSubNssiInfo.setSliceProfile_CN_transferIntervalTarget(paramsObject.getString("SliceProfile.CN.transferIntervalTarget")); - nsiAndSubNssiInfo.setSliceProfile_CN_survivalTime(paramsObject.getString("SliceProfile.CN.survivalTime")); - nsiAndSubNssiInfo.setSliceProfile_CN_ipAddress(paramsObject.getString("SliceProfile.CN.ipAddress")); - nsiAndSubNssiInfo.setSliceProfile_CN_logicInterfaceId(paramsObject.getString("SliceProfile.CN.logicInterfaceId")); - nsiAndSubNssiInfo.setSliceProfile_CN_nextHopInfo(paramsObject.getString("SliceProfile.CN.nextHopInfo")); - + void convertNsiAndSubNssiInfo(NsiAndSubNssiInfo nsiAndSubNssiInfo, SliceTaskParams sliceTaskParams) { + + nsiAndSubNssiInfo.setSuggestNsiId(sliceTaskParams.getSuggestNsiId()); + nsiAndSubNssiInfo.setSuggestNsiName(sliceTaskParams.getSuggestNSIName()); + nsiAndSubNssiInfo.setAnSuggestNssiId(sliceTaskParams.getAnSliceTaskInfo().getSuggestNssiId()); + nsiAndSubNssiInfo.setAnSuggestNssiName(sliceTaskParams.getAnSliceTaskInfo().getSuggestNSSIName()); + nsiAndSubNssiInfo.setAn5qi(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getAn5qi()); + + String anCoverageAreaTA = sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getCoverageAreaTAList(); + List areaTaList = generalConvert.getAreaTaList(anCoverageAreaTA); + nsiAndSubNssiInfo.setAnCoverageAreaTaList(areaTaList); + nsiAndSubNssiInfo.setAnLatency(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getLatency()); + nsiAndSubNssiInfo.setAnScriptName(sliceTaskParams.getAnSliceTaskInfo().getScriptName()); + nsiAndSubNssiInfo.setAnEnableNSSISelection(sliceTaskParams.getAnSliceTaskInfo().getEnableNSSISelection()); + nsiAndSubNssiInfo.setSliceProfile_AN_sNSSAI(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getSNSSAIList()); + nsiAndSubNssiInfo.setSliceProfile_AN_maxNumberofUEs(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getMaxNumberOfUEs()); + + nsiAndSubNssiInfo.setSliceProfile_AN_maxNumberofPDUSession(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getMaxNumberOfPDUSession()); + nsiAndSubNssiInfo.setSliceProfile_AN_expDataRateDL(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getExpDataRateDL()); + nsiAndSubNssiInfo.setSliceProfile_AN_expDataRateUL(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getExpDataRateUL()); + nsiAndSubNssiInfo.setSliceProfile_AN_areaTrafficCapDL(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getAreaTrafficCapDL()); + nsiAndSubNssiInfo.setSliceProfile_AN_areaTrafficCapUL(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getAreaTrafficCapUL()); + + nsiAndSubNssiInfo.setSliceProfile_AN_overallUserDensity(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getOverallUserDensity()); + nsiAndSubNssiInfo.setSliceProfile_AN_activityFactor(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getActivityFactor()); + nsiAndSubNssiInfo.setSliceProfile_AN_uEMobilityLevel(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getUeMobilityLevel()); + nsiAndSubNssiInfo.setSliceProfile_AN_resourceSharingLevel(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getResourceSharingLevel()); + nsiAndSubNssiInfo.setSliceProfile_AN_sST(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getSST()); + + nsiAndSubNssiInfo.setSliceProfile_AN_cSAvailabilityTarget(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getCsAvailabilityTarget()); + nsiAndSubNssiInfo.setSliceProfile_AN_cSReliabilityMeanTime(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getCsReliabilityMeanTime()); + nsiAndSubNssiInfo.setSliceProfile_AN_expDataRate(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getExpDataRate()); + nsiAndSubNssiInfo.setSliceProfile_AN_msgSizeByte(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getMsgSizeByte()); + nsiAndSubNssiInfo.setSliceProfile_AN_transferIntervalTarget(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getTransferIntervalTarget()); + nsiAndSubNssiInfo.setSliceProfile_AN_survivalTime(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getSurvivalTime()); + nsiAndSubNssiInfo.setSliceProfile_AN_ipAddress(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getIpAddress()); + nsiAndSubNssiInfo.setSliceProfile_AN_logicInterfaceId(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getLogicInterfaceId()); + nsiAndSubNssiInfo.setSliceProfile_AN_nextHopInfo(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getNextHopInfo()); + + nsiAndSubNssiInfo.setTnBhSuggestNssiId(sliceTaskParams.getTnBHSliceTaskInfo().getSuggestNssiId()); + nsiAndSubNssiInfo.setTnBhSuggestNssiName(sliceTaskParams.getTnBHSliceTaskInfo().getSuggestNSSIName()); + nsiAndSubNssiInfo.setTnBhLatency(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile().getLatency()); + nsiAndSubNssiInfo.setTnBhBandwidth(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile().getMaxBandwidth()); + nsiAndSubNssiInfo.setTnBhScriptName(sliceTaskParams.getTnBHSliceTaskInfo().getScriptName()); + nsiAndSubNssiInfo.setTnEnableNSSISelection(sliceTaskParams.getTnBHSliceTaskInfo().getEnableNSSISelection()); + nsiAndSubNssiInfo.setSliceProfile_TN_BH_jitte(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile().getJitter()); + nsiAndSubNssiInfo.setSliceProfile_TN_BH_pLMNIdList(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile().getPLMNIdList()); + nsiAndSubNssiInfo.setSliceProfile_TN_BH_sNSSAI(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile().getSNSSAIList()); + nsiAndSubNssiInfo.setSliceProfile_TN_BH_sST(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile().getSST()); + + nsiAndSubNssiInfo.setCnSuggestNssiId(sliceTaskParams.getCnSliceTaskInfo().getSuggestNssiId()); + nsiAndSubNssiInfo.setCnSuggestNssiName(sliceTaskParams.getCnSliceTaskInfo().getSuggestNSSIName()); + nsiAndSubNssiInfo.setCnServiceSnssai(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getSNSSAIList()); + nsiAndSubNssiInfo.setCnResourceSharingLevel(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getResourceSharingLevel()); + nsiAndSubNssiInfo.setCnUeMobilityLevel(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getUeMobilityLevel()); + nsiAndSubNssiInfo.setCnLatency(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getLatency()); + nsiAndSubNssiInfo.setCnMaxNumberOfUes(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getMaxNumberOfUEs()); + nsiAndSubNssiInfo.setCnActivityFactor(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getActivityFactor()); + nsiAndSubNssiInfo.setCnExpDataRateDl(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getExpDataRateDL()); + nsiAndSubNssiInfo.setCnExpDataRateUl(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getExpDataRateUL()); + nsiAndSubNssiInfo.setCnAreaTrafficCapDl(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getAreaTrafficCapDL()); + nsiAndSubNssiInfo.setCnAreaTrafficCapUl(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getAreaTrafficCapUL()); + nsiAndSubNssiInfo.setCnScriptName(sliceTaskParams.getCnSliceTaskInfo().getScriptName()); + nsiAndSubNssiInfo.setCnEnableNSSISelection(sliceTaskParams.getCnSliceTaskInfo().getEnableNSSISelection()); + nsiAndSubNssiInfo.setSliceProfile_CN_maxNumberofPDUSession(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getMaxNumberOfPDUSession()); + nsiAndSubNssiInfo.setSliceProfile_CN_overallUserDensity(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getOverallUserDensity()); + nsiAndSubNssiInfo.setSliceProfile_CN_coverageAreaTAList(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getCoverageAreaTAList()); + nsiAndSubNssiInfo.setSliceProfile_CN_sST(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getSST()); + nsiAndSubNssiInfo.setSliceProfile_CN_cSAvailabilityTarget(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getCsAvailabilityTarget()); + nsiAndSubNssiInfo.setSliceProfile_CN_cSReliabilityMeanTime(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getCsReliabilityMeanTime()); + nsiAndSubNssiInfo.setSliceProfile_CN_expDataRate(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getExpDataRate()); + nsiAndSubNssiInfo.setSliceProfile_CN_msgSizeByte(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getMsgSizeByte()); + nsiAndSubNssiInfo.setSliceProfile_CN_transferIntervalTarget(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getTransferIntervalTarget()); + nsiAndSubNssiInfo.setSliceProfile_CN_survivalTime(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getSurvivalTime()); + nsiAndSubNssiInfo.setSliceProfile_CN_ipAddress(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getIpAddress()); + nsiAndSubNssiInfo.setSliceProfile_CN_logicInterfaceId(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getLogicInterfaceId()); + nsiAndSubNssiInfo.setSliceProfile_CN_nextHopInfo(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile().getNextHopInfo()); } void convertTaskAuditToSoTask(SOTask targetSoTaskInfo, SlicingTaskAuditInfo sourceSlicingTaskAuditInfo) { @@ -227,92 +242,92 @@ public class TaskMgtServiceConvert { logger.error("convertTaskAuditToSoTask: sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo() is null"); return; } - - JSONObject jsonObject = JSONObject.parseObject(targetSoTaskInfo.getParams()); - jsonObject.put("suggestNSIId", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSuggestNsiId()); - jsonObject.put("suggestNSIName", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSuggestNsiName()); - jsonObject.put("AN.suggestNSSIId", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnSuggestNssiId()); - jsonObject.put("AN.suggestNSSIName", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnSuggestNssiName()); - jsonObject.put("SliceProfile.AN.latency", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnLatency()); - jsonObject.put("SliceProfile.AN.5QI", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAn5qi()); - + SliceTaskParams sliceTaskParams = new SliceTaskParams(); + sliceTaskParams.setSuggestNsiId(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSuggestNsiId()); + sliceTaskParams.setSuggestNSIName(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSuggestNsiName()); + AnSliceTaskInfo anSliceTaskInfo = new AnSliceTaskInfo(); + anSliceTaskInfo.setSuggestNssiId(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnSuggestNssiId()); + anSliceTaskInfo.setSuggestNSSIName(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnSuggestNssiName()); + SliceProfile sliceProfile = new SliceProfile(); + sliceProfile.setLatency(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnLatency()); + sliceProfile.setAn5qi(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAn5qi()); String aNCoverageAreaTAList = getAreaTaListString (sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnCoverageAreaTaList(), '|'); - jsonObject.put("SliceProfile.AN.coverageAreaTAList", aNCoverageAreaTAList); - jsonObject.put("AN.ScriptName", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnScriptName()); - jsonObject.put("AN.enableNSSISelection", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnEnableNSSISelection()); - jsonObject.put("SliceProfile.AN.sNSSAI", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_sNSSAI()); - jsonObject.put("SliceProfile.AN.maxNumberofUEs", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_maxNumberofUEs()); - jsonObject.put("SliceProfile.AN.maxNumberofPDUSession", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_maxNumberofPDUSession()); - jsonObject.put("SliceProfile.AN.expDataRateDL", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_expDataRateDL()); - jsonObject.put("SliceProfile.AN.expDataRateUL", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_expDataRateUL()); - jsonObject.put("SliceProfile.AN.areaTrafficCapDL", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_areaTrafficCapDL()); - jsonObject.put("SliceProfile.AN.areaTrafficCapUL", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_areaTrafficCapUL()); - jsonObject.put("SliceProfile.AN.overallUserDensity", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_overallUserDensity()); - jsonObject.put("SliceProfile.AN.activityFactor", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_activityFactor()); - jsonObject.put("SliceProfile.AN.uEMobilityLevel", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_uEMobilityLevel()); - jsonObject.put("SliceProfile.AN.resourceSharingLevel", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_resourceSharingLevel()); - jsonObject.put("SliceProfile.AN.sST", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_sST()); - jsonObject.put("SliceProfile.AN.cSAvailabilityTarget", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_cSAvailabilityTarget()); - jsonObject.put("SliceProfile.AN.cSReliabilityMeanTime", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_cSReliabilityMeanTime()); - jsonObject.put("SliceProfile.AN.expDataRate", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_expDataRate()); - jsonObject.put("SliceProfile.AN.msgSizeByte", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_msgSizeByte()); - jsonObject.put("SliceProfile.AN.transferIntervalTarget", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_transferIntervalTarget()); - jsonObject.put("SliceProfile.AN.survivalTime", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_survivalTime()); - jsonObject.put("SliceProfile.AN.ipAddress", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_ipAddress()); - jsonObject.put("SliceProfile.AN.logicInterfaceId", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_logicInterfaceId()); - jsonObject.put("SliceProfile.AN.nextHopInfo", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_nextHopInfo()); - - jsonObject.put("TN.BH.suggestNSSIId", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnBhSuggestNssiId()); - jsonObject.put("TN.BH.suggestNSSIName", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnBhSuggestNssiName()); - jsonObject.put("SliceProfile.TN.BH.maxBandwidth", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnBhBandwidth()); - jsonObject.put("SliceProfile.TN.BH.latency", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnBhLatency()); - jsonObject.put("TN.BH.ScriptName", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnBhScriptName()); - jsonObject.put("TN.BH.enableNSSISelection", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnEnableNSSISelection()); - jsonObject.put("SliceProfile.TN.BH.jitter", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_jitte()); - jsonObject.put("SliceProfile.TN.BH.pLMNIdList", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_pLMNIdList()); - jsonObject.put("SliceProfile.TN.BH.sNSSAI", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_sNSSAI()); - jsonObject.put("SliceProfile.TN.BH.sST", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_sST()); - - jsonObject.put("CN.suggestNSSIId", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnSuggestNssiId()); - jsonObject.put("CN.suggestNSSIName", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnSuggestNssiName()); - jsonObject - .put("SliceProfile.CN.sNSSAI", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnServiceSnssai()); - jsonObject.put("SliceProfile.CN.resourceSharingLevel", - sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnResourceSharingLevel()); - jsonObject.put("SliceProfile.CN.uEMobilityLevel", - sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnUeMobilityLevel()); - jsonObject.put("SliceProfile.CN.latency", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnLatency()); - jsonObject.put("SliceProfile.CN.maxNumberofUEs", - sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnMaxNumberOfUes()); - jsonObject.put("SliceProfile.CN.activityFactor", - sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnActivityFactor()); - jsonObject.put("SliceProfile.CN.expDataRateDL", - sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnExpDataRateDl()); - jsonObject.put("SliceProfile.CN.expDataRateUL", - sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnExpDataRateUl()); - jsonObject.put("SliceProfile.CN.areaTrafficCapDL", - sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnAreaTrafficCapDl()); - jsonObject.put("SliceProfile.CN.areaTrafficCapUL", - sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnAreaTrafficCapUl()); - jsonObject.put("CN.ScriptName", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnScriptName()); - jsonObject.put("CN.enableNSSISelection", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnEnableNSSISelection()); - jsonObject.put("SliceProfile.CN.maxNumberofPDUSession", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_maxNumberofPDUSession()); - jsonObject.put("SliceProfile.CN.overallUserDensity", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_overallUserDensity()); - jsonObject.put("SliceProfile.CN.coverageAreaTAList", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_coverageAreaTAList()); - jsonObject.put("SliceProfile.CN.sST", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_sST()); - jsonObject.put("SliceProfile.CN.cSAvailabilityTarget", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_cSAvailabilityTarget()); - jsonObject.put("SliceProfile.CN.cSReliabilityMeanTime", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_cSReliabilityMeanTime()); - jsonObject.put("SliceProfile.CN.expDataRate", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_expDataRate()); - jsonObject.put("SliceProfile.CN.msgSizeByte", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_msgSizeByte()); - jsonObject.put("SliceProfile.CN.transferIntervalTarget", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_transferIntervalTarget()); - jsonObject.put("SliceProfile.CN.survivalTime", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_survivalTime()); - jsonObject.put("SliceProfile.CN.ipAddress", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_ipAddress()); - jsonObject.put("SliceProfile.CN.logicInterfaceId", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_logicInterfaceId()); - jsonObject.put("SliceProfile.CN.nextHopInfo", sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_nextHopInfo()); - - String param = jsonObject.toJSONString(); - targetSoTaskInfo.setParams(param); + sliceProfile.setCoverageAreaTAList(aNCoverageAreaTAList); + anSliceTaskInfo.setScriptName(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnScriptName()); + anSliceTaskInfo.setEnableNSSISelection(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getAnEnableNSSISelection()); + sliceProfile.setSNSSAIList(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_sNSSAI()); + sliceProfile.setMaxNumberOfUEs(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_maxNumberofUEs()); + sliceProfile.setMaxNumberOfPDUSession(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_maxNumberofPDUSession()); + sliceProfile.setExpDataRateDL(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_expDataRateDL()); + sliceProfile.setExpDataRateUL(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_expDataRateUL()); + sliceProfile.setAreaTrafficCapDL(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_areaTrafficCapDL()); + sliceProfile.setExpDataRateUL(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_areaTrafficCapUL()); + sliceProfile.setOverallUserDensity(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_overallUserDensity()); + sliceProfile.setActivityFactor(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_activityFactor()); + sliceProfile.setUeMobilityLevel(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_uEMobilityLevel()); + sliceProfile.setResourceSharingLevel(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_resourceSharingLevel()); + sliceProfile.setSST(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_sST()); + sliceProfile.setCsAvailabilityTarget(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_cSAvailabilityTarget()); + sliceProfile.setCsReliabilityMeanTime(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_cSReliabilityMeanTime()); + sliceProfile.setExpDataRate(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_expDataRate()); + sliceProfile.setMsgSizeByte(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_msgSizeByte()); + sliceProfile.setTransferIntervalTarget(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_transferIntervalTarget()); + sliceProfile.setSurvivalTime(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_survivalTime()); + sliceProfile.setIpAddress(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_ipAddress()); + sliceProfile.setLogicInterfaceId(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_logicInterfaceId()); + sliceProfile.setNextHopInfo(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_AN_nextHopInfo()); + anSliceTaskInfo.setSliceProfile(sliceProfile); + sliceTaskParams.setAnSliceTaskInfo(anSliceTaskInfo); + + TnBHSliceTaskInfo tnBHSliceTaskInfo = new TnBHSliceTaskInfo(); + SliceProfile tnSliceProfile = new SliceProfile(); + tnBHSliceTaskInfo.setSuggestNssiId(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnBhSuggestNssiId()); + tnBHSliceTaskInfo.setSuggestNSSIName(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnBhSuggestNssiName()); + tnSliceProfile.setMaxBandwidth(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnBhBandwidth()); + tnSliceProfile.setLatency(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnBhLatency()); + tnBHSliceTaskInfo.setScriptName(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnBhScriptName()); + tnBHSliceTaskInfo.setEnableNSSISelection(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getTnEnableNSSISelection()); + tnSliceProfile.setJitter(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_jitte()); + tnSliceProfile.setPLMNIdList(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_pLMNIdList()); + tnSliceProfile.setSNSSAIList(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_sNSSAI()); + tnSliceProfile.setSST(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_sST()); + tnBHSliceTaskInfo.setSliceProfile(tnSliceProfile); + sliceTaskParams.setTnBHSliceTaskInfo(tnBHSliceTaskInfo); + + CnSliceTaskInfo cnSliceTaskInfo = new CnSliceTaskInfo(); + SliceProfile cnSliceProfile = new SliceProfile(); + cnSliceTaskInfo.setSuggestNssiId(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnSuggestNssiId()); + cnSliceTaskInfo.setSuggestNSSIName(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnSuggestNssiName()); + cnSliceProfile.setSNSSAIList(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnServiceSnssai()); + cnSliceProfile.setResourceSharingLevel(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnResourceSharingLevel()); + cnSliceProfile.setUeMobilityLevel(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnUeMobilityLevel()); + cnSliceProfile.setLatency(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnLatency()); + cnSliceProfile.setMaxNumberOfUEs(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnMaxNumberOfUes()); + cnSliceProfile.setActivityFactor(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnActivityFactor()); + cnSliceProfile.setExpDataRateDL( sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnExpDataRateDl()); + cnSliceProfile.setExpDataRateUL(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnExpDataRateUl()); + cnSliceProfile.setAreaTrafficCapDL(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnAreaTrafficCapDl()); + cnSliceProfile.setAreaTrafficCapUL(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnAreaTrafficCapUl()); + cnSliceTaskInfo.setScriptName(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnScriptName()); + cnSliceTaskInfo.setEnableNSSISelection(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getCnEnableNSSISelection()); + cnSliceProfile.setMaxNumberOfPDUSession(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_maxNumberofPDUSession()); + cnSliceProfile.setOverallUserDensity(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_overallUserDensity()); + cnSliceProfile.setCoverageAreaTAList(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_coverageAreaTAList()); + cnSliceProfile.setSST(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_sST()); + cnSliceProfile.setCsAvailabilityTarget(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_cSAvailabilityTarget()); + cnSliceProfile.setCsReliabilityMeanTime(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_cSReliabilityMeanTime()); + cnSliceProfile.setExpDataRate(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_expDataRate()); + cnSliceProfile.setMsgSizeByte(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_msgSizeByte()); + cnSliceProfile.setTransferIntervalTarget(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_transferIntervalTarget()); + cnSliceProfile.setSurvivalTime(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_survivalTime()); + cnSliceProfile.setIpAddress(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_ipAddress()); + cnSliceProfile.setLogicInterfaceId(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_logicInterfaceId()); + cnSliceProfile.setNextHopInfo(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_CN_nextHopInfo()); + cnSliceTaskInfo.setSliceProfile(cnSliceProfile); + sliceTaskParams.setCnSliceTaskInfo(cnSliceTaskInfo); + + targetSoTaskInfo.setSliceTaskParams(sliceTaskParams); } String getAreaTaListString(List anCoverageAreaTaList, char separator) { @@ -329,73 +344,55 @@ public class TaskMgtServiceConvert { slicingTaskCreationInfo.setProcessingStatus(soTask.getStatus()); slicingTaskCreationInfo.setTaskName(soTask.getName()); - JSONObject paramsObject = JSON.parseObject(soTask.getParams()); - if (paramsObject == null) { + SliceTaskParams sliceTaskParams = soTask.getSliceTaskParams(); + if (sliceTaskParams == null) { logger.error("convertTaskCreationInfo: paramsObject is null"); return; } BusinessDemandInfo businessDemandInfo = new BusinessDemandInfo(); - convertBusinessDemandInfo(businessDemandInfo, paramsObject); + convertBusinessDemandInfo(businessDemandInfo, sliceTaskParams); slicingTaskCreationInfo.setBusinessDemandInfo(businessDemandInfo); NstInfo nstInfo = new NstInfo(); - convertNstInfo(nstInfo, paramsObject); + convertNstInfo(nstInfo, sliceTaskParams); slicingTaskCreationInfo.setNstInfo(nstInfo); } - void convertCreationBusinessDemandInfo(BusinessDemandInfo targetBusinessDemandInfo, JSONObject paramsObject) { - targetBusinessDemandInfo.setServiceName(paramsObject.getString("ServiceName")); - targetBusinessDemandInfo.setServiceSnssai(paramsObject.getString("ServiceProfile.sNSSAI")); - targetBusinessDemandInfo.setExpDataRateDL(paramsObject.getString("ServiceProfile.expDataRateDL")); - targetBusinessDemandInfo.setExpDataRateUL(paramsObject.getString("ServiceProfile.expDataRateUL")); - targetBusinessDemandInfo.setUeMobilityLevel(paramsObject.getString("ServiceProfile.uEMobilityLevel")); - targetBusinessDemandInfo.setLatency(paramsObject.getString("ServiceProfile.latency")); - String useInterval = generalConvert.getUseInterval(paramsObject.getString("ServiceId")); - targetBusinessDemandInfo.setUseInterval(useInterval); - String coverageAreaTA = paramsObject.getString("ServiceProfile.coverageAreaTAList"); - targetBusinessDemandInfo.setCoverageAreaTaList(generalConvert.getAreaTaList(coverageAreaTA)); - targetBusinessDemandInfo.setActivityFactor(paramsObject.getString("ServiceProfile.activityFactor")); - targetBusinessDemandInfo.setResourceSharingLevel(paramsObject.getString("ServiceProfile.resourceSharingLevel")); - targetBusinessDemandInfo.setAreaTrafficCapDL(paramsObject.getString("ServiceProfile.areaTrafficCapDL")); - targetBusinessDemandInfo.setAreaTrafficCapUL(paramsObject.getString("ServiceProfile.areaTrafficCapUL")); - targetBusinessDemandInfo.setMaxNumberOfUEs(paramsObject.getString("ServiceProfile.maxNumberofUEs")); - } void convertTaskCreationProgress(SlicingTaskCreationProgress slicingTaskCreationProgress, SOTask soTask) { - JSONObject paramsObject = JSON.parseObject(soTask.getParams()); - if (paramsObject == null) { + SliceTaskParams sliceTaskParams = soTask.getSliceTaskParams(); + if (sliceTaskParams == null) { logger.error("convertTaskCreationProgress: paramsObject is null"); return; } - - String anProgress = paramsObject.getString("AN.progress"); + String anProgress = sliceTaskParams.getAnSliceTaskInfo().getProgress(); slicingTaskCreationProgress.setAnProgress(anProgress); - String tnProgress = paramsObject.getString("TN.BH.progress"); + String tnProgress = sliceTaskParams.getTnBHSliceTaskInfo().getProgress(); slicingTaskCreationProgress.setTnProgress(tnProgress); - String cnProgress = paramsObject.getString("CN.progress"); + String cnProgress = sliceTaskParams.getCnSliceTaskInfo().getProgress(); slicingTaskCreationProgress.setCnProgress(cnProgress); - String anStatus = paramsObject.getString("AN.status"); + String anStatus =sliceTaskParams.getAnSliceTaskInfo().getStatus(); slicingTaskCreationProgress.setAnStatus(anStatus); - String tnStatus = paramsObject.getString("TN.BH.status"); + String tnStatus = sliceTaskParams.getTnBHSliceTaskInfo().getStatus(); slicingTaskCreationProgress.setTnStatus(tnStatus); - String cnStatus = paramsObject.getString("CN.status"); + String cnStatus =sliceTaskParams.getCnSliceTaskInfo().getStatus(); slicingTaskCreationProgress.setCnStatus(cnStatus); - String anStatusDescription = paramsObject.getString("AN.statusDescription"); + String anStatusDescription =sliceTaskParams.getAnSliceTaskInfo().getStatusDescription(); slicingTaskCreationProgress.setAnStatusDescription(anStatusDescription); - String tnStatusDescription = paramsObject.getString("TN.BH.statusDescription"); + String tnStatusDescription = sliceTaskParams.getTnBHSliceTaskInfo().getStatusDescription(); slicingTaskCreationProgress.setTnStatusDescription(tnStatusDescription); - String cnStatusDescription = paramsObject.getString("CN.statusDescription"); + String cnStatusDescription =sliceTaskParams.getCnSliceTaskInfo().getStatusDescription(); slicingTaskCreationProgress.setCnStatusDescription(cnStatusDescription); } } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImpl.java index 1e0b4cee..e9f46972 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImpl.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImpl.java @@ -27,6 +27,7 @@ import javax.annotation.Resource; import okhttp3.MediaType; import okhttp3.RequestBody; import okhttp3.ResponseBody; +import org.apache.commons.beanutils.BeanUtils; import org.onap.usecaseui.server.bean.nsmf.common.ResultHeader; import org.onap.usecaseui.server.bean.nsmf.common.ServiceResult; import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskAuditInfo; @@ -39,6 +40,19 @@ import org.onap.usecaseui.server.service.nsmf.TaskMgtService; import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService; import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTask; import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTaskRsp; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.SliceTaskParams; +import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.ConnectionLink; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.ConnectionLinkList; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.EndPointInfoList; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.NetworkPolicy; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.Relationship; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.RelationshipData; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo.ConnectionListVo; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo.ConnectionVo; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo.EndPointInfoListVo; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo.PropertiesVo; + import org.onap.usecaseui.server.util.RestfulServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,6 +60,13 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import retrofit2.Response; +import javax.annotation.Resource; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Type; +import java.util.List; +import java.util.stream.Collectors; + @Service("TaskMgtService") @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy @@ -58,12 +79,18 @@ public class TaskMgtServiceImpl implements TaskMgtService { private SOSliceService soSliceService; + private AAISliceService aaiSliceService; + + public TaskMgtServiceImpl() { - this(RestfulServices.create(SOSliceService.class)); + this(RestfulServices.create(SOSliceService.class),RestfulServices.create(AAISliceService.class)); + } - public TaskMgtServiceImpl(SOSliceService soSliceService) { + public TaskMgtServiceImpl(SOSliceService soSliceService,AAISliceService aaiSliceService) { this.soSliceService = soSliceService; + this.aaiSliceService = aaiSliceService; + } @Override @@ -194,12 +221,12 @@ public class TaskMgtServiceImpl implements TaskMgtService { ResultHeader resultHeader = new ResultHeader(); String resultMsg; try { - // TODO Response response = this.soSliceService.getTaskById(slicingTaskAuditInfo.getTaskId()).execute(); if (response.isSuccessful()) { SOTask soTaskInfo = response.body(); Gson gson = new Gson(); logger.info("updateTaskAuditInfo: getTaskById response is:{}", gson.toJson(soTaskInfo)); + taskMgtServiceConvert.convertTaskAuditToSoTask(soTaskInfo, slicingTaskAuditInfo); String jsonstr = JSON.toJSONString(soTaskInfo); @@ -257,12 +284,12 @@ public class TaskMgtServiceImpl implements TaskMgtService { String resultMsg; try { - // TODO Response response = this.soSliceService.getTaskByIdD(taskId).execute(); if (response.isSuccessful()) { Gson gson = new Gson(); SOTask soTask = response.body(); logger.info("updateTaskAuditInfo: getTaskById response is:{}", gson.toJson(soTask)); + taskMgtServiceConvert.convertTaskCreationInfo(slicingTaskCreationInfo, soTask); // return normal result code resultMsg = "5G slicing task creation infomation query result."; @@ -298,7 +325,6 @@ public class TaskMgtServiceImpl implements TaskMgtService { String resultMsg; try { - // TODO Response response = this.soSliceService.getTaskByIdD(taskId).execute(); if (response.isSuccessful()) { SOTask soTask = response.body(); @@ -327,4 +353,73 @@ public class TaskMgtServiceImpl implements TaskMgtService { serviceResult.setResult_body(slicingTaskCreationProgress); return serviceResult; } + + @Override + public ServiceResult queryConnectionLinks() { + ServiceResult serviceResult = new ServiceResult(); + ResultHeader resultHeader = new ResultHeader(); + String resultMsg =""; + + ConnectionLinkList connectionLinkList = new ConnectionLinkList(); + ConnectionVo connectionVo = new ConnectionVo(); + ConnectionListVo connectionListVo = new ConnectionListVo(); + try { + Response response = this.aaiSliceService.getConnectionLinks().execute(); + if(response.isSuccessful()){ + connectionLinkList = response.body(); + logger.info(connectionLinkList.toString()); + List connectionLinks = connectionLinkList.getLogicalLink(); + List tsciConnectionLink = connectionLinks.stream().filter(e -> e.getLinkType().equals("TsciConnectionLink") && e.getRelationshipList()!=null).collect(Collectors.toList()); + for (ConnectionLink connectionLink : tsciConnectionLink) { + Response anInfo = this.aaiSliceService.getEndpointByLinkName(connectionLink.getLinkName()).execute(); + Response cnInfo = this.aaiSliceService.getEndpointByLinkName2(connectionLink.getLinkName2()).execute(); + + PropertiesVo propertiesVo = new PropertiesVo(); + List relationshipDataList = connectionLink.getRelationshipList().getRelationship().get(0).getRelationshipDataList(); + List allottedResourceId = relationshipDataList.stream().filter(e -> e.getRelationshipKey().equals("allotted-resource.id")).collect(Collectors.toList()); + List serviceInstanceId = relationshipDataList.stream().filter(e -> e.getRelationshipKey().equals("service-instance.service-instance-id")).collect(Collectors.toList()); + Response AllottedResource=this.aaiSliceService.getAllottedResource(serviceInstanceId.get(0).getRelationshipValue(),allottedResourceId.get(0).getRelationshipValue()).execute(); + List relationships= AllottedResource.body().getRelationshipList().getRelationship().stream().filter(a-> a.getRelatedTo().equals("network-policy")).collect(Collectors.toList()); + List networkPolicyId=relationships.get(0).getRelationshipDataList().stream().filter(e -> e.getRelationshipKey().equals("network-policy.network-policy-id")).collect(Collectors.toList()); + Response networkPolicy=this.aaiSliceService.getNetworkPolicy(networkPolicyId.get(0).getRelationshipValue()).execute(); + propertiesVo.setJitter(networkPolicy.body().getJitter()); + propertiesVo.setLatency(networkPolicy.body().getLatency()); + propertiesVo.setMaxBandwidth(networkPolicy.body().getMaxBandwidth()); + Response serviceInstance=this.aaiSliceService.getServiceInstance(serviceInstanceId.get(0).getRelationshipValue()).execute(); + propertiesVo.setResourceSharingLevel(serviceInstance.body().getServiceFunction()); + + connectionListVo.setLinkId(connectionLink.getLinkId()); + EndPointInfoListVo anInfoVo = new EndPointInfoListVo(); + EndPointInfoListVo cnInfoVo = new EndPointInfoListVo(); + BeanUtils.copyProperties(anInfoVo,anInfo.body()); + BeanUtils.copyProperties(cnInfoVo,cnInfo.body()); + connectionListVo.setAnInfo(anInfoVo); + connectionListVo.setCnInfo(cnInfoVo); + connectionListVo.setProperties(propertiesVo); + + + } + connectionVo.setRecord_number(tsciConnectionLink.size()+""); + connectionVo.setConnection_links_list(connectionListVo); + resultMsg = "ConnectionLinks query result."; + resultHeader.setResult_code(NsmfCodeConstant.SUCCESS_CODE); + }else { + logger.error(String + .format("queryConnectionLinks: Can not get ConnectionLinks[code={}, message={}]", + response.code(), response.message())); + resultMsg = "ConnectionLinks progress query failed."; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + } + } catch (Exception e) { + resultMsg = "ConnectionLinks progress query failed. Unknown exception occurred!"; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + logger.error(e.getMessage()); + } + logger.info(resultMsg); + logger.info("queryConnectionLinks: ConnectionLinks progress has been finished."); + resultHeader.setResult_message(resultMsg); + serviceResult.setResult_header(resultHeader); + serviceResult.setResult_body(connectionVo); + return serviceResult; + } } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/AAISliceService.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/AAISliceService.java index 6efcfdc9..f8cae8d6 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/AAISliceService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/AAISliceService.java @@ -18,6 +18,11 @@ package org.onap.usecaseui.server.service.slicingdomain.aai; import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceNST; import com.alibaba.fastjson.JSONObject; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceNST; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.ConnectionLink; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.ConnectionLinkList; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.EndPointInfoList; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.NetworkPolicy; import retrofit2.Call; import retrofit2.http.GET; @@ -167,11 +172,65 @@ public interface AAISliceService { @Path("model-version-id") String modelVersionId); @Headers({ - "X-TransactionId: 9999", - "X-FromAppId: MSO", - "Authorization: Basic QUFJOkFBSQ==", - "Accept: application/json" + "X-TransactionId: 9999", + "X-FromAppId: MSO", + "Authorization: Basic QUFJOkFBSQ==", + "Accept: application/json" }) @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=communication-service") Call listOrders(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType); + + @Headers({ + "X-TransactionId: 9999", + "X-FromAppId: MSO", + "Authorization: Basic QUFJOkFBSQ==", + "Accept: application/json" + }) + @GET("/api/aai-network/v21/logical-links") + Call getConnectionLinks(); + + @Headers({ + "X-TransactionId: 9999", + "X-FromAppId: MSO", + "Authorization: Basic QUFJOkFBSQ==", + "Accept: application/json" + }) + @GET("/api/aai-network/v21/network-routes/network-route/{route-id}") + Call getEndpointByLinkName(@Path("route-id") String linkName); + + @Headers({ + "X-TransactionId: 9999", + "X-FromAppId: MSO", + "Authorization: Basic QUFJOkFBSQ==", + "Accept: application/json" + }) + @GET("/api/aai-network/v21/network-routes/network-route/{route-id}") + Call getEndpointByLinkName2(@Path("route-id") String linkName2); + + @Headers({ + "X-TransactionId: 9999", + "X-FromAppId: MSO", + "Authorization: Basic QUFJOkFBSQ==", + "Accept: application/json" + }) + @GET("/api/aai-business/v21/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/{service-instance-id}/allotted-resources/allotted-resource/{allotted-resource-id}") + Call getAllottedResource(@Path("service-instance-id") String serviceInstancesId,@Path("allotted-resource-id") String allottedResourceId); + + @Headers({ + "X-TransactionId: 9999", + "X-FromAppId: MSO", + "Authorization: Basic QUFJOkFBSQ==", + "Accept: application/json" + }) + @GET("/api/aai-business/v21/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/{service-instance-id}") + Call getServiceInstance(@Path("service-instance-id") String serviceInstancesId); + + @Headers({ + "X-TransactionId: 9999", + "X-FromAppId: MSO", + "Authorization: Basic QUFJOkFBSQ==", + "Accept: application/json" + }) + @GET("/api/aai-network/v21/network-policies/network-policy/{network-policy-id}") + Call getNetworkPolicy(@Path("network-policy-id")String relationshipValue); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/ConnectionLink.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/ConnectionLink.java new file mode 100644 index 00000000..8c86e7a9 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/ConnectionLink.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class ConnectionLink { + @JsonProperty("link-name") + private String linkName; + @JsonProperty("in-maint") + private String inMaint; + @JsonProperty("link-type") + private String linkType; + @JsonProperty("resource-version") + private String resourceVersion; + @JsonProperty("link-name2") + private String linkName2; + @JsonProperty("link-id") + private String linkId; + @JsonProperty("service-function") + private String serviceFunction; + @JsonProperty("relationship-list") + private RelationshipList relationshipList; + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/ConnectionLinkList.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/ConnectionLinkList.java new file mode 100644 index 00000000..a1018a9b --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/ConnectionLinkList.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class ConnectionLinkList { + + @JsonProperty("logical-link") + private List logicalLink; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/EndPointInfoList.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/EndPointInfoList.java new file mode 100644 index 00000000..69c92884 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/EndPointInfoList.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class EndPointInfoList { + + + @JsonProperty("ip-address") + private String ipAddress; + @JsonProperty("logic-id") + private String logicId; + @JsonProperty("next-hop") + private String nextHop; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/NetworkPolicy.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/NetworkPolicy.java new file mode 100644 index 00000000..11ccb15a --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/NetworkPolicy.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class NetworkPolicy { + @JsonProperty("latency") + private String latency; + @JsonProperty("jitter") + private String jitter; + @JsonProperty("max-bandwidth") + private String maxBandwidth; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/Relationship.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/Relationship.java new file mode 100644 index 00000000..49cace3f --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/Relationship.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class Relationship { + @JsonProperty("related-to") + private String relatedTo; + @JsonProperty("relationship-label") + private String relationshipLabel; + @JsonProperty("related-link") + private String relatedLink; + @JsonProperty("relationship-data") + private List relationshipDataList; + + + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelationshipData.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelationshipData.java new file mode 100644 index 00000000..7efd3012 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelationshipData.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class RelationshipData { + @JsonProperty("relationship-key") + private String relationshipKey; + @JsonProperty("relationship-value") + private String relationshipValue; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelationshipList.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelationshipList.java new file mode 100644 index 00000000..248c04c8 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelationshipList.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class RelationshipList { + @JsonProperty("relationship") + private List relationship; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionListVo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionListVo.java new file mode 100644 index 00000000..f1f4e0e4 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionListVo.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class ConnectionListVo { + + private String linkId; + + private EndPointInfoListVo anInfo; + + private EndPointInfoListVo cnInfo; + + private PropertiesVo properties; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionVo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionVo.java new file mode 100644 index 00000000..b1ed4d5b --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionVo.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; +import lombok.Setter; + + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class ConnectionVo { + private String record_number; + + private ConnectionListVo connection_links_list; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/EndPointInfoListVo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/EndPointInfoListVo.java new file mode 100644 index 00000000..6f8872fa --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/EndPointInfoListVo.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class EndPointInfoListVo { + + + private String ipAddress; + private String logicId; + private String nextHop; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/PropertiesVo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/PropertiesVo.java new file mode 100644 index 00000000..5a21d9e2 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/PropertiesVo.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class PropertiesVo { + + private String latency; + + private String jitter; + + private String maxBandwidth; + + private String resourceSharingLevel; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/AnSliceTaskInfo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/AnSliceTaskInfo.java new file mode 100644 index 00000000..ac02a4b8 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/AnSliceTaskInfo.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.so.bean; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class AnSliceTaskInfo { + private String suggestNssiId; + private String suggestNSSIName; + private String progress; + private String status; + private String statusDescription; + private SliceProfile sliceProfile ; + private String scriptName ; + private Boolean enableNSSISelection ; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/CnSliceTaskInfo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/CnSliceTaskInfo.java new file mode 100644 index 00000000..37d67756 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/CnSliceTaskInfo.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.so.bean; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class CnSliceTaskInfo { + private String suggestNssiId; + private String suggestNSSIName; + private String progress; + private String status; + private String statusDescription; + private SliceProfile sliceProfile ; + private String scriptName ; + private Boolean enableNSSISelection ; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTask.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTask.java index 0fd5684f..beb39f3c 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTask.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTask.java @@ -32,7 +32,7 @@ public class SOTask { private String isManual; - private String params; + private SliceTaskParams sliceTaskParams; public String getStatus() { @@ -85,13 +85,11 @@ public class SOTask { this.isManual = isManual; } - public String getParams() { - return params; + public SliceTaskParams getSliceTaskParams() { + return sliceTaskParams; } - public void setParams(String params) { - this.params = params; + public void setSliceTaskParams(SliceTaskParams sliceTaskParams) { + this.sliceTaskParams = sliceTaskParams; } - - } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/ServiceProfile.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/ServiceProfile.java new file mode 100644 index 00000000..e37897cc --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/ServiceProfile.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.so.bean; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class ServiceProfile { + + private String termDensity; + private String maxPktSize; + private String maxNumberofUEs; + private String survivalTime; + private String reliability; + private String latency; + private String dLThptPerSlice; + private String availability; + private String sNSSAI; + private String jitter; + private String sST; + private String maxNumberofConns; + private String dLThptPerUE; + private String uEMobilityLevel; + private String uLThptPerUE; + private String pLMNIdList; + private String coverageAreaTAList; + private String uLThptPerSlice; + private String activityFactor; + private String resourceSharingLevel; + private String expDataRateDL; + private String expDataRateUL; + private String areaTrafficCapDL; + private String areaTrafficCapUL; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SliceProfile.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SliceProfile.java new file mode 100644 index 00000000..980a3378 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SliceProfile.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.so.bean; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class SliceProfile { + + private String sliceProfileId; + private String sNSSAIList; + private String pLMNIdList; + private String maxNumberOfUEs; + private String coverageAreaTAList; + private String latency; + private String ueMobilityLevel; + private String resourceSharingLevel; + private String maxBandwidth; + private String sST; + private String activityFactor; + private String survivalTime; + private String expDataRateUL; + private String expDataRateDL; + private String areaTrafficCapUL; + private String areaTrafficCapDL; + private String jitter; + private String csAvailabilityTarget; + private String expDataRate; + private String maxNumberOfPDUSession; + private String overallUserDensity; + private String csReliabilityMeanTime; + private String msgSizeByte; + private String transferIntervalTarget; + private String ipAddress; + private String logicInterfaceId; + private String nextHopInfo; + @JsonProperty("5QI") + private String an5qi; + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SliceTaskParams.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SliceTaskParams.java new file mode 100644 index 00000000..89088e97 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SliceTaskParams.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.so.bean; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class SliceTaskParams { + private String serviceId; + private String serviceName; + private String nstId; + private String nstName; + private ServiceProfile serviceProfile; + private String suggestNsiId; + private String suggestNSIName; + private TnBHSliceTaskInfo tnBHSliceTaskInfo; + private TnMHSliceTaskInfo tnMHSliceTaskInfo; + private TnFHSliceTaskInfo tnFHSliceTaskInfo; + private CnSliceTaskInfo cnSliceTaskInfo; + private AnSliceTaskInfo anSliceTaskInfo; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnBHSliceTaskInfo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnBHSliceTaskInfo.java new file mode 100644 index 00000000..e68496dc --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnBHSliceTaskInfo.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.so.bean; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class TnBHSliceTaskInfo { + private String suggestNssiId; + private String suggestNSSIName; + private String progress; + private String status; + private String statusDescription; + private SliceProfile sliceProfile ; + private String scriptName ; + private Boolean enableNSSISelection ; + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnFHSliceTaskInfo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnFHSliceTaskInfo.java new file mode 100644 index 00000000..a31bb6f4 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnFHSliceTaskInfo.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.so.bean; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class TnFHSliceTaskInfo { + private SliceProfile sliceProfile ; + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnMHSliceTaskInfo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnMHSliceTaskInfo.java new file mode 100644 index 00000000..5941680e --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/TnMHSliceTaskInfo.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2021 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.usecaseui.server.service.slicingdomain.so.bean; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class TnMHSliceTaskInfo { + private SliceProfile sliceProfile ; + +} diff --git a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvertTest.java b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvertTest.java index f14a84fe..b0216c8c 100644 --- a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvertTest.java +++ b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceConvertTest.java @@ -33,33 +33,48 @@ import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskCreationProgress; import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskList; import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService; import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.AnSliceTaskInfo; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.CnSliceTaskInfo; import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTask; import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTaskRsp; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.ServiceProfile; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.SliceProfile; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.SliceTaskParams; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.TnBHSliceTaskInfo; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; public class TaskMgtServiceConvertTest { TaskMgtServiceConvert taskMgtServiceConvert = null; AAISliceService aaiSliceService; + GeneralConvertImpl generalConvert; @Before public void before() throws Exception { aaiSliceService = mock(AAISliceService.class); + generalConvert = mock(GeneralConvertImpl.class); taskMgtServiceConvert = new TaskMgtServiceConvert(aaiSliceService); + taskMgtServiceConvert.setGeneralConvert(generalConvert); } @Test public void itCanConvertSlicingTaskList() { SlicingTaskList targetSlicingTaskList = new SlicingTaskList(); SOTaskRsp soTaskRsp = new SOTaskRsp(); - SOTaskRsp soTaskRspSuc = new SOTaskRsp(); List task = new ArrayList<>(); SOTask soTask = new SOTask(); + SliceTaskParams sliceTaskParams = new SliceTaskParams(); + ServiceProfile serviceProfile = new ServiceProfile(); + sliceTaskParams.setServiceProfile(serviceProfile); + soTask.setSliceTaskParams(sliceTaskParams); task.add(soTask); - soTaskRspSuc.setTask(task); + soTaskRsp.setTask(task); try { taskMgtServiceConvert.convertSlicingTaskList(targetSlicingTaskList, soTaskRsp, 1, 100); - taskMgtServiceConvert.convertSlicingTaskList(targetSlicingTaskList, soTaskRspSuc, 1, 100); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { @@ -71,8 +86,21 @@ public class TaskMgtServiceConvertTest { public void itCanConvertTaskAuditInfo() { SlicingTaskAuditInfo targetSlicingTaskAuditInfo = new SlicingTaskAuditInfo(); SOTask sourceSoTaskInfo = new SOTask(); - String params = "{\"globalSubscriberId\":\"5GCustomer\",\"serviceType\":\"5G\"}"; - sourceSoTaskInfo.setParams(params); + SliceProfile sliceProfile = new SliceProfile(); + AnSliceTaskInfo anSliceTaskInfo = new AnSliceTaskInfo(); + anSliceTaskInfo.setSliceProfile(sliceProfile); + TnBHSliceTaskInfo tnBHSliceTaskInfo = new TnBHSliceTaskInfo(); + tnBHSliceTaskInfo.setSliceProfile(sliceProfile); + CnSliceTaskInfo cnSliceTaskInfo = new CnSliceTaskInfo(); + cnSliceTaskInfo.setSliceProfile(sliceProfile); + ServiceProfile serviceProfile = new ServiceProfile(); + SliceTaskParams sliceTaskParams = new SliceTaskParams(); + sliceTaskParams.setAnSliceTaskInfo(anSliceTaskInfo); + sliceTaskParams.setTnBHSliceTaskInfo(tnBHSliceTaskInfo); + sliceTaskParams.setCnSliceTaskInfo(cnSliceTaskInfo); + sliceTaskParams.setServiceProfile(serviceProfile); + sliceTaskParams.setSuggestNSIName("123"); + sourceSoTaskInfo.setSliceTaskParams(sliceTaskParams); taskMgtServiceConvert.convertTaskAuditInfo(targetSlicingTaskAuditInfo, sourceSoTaskInfo); } @@ -80,25 +108,37 @@ public class TaskMgtServiceConvertTest { @Test public void itCanConvertBusinessDemandInfo() { BusinessDemandInfo targetBusinessDemandInfo = new BusinessDemandInfo(); - JSONObject paramsObject = new JSONObject(); + SliceTaskParams sliceTaskParams = new SliceTaskParams(); + ServiceProfile serviceProfile = new ServiceProfile(); + sliceTaskParams.setServiceProfile(serviceProfile); - taskMgtServiceConvert.convertBusinessDemandInfo(targetBusinessDemandInfo, paramsObject); + taskMgtServiceConvert.convertBusinessDemandInfo(targetBusinessDemandInfo, sliceTaskParams); } @Test public void itCanConvertNstInfo() { NstInfo nstInfo = new NstInfo(); - JSONObject paramsObject = new JSONObject(); + SliceTaskParams sliceTaskParams = new SliceTaskParams(); - taskMgtServiceConvert.convertNstInfo(nstInfo, paramsObject); + taskMgtServiceConvert.convertNstInfo(nstInfo, sliceTaskParams); } @Test public void itCanConvertNsiAndSubNssiInfo() { NsiAndSubNssiInfo nsiAndSubNssiInfo = new NsiAndSubNssiInfo(); - JSONObject paramsObject = new JSONObject(); - - taskMgtServiceConvert.convertNsiAndSubNssiInfo(nsiAndSubNssiInfo, paramsObject); + SliceProfile sliceProfile = new SliceProfile(); + AnSliceTaskInfo anSliceTaskInfo = new AnSliceTaskInfo(); + anSliceTaskInfo.setSliceProfile(sliceProfile); + TnBHSliceTaskInfo tnBHSliceTaskInfo = new TnBHSliceTaskInfo(); + tnBHSliceTaskInfo.setSliceProfile(sliceProfile); + CnSliceTaskInfo cnSliceTaskInfo = new CnSliceTaskInfo(); + cnSliceTaskInfo.setSliceProfile(sliceProfile); + SliceTaskParams sliceTaskParams = new SliceTaskParams(); + sliceTaskParams.setAnSliceTaskInfo(anSliceTaskInfo); + sliceTaskParams.setTnBHSliceTaskInfo(tnBHSliceTaskInfo); + sliceTaskParams.setCnSliceTaskInfo(cnSliceTaskInfo); + + taskMgtServiceConvert.convertNsiAndSubNssiInfo(nsiAndSubNssiInfo, sliceTaskParams); } @Test @@ -139,36 +179,6 @@ public class TaskMgtServiceConvertTest { nsiAndSubNssiInfo.setAn5qi("er4"); nsiAndSubNssiInfo.setAnScriptName("scriptTest"); sourceSlicingTaskAuditInfoSuc.setNsiAndSubNssiInfo(nsiAndSubNssiInfo); - targetSoTaskInfo.setParams("{\n" - + "\t\t\"ServiceId\": \"46da8cf8-0878-48ac-bea3-f2200959411a\",\n" - + "\t\t\"ServiceName\": \"eMBB E2EService\",\n" - + "\t\t\"NSTId\": \"46da8cf8-0878-48ac-bea3-f2200959411a\",\n" - + "\t\t\"NSTName\": \"eMBB NST\",\n" - + "\t\t\"AN.ScriptName\": \"an script\",\n" - + "\t\t\"TN.ScriptName\": \"tn script\",\n" - + "\t\t\"CN.ScriptName\": \"cn_script\",\n" - + "\t\t\"ServiceProfile.S-NSSAI\": \"1-010101\",\n" - + "\t\t\"ServiceProfile.sST\": \"eMBB\",\n" - + "\t\t\"ServiceProfile.nsMaxNumberofUEs\": \"100000\",\n" - + "\t\t\"ServiceProfile.nsCoverageAreaTAList\": \"xxxx;xxxxx;xxxxx\",\n" - + "\t\t\"ServiceProfile.nsLatency\": \"30\",\n" - + "\t\t\"ServiceProfile.nsUEMobilityLevel\": \"stageary\",\n" - + "\t\t\"ServiceProfile.nsResourceSharingLevel\": \"shared\",\n" - + "\t\t\"ServiceProfile.nsPerfReq.expDataRateDL\": \"300\",\n" - + "\t\t\"ServiceProfile.nsPerfReq.expDataRateUL\": \"300\",\n" - + "\t\t\"ServiceProfile.nsPerfReq.areaTrafficCapDL\": \"300\",\n" - + "\t\t\"ServiceProfile.nsPerfReq.areaTrafficCapUL\": \"300\",\n" - + "\t\t\"ServiceProfile.nsPerfReq.activityFactor\": \"60\",\n" - + "\t\t\"AN.progress\": 40,\n" - + "\t\t\"AN.status\": \"processing\",\n" - + "\t\t\"AN.statusDescription\": \"5QI instantiating\",\n" - + "\t\t\"TN.progress\": 30,\n" - + "\t\t\"TN.status\": \"processing\",\n" - + "\t\t\"TN.statusDescription\": \"L3VPN creating\",\n" - + "\t\t\"CN.progress\": 40,\n" - + "\t\t\"CN.status\": \"processing\",\n" - + "\t\t\"CN.statusDescription\": \"VNF processing\"\n" - + "\t}"); taskMgtServiceConvert.convertTaskAuditToSoTask(targetSoTaskInfo, sourceSlicingTaskAuditInfoSuc); } @@ -187,20 +197,23 @@ public class TaskMgtServiceConvertTest { SlicingTaskCreationInfo slicingTaskCreationInfo = new SlicingTaskCreationInfo(); SOTask sourceSoTaskInfo = new SOTask(); - String params = "{\"globalSubscriberId\":\"5GCustomer\",\"serviceType\":\"5G\"}"; - sourceSoTaskInfo.setParams(params); + SliceProfile sliceProfile = new SliceProfile(); + AnSliceTaskInfo anSliceTaskInfo = new AnSliceTaskInfo(); + anSliceTaskInfo.setSliceProfile(sliceProfile); + TnBHSliceTaskInfo tnBHSliceTaskInfo = new TnBHSliceTaskInfo(); + tnBHSliceTaskInfo.setSliceProfile(sliceProfile); + CnSliceTaskInfo cnSliceTaskInfo = new CnSliceTaskInfo(); + cnSliceTaskInfo.setSliceProfile(sliceProfile); + ServiceProfile serviceProfile = new ServiceProfile(); + SliceTaskParams sliceTaskParams = new SliceTaskParams(); + sliceTaskParams.setAnSliceTaskInfo(anSliceTaskInfo); + sliceTaskParams.setTnBHSliceTaskInfo(tnBHSliceTaskInfo); + sliceTaskParams.setCnSliceTaskInfo(cnSliceTaskInfo); + sliceTaskParams.setServiceProfile(serviceProfile); + sourceSoTaskInfo.setSliceTaskParams(sliceTaskParams); taskMgtServiceConvert.convertTaskCreationInfo(slicingTaskCreationInfo, sourceSoTaskInfo); } - @Test - public void itCanConvertCreationBusinessDemandInfo() { - - BusinessDemandInfo targetBusinessDemandInfo = new BusinessDemandInfo(); - JSONObject paramsObject = new JSONObject(); - - taskMgtServiceConvert.convertCreationBusinessDemandInfo(targetBusinessDemandInfo, paramsObject); - } - @Test public void itCanConvertTaskCreationProgress() { @@ -209,14 +222,14 @@ public class TaskMgtServiceConvertTest { taskMgtServiceConvert.convertTaskCreationProgress(slicingTaskCreationProgress, soTask); SOTask soTaskSuc = new SOTask(); - soTaskSuc.setParams("{\n" - + "\t\"AN.progress\": \"99\",\n" - + "\t\"TN.progress\": \"99\",\n" - + "\t\"CN.progress\": \"2020-02-10T09:22:58.000+0000\",\n" - + "\t\"AN.status\": \"WaitingToConfirm\",\n" - + "\t\"TN.status\": \"WaitingToConfirm\",\n" - + "\t\"CN.status\": \"WaitingToConfirm\"\n" - + "}"); + AnSliceTaskInfo anSliceTaskInfo = new AnSliceTaskInfo(); + TnBHSliceTaskInfo tnBHSliceTaskInfo = new TnBHSliceTaskInfo(); + CnSliceTaskInfo cnSliceTaskInfo = new CnSliceTaskInfo(); + SliceTaskParams sliceTaskParams = new SliceTaskParams(); + sliceTaskParams.setAnSliceTaskInfo(anSliceTaskInfo); + sliceTaskParams.setTnBHSliceTaskInfo(tnBHSliceTaskInfo); + sliceTaskParams.setCnSliceTaskInfo(cnSliceTaskInfo); + soTask.setSliceTaskParams(sliceTaskParams); taskMgtServiceConvert.convertTaskCreationProgress(slicingTaskCreationProgress, soTaskSuc); } diff --git a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImplTest.java index e0f4d460..50559792 100644 --- a/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImplTest.java +++ b/server/src/test/java/org/onap/usecaseui/server/service/nsmf/impl/TaskMgtServiceImplTest.java @@ -38,16 +38,20 @@ import org.onap.usecaseui.server.service.slicingdomain.kpi.KpiSliceService; import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalTraffic; import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService; import org.onap.usecaseui.server.service.slicingdomain.so.bean.SOTask; +import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.ConnectionLinkList; public class TaskMgtServiceImplTest { TaskMgtServiceImpl taskMgtService = null; SOSliceService soSliceService = null; + AAISliceService aaiSliceService = null; @Before public void before() throws Exception { soSliceService = mock(SOSliceService.class); - taskMgtService = new TaskMgtServiceImpl(soSliceService); + aaiSliceService = mock(AAISliceService.class); + taskMgtService = new TaskMgtServiceImpl(soSliceService,aaiSliceService); } @Test @@ -166,5 +170,20 @@ public class TaskMgtServiceImplTest { taskMgtService.queryTaskCreationProgress(taskId); } + @Test + public void queryConnectionLinksWithThrowsException() { + String taskId = "we23-345r-45ty-5687"; + when(aaiSliceService.getConnectionLinks()).thenReturn(failedCall("so is not exist!")); + taskMgtService.queryConnectionLinks(); + } + + @Test + public void itCanqueryConnectionLinks() { + String taskId = "we23-345r-45ty-5687"; + ConnectionLinkList connectionLinkList = new ConnectionLinkList(); + when(aaiSliceService.getConnectionLinks()).thenReturn(successfulCall(connectionLinkList)); + taskMgtService.queryConnectionLinks(); + } + } diff --git a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTaskTest.java b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTaskTest.java index 43d58eb0..67b3fb44 100644 --- a/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTaskTest.java +++ b/server/src/test/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/SOTaskTest.java @@ -33,7 +33,6 @@ public class SOTaskTest { @Test public void testSetAndGetSOTask() throws Exception { SOTask soTask = new SOTask(); - soTask.setParams("params"); soTask.setStatus("activate"); soTask.setTaskId("id001"); soTask.setRequestId("id001"); @@ -41,7 +40,6 @@ public class SOTaskTest { soTask.setCreatedTime("182930493"); soTask.setIsManual("Manual"); - soTask.getParams(); soTask.getCreatedTime(); soTask.getIsManual(); soTask.getName(); -- cgit 1.2.3-korg