aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authork.kedron <k.kedron@partner.samsung.com>2021-08-19 12:54:32 +0200
committerk.kedron <k.kedron@partner.samsung.com>2021-08-27 20:54:24 +0200
commitd6f791ccbe61cc9359c03df4dbe19f64c812aaf9 (patch)
tree72113281b6458c64711228e26fec38142e437505 /src/main/java
parentf176c991d7ea04b10503ef79c98c9adc87e91fb6 (diff)
Add trafficModel support
In PM Bulk file Issue-ID: INT-1945 Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com> Change-Id: If0e339a2a7652b03435f061aaa4800c55c410ccc
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/a1pesimulator/data/ves/MeasurementFields.java12
-rw-r--r--src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java23
2 files changed, 24 insertions, 11 deletions
diff --git a/src/main/java/org/onap/a1pesimulator/data/ves/MeasurementFields.java b/src/main/java/org/onap/a1pesimulator/data/ves/MeasurementFields.java
index 86af5d6..5fe98b3 100644
--- a/src/main/java/org/onap/a1pesimulator/data/ves/MeasurementFields.java
+++ b/src/main/java/org/onap/a1pesimulator/data/ves/MeasurementFields.java
@@ -13,9 +13,12 @@
package org.onap.a1pesimulator.data.ves;
+import static org.onap.a1pesimulator.util.Constants.MEASUREMENT_FIELD_VALUE;
+
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -39,5 +42,14 @@ public class MeasurementFields {
private String name;
private Map<String, String> hashMap;
+
+ public String getMeasurementValue() {
+ if (hashMap.containsKey(MEASUREMENT_FIELD_VALUE)) {
+ return hashMap.get(MEASUREMENT_FIELD_VALUE);
+ } else {
+ return hashMap.entrySet().stream().map(entry -> entry.getKey() + ":" + entry.getValue())
+ .collect(Collectors.joining(","));
+ }
+ }
}
}
diff --git a/src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java b/src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java
index fffee12..813c8a4 100644
--- a/src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java
+++ b/src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java
@@ -17,13 +17,11 @@ import static java.util.Comparator.comparing;
import static java.util.Objects.isNull;
import static org.onap.a1pesimulator.util.Constants.EMPTY_STRING;
import static org.onap.a1pesimulator.util.Constants.MEASUREMENT_FIELD_IDENTIFIER;
-import static org.onap.a1pesimulator.util.Constants.MEASUREMENT_FIELD_VALUE;
import static org.onap.a1pesimulator.util.Constants.TEMP_DIR;
import static org.onap.a1pesimulator.util.Convertors.ISO_8601_DATE;
import static org.onap.a1pesimulator.util.Convertors.YYYYMMDD_PATTERN;
import static org.onap.a1pesimulator.util.Convertors.truncateToSpecifiedMinutes;
import static org.onap.a1pesimulator.util.Convertors.zonedDateTimeToString;
-import static org.onap.a1pesimulator.util.RanVesUtils.UE_PARAM_TRAFFIC_MODEL;
import java.io.File;
import java.time.ZonedDateTime;
@@ -200,8 +198,8 @@ public class PMBulkFileService {
HashMap<String, String> measurmentMap = new HashMap<>();
AtomicInteger i = new AtomicInteger(1);
event.getMeasurementFields().getAdditionalMeasurements().forEach(additionalMeasurement -> {
- if (Stream.of(UE_PARAM_TRAFFIC_MODEL, MEASUREMENT_FIELD_IDENTIFIER)
- .noneMatch(elementName -> elementName.equalsIgnoreCase(additionalMeasurement.getName()))) {
+ if (Stream.of(MEASUREMENT_FIELD_IDENTIFIER)
+ .noneMatch(elementName -> elementName.equalsIgnoreCase(additionalMeasurement.getName()))) {
Element measType = doc.createElement("measType");
measInfo.appendChild(measType);
measType.setAttribute("p", String.valueOf(i));
@@ -216,13 +214,16 @@ public class PMBulkFileService {
measInfo.appendChild(measValue);
measValue.setAttribute("measObjLdn", eventMemoryHolder.getCellId());
event.getMeasurementFields().getAdditionalMeasurements().stream()
- .filter(additionalMeasurement -> measurmentMap.containsKey(additionalMeasurement.getName())).forEach(additionalMeasurement -> {
-
- //r elements
- Element r = doc.createElement("r");
- measValue.appendChild(r);
- r.setAttribute("p", measurmentMap.get(additionalMeasurement.getName()));
- r.setTextContent(additionalMeasurement.getHashMap().get(MEASUREMENT_FIELD_VALUE));
+ .filter(additionalMeasurement -> measurmentMap.containsKey(additionalMeasurement.getName()))
+ .forEach(additionalMeasurement -> {
+ if (!additionalMeasurement.getMeasurementValue().isEmpty()) {
+
+ //r elements
+ Element r = doc.createElement("r");
+ measValue.appendChild(r);
+ r.setAttribute("p", measurmentMap.get(additionalMeasurement.getName()));
+ r.setTextContent(additionalMeasurement.getMeasurementValue());
+ }
});
});
}