diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | docker/Dockerfile | 6 | ||||
-rw-r--r-- | docker/resources/cells.json (renamed from doc/resources/cells.json) | 0 | ||||
-rw-r--r-- | docker/resources/ue.json (renamed from doc/resources/ue.json) | 0 | ||||
-rw-r--r-- | docker/resources/vnf.config (renamed from doc/resources/vnf.config) | 0 | ||||
-rw-r--r-- | src/main/java/org/onap/a1pesimulator/data/ves/MeasurementFields.java | 12 | ||||
-rw-r--r-- | src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java | 23 | ||||
-rw-r--r-- | src/main/resources/application-dev.properties | 4 | ||||
-rw-r--r-- | src/main/resources/application.properties | 8 |
9 files changed, 38 insertions, 20 deletions
@@ -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/docker/Dockerfile b/docker/Dockerfile index 95ee9a4..3cce571 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -4,12 +4,12 @@ COPY --chown=onap:onap a1-pe-simulator*.jar /a1-pe-simulator/a1-pe-simulator.jar # Create conf directory where vnf.config and topology files will be placed by ONAP controller USER root -RUN mkdir /var/netconf2 && chown onap:onap /var/netconf2 +RUN mkdir /a1-pe-simulator/config && chown onap:onap /a1-pe-simulator/config # Create folder for FTP upload via file system and change owner -RUN mkdir -p /a1pesim/generated_pm_bulks && chown onap:onap /a1pesim/generated_pm_bulks +RUN mkdir -p /a1-pe-simulator/generated_pm_bulks && chown onap:onap /a1-pe-simulator/generated_pm_bulks USER onap -COPY --chown=onap:onap resource/* /var/netconf2/ +COPY --chown=onap:onap resources/ /a1-pe-simulator/config WORKDIR /a1-pe-simulator diff --git a/doc/resources/cells.json b/docker/resources/cells.json index 42e94c2..42e94c2 100644 --- a/doc/resources/cells.json +++ b/docker/resources/cells.json diff --git a/doc/resources/ue.json b/docker/resources/ue.json index 2342723..2342723 100644 --- a/doc/resources/ue.json +++ b/docker/resources/ue.json diff --git a/doc/resources/vnf.config b/docker/resources/vnf.config index d14fe7b..d14fe7b 100644 --- a/doc/resources/vnf.config +++ b/docker/resources/vnf.config 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 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 581e0cf..0228b87 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -12,7 +12,7 @@ # server.port=9998 -vnf.config.file=/var/a1pesim/vnf.config +vnf.config.file=/a1-pe-simulator/config/vnf.config ves.collector.protocol=https ves.collector.endpoint=/eventListener/v7 ves.pm.maxPoolSize=10 @@ -28,8 +28,8 @@ ftp.server.filepath=upload ftp.server.username=admin ftp.server.password=samsung topology.cell.range=5 -topology.cell.config.file=/var/a1pesim/cells.json -topology.ue.config.file=/var/a1pesim/ue.json +topology.cell.config.file=/a1-pe-simulator/config/cells.json +topology.ue.config.file=/a1-pe-simulator/config/ue.json spring.cache.cache-names=vnfConfig,pmVes,failurePmVes spring.cache.caffeine.spec=maximumSize=10,expireAfterAccess=900s spring.mvc.view.prefix:/ @@ -38,7 +38,7 @@ logging.config=classpath:logback-spring.xml refresher.fixed.rate.ms=60000 restapi.version=v1 # PM Bulk File constants -xml.pm.location=/a1pesim/generated_pm_bulks +xml.pm.location=/a1-pe-simulator/generated_pm_bulks xml.pm.bulk.fileFormatVersion=32.435 V7.0 xml.pm.bulk.vendorName=Samsung xml.pm.bulk.userLabel=ORAN PE Sim |