aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-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
-rw-r--r--src/main/resources/application-dev.properties4
4 files changed, 31 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 0b7223b..5196386 100644
--- a/.gitignore
+++ b/.gitignore
@@ -107,4 +107,7 @@ local.properties
a1-pe-simulator.iml
# Building docker-image files
-**/docker/resource/* \ No newline at end of file
+**/docker/resource/*
+
+# Default A1 PM bulk files directory
+generated_pm_bulks/ \ No newline at end of file
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());
+ }
});
});
}
diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties
index bd735c6..4999df3 100644
--- a/src/main/resources/application-dev.properties
+++ b/src/main/resources/application-dev.properties
@@ -15,4 +15,6 @@ vnf.config.file=src/test/resources/vnf.config
topology.cell.config.file=src/test/resources/cells.json
topology.ue.config.file=src/test/resources/ue.json
-ves.collector.protocol=http \ No newline at end of file
+ves.collector.protocol=http
+
+xml.pm.location=generated_pm_bulks/ \ No newline at end of file