aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislav Marszalek <s.marszalek2@partner.samsung.com>2021-07-16 08:24:29 +0200
committerStanislav Marszalek <s.marszalek2@partner.samsung.com>2021-07-28 12:24:34 +0000
commit9a735bbccf18e984a9ae7c6bb81ee133ad911941 (patch)
treebb9b0e0c43ef31f95ef2768ca3249a7d51d4c828
parentcc41ed25adcd0d5a4714ac92eee387c41eacbd3e (diff)
O1 PM Bulk support - Changes from testing against ONAP
Issue-ID: INT-1945 Signed-off-by: Stanislav Marszalek <s.marszalek2@partner.samsung.com> Change-Id: I02d3684c98d563d7f386de2fdf032e930ac49b2f
-rw-r--r--docker/Dockerfile2
-rw-r--r--src/main/java/org/onap/a1pesimulator/data/ves/CommonEventHeader.java2
-rw-r--r--src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java11
-rw-r--r--src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java9
-rw-r--r--src/main/java/org/onap/a1pesimulator/util/Convertors.java2
-rw-r--r--src/main/resources/application.properties5
-rw-r--r--src/test/resources/application.properties5
7 files changed, 31 insertions, 5 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 08bb20f..95ee9a4 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -5,6 +5,8 @@ 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
+# 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
USER onap
COPY --chown=onap:onap resource/* /var/netconf2/
diff --git a/src/main/java/org/onap/a1pesimulator/data/ves/CommonEventHeader.java b/src/main/java/org/onap/a1pesimulator/data/ves/CommonEventHeader.java
index 9cef221..baa8ab5 100644
--- a/src/main/java/org/onap/a1pesimulator/data/ves/CommonEventHeader.java
+++ b/src/main/java/org/onap/a1pesimulator/data/ves/CommonEventHeader.java
@@ -42,6 +42,8 @@ public class CommonEventHeader {
private Long lastEpochMicrosec;
+ private String timeZoneOffset;
+
private String priority;
private Integer sequence;
diff --git a/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java b/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java
index b5e7a9c..644ce3b 100644
--- a/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java
+++ b/src/main/java/org/onap/a1pesimulator/service/fileready/FileReadyEventService.java
@@ -5,6 +5,7 @@ import static org.onap.a1pesimulator.util.Constants.FILE_READY_CHANGE_IDENTIFIER
import static org.onap.a1pesimulator.util.Constants.FILE_READY_CHANGE_TYPE;
import java.io.File;
+import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -51,6 +52,12 @@ public class FileReadyEventService {
@Value("${file.ready.notificationFieldsVersion}")
private String notificationFieldsVersion;
+ @Value("${file.ready.priority}")
+ private String priority;
+
+ @Value("${file.ready.reportingEntityName}")
+ private String reportingEntityName;
+
public FileReadyEventService(FtpServerService ftpServerService) {
this.ftpServerService = ftpServerService;
}
@@ -118,6 +125,10 @@ public class FileReadyEventService {
.domain(domain)
.eventName(eventName)
.eventId(UUID.randomUUID().toString())
+ .priority(priority)
+ .reportingEntityName(reportingEntityName)
+ .sequence(0)
+ .timeZoneOffset(ZonedDateTime.now().getOffset().toString())
.build();
}
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 e628977..37b3440 100644
--- a/src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java
+++ b/src/main/java/org/onap/a1pesimulator/service/fileready/PMBulkFileService.java
@@ -70,6 +70,9 @@ public class PMBulkFileService {
@Value("${xml.pm.bulk.userLabel}")
private String userLabel;
+ @Value("${xml.pm.bulk.domainId}")
+ private String domainId;
+
public PMBulkFileService(VnfConfigReader vnfConfigReader) {
this.vnfConfigReader = vnfConfigReader;
}
@@ -240,14 +243,15 @@ public class PMBulkFileService {
* @param collectedEvents list of stored events
* @return newly created File
*/
- private static File getXmlFile(List<EventMemoryHolder> collectedEvents) {
- StringBuilder fileNameBuilder = new StringBuilder("D");
+ private File getXmlFile(List<EventMemoryHolder> collectedEvents) {
+ StringBuilder fileNameBuilder = new StringBuilder("C");
ZonedDateTime firstEventTime = earliestEventTime(collectedEvents);
ZonedDateTime lastEventTime = latestEventTime(collectedEvents);
fileNameBuilder.append(zonedDateTimeToString(firstEventTime, YYYYMMDD_PATTERN)).append(".");
fileNameBuilder.append(zonedDateTimeToString(truncateToSpecifiedMinutes(firstEventTime, 5), "HHmmZ")).append("-");
fileNameBuilder.append(zonedDateTimeToString(lastEventTime, YYYYMMDD_PATTERN)).append(".");
fileNameBuilder.append(zonedDateTimeToString(truncateToSpecifiedMinutes(lastEventTime, 5), "HHmmZ"));
+ fileNameBuilder.append("_").append(domainId);
fileNameBuilder.append(appendRcIfNecessary(fileNameBuilder));
fileNameBuilder.append(".xml");
@@ -270,6 +274,7 @@ public class PMBulkFileService {
if (uniqueFileNamesWithCount.containsKey(fileName)) {
sequence = uniqueFileNamesWithCount.get(fileName).incrementAndGet();
} else {
+ uniqueFileNamesWithCount.clear(); //we have new dates, so we can clear existing list to not grow infinitely
uniqueFileNamesWithCount.put(fileName, new AtomicInteger(0));
}
return sequence > 0 ? "_-_" + sequence : EMPTY_STRING;
diff --git a/src/main/java/org/onap/a1pesimulator/util/Convertors.java b/src/main/java/org/onap/a1pesimulator/util/Convertors.java
index 11e703f..3d1f96c 100644
--- a/src/main/java/org/onap/a1pesimulator/util/Convertors.java
+++ b/src/main/java/org/onap/a1pesimulator/util/Convertors.java
@@ -9,7 +9,7 @@ import lombok.experimental.UtilityClass;
public class Convertors {
public static final String YYYYMMDD_PATTERN = "yyyyMMdd";
- public static final String ISO_8601_DATE = "yyyy-MM-dd'T'HH:mm:ssZ";
+ public static final String ISO_8601_DATE = "yyyy-MM-dd'T'HH:mm:ssXXX";
public static String zonedDateTimeToString(ZonedDateTime localDateTime) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(YYYYMMDD_PATTERN);
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index fd95743..955bc41 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -45,6 +45,7 @@ xml.pm.bulk.fileFormatVersion=32.435 V7.0
xml.pm.bulk.vendorName=Samsung
xml.pm.bulk.userLabel=ORAN PE Sim
xml.pm.bulk.fileSender=ORAN
+xml.pm.bulk.domainId=DomainId
#File Ready Event constants
file.ready.version=4.0.1
file.ready.vesEventListenerVersion=7.0.1
@@ -52,4 +53,6 @@ file.ready.domain=notification
file.ready.eventName=stndDefined-PE-Samsung-Notification
file.ready.fileFormatType=org.3GPP.32.435#measCollec
file.ready.fileFormatVersion=V10
-file.ready.notificationFieldsVersion=2.0 \ No newline at end of file
+file.ready.notificationFieldsVersion=2.0
+file.ready.priority=Normal
+file.ready.reportingEntityName=otenb5309 \ No newline at end of file
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index 77c2933..56a17cb 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -38,6 +38,7 @@ xml.pm.bulk.fileFormatVersion=32.435 V7.0
xml.pm.bulk.vendorName=Samsung
xml.pm.bulk.userLabel=ORAN PE Sim
xml.pm.bulk.fileSender=ORAN
+xml.pm.bulk.domainId=DomainId
#File Ready Event constants
ftp.server.upload=false
file.ready.version=4.0.1
@@ -46,4 +47,6 @@ file.ready.domain=notification
file.ready.eventName=stndDefined-PE-Samsung-Notification
file.ready.fileFormatType=org.3GPP.32.435#measCollec
file.ready.fileFormatVersion=V10
-file.ready.notificationFieldsVersion=2.0 \ No newline at end of file
+file.ready.notificationFieldsVersion=2.0
+file.ready.priority=Normal
+file.ready.reportingEntityName=otenb5309 \ No newline at end of file