summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/kpi-computation-ms/Changelog.md4
-rw-r--r--components/kpi-computation-ms/pom.xml4
-rw-r--r--components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/KpiComputation.java27
-rw-r--r--components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/RatioKpiComputation.java5
-rw-r--r--components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/SumRatioKpiComputation.java5
-rw-r--r--components/kpi-computation-ms/src/test/java/org/onap/dcaegen2/kpi/computation/KpiComputationTest.java15
-rw-r--r--components/kpi-computation-ms/src/test/resources/kpi/RAN.xml117
-rw-r--r--components/kpi-computation-ms/src/test/resources/kpi/kpi_config_slicing.json17
-rw-r--r--components/kpi-computation-ms/src/test/resources/kpi/ves_message_slicing.json270
-rw-r--r--components/kpi-computation-ms/version.properties3
10 files changed, 452 insertions, 15 deletions
diff --git a/components/kpi-computation-ms/Changelog.md b/components/kpi-computation-ms/Changelog.md
index a094d17b..5c9c4f0b 100644
--- a/components/kpi-computation-ms/Changelog.md
+++ b/components/kpi-computation-ms/Changelog.md
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
+## [1.0.5]
+### Changed
+* Enhancements to KPI Computation MS for Kohn Release (DCAEGEN2-3193)
+
## [1.0.4]
### Changed
* Fix security vulnerability issues (DCAEGEN2-3047)
diff --git a/components/kpi-computation-ms/pom.xml b/components/kpi-computation-ms/pom.xml
index c67ece88..1defef1f 100644
--- a/components/kpi-computation-ms/pom.xml
+++ b/components/kpi-computation-ms/pom.xml
@@ -29,7 +29,7 @@
<groupId>org.onap.dcaegen2.services.components</groupId>
<artifactId>kpi-ms</artifactId>
- <version>1.0.4-SNAPSHOT</version>
+ <version>1.0.5-SNAPSHOT</version>
<name>dcaegen2-services-kpi-computation-ms</name>
<description>Kpi ms</description>
<packaging>jar</packaging>
@@ -297,7 +297,7 @@
<artifactId>openpojo</artifactId>
<version>0.8.10</version>
</dependency>
- <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-core -->
+ <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-core -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
diff --git a/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/KpiComputation.java b/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/KpiComputation.java
index d3493528..5e6c5a41 100644
--- a/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/KpiComputation.java
+++ b/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/KpiComputation.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 China Mobile.
* Copyright (C) 2021 Deutsche Telekom AG. All rights reserved.
+ * Copyright (C) 2022 Wipro Limited. 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.
@@ -169,18 +170,20 @@ public class KpiComputation {
if (measValue != null) {
key = new StringBuilder().append(operand).toString();
int index = measTypesList.indexOf(measValue);
- MeasValues measValues = m.getMeasValuesList().stream().findFirst().orElse(null);
- List<MeasResult> measResults = measValues.getMeasResults();
- String measObjInstId = measValues.getMeasObjInstId();
- MeasResult measResult = measResults.stream()
- .filter(v -> v.getPvalue() == (index + 1))
- .findFirst()
- .orElse(null);
- if (measResult != null) {
- KpiOperand newKpiOperand = new KpiOperand(measObjInstId, new BigDecimal(measResult.getSvalue()));
- kpiOperands.add(newKpiOperand);
- } else {
- logger.info("measResults mis-matched - incorrect ves msg construction");
+ List<MeasValues> measValuesList = m.getMeasValuesList();
+ for ( MeasValues measValues : measValuesList) {
+ List<MeasResult> measResults = measValues.getMeasResults();
+ String measObjInstId = measValues.getMeasObjInstId();
+ MeasResult measResult = measResults.stream()
+ .filter(v -> v.getPvalue() == (index + 1))
+ .findFirst()
+ .orElse(null);
+ if (measResult != null) {
+ KpiOperand newKpiOperand = new KpiOperand(measObjInstId, new BigDecimal(measResult.getSvalue()));
+ kpiOperands.add(newKpiOperand);
+ } else {
+ logger.info("measResults mis-matched - incorrect ves msg construction");
+ }
}
}
}
diff --git a/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/RatioKpiComputation.java b/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/RatioKpiComputation.java
index 96559a4c..754c3573 100644
--- a/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/RatioKpiComputation.java
+++ b/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/RatioKpiComputation.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Deutsche Telekom AG. All rights reserved.
+ * Copyright (C) 2022 Wipro Limited. 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.
@@ -30,6 +31,7 @@ import java.util.Map;
import java.util.UUID;
import org.onap.dcaegen2.kpi.config.ControlLoopSchemaType;
+import org.onap.dcaegen2.kpi.exception.KpiComputationException;
import org.onap.dcaegen2.kpi.models.CommonEventHeader;
import org.onap.dcaegen2.kpi.models.KpiOperand;
import org.onap.dcaegen2.kpi.models.MeasDataCollection;
@@ -76,6 +78,9 @@ public class RatioKpiComputation extends BaseKpiComputation {
}
}
}
+ else {
+ throw new KpiComputationException("Insufficient number of operands to perform Ratio computation");
+ }
return vesEvents;
}
}
diff --git a/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/SumRatioKpiComputation.java b/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/SumRatioKpiComputation.java
index a031abde..1c7436aa 100644
--- a/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/SumRatioKpiComputation.java
+++ b/components/kpi-computation-ms/src/main/java/org/onap/dcaegen2/kpi/computation/SumRatioKpiComputation.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2022 Deutsche Telekom AG. All rights reserved.
+* Copyright (C) 2022 Wipro Limited. 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.
@@ -29,6 +30,7 @@ import java.util.ListIterator;
import java.util.Map;
import org.onap.dcaegen2.kpi.config.ControlLoopSchemaType;
+import org.onap.dcaegen2.kpi.exception.KpiComputationException;
import org.onap.dcaegen2.kpi.models.CommonEventHeader;
import org.onap.dcaegen2.kpi.models.KpiOperand;
import org.onap.dcaegen2.kpi.models.MeasDataCollection;
@@ -78,6 +80,9 @@ public class SumRatioKpiComputation extends BaseKpiComputation {
BigDecimal result = sumK1.multiply(new BigDecimal("100")).divide(sumK2, 0, RoundingMode.HALF_UP);
vesEvents.add(generateVesEvent(pmEvent, schemaType.toString(), result, measType));
}
+ else {
+ throw new KpiComputationException("Insufficient number of operands to perform SumRatio computation");
+ }
return vesEvents;
}
}
diff --git a/components/kpi-computation-ms/src/test/java/org/onap/dcaegen2/kpi/computation/KpiComputationTest.java b/components/kpi-computation-ms/src/test/java/org/onap/dcaegen2/kpi/computation/KpiComputationTest.java
index 1ed65572..4320981b 100644
--- a/components/kpi-computation-ms/src/test/java/org/onap/dcaegen2/kpi/computation/KpiComputationTest.java
+++ b/components/kpi-computation-ms/src/test/java/org/onap/dcaegen2/kpi/computation/KpiComputationTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2021 China Mobile.
* Copyright (C) 2022 Deutsche Telekom AG. All rights reserved.
+ * Copyright (C) 2022 Wipro Limited. 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.
@@ -40,9 +41,11 @@ public class KpiComputationTest {
private static final String KPI_CONFIG_FILE = "kpi/kpi_config.json";
private static final String VES_MESSAGE_FILE = "kpi/ves_message.json";
private static final String KPI_CONFIG_RATIO_FILE = "kpi/kpi_config_ratio.json";
+ private static final String KPI_CONFIG_SLICING_RATIO_FILE = "kpi/kpi_config_slicing.json";
private static final String KPI_CONFIG_SUMRATIO_FILE = "kpi/kpi_config_sumratio.json";
private static final String VES_MESSAGE_EMPTY_FILE = "kpi/ves_message_empty.json";
private static final String VES_MESSAGE_NULL_FILE = "kpi/ves_message_null.json";
+ private static final String VES_MESSAGE_SLICING_FILE = "kpi/ves_message_slicing.json";
private static final String VES_MESSAGE_EVENTNAME_FILE = "kpi/ves_message_eventname.json";
@Test
@@ -75,6 +78,18 @@ public class KpiComputationTest {
}
@Test
+ public void testKpiComputationSlicingRatio() {
+ String strKpiConfigRatio = FileUtils.getFileContents(KPI_CONFIG_SLICING_RATIO_FILE);
+ String vesMessage = FileUtils.getFileContents(VES_MESSAGE_SLICING_FILE);
+ Configuration config = mock(Configuration.class);
+ when(config.getKpiConfig()).thenReturn(strKpiConfigRatio);
+ List<VesEvent> vesList = new KpiComputation().checkAndDoComputation(vesMessage, config);
+ VesEvent vesEvent = vesList.get(0);
+ assertEquals(vesEvent.getEvent().getPerf3gppFields().getMeasDataCollection().getMeasInfoList().get(0)
+ .getMeasValuesList().get(0).getMeasResults().get(0).getSvalue(), "158");
+ }
+
+ @Test
public void testKpiComputationSumRatio() {
String strKpiConfigSumRatio = FileUtils.getFileContents(KPI_CONFIG_SUMRATIO_FILE);
diff --git a/components/kpi-computation-ms/src/test/resources/kpi/RAN.xml b/components/kpi-computation-ms/src/test/resources/kpi/RAN.xml
new file mode 100644
index 00000000..9b8da644
--- /dev/null
+++ b/components/kpi-computation-ms/src/test/resources/kpi/RAN.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+~ ============LICENSE_START=======================================================
+~ Copyright (c) 2022 Wipro Limited. 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.
+~ ============LICENSE_END=========================================================
+-->
+<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec">
+ <fileHeader dnPrefix="Prefix" fileFormatVersion="32.435 V10.0" vendorName="Acme Ltd">
+ <fileSender localDn="cucpserver2"/>
+ <measCollec beginTime="2021-01-15T05:46:30.387"/>
+ </fileHeader>
+ <measData>
+ <managedElement localDn="cucpserver2" swVersion="r0.1"/>
+ <measInfo measInfoId="measInfoIsVal">
+ <job jobId="7836"/>
+ <granPeriod duration="PT900S" endTime="2021-01-15T05:46:30.387"/>
+ <repPeriod duration="PT900S"/>
+ <measType p="1">SM.PduSessionCreationSucc.0011-0010</measType>
+ <measType p="2">SM.PduSessionCreationReq.0011-0010</measType>
+ <measType p="3">SM.PduSessionCreationFail.0</measType>
+ <measValue measObjLdn="10896">
+ <r p="1">5813.0</r>
+ <r p="2">3679.0</r>
+ <r p="3">1333.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="10897">
+ <r p="1">5637.0</r>
+ <r p="2">3406.0</r>
+ <r p="3">1333.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="11561">
+ <r p="1">5130.0</r>
+ <r p="2">3083.0</r>
+ <r p="3">1333.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="11562">
+ <r p="1">6020.0</r>
+ <r p="2">3956.0</r>
+ <r p="3">1333.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="11568">
+ <r p="1">5527.0</r>
+ <r p="2">4117.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="11569">
+ <r p="1">5086.0</r>
+ <r p="2">3206.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="13905">
+ <r p="1">1655.0</r>
+ <r p="2">1183.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="13910">
+ <r p="1">2587.0</r>
+ <r p="2">1900.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="14427">
+ <r p="1">1668.0</r>
+ <r p="2">1217.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="14655">
+ <r p="1">4904.0</r>
+ <r p="2">3155.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="14656">
+ <r p="1">5357.0</r>
+ <r p="2">3577.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="15360">
+ <r p="1">2177.0</r>
+ <r p="2">1438.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="15361">
+ <r p="1">2480.0</r>
+ <r p="2">1615.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="15548">
+ <r p="1">1730.0</r>
+ <r p="2">1174.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ <measValue measObjLdn="15549">
+ <r p="1">2227.0</r>
+ <r p="2">1341.0</r>
+ <suspect>false</suspect>
+ </measValue>
+ </measInfo>
+ </measData>
+ <fileFooter>
+ <measCollec endTime="2021-01-15T05:46:30.387"/>
+ </fileFooter>
+</measCollecFile>
diff --git a/components/kpi-computation-ms/src/test/resources/kpi/kpi_config_slicing.json b/components/kpi-computation-ms/src/test/resources/kpi/kpi_config_slicing.json
new file mode 100644
index 00000000..bbc7fb2a
--- /dev/null
+++ b/components/kpi-computation-ms/src/test/resources/kpi/kpi_config_slicing.json
@@ -0,0 +1,17 @@
+{
+ "domain": "measurementsForKpi",
+ "methodForKpi": [{
+ "eventName": "perf3gpp_CORE-cucpserver2_pmMeasResult",
+ "controlLoopSchemaType": "SLICE",
+ "policyScope": "resource=networkSlice;type=configuration",
+ "policyName": "configuration.dcae.microservice.pm-mapper.xml",
+ "policyVersion": "v0.0.1",
+ "kpis": [{
+ "measType": "PDUSessionEstSR",
+ "operation": "RATIO",
+ "operands": ["SM.PduSessionCreationSucc","SM.PduSessionCreationReq"]
+ }
+ ]
+ }
+ ]
+}
diff --git a/components/kpi-computation-ms/src/test/resources/kpi/ves_message_slicing.json b/components/kpi-computation-ms/src/test/resources/kpi/ves_message_slicing.json
new file mode 100644
index 00000000..41a8f91c
--- /dev/null
+++ b/components/kpi-computation-ms/src/test/resources/kpi/ves_message_slicing.json
@@ -0,0 +1,270 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "domain": "perf3gpp",
+ "eventId": "243f63f4-bb54-4f65-8aab-d254cd5b026d",
+ "sequence": 0,
+ "eventName": "perf3gpp_CORE-cucpserver2_pmMeasResult",
+ "sourceName": "oteNB5309",
+ "reportingEntityName": "",
+ "priority": "Normal",
+ "startEpochMicrosec": 1610689590387,
+ "lastEpochMicrosec": 1610689590387,
+ "version": "4.0",
+ "vesEventListenerVersion": "7.1",
+ "timeZoneOffset": "UTC+05:00"
+ },
+ "perf3gppFields": {
+ "perf3gppFieldsVersion": "1.0",
+ "measDataCollection": {
+ "granularityPeriod": 900,
+ "measuredEntityUserName": "",
+ "measuredEntityDn": "cucpserver2",
+ "measuredEntitySoftwareVersion": "r0.1",
+ "measInfoList": [
+ {
+ "measInfoId": {
+ "sMeasInfoId": "measInfoIsVal"
+ },
+ "measTypes": {
+ "sMeasTypesList": [
+ "SM.PduSessionCreationSucc.0011-0010",
+ "SM.PduSessionCreationReq.0011-0010",
+ "SM.PduSessionCreationFail.0"
+ ]
+ },
+ "measValuesList": [
+ {
+ "measObjInstId": "10896",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "5813.0"
+ },
+ {
+ "p": 2,
+ "sValue": "3679.0"
+ },
+ {
+ "p": 3,
+ "sValue": "1333.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "10897",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "5637.0"
+ },
+ {
+ "p": 2,
+ "sValue": "3406.0"
+ },
+ {
+ "p": 3,
+ "sValue": "1333.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "11561",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "5130.0"
+ },
+ {
+ "p": 2,
+ "sValue": "3083.0"
+ },
+ {
+ "p": 3,
+ "sValue": "1333.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "11562",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "6020.0"
+ },
+ {
+ "p": 2,
+ "sValue": "3956.0"
+ },
+ {
+ "p": 3,
+ "sValue": "1333.0"
+ }
+
+ ]
+ },
+ {
+ "measObjInstId": "11568",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "5527.0"
+ },
+ {
+ "p": 2,
+ "sValue": "4117.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "11569",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "5086.0"
+ },
+ {
+ "p": 2,
+ "sValue": "3206.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "13905",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "1655.0"
+ },
+ {
+ "p": 2,
+ "sValue": "1183.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "13910",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "2587.0"
+ },
+ {
+ "p": 2,
+ "sValue": "1900.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "14427",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "1668.0"
+ },
+ {
+ "p": 2,
+ "sValue": "1217.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "14655",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "4904.0"
+ },
+ {
+ "p": 2,
+ "sValue": "3155.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "14656",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "5357.0"
+ },
+ {
+ "p": 2,
+ "sValue": "3577.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "15360",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "2177.0"
+ },
+ {
+ "p": 2,
+ "sValue": "1438.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "15361",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "2480.0"
+ },
+ {
+ "p": 2,
+ "sValue": "1615.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "15548",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "1730.0"
+ },
+ {
+ "p": 2,
+ "sValue": "1174.0"
+ }
+ ]
+ },
+ {
+ "measObjInstId": "15549",
+ "suspectFlag": "false",
+ "measResults": [
+ {
+ "p": 1,
+ "sValue": "2227.0"
+ },
+ {
+ "p": 2,
+ "sValue": "1341.0"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+}
diff --git a/components/kpi-computation-ms/version.properties b/components/kpi-computation-ms/version.properties
index ada000a6..be3c3ddd 100644
--- a/components/kpi-computation-ms/version.properties
+++ b/components/kpi-computation-ms/version.properties
@@ -3,6 +3,7 @@
# kpi-ms
# ================================================================================
# Copyright (C) 2021 China Mobile.
+# Copyright (C) 2022 Wipro Limited. 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.
@@ -20,7 +21,7 @@
###############################################################################
major=1
minor=0
-patch=4
+patch=5
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT