From 9a735bbccf18e984a9ae7c6bb81ee133ad911941 Mon Sep 17 00:00:00 2001 From: Stanislav Marszalek Date: Fri, 16 Jul 2021 08:24:29 +0200 Subject: O1 PM Bulk support - Changes from testing against ONAP Issue-ID: INT-1945 Signed-off-by: Stanislav Marszalek Change-Id: I02d3684c98d563d7f386de2fdf032e930ac49b2f --- .../org/onap/a1pesimulator/data/ves/CommonEventHeader.java | 2 ++ .../service/fileready/FileReadyEventService.java | 11 +++++++++++ .../a1pesimulator/service/fileready/PMBulkFileService.java | 9 +++++++-- src/main/java/org/onap/a1pesimulator/util/Convertors.java | 2 +- src/main/resources/application.properties | 5 ++++- 5 files changed, 25 insertions(+), 4 deletions(-) (limited to 'src/main') 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 collectedEvents) { - StringBuilder fileNameBuilder = new StringBuilder("D"); + private File getXmlFile(List 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 -- cgit 1.2.3-korg