diff options
author | hekeguang <hekeguang@chinamobile.com> | 2020-09-07 17:07:02 +0800 |
---|---|---|
committer | hekeguang <hekeguang@chinamobile.com> | 2020-09-07 17:07:16 +0800 |
commit | 7a47a7e742fe2d4e3ceb9f5e7789f9471631d319 (patch) | |
tree | 8847ab4b50e3eac89f02e2a7684e34058e8be7ae | |
parent | 6835146775eaf70d860f1b076863ad23b35c9554 (diff) |
Add code to support standard API interface with EXT-API for KPI monitoring,
Issue-ID: USECASEUI-443
Change-Id: Idaf4e270248ca047e7e370750a6a6c7109a8aa56
Signed-off-by: hekeguang <hekeguang@chinamobile.com>
10 files changed, 151 insertions, 121 deletions
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 f77772a8..5165d646 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 @@ -49,7 +49,7 @@ public class NsiAndSubNssiInfo { String anScriptName; @JsonProperty("an_enableNSSISelection") - String anEnableNSSISelection; + Boolean anEnableNSSISelection; @JsonProperty("sliceProfile_AN_sNSSAI") String sliceProfile_AN_sNSSAI; @@ -145,7 +145,7 @@ public class NsiAndSubNssiInfo { String sliceProfile_TN_sST; @JsonProperty("tn_enableNSSISelection") - String tnEnableNSSISelection; + Boolean tnEnableNSSISelection; @JsonProperty("cn_suggest_nssi_id") String cnSuggestNssiId; @@ -187,7 +187,7 @@ public class NsiAndSubNssiInfo { String cnScriptName; @JsonProperty("cn_enableNSSISelection") - String cnEnableNSSISelection; + Boolean cnEnableNSSISelection; @JsonProperty("sliceProfile_CN_pLMNIdList") String sliceProfile_CN_pLMNIdList; diff --git a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvert.java b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvert.java index f6b20617..64e12846 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvert.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/nsmf/impl/ResourceMonitorServiceConvert.java @@ -29,10 +29,10 @@ import org.onap.usecaseui.server.bean.nsmf.monitor.UsageTrafficInfo; import org.onap.usecaseui.server.bean.nsmf.monitor.UserNumberInfo; import org.onap.usecaseui.server.constant.nsmf.NsmfParamConstant; import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth; -import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalBandwidth.TotalBandwidth; import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiTotalTraffic; import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiUserNumber; -import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.KpiUserNumber.UserNumbers; +import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.TotalBandwidth; +import org.onap.usecaseui.server.service.slicingdomain.kpi.bean.UserNumbers; import org.onap.usecaseui.server.util.nsmf.NsmfCommonUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,8 +54,8 @@ public class ResourceMonitorServiceConvert { } void convertUsageTrafficInfo(UsageTrafficInfo usageTrafficInfo, KpiTotalTraffic kpiTotalTraffic) { - usageTrafficInfo.setServiceId(kpiTotalTraffic.getId()); - usageTrafficInfo.setTrafficData(String.valueOf(kpiTotalTraffic.getTotalTraffic())); + usageTrafficInfo.setServiceId(kpiTotalTraffic.getRequest().getId()); + usageTrafficInfo.setTrafficData(String.valueOf(kpiTotalTraffic.getResult().get(0))); } SlicingKpiReqInfo buildSlicingKpiReqInfo(ServiceInfo serviceInfo, String queryTimestamp, int kpiHours) { @@ -70,10 +70,10 @@ public class ResourceMonitorServiceConvert { throws InvocationTargetException, IllegalAccessException, ParseException { List<UserNumberInfo> userNumberInfoList = new ArrayList<>(); - serviceOnlineUserInfo.setId(kpiUserNumber.getId()); + serviceOnlineUserInfo.setId(kpiUserNumber.getRequest().getId()); - if (kpiUserNumber.getUserNumbers() != null) { - for (UserNumbers userNumbers : kpiUserNumber.getUserNumbers()) { + if (kpiUserNumber.getResult() != null) { + for (UserNumbers userNumbers : kpiUserNumber.getResult()) { String newTimeStamp = NsmfCommonUtil .timestamp2Time(userNumbers.getTimeStamp().replace("T", NsmfParamConstant.SPACE)); UserNumberInfo userNumberInfo = new UserNumberInfo(); @@ -91,9 +91,9 @@ public class ResourceMonitorServiceConvert { throws InvocationTargetException, IllegalAccessException, ParseException { List<TotalBandwidthInfo> totalBandwidthInfoList = new ArrayList<>(); - serviceTotalBandwidthInfo.setId(kpiTotalBandwidth.getId()); - if (kpiTotalBandwidth.getTotalBandwidth() != null) { - for (TotalBandwidth totalBandwidth : kpiTotalBandwidth.getTotalBandwidth()) { + serviceTotalBandwidthInfo.setId(kpiTotalBandwidth.getRequest().getId()); + if (kpiTotalBandwidth.getResult() != null) { + for (TotalBandwidth totalBandwidth : kpiTotalBandwidth.getResult()) { String newTimeStamp = NsmfCommonUtil .timestamp2Time(totalBandwidth.getTimeStamp().replace("T", NsmfParamConstant.SPACE)); TotalBandwidthInfo totalBandwidthInfo = new TotalBandwidthInfo(); 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 86bc3524..5783e49b 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 @@ -158,7 +158,7 @@ public class TaskMgtServiceConvert { nsiAndSubNssiInfo.setAnCoverageAreaTaList(generalConvert.getAreaTaList(anCoverageAreaTA)); nsiAndSubNssiInfo.setAnLatency(paramsObject.getString("SliceProfile.AN.latency")); nsiAndSubNssiInfo.setAnScriptName(paramsObject.getString("AN.ScriptName")); - nsiAndSubNssiInfo.setAnEnableNSSISelection(paramsObject.getString("AN.enableNSSISelection")); + 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")); @@ -186,7 +186,7 @@ public class TaskMgtServiceConvert { nsiAndSubNssiInfo.setTnLatency(paramsObject.getString("SliceProfile.TN.latency")); nsiAndSubNssiInfo.setTnBandwidth(paramsObject.getString("SliceProfile.TN.maxBandwidth")); nsiAndSubNssiInfo.setTnScriptName(paramsObject.getString("TN.ScriptName")); - nsiAndSubNssiInfo.setTnEnableNSSISelection(paramsObject.getString("TN.enableNSSISelection")); + nsiAndSubNssiInfo.setTnEnableNSSISelection(paramsObject.getBoolean("TN.enableNSSISelection")); nsiAndSubNssiInfo.setSliceProfile_TN_jitte(paramsObject.getString("SliceProfile.TN.jitte")); nsiAndSubNssiInfo.setSliceProfile_TN_pLMNIdList(paramsObject.getString("SliceProfile.TN.pLMNIdList")); nsiAndSubNssiInfo.setSliceProfile_TN_sNSSAI(paramsObject.getString("SliceProfile.TN.sNSSAI")); @@ -205,7 +205,7 @@ public class TaskMgtServiceConvert { nsiAndSubNssiInfo.setCnAreaTrafficCapDl(paramsObject.getString("SliceProfile.CN.areaTrafficCapDL")); nsiAndSubNssiInfo.setCnAreaTrafficCapUl(paramsObject.getString("SliceProfile.CN.areaTrafficCapUL")); nsiAndSubNssiInfo.setCnScriptName(paramsObject.getString("CN.ScriptName")); - nsiAndSubNssiInfo.setCnEnableNSSISelection(paramsObject.getString("CN.enableNSSISelection")); + 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")); diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/KpiSliceService.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/KpiSliceService.java index 3794dad1..084616be 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/KpiSliceService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/KpiSliceService.java @@ -28,15 +28,15 @@ import retrofit2.http.POST; public interface KpiSliceService { @Headers({"Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", "Accept: application/json"}) - @POST("/api/kpi-service/v1/userNumber") + @POST("/api/datalake/v1/exposure/userNumber") Call<KpiUserNumber> listUserNumber(@Body RequestBody body); @Headers({"Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", "Accept: application/json"}) - @POST("/api/kpi-service/v1/totalBandwidth") + @POST("/api/datalake/v1/exposure/totalBandwidth") Call<KpiTotalBandwidth> listTotalBandwidth(@Body RequestBody body); @Headers({"Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", "Accept: application/json"}) - @POST("/api/kpi-service/v1/totalTraffic") + @POST("/api/datalake/v1/exposure/totalTraffic") Call<KpiTotalTraffic> listTotalTraffic(@Body RequestBody body); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalBandwidth.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalBandwidth.java index eed118c1..71f5bade 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalBandwidth.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalBandwidth.java @@ -19,52 +19,19 @@ package org.onap.usecaseui.server.service.slicingdomain.kpi.bean; import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; +import lombok.Setter; +import org.onap.usecaseui.server.bean.nsmf.monitor.SlicingKpiReqInfo; @JsonIgnoreProperties(ignoreUnknown = true) +@Getter +@Setter public class KpiTotalBandwidth { - private String id; - private List<TotalBandwidth> totalBandwidth; - - - public static class TotalBandwidth{ - private String timeStamp; - - private int bandwidth; + private List<TotalBandwidth> result; - public String getTimeStamp() { - return timeStamp; - } + private SlicingKpiReqInfo request; - public void setTimeStamp(String timeStamp) { - this.timeStamp = timeStamp; - } - - public int getBandwidth() { - return bandwidth; - } - - public void setBandwidth(int bandwidth) { - this.bandwidth = bandwidth; - } - - - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public List<TotalBandwidth> getTotalBandwidth() { - return totalBandwidth; - } - - public void setTotalBandwidth(List<TotalBandwidth> totalBandwidth) { - this.totalBandwidth = totalBandwidth; - } + private int result_count; } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalTraffic.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalTraffic.java index 8c4f99e3..d401f3c7 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalTraffic.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiTotalTraffic.java @@ -16,29 +16,22 @@ package org.onap.usecaseui.server.service.slicingdomain.kpi.bean; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import org.onap.usecaseui.server.bean.nsmf.monitor.TrafficReqInfo; +@Getter +@Setter @JsonIgnoreProperties(ignoreUnknown=true) public class KpiTotalTraffic { - private String id; - - private int totalTraffic; + private List<TotalTraffic> result; - public String getId() { - return id; - } + private TrafficReqInfo request; - public void setId(String id) { - this.id = id; - } + private int result_count; - public int getTotalTraffic() { - return totalTraffic; - } - - public void setTotalTraffic(int totalTraffic) { - this.totalTraffic = totalTraffic; - } - - } + + diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiUserNumber.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiUserNumber.java index ca4edccf..1122ca21 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiUserNumber.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/KpiUserNumber.java @@ -16,54 +16,20 @@ package org.onap.usecaseui.server.service.slicingdomain.kpi.bean; import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; +import lombok.Setter; +import org.onap.usecaseui.server.bean.nsmf.monitor.SlicingKpiReqInfo; +import org.onap.usecaseui.server.bean.nsmf.monitor.TrafficReqInfo; @JsonIgnoreProperties(ignoreUnknown = true) +@Getter +@Setter public class KpiUserNumber { - private String id; + private List<UserNumbers> result; - private List<UserNumbers> userNumbers; - - public static class UserNumbers { - - private String timeStamp; - - private int userNumber; - - public String getTimeStamp() { - return timeStamp; - } - - public void setTimeStamp(String timeStamp) { - this.timeStamp = timeStamp; - } - - public int getUserNumber() { - return userNumber; - } - - public void setUserNumber(int userNumber) { - this.userNumber = userNumber; - } - - - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public List<UserNumbers> getUserNumbers() { - return userNumbers; - } - - public void setUserNumbers(List<UserNumbers> userNumbers) { - this.userNumbers = userNumbers; - } + private SlicingKpiReqInfo request; + private int result_count; } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/TotalBandwidth.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/TotalBandwidth.java new file mode 100644 index 00000000..6e186691 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/TotalBandwidth.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2020 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.kpi.bean; + +public class TotalBandwidth { + private String timeStamp; + + private int bandwidth; + + public String getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(String timeStamp) { + this.timeStamp = timeStamp; + } + + public int getBandwidth() { + return bandwidth; + } + + public void setBandwidth(int bandwidth) { + this.bandwidth = bandwidth; + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/TotalTraffic.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/TotalTraffic.java new file mode 100644 index 00000000..b0ff30c2 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/TotalTraffic.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2020 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.kpi.bean; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class TotalTraffic { + private int totalTraffic; +} diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/UserNumbers.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/UserNumbers.java new file mode 100644 index 00000000..43930d4d --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/kpi/bean/UserNumbers.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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.kpi.bean; + +public class UserNumbers { + + private String timeStamp; + + private int userNumber; + + public String getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(String timeStamp) { + this.timeStamp = timeStamp; + } + + public int getUserNumber() { + return userNumber; + } + + public void setUserNumber(int userNumber) { + this.userNumber = userNumber; + } + + +} |