diff options
author | suzhenyu <zysuh@isoftstone.com> | 2021-03-11 17:45:39 +0800 |
---|---|---|
committer | suzhenyu <zysuh@isoftstone.com> | 2021-03-15 16:59:20 +0800 |
commit | 90ba0b18db5d00dd913183348becc54ac7c212e1 (patch) | |
tree | d3a1d1f7e9c73da018c604ea7ee55500f33ff87a | |
parent | 1089fdceb23db729cf895e020138b8310f4c9a52 (diff) |
Change the business of queryslicingbusiness details
Issue-ID: USECASEUI-557
Change-Id: I844f1fbcbc00bacc039c0fda4b2422558790993b
Signed-off-by: suzhenyu <zysuh@isoftstone.com>
18 files changed, 412 insertions, 134 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/resource/SlicingBusinessDetails.java b/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/resource/SlicingBusinessDetails.java index 15be20fa..d10c067a 100644 --- a/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/resource/SlicingBusinessDetails.java +++ b/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/resource/SlicingBusinessDetails.java @@ -20,6 +20,7 @@ import lombok.Getter; import lombok.Setter; import org.onap.usecaseui.server.bean.nsmf.task.BusinessDemandInfo; import org.onap.usecaseui.server.bean.nsmf.task.NstInfo; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo.ConnectionLinkInfo; @Getter @Setter @@ -32,4 +33,7 @@ public class SlicingBusinessDetails { @JsonProperty("nsi_info") private NsiInfo nsiInfo; + + @JsonProperty("connection_link") + private ConnectionLinkInfo connectionLinkInfo; } diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/task/NsiAndSubNssiInfo.java b/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/task/NsiAndSubNssiInfo.java index 3348c939..387384ce 100644 --- a/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/task/NsiAndSubNssiInfo.java +++ b/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/task/NsiAndSubNssiInfo.java @@ -16,10 +16,11 @@ package org.onap.usecaseui.server.bean.nsmf.task; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; import lombok.Getter; import lombok.Setter; +import java.util.List; + @Getter @Setter public class NsiAndSubNssiInfo { @@ -144,6 +145,12 @@ public class NsiAndSubNssiInfo { @JsonProperty("sliceProfile_TN_BH_sST") String sliceProfile_TN_BH_sST; + @JsonProperty("sliceProfile_TN_BH_resourceSharingLevel") + String sliceProfile_TN_BH_resourceSharingLevel; + + @JsonProperty("sliceProfile_TN_BH_connection_links") + String sliceProfile_TN_BH_connectionLinkId; + @JsonProperty("tn_bh_enableNSSISelection") Boolean tnEnableNSSISelection; diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java index 0feef9cd..3d49a0f8 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMgtServiceImpl.java @@ -16,18 +16,14 @@ package org.onap.usecaseui.server.service.nsmf.impl; -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.List; - import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import javax.annotation.Resource; import okhttp3.MediaType; import okhttp3.RequestBody; +import org.apache.commons.beanutils.BeanUtils; import org.onap.usecaseui.server.bean.ServiceInstanceOperations; import org.onap.usecaseui.server.bean.nsmf.common.ResultHeader; import org.onap.usecaseui.server.bean.nsmf.common.ServiceResult; @@ -51,17 +47,32 @@ import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceService; import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceAndInstance; import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceInstance; import org.onap.usecaseui.server.service.slicingdomain.aai.bean.AAIServiceRsp; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.ConnectionLink; +import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.EndPointInfoList; +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.ConnectionLinkInfo; import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService; import org.onap.usecaseui.server.service.slicingdomain.so.bean.ActivateService; +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.SOOperation; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.TnBHSliceTaskInfo; import org.onap.usecaseui.server.util.DateUtils; import org.onap.usecaseui.server.util.RestfulServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; import retrofit2.Response; +import javax.annotation.Resource; +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.List; +import java.util.stream.Collectors; + @Service("ResourceMgtService") @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy @@ -246,6 +257,10 @@ public class ResourceMgtServiceImpl implements ResourceMgtService { ResultHeader resultHeader = new ResultHeader(); AAIServiceAndInstance aaiServiceAndInstance = new AAIServiceAndInstance(); SlicingBusinessDetails slicingBusinessDetails = new SlicingBusinessDetails(); + CnSliceTaskInfo cnSliceTaskInfo = new CnSliceTaskInfo(); + TnBHSliceTaskInfo tnBHSliceTaskInfo = new TnBHSliceTaskInfo(); + AnSliceTaskInfo anSliceTaskInfo = new AnSliceTaskInfo(); + ConnectionLinkInfo connectionLinkInfo = new ConnectionLinkInfo(); String resultMsg; try { @@ -268,11 +283,130 @@ public class ResourceMgtServiceImpl implements ResourceMgtService { resultMsg = "5G slicing business details query failed!"; resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); } + Response<ConnectionLink> connectionLinkResponse = this.aaiSliceService + .getServiceInstance(businessId).execute(); + if (connectionLinkResponse.isSuccessful()) { + ConnectionLink connectionLink = connectionLinkResponse.body(); + logger.info("ConnectionLink", connectionLink); + List<Relationship> relationship = connectionLink.getRelationshipList().getRelationship(); + List<Relationship> embbCnExternal = relationship.stream().filter(e -> e.getRelatedToProperties() + .get(0).getPropertyValue().equals("EmbbCn_External")).collect(Collectors.toList()); + List<Relationship> TnONAPInternalBH = relationship.stream().filter(e -> e.getRelatedToProperties() + .get(0).getPropertyValue().equals("Tn_ONAP_internal_BH")).collect(Collectors.toList()); + List<Relationship> EmbbAnNF = relationship.stream().filter(e -> e.getRelatedToProperties() + .get(0).getPropertyValue().equals("EmbbAn_NF")).collect(Collectors.toList()); + if(!ObjectUtils.isEmpty(embbCnExternal)) { + // TODO: 2021/3/3 Cn的参数 + List<RelationshipData> relationshipDataCn = embbCnExternal.get(0).getRelationshipDataList(); + List<RelationshipData> cn = relationshipDataCn.stream().filter(e -> e.getRelationshipKey() + .equals("service-instance.service-instance-id")).collect(Collectors.toList()); + Response<ConnectionLink> executeCn = this.aaiSliceService.getServiceInstance(cn.get(0) + .getRelationshipValue()).execute(); + if (executeCn.isSuccessful()) { + ConnectionLink body = executeCn.body(); + List<Relationship> relationshipCn = body.getRelationshipList().getRelationship(); + List<Relationship> networkRouteCn = relationshipCn.stream().filter(e -> e.getRelatedTo() + .equals("network-route")).collect(Collectors.toList()); + List<RelationshipData> relationshipDataListCn = networkRouteCn.get(0).getRelationshipDataList(); + String networkRouteCnId = relationshipDataListCn.get(0).getRelationshipValue(); + Response<EndPointInfoList> endPointInfoListCn = this.aaiSliceService + .getEndpointByLinkName(networkRouteCnId).execute(); + if (endPointInfoListCn.isSuccessful()) { + EndPointInfoList endPointInfoList = endPointInfoListCn.body(); + BeanUtils.copyProperties(cnSliceTaskInfo, endPointInfoList); + } else { + logger.error(String.format("Can not get SOOperation[code={}, message={}]", response.code(), + response.message())); + resultMsg = "5G slicing service operation progress query failed!"; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + } + } else { + logger.error(String.format("Can not get SOOperation[code={}, message={}]", response.code(), + response.message())); + resultMsg = "5G slicing service operation progress query failed!"; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + } + } + if(!ObjectUtils.isEmpty(TnONAPInternalBH)) { + // TODO: 2021/3/3 Tn的参数 + List<RelationshipData> relationshipDataTn = TnONAPInternalBH.get(0).getRelationshipDataList(); + List<RelationshipData> tn = relationshipDataTn.stream().filter(e -> e.getRelationshipKey() + .equals("service-instance.service-instance-id")).collect(Collectors.toList()); + Response<ConnectionLink> executeTn = this.aaiSliceService + .getServiceInstance(tn.get(0).getRelationshipValue()).execute(); + if (executeTn.isSuccessful()) { + ConnectionLink body = executeTn.body(); + List<Relationship> relationshipTn = body.getRelationshipList().getRelationship(); + List<Relationship> networkRouteTn = relationshipTn.stream().filter(e -> e.getRelatedTo() + .equals("network-route")).collect(Collectors.toList()); + List<RelationshipData> relationshipDataListTn = networkRouteTn.get(0).getRelationshipDataList(); + String networkRouteTnId = relationshipDataListTn.get(0).getRelationshipValue(); + Response<EndPointInfoList> endPointInfoListTn = this.aaiSliceService + .getEndpointByLinkName(networkRouteTnId).execute(); + if (endPointInfoListTn.isSuccessful()) { + EndPointInfoList endPointInfoList = endPointInfoListTn.body(); + BeanUtils.copyProperties(tnBHSliceTaskInfo, endPointInfoList); + + } else { + logger.error(String.format("Can not get SOOperation[code={}, message={}]", response.code(), + response.message())); + resultMsg = "5G slicing service operation progress query failed!"; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + } + } else { + logger.error(String.format("Can not get SOOperation[code={}, message={}]", response.code(), + response.message())); + resultMsg = "5G slicing service operation progress query failed!"; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + } + } + if(!ObjectUtils.isEmpty(EmbbAnNF)) { + // TODO: 2021/3/3 an的参数 + List<RelationshipData> relationshipDataAn = EmbbAnNF.get(0).getRelationshipDataList(); + List<RelationshipData> an = relationshipDataAn.stream().filter(e -> e.getRelationshipKey() + .equals("service-instance.service-instance-id")).collect(Collectors.toList()); + Response<ConnectionLink> executeAn = this.aaiSliceService + .getServiceInstance(an.get(0).getRelationshipValue()).execute(); + if (executeAn.isSuccessful()) { + ConnectionLink body = executeAn.body(); + List<Relationship> relationshipAn = body.getRelationshipList().getRelationship(); + List<Relationship> networkRouteAn = relationshipAn.stream().filter(e -> e.getRelatedTo() + .equals("network-route")).collect(Collectors.toList()); + List<RelationshipData> relationshipDataListAn = networkRouteAn.get(0).getRelationshipDataList(); + String networkRouteAnId = relationshipDataListAn.get(0).getRelationshipValue(); + Response<EndPointInfoList> endPointInfoListAn = this.aaiSliceService + .getEndpointByLinkName(networkRouteAnId).execute(); + if (endPointInfoListAn.isSuccessful()) { + EndPointInfoList endPointInfoList = endPointInfoListAn.body(); + BeanUtils.copyProperties(anSliceTaskInfo, endPointInfoList); + } else { + logger.error(String.format("Can not get SOOperation[code={}, message={}]", response.code(), + response.message())); + resultMsg = "5G slicing service operation progress query failed!"; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + } + } else { + logger.error(String.format("Can not get SOOperation[code={}, message={}]", response.code(), + response.message())); + resultMsg = "5G slicing service operation progress query failed!"; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + } + } + + } else { + logger.error("queryOperationProgress: serviceInstanceOperations is null!"); + resultMsg = "5G slicing service operation progress query failed!"; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + } } catch (Exception e) { resultMsg = "5G slicing business details query failed. Unknown exception occurred!"; resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); logger.error("Exception in querySlicingBusinessDetails response",e); } + connectionLinkInfo.setCnSliceTaskInfo(cnSliceTaskInfo); + connectionLinkInfo.setTnBHSliceTaskInfo(tnBHSliceTaskInfo); + connectionLinkInfo.setAnSliceTaskInfo(anSliceTaskInfo); + slicingBusinessDetails.setConnectionLinkInfo(connectionLinkInfo); logger.info(resultMsg); logger.info("querySlicingBusinessDetails: 5G slicing business details query has been finished."); 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 b77b3c6c..3383fefa 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 @@ -15,12 +15,8 @@ */ package org.onap.usecaseui.server.service.nsmf.impl; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; -import javax.annotation.Resource; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; import lombok.Setter; import org.apache.commons.beanutils.BeanUtils; import org.onap.usecaseui.server.bean.nsmf.common.PagedResult; @@ -33,22 +29,24 @@ import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskCreationProgress; import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskInfo; 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.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.SliceProfile; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.SliceTaskParams; +import org.onap.usecaseui.server.service.slicingdomain.so.bean.TnBHSliceTaskInfo; import org.onap.usecaseui.server.util.RestfulServices; import org.onap.usecaseui.server.util.nsmf.NsmfCommonUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; -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.lang.reflect.Type; import java.util.ArrayList; import java.util.List; @Service("TaskMgtConvertService") @@ -84,8 +82,10 @@ public class TaskMgtServiceConvert { for (SOTask soTask : sourceSoTaskRsp.getTask()) { SlicingTaskInfo slicingTaskInfo = new SlicingTaskInfo(); BeanUtils.copyProperties(slicingTaskInfo, soTask); - SliceTaskParams sliceTaskParams = soTask.getSliceTaskParams(); - slicingTaskInfo.setServiceSnssai(sliceTaskParams.getServiceProfile().getSNSSAI()); + String params = soTask.getParams(); + Gson gson = new Gson(); + Type type = new TypeToken<SliceTaskParams>() {}.getType(); + SliceTaskParams sliceTaskParams = gson.fromJson(params, type); slicingTaskInfo.setServiceSnssai(sliceTaskParams.getServiceProfile().getSNSSAI()); slicingTaskInfo.setServiceType(sliceTaskParams.getServiceProfile().getSST()); slicingTaskInfo.setName(sliceTaskParams.getServiceName()); slicingTaskInfo.setCreateTime(soTask.getCreatedTime()); @@ -102,7 +102,10 @@ public class TaskMgtServiceConvert { targetSlicingTaskAuditInfo.setCreateTime(sourceSoTaskInfo.getCreatedTime()); targetSlicingTaskAuditInfo.setProcessingStatus(sourceSoTaskInfo.getStatus()); - SliceTaskParams sliceTaskParams = sourceSoTaskInfo.getSliceTaskParams(); + String params = sourceSoTaskInfo.getParams(); + Gson gson = new Gson(); + Type type = new TypeToken<SliceTaskParams>() {}.getType(); + SliceTaskParams sliceTaskParams = gson.fromJson(params, type); if (sliceTaskParams == null) { logger.error("convertTaskAuditInfo: paramsObject is null"); return; @@ -162,79 +165,90 @@ public class TaskMgtServiceConvert { 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<String> 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()); - + if(!ObjectUtils.isEmpty(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile())){ + nsiAndSubNssiInfo.setAnSuggestNssiId(sliceTaskParams.getAnSliceTaskInfo().getSuggestNssiId()); + nsiAndSubNssiInfo.setAnSuggestNssiName(sliceTaskParams.getAnSliceTaskInfo().getSuggestNSSIName()); + nsiAndSubNssiInfo.setAn5qi(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getAn5qi()); + + String anCoverageAreaTA = sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getCoverageAreaTAList(); + List<String> areaTaList = generalConvert.getAreaTaList(anCoverageAreaTA); + nsiAndSubNssiInfo.setAnCoverageAreaTaList(areaTaList); + nsiAndSubNssiInfo.setAnLatency(sliceTaskParams.getAnSliceTaskInfo().getSliceProfile().getLatency()); + + 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()); + if(!ObjectUtils.isEmpty(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile())){ + nsiAndSubNssiInfo.setTnBhLatency(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile().getLatency()); + nsiAndSubNssiInfo.setTnBhBandwidth(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile().getMaxBandwidth()); + + 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.setSliceProfile_TN_BH_connectionLinkId(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile().getConnectionLinkId()); + nsiAndSubNssiInfo.setSliceProfile_TN_BH_resourceSharingLevel(sliceTaskParams.getTnBHSliceTaskInfo().getSliceProfile().getResourceSharingLevel()); + } 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()); + nsiAndSubNssiInfo.setCnSuggestNssiId(sliceTaskParams.getCnSliceTaskInfo().getSuggestNssiId()); + nsiAndSubNssiInfo.setCnSuggestNssiName(sliceTaskParams.getCnSliceTaskInfo().getSuggestNSSIName()); + if(!ObjectUtils.isEmpty(sliceTaskParams.getCnSliceTaskInfo().getSliceProfile())){ + 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.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) { @@ -292,6 +306,8 @@ public class TaskMgtServiceConvert { tnSliceProfile.setPLMNIdList(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_pLMNIdList()); tnSliceProfile.setSNSSAIList(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_sNSSAI()); tnSliceProfile.setSST(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_sST()); + tnSliceProfile.setConnectionLinkId(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_connectionLinkId()); + tnSliceProfile.setResourceSharingLevel(sourceSlicingTaskAuditInfo.getNsiAndSubNssiInfo().getSliceProfile_TN_BH_resourceSharingLevel()); tnBHSliceTaskInfo.setSliceProfile(tnSliceProfile); sliceTaskParams.setTnBHSliceTaskInfo(tnBHSliceTaskInfo); @@ -344,7 +360,10 @@ public class TaskMgtServiceConvert { slicingTaskCreationInfo.setProcessingStatus(soTask.getStatus()); slicingTaskCreationInfo.setTaskName(soTask.getName()); - SliceTaskParams sliceTaskParams = soTask.getSliceTaskParams(); + String params = soTask.getParams(); + Gson gson = new Gson(); + Type type = new TypeToken<SliceTaskParams>() {}.getType(); + SliceTaskParams sliceTaskParams = gson.fromJson(params, type); if (sliceTaskParams == null) { logger.error("convertTaskCreationInfo: paramsObject is null"); return; @@ -363,8 +382,10 @@ public class TaskMgtServiceConvert { void convertTaskCreationProgress(SlicingTaskCreationProgress slicingTaskCreationProgress, SOTask soTask) { - SliceTaskParams sliceTaskParams = soTask.getSliceTaskParams(); - if (sliceTaskParams == null) { + String params = soTask.getParams(); + Gson gson = new Gson(); + Type type = new TypeToken<SliceTaskParams>() {}.getType(); + SliceTaskParams sliceTaskParams = gson.fromJson(params, type); if (sliceTaskParams == null) { logger.error("convertTaskCreationProgress: paramsObject is null"); return; } 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 e9f46972..0822620c 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 @@ -15,15 +15,10 @@ */ package org.onap.usecaseui.server.service.nsmf.impl; -import java.lang.reflect.Type; -import java.util.List; - import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; - -import javax.annotation.Resource; import okhttp3.MediaType; import okhttp3.RequestBody; import okhttp3.ResponseBody; @@ -35,12 +30,7 @@ import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskCreationInfo; import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskCreationProgress; import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskList; import org.onap.usecaseui.server.constant.nsmf.NsmfCodeConstant; - 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; @@ -52,18 +42,20 @@ import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connectionvo.Con 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.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.util.RestfulServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; +import org.springframework.util.ObjectUtils; import retrofit2.Response; import javax.annotation.Resource; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Type; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -363,6 +355,7 @@ public class TaskMgtServiceImpl implements TaskMgtService { ConnectionLinkList connectionLinkList = new ConnectionLinkList(); ConnectionVo connectionVo = new ConnectionVo(); ConnectionListVo connectionListVo = new ConnectionListVo(); + List<ConnectionListVo> list = new ArrayList<>(); try { Response<ConnectionLinkList> response = this.aaiSliceService.getConnectionLinks().execute(); if(response.isSuccessful()){ @@ -370,37 +363,38 @@ public class TaskMgtServiceImpl implements TaskMgtService { logger.info(connectionLinkList.toString()); List<ConnectionLink> connectionLinks = connectionLinkList.getLogicalLink(); List<ConnectionLink> tsciConnectionLink = connectionLinks.stream().filter(e -> e.getLinkType().equals("TsciConnectionLink") && e.getRelationshipList()!=null).collect(Collectors.toList()); - for (ConnectionLink connectionLink : tsciConnectionLink) { - Response<EndPointInfoList> anInfo = this.aaiSliceService.getEndpointByLinkName(connectionLink.getLinkName()).execute(); - Response<EndPointInfoList> cnInfo = this.aaiSliceService.getEndpointByLinkName2(connectionLink.getLinkName2()).execute(); - - PropertiesVo propertiesVo = new PropertiesVo(); - List<RelationshipData> relationshipDataList = connectionLink.getRelationshipList().getRelationship().get(0).getRelationshipDataList(); - List<RelationshipData> allottedResourceId = relationshipDataList.stream().filter(e -> e.getRelationshipKey().equals("allotted-resource.id")).collect(Collectors.toList()); - List<RelationshipData> serviceInstanceId = relationshipDataList.stream().filter(e -> e.getRelationshipKey().equals("service-instance.service-instance-id")).collect(Collectors.toList()); - Response<ConnectionLink> AllottedResource=this.aaiSliceService.getAllottedResource(serviceInstanceId.get(0).getRelationshipValue(),allottedResourceId.get(0).getRelationshipValue()).execute(); - List<Relationship> relationships= AllottedResource.body().getRelationshipList().getRelationship().stream().filter(a-> a.getRelatedTo().equals("network-policy")).collect(Collectors.toList()); - List<RelationshipData> networkPolicyId=relationships.get(0).getRelationshipDataList().stream().filter(e -> e.getRelationshipKey().equals("network-policy.network-policy-id")).collect(Collectors.toList()); - Response<NetworkPolicy> 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<ConnectionLink> 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); - - + if(!ObjectUtils.isEmpty(tsciConnectionLink)){ + for (ConnectionLink connectionLink : tsciConnectionLink) { + Response<EndPointInfoList> anInfo = this.aaiSliceService.getEndpointByLinkName(connectionLink.getLinkName()).execute(); + Response<EndPointInfoList> cnInfo = this.aaiSliceService.getEndpointByLinkName2(connectionLink.getLinkName2()).execute(); + + PropertiesVo propertiesVo = new PropertiesVo(); + List<RelationshipData> relationshipDataList = connectionLink.getRelationshipList().getRelationship().get(0).getRelationshipDataList(); + List<RelationshipData> allottedResourceId = relationshipDataList.stream().filter(e -> e.getRelationshipKey().equals("allotted-resource.id")).collect(Collectors.toList()); + List<RelationshipData> serviceInstanceId = relationshipDataList.stream().filter(e -> e.getRelationshipKey().equals("service-instance.service-instance-id")).collect(Collectors.toList()); + Response<ConnectionLink> AllottedResource=this.aaiSliceService.getAllottedResource(serviceInstanceId.get(0).getRelationshipValue(),allottedResourceId.get(0).getRelationshipValue()).execute(); + List<Relationship> relationships= AllottedResource.body().getRelationshipList().getRelationship().stream().filter(a-> a.getRelatedTo().equals("network-policy")).collect(Collectors.toList()); + List<RelationshipData> networkPolicyId=relationships.get(0).getRelationshipDataList().stream().filter(e -> e.getRelationshipKey().equals("network-policy.network-policy-id")).collect(Collectors.toList()); + Response<NetworkPolicy> 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<ConnectionLink> 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); + list.add(connectionListVo); + } } connectionVo.setRecord_number(tsciConnectionLink.size()+""); - connectionVo.setConnection_links_list(connectionListVo); + connectionVo.setConnection_links_list(list); resultMsg = "ConnectionLinks query result."; resultHeader.setResult_code(NsmfCodeConstant.SUCCESS_CODE); }else { @@ -414,7 +408,7 @@ public class TaskMgtServiceImpl implements TaskMgtService { 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); 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 index 69c92884..f837c19d 100644 --- 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 @@ -33,4 +33,10 @@ public class EndPointInfoList { private String logicId; @JsonProperty("next-hop") private String nextHop; + @JsonProperty("lantency") + private String lantency ; + @JsonProperty("max_bandWidth") + private String maxBandWidth ; + @JsonProperty("link_type") + private String linkType ; } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelatedToProperty.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelatedToProperty.java new file mode 100644 index 00000000..1fbaba27 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/RelatedToProperty.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 RelatedToProperty { + + @JsonProperty("property-key") + private String PropertyKey; + @JsonProperty("property-value") + private String PropertyValue; +} 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 index 49cace3f..050991a7 100644 --- 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 @@ -35,6 +35,8 @@ public class Relationship { private String relatedLink; @JsonProperty("relationship-data") private List<RelationshipData> relationshipDataList; + @JsonProperty("related-to-property") + private List<RelatedToProperty> relatedToProperties; diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionLinkInfo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionLinkInfo.java new file mode 100644 index 00000000..4571803c --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionLinkInfo.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.aai.bean.connectionvo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +import lombok.Setter; +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.TnBHSliceTaskInfo; + +@Getter +@Setter +@JsonIgnoreProperties(ignoreUnknown = true) +public class ConnectionLinkInfo { + @JsonProperty("an_slice_task_info") + private AnSliceTaskInfo anSliceTaskInfo; + @JsonProperty("cn_slice_task_info") + private CnSliceTaskInfo cnSliceTaskInfo; + @JsonProperty("tn_bh_slice_task_info") + private TnBHSliceTaskInfo tnBHSliceTaskInfo; + +} 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 index b1ed4d5b..11578170 100644 --- 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 @@ -20,6 +20,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Getter; import lombok.Setter; +import java.util.List; + @Getter @Setter @@ -27,5 +29,5 @@ import lombok.Setter; public class ConnectionVo { private String record_number; - private ConnectionListVo connection_links_list; + private List<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 index 6f8872fa..ba01227e 100644 --- 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 @@ -25,7 +25,6 @@ import lombok.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/so/bean/AnSliceTaskInfo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/so/bean/AnSliceTaskInfo.java index ac02a4b8..d1544ece 100644 --- 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 @@ -17,6 +17,7 @@ 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 @@ -30,4 +31,12 @@ public class AnSliceTaskInfo { private SliceProfile sliceProfile ; private String scriptName ; private Boolean enableNSSISelection ; + @JsonProperty("ip_adrress") + private String ipAdrress ; + @JsonProperty("interface_id") + private String interfaceId ; + @JsonProperty("nextHop_info") + private String nextHopInfo ; + + } 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 index 37d67756..844b582f 100644 --- 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 @@ -17,6 +17,7 @@ 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 @@ -30,4 +31,10 @@ public class CnSliceTaskInfo { private SliceProfile sliceProfile ; private String scriptName ; private Boolean enableNSSISelection ; + @JsonProperty("ip_adrress") + private String ipAdrress ; + @JsonProperty("interface_id") + private String interfaceId ; + @JsonProperty("nextHop_info") + private String nextHopInfo ; } 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 beb39f3c..074f67fb 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,6 +32,8 @@ public class SOTask { private String isManual; + private String params; + private SliceTaskParams sliceTaskParams; @@ -85,6 +87,14 @@ public class SOTask { this.isManual = isManual; } + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params; + } + public SliceTaskParams getSliceTaskParams() { return sliceTaskParams; } 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 index 980a3378..2bdec47b 100644 --- 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 @@ -32,6 +32,7 @@ public class SliceProfile { private String latency; private String ueMobilityLevel; private String resourceSharingLevel; + private String connectionLinkId; private String maxBandwidth; private String sST; private String activityFactor; 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 index 89088e97..48a74701 100644 --- 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 @@ -17,6 +17,7 @@ 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 @@ -29,7 +30,9 @@ public class SliceTaskParams { private ServiceProfile serviceProfile; private String suggestNsiId; private String suggestNSIName; + @JsonProperty("tnBHSliceTaskInfo") private TnBHSliceTaskInfo tnBHSliceTaskInfo; + @JsonProperty("tnMHSliceTaskInfo") private TnMHSliceTaskInfo tnMHSliceTaskInfo; private TnFHSliceTaskInfo tnFHSliceTaskInfo; private CnSliceTaskInfo cnSliceTaskInfo; 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 index e68496dc..6e527aa2 100644 --- 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 @@ -17,6 +17,7 @@ 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 @@ -27,8 +28,15 @@ public class TnBHSliceTaskInfo { private String progress; private String status; private String statusDescription; - private SliceProfile sliceProfile ; + @JsonProperty("sliceProfile") + private SliceProfile sliceProfile; private String scriptName ; private Boolean enableNSSISelection ; + @JsonProperty("lantency") + private String lantency ; + @JsonProperty("max_bandWidth") + private String maxBandWidth ; + @JsonProperty("link_type") + private String linkType ; } 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 index 5941680e..7c0c3fb4 100644 --- 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 @@ -17,11 +17,13 @@ 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 TnMHSliceTaskInfo { + @JsonProperty("sliceProfile") private SliceProfile sliceProfile ; } |