aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
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 /src/main/java
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
Diffstat (limited to 'src/main/java')
-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
4 files changed, 21 insertions, 3 deletions
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);