diff options
11 files changed, 90 insertions, 134 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/resource/TnBHSliceTaskInfoToUI.java b/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/resource/TnBHSliceTaskInfoToUI.java index f895a00e..c29f0fb9 100644 --- a/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/resource/TnBHSliceTaskInfoToUI.java +++ b/server/src/main/java/org/onap/usecaseui/server/bean/nsmf/resource/TnBHSliceTaskInfoToUI.java @@ -30,4 +30,7 @@ public class TnBHSliceTaskInfoToUI { @JsonProperty("max_bandWidth") private String maxBandWidth; + + @JsonProperty("link_type") + private String linkType;//point-to-point } 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 44dc0050..f5392983 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 @@ -87,7 +87,7 @@ public class TaskMgtController { @GetMapping(value = { "/connectionLinks/pageNo/{pageNo}/pageSize/{pageSize}"}, produces = "application/json") public ServiceResult queryConnectionLinks(@PathVariable int pageNo, @PathVariable int pageSize) { - return taskMgtService.queryConnectionLinks(); + return taskMgtService.queryConnectionLinks(pageNo, pageSize); } } 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 b85b15f6..ce1c47d0 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 @@ -17,6 +17,7 @@ package org.onap.usecaseui.server.service.nsmf; import org.onap.usecaseui.server.bean.nsmf.common.ServiceResult; import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskAuditInfo; +import org.springframework.web.bind.annotation.PathVariable; public interface TaskMgtService { @@ -32,6 +33,6 @@ public interface TaskMgtService { ServiceResult queryTaskCreationProgress(String taskId); - ServiceResult queryConnectionLinks(); + ServiceResult queryConnectionLinks(int pageNo, int pageSize); } 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 e71639ed..a12ddbcf 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 @@ -293,103 +293,88 @@ public class ResourceMgtServiceImpl implements ResourceMgtService { if (networkInfoResponse.isSuccessful()) { NetworkInfo networkInfo = networkInfoResponse.body(); logger.info("networkInfo: {}", networkInfo); - List<Relationship> relationship = networkInfo.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() + List<Relationship> relationshipList = networkInfo.getRelationshipList().getRelationship(); + + for (Relationship relationshipInfo : relationshipList) { + List<RelationshipData> relationshipDataList = relationshipInfo.getRelationshipDataList(); + List<RelationshipData> serviceInstanceInfo = relationshipDataList.stream() + .filter(e -> e.getRelationshipKey() .equals("service-instance.service-instance-id")).collect(Collectors.toList()); - Response<NetworkInfo> executeCn = this.aaiSliceService.getServiceNetworkInstance(cn.get(0) - .getRelationshipValue()).execute(); - if (executeCn.isSuccessful()) { - NetworkInfo 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(); - cnSliceTaskInfo.setInterfaceId(endPointInfoList.getLogicId()); - cnSliceTaskInfo.setIpAdrress(endPointInfoList.getIpAddress()); - cnSliceTaskInfo.setNextHopInfo(endPointInfoList.getNextHop()); - } else { - logger.error(String.format("Can not get getEndpointByLinkName[code={}, message={}]", response.code(), + String networkRouteCnId = serviceInstanceInfo.get(0).getRelationshipValue(); + Response<NetworkInfo> networkInfoResponse1 = this.aaiSliceService + .getServiceNetworkInstance(networkRouteCnId).execute(); + if (networkInfoResponse1.isSuccessful()) { + NetworkInfo networkInfo1 = networkInfoResponse1.body(); + String networkType = networkInfo1.getWorkloadContext(); + if (networkType.equals("AN") || networkType.equals("CN")) { + List<Relationship> networkInfoRelationship = networkInfo1.getRelationshipList() + .getRelationship(); + List<Relationship> networkRouteCn = networkInfoRelationship.stream() + .filter(e -> e.getRelatedTo() + .equals("network-route")).collect(Collectors.toList()); + List<RelationshipData> networkInfoRelationshipDataList = networkRouteCn.get(0) + .getRelationshipDataList(); + String networkRouteId = networkInfoRelationshipDataList.get(0).getRelationshipValue(); + Response<EndPointInfoList> networkInfoEndPointInfoList = this.aaiSliceService + .getEndpointByLinkName(networkRouteId).execute(); + if (networkInfoEndPointInfoList.isSuccessful()) { + EndPointInfoList endPointInfoList = networkInfoEndPointInfoList.body(); + if (networkType.equals("CN")) { + cnSliceTaskInfo.setInterfaceId(endPointInfoList.getLogicId()); + cnSliceTaskInfo.setIpAdrress(endPointInfoList.getIpAddress()); + cnSliceTaskInfo.setNextHopInfo(endPointInfoList.getNextHop()); + } + if (networkType.equals("AN")) { + anSliceTaskInfo.setInterfaceId(endPointInfoList.getLogicId()); + anSliceTaskInfo.setIpAdrress(endPointInfoList.getIpAddress()); + anSliceTaskInfo.setNextHopInfo(endPointInfoList.getNextHop()); + } + } else { + logger.error(String.format( + "querySlicingBusinessDetails: Can not get getEndpointByLinkName[code={}, message={}]", + response.code(), response.message())); - resultMsg = "5G slicing service operation progress query failed!"; - resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + resultMsg = "5G slicing business details query failed!"; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + } } - } else { - logger.error(String.format("Can not get getServiceNetworkInstance[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<SliceProfileList> executeTn = this.aaiSliceService - .getSliceProfiles(tn.get(0).getRelationshipValue()).execute(); - if (executeTn.isSuccessful()) { - SliceProfileList body = executeTn.body(); - SliceProfileInfo sliceProfileInfo = body.getSliceProfileInfoList().get(0); - tnBHSliceTaskInfo.setLantency(sliceProfileInfo.getLatency()); - tnBHSliceTaskInfo.setMaxBandWidth(sliceProfileInfo.getMaxBandwidth()); - } else { - logger.error(String.format("Can not getSliceProfiles [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<NetworkInfo> executeAn = this.aaiSliceService - .getServiceNetworkInstance(an.get(0).getRelationshipValue()).execute(); - if (executeAn.isSuccessful()) { - NetworkInfo 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(); - anSliceTaskInfo.setInterfaceId(endPointInfoList.getLogicId()); - anSliceTaskInfo.setIpAdrress(endPointInfoList.getIpAddress()); - anSliceTaskInfo.setNextHopInfo(endPointInfoList.getNextHop()); - } else { - logger.error(String.format("Can not get getEndpointByLinkName[code={}, message={}]", response.code(), + if (networkType.equals("TN_BH")) { + List<RelationshipData> tnRelationshipDataList = relationshipInfo.getRelationshipDataList(); + List<RelationshipData> tnServiceInstanceInfo = tnRelationshipDataList.stream() + .filter(e -> e.getRelationshipKey() + .equals("service-instance.service-instance-id")).collect(Collectors.toList()); + + Response<SliceProfileList> executeTn = this.aaiSliceService + .getSliceProfiles(tnServiceInstanceInfo.get(0).getRelationshipValue()).execute(); + if (executeTn.isSuccessful()) { + SliceProfileList body = executeTn.body(); + SliceProfileInfo sliceProfileInfo = body.getSliceProfileInfoList().get(0); + tnBHSliceTaskInfo.setLantency(sliceProfileInfo.getLatency()); + tnBHSliceTaskInfo.setMaxBandWidth(sliceProfileInfo.getMaxBandwidth()); + tnBHSliceTaskInfo.setLinkType("P2P"); + } else { + logger.error(String.format( + "querySlicingBusinessDetails: Can not getSliceProfiles [code={}, message={}]", + response.code(), response.message())); - resultMsg = "5G slicing service operation progress query failed!"; - resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + resultMsg = "5G slicing business details query failed!"; + resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); + } } } else { - logger.error(String.format("Can not get getEndpointByLinkName[code={}, message={}]", response.code(), - response.message())); - resultMsg = "5G slicing service operation progress query failed!"; + logger.error(String.format( + "querySlicingBusinessDetails: Can not get getServiceNetworkInstance [code={}, message={}]", + response.code(), + response.message())); + resultMsg = "5G slicing business details query failed!"; resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); } } - } else { - logger.error("queryOperationProgress: serviceInstanceOperations is null!"); + logger.error(String.format( + "querySlicingBusinessDetails: Can not init getServiceNetworkInstance [code={}, message={}]", + response.code(), + response.message())); resultMsg = "5G slicing service operation progress query failed!"; resultHeader.setResult_code(NsmfCodeConstant.ERROR_CODE_UNKNOWN); } 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 0822620c..5a1fa7a3 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 @@ -23,6 +23,7 @@ import okhttp3.MediaType; import okhttp3.RequestBody; import okhttp3.ResponseBody; import org.apache.commons.beanutils.BeanUtils; +import org.onap.usecaseui.server.bean.nsmf.common.PagedResult; 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; @@ -46,6 +47,7 @@ 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.onap.usecaseui.server.util.nsmf.NsmfCommonUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; @@ -347,7 +349,7 @@ public class TaskMgtServiceImpl implements TaskMgtService { } @Override - public ServiceResult queryConnectionLinks() { + public ServiceResult queryConnectionLinks(int pageNo, int pageSize) { ServiceResult serviceResult = new ServiceResult(); ResultHeader resultHeader = new ResultHeader(); String resultMsg =""; @@ -393,8 +395,9 @@ public class TaskMgtServiceImpl implements TaskMgtService { list.add(connectionListVo); } } - connectionVo.setRecord_number(tsciConnectionLink.size()+""); - connectionVo.setConnection_links_list(list); + PagedResult pagedOrderList = NsmfCommonUtil.getPagedList(list, pageNo, pageSize); + connectionVo.setRecord_number(list.size()); + connectionVo.setConnection_links_list(pagedOrderList.getPagedList()); resultMsg = "ConnectionLinks query result."; resultHeader.setResult_code(NsmfCodeConstant.SUCCESS_CODE); }else { 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 c7533c5b..34103f9a 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 @@ -20,7 +20,6 @@ import org.onap.usecaseui.server.service.slicingdomain.aai.bean.connection.Netwo 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; 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 0b3f75bd..277ac3a9 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 @@ -28,7 +28,7 @@ public class EndPointInfoList { @JsonProperty("ip-address") private String ipAddress; - @JsonProperty("logic-id") + @JsonProperty("logical-interface-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/NetworkInfo.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/NetworkInfo.java index 4b4a10e6..00e6253a 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/NetworkInfo.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connection/NetworkInfo.java @@ -34,6 +34,8 @@ public class NetworkInfo { private String serviceType; @JsonProperty("service-role") private String serviceRole; + @JsonProperty("workload-context") + private String workloadContext; @JsonProperty("environment-context") private String environmentContext; @JsonProperty("model-invariant-id") 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 deleted file mode 100644 index 4571803c..00000000 --- a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/bean/connectionvo/ConnectionLinkInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 11578170..19a86b27 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 @@ -27,7 +27,7 @@ import java.util.List; @Setter @JsonIgnoreProperties(ignoreUnknown = true) public class ConnectionVo { - private String record_number; + private int record_number; private List<ConnectionListVo> connection_links_list; } 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 50559792..abf90755 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 @@ -174,7 +174,7 @@ public class TaskMgtServiceImplTest { public void queryConnectionLinksWithThrowsException() { String taskId = "we23-345r-45ty-5687"; when(aaiSliceService.getConnectionLinks()).thenReturn(failedCall("so is not exist!")); - taskMgtService.queryConnectionLinks(); + taskMgtService.queryConnectionLinks(3,5); } @Test @@ -182,7 +182,7 @@ public class TaskMgtServiceImplTest { String taskId = "we23-345r-45ty-5687"; ConnectionLinkList connectionLinkList = new ConnectionLinkList(); when(aaiSliceService.getConnectionLinks()).thenReturn(successfulCall(connectionLinkList)); - taskMgtService.queryConnectionLinks(); + taskMgtService.queryConnectionLinks(3,5); } |