aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authork.kedron <k.kedron@partner.samsung.com>2021-09-16 17:08:30 +0200
committerKrystian Kedron <k.kedron@partner.samsung.com>2021-09-20 10:55:29 +0000
commitf1563a03cabc572d1cd15260befdaa8808048fbf (patch)
tree11e08a9141b82b444957bff6dfdae6358daf3ed9
parent5cdf20e8b9a1a3fef125b760591b934dfeeb2787 (diff)
Add support for reportingMethod
In GlobalVesConfiguration Also update eventStructure endpoint Issue-ID: INT-1945 Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com> Change-Id: I49add658f9a70bcff3292e35ae76a68ce3ba5b77
-rw-r--r--src/main/java/org/onap/a1pesimulator/controller/RanCellController.java6
-rw-r--r--src/main/java/org/onap/a1pesimulator/controller/RanEventConfigureController.java9
-rw-r--r--src/main/java/org/onap/a1pesimulator/data/ReportingMethodEnum.java2
-rw-r--r--src/main/java/org/onap/a1pesimulator/data/fileready/RanPeriodicEvent.java3
-rw-r--r--src/main/java/org/onap/a1pesimulator/data/ves/GlobalVesConfiguration.java5
-rw-r--r--src/main/java/org/onap/a1pesimulator/service/ves/RanVesBrokerService.java6
-rw-r--r--src/main/java/org/onap/a1pesimulator/service/ves/RanVesBrokerServiceImpl.java14
-rw-r--r--src/main/java/org/onap/a1pesimulator/service/ves/RanVesDataProvider.java16
-rw-r--r--src/main/java/org/onap/a1pesimulator/service/ves/RanVesHolder.java6
-rw-r--r--src/main/resources/application.properties1
-rw-r--r--src/test/java/org/onap/a1pesimulator/service/ves/RanVesHolderTest.java8
-rw-r--r--src/test/resources/application.properties1
12 files changed, 57 insertions, 20 deletions
diff --git a/src/main/java/org/onap/a1pesimulator/controller/RanCellController.java b/src/main/java/org/onap/a1pesimulator/controller/RanCellController.java
index f79cb64..10dfe2b 100644
--- a/src/main/java/org/onap/a1pesimulator/controller/RanCellController.java
+++ b/src/main/java/org/onap/a1pesimulator/controller/RanCellController.java
@@ -126,13 +126,13 @@ public class RanCellController {
return ResponseEntity.accepted().build();
}
- @GetMapping(value = "/{identifier}/eventStructure")
- public ResponseEntity<VesEvent> getVesEventStructure(final @PathVariable String identifier) {
+ @GetMapping(value = "/{identifier}/pmConfig")
+ public ResponseEntity<RanPeriodicEvent> getPMConfig(final @PathVariable String identifier) {
checkIfCellExistOrThrowException(identifier);
if (!ranVesBrokerService.getEnabledEventElementIdentifiers().contains(identifier)) {
return ResponseEntity.notFound().build();
}
- return ResponseEntity.ok(ranVesBrokerService.getEventStructure(identifier));
+ return ResponseEntity.ok(ranVesBrokerService.getPeriodicEvent(identifier));
}
private Integer getInterval(Integer requested) {
diff --git a/src/main/java/org/onap/a1pesimulator/controller/RanEventConfigureController.java b/src/main/java/org/onap/a1pesimulator/controller/RanEventConfigureController.java
index 5efe07a..5b5037c 100644
--- a/src/main/java/org/onap/a1pesimulator/controller/RanEventConfigureController.java
+++ b/src/main/java/org/onap/a1pesimulator/controller/RanEventConfigureController.java
@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
-@RequestMapping({"${restapi.version}/ran/eventConfig"})
+@RequestMapping({"${restapi.version}/ran/globalPMConfig"})
public class RanEventConfigureController {
private final RanVesBrokerService ranVesBrokerService;
@@ -33,16 +33,17 @@ public class RanEventConfigureController {
}
@GetMapping
- public ResponseEntity<GlobalVesConfiguration> getEventConfig() {
+ public ResponseEntity<GlobalVesConfiguration> getGlobalPMConfig() {
GlobalVesConfiguration config = new GlobalVesConfiguration(ranVesBrokerService.getGlobalVesInterval(),
- ranVesBrokerService.getGlobalPmVesStructure());
+ ranVesBrokerService.getGlobalPmVesStructure(), ranVesBrokerService.getGlobalReportingMethod());
return ResponseEntity.ok(config);
}
@PostMapping
- public ResponseEntity<Void> setEventConfig(final @RequestBody GlobalVesConfiguration config) {
+ public ResponseEntity<Void> setGlobalPMConfig(final @RequestBody GlobalVesConfiguration config) {
ranVesBrokerService.setGlobalPmVesStructure(config.getEvent());
ranVesBrokerService.setGlobalVesInterval(config.getInterval());
+ ranVesBrokerService.setGlobalReportingMethod(config.getReportingMethod());
return ResponseEntity.ok().build();
}
}
diff --git a/src/main/java/org/onap/a1pesimulator/data/ReportingMethodEnum.java b/src/main/java/org/onap/a1pesimulator/data/ReportingMethodEnum.java
index f2a799b..f7bb52c 100644
--- a/src/main/java/org/onap/a1pesimulator/data/ReportingMethodEnum.java
+++ b/src/main/java/org/onap/a1pesimulator/data/ReportingMethodEnum.java
@@ -17,7 +17,7 @@ import lombok.Getter;
@Getter
public enum ReportingMethodEnum {
- FILE_READY("File ready"),
+ FILE_READY("FILE_READY"),
VES("VES");
public final String value;
diff --git a/src/main/java/org/onap/a1pesimulator/data/fileready/RanPeriodicEvent.java b/src/main/java/org/onap/a1pesimulator/data/fileready/RanPeriodicEvent.java
index 56d375e..364b368 100644
--- a/src/main/java/org/onap/a1pesimulator/data/fileready/RanPeriodicEvent.java
+++ b/src/main/java/org/onap/a1pesimulator/data/fileready/RanPeriodicEvent.java
@@ -13,6 +13,7 @@
package org.onap.a1pesimulator.data.fileready;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.concurrent.ScheduledFuture;
import org.onap.a1pesimulator.data.ves.VesEvent;
@@ -23,10 +24,12 @@ import lombok.Data;
@Data
@Builder
+@JsonIgnoreProperties({ "scheduledFuture", "ranRunnable" })
public class RanPeriodicEvent {
private VesEvent event;
private Integer interval;
+ private String reportingMethod;
private ScheduledFuture<?> scheduledFuture;
private AbstractRanRunnable ranRunnable;
}
diff --git a/src/main/java/org/onap/a1pesimulator/data/ves/GlobalVesConfiguration.java b/src/main/java/org/onap/a1pesimulator/data/ves/GlobalVesConfiguration.java
index 2d51a50..1186f84 100644
--- a/src/main/java/org/onap/a1pesimulator/data/ves/GlobalVesConfiguration.java
+++ b/src/main/java/org/onap/a1pesimulator/data/ves/GlobalVesConfiguration.java
@@ -20,6 +20,7 @@ import lombok.Getter;
@AllArgsConstructor
public class GlobalVesConfiguration {
- private Integer interval;
- private VesEvent event;
+ private final Integer interval;
+ private final VesEvent event;
+ private final String reportingMethod;
}
diff --git a/src/main/java/org/onap/a1pesimulator/service/ves/RanVesBrokerService.java b/src/main/java/org/onap/a1pesimulator/service/ves/RanVesBrokerService.java
index 8767251..1b92fbf 100644
--- a/src/main/java/org/onap/a1pesimulator/service/ves/RanVesBrokerService.java
+++ b/src/main/java/org/onap/a1pesimulator/service/ves/RanVesBrokerService.java
@@ -32,7 +32,7 @@ public interface RanVesBrokerService {
Collection<String> getEnabledEventElementIdentifiers();
- VesEvent getEventStructure(String identifier);
+ RanPeriodicEvent getPeriodicEvent(String identifier);
VesEvent startSendingFailureVesEvents(String identifier, ReportingMethodEnum reportingMethods);
@@ -43,4 +43,8 @@ public interface RanVesBrokerService {
Integer getGlobalVesInterval();
void setGlobalVesInterval(Integer interval);
+
+ String getGlobalReportingMethod();
+
+ void setGlobalReportingMethod(String reportingMethod);
}
diff --git a/src/main/java/org/onap/a1pesimulator/service/ves/RanVesBrokerServiceImpl.java b/src/main/java/org/onap/a1pesimulator/service/ves/RanVesBrokerServiceImpl.java
index 4417212..ea4b46d 100644
--- a/src/main/java/org/onap/a1pesimulator/service/ves/RanVesBrokerServiceImpl.java
+++ b/src/main/java/org/onap/a1pesimulator/service/ves/RanVesBrokerServiceImpl.java
@@ -71,8 +71,8 @@ public class RanVesBrokerServiceImpl implements RanVesBrokerService {
}
@Override
- public VesEvent getEventStructure(String identifier) {
- return vesHolder.getEventStructure(identifier);
+ public RanPeriodicEvent getPeriodicEvent(String identifier) {
+ return vesHolder.getPeriodicEventForCell(identifier);
}
@Override
@@ -95,6 +95,16 @@ public class RanVesBrokerServiceImpl implements RanVesBrokerService {
vesDataProvider.setInterval(interval);
}
+ @Override
+ public String getGlobalReportingMethod() {
+ return vesDataProvider.getReportingMethod();
+ }
+
+ @Override
+ public void setGlobalReportingMethod(String reportingMethod) {
+ vesDataProvider.setReportingMethod(reportingMethod);
+ }
+
private void enrichWithIdentifier(String identifier, VesEvent event) {
if (event.getMeasurementFields() == null || event.getMeasurementFields().getAdditionalMeasurements() == null) {
return;
diff --git a/src/main/java/org/onap/a1pesimulator/service/ves/RanVesDataProvider.java b/src/main/java/org/onap/a1pesimulator/service/ves/RanVesDataProvider.java
index 9a9a2f6..931b258 100644
--- a/src/main/java/org/onap/a1pesimulator/service/ves/RanVesDataProvider.java
+++ b/src/main/java/org/onap/a1pesimulator/service/ves/RanVesDataProvider.java
@@ -38,12 +38,18 @@ public class RanVesDataProvider {
private VesEvent failurePmVesEvent;
@Setter
private Integer interval;
+ @Setter
+ private String reportingMethod;
private final Integer defaultInterval;
+ private final String defaultReportingMethod;
private final ResourceLoader resourceLoader;
- public RanVesDataProvider(@Value("${ves.defaultInterval}") Integer defaultInterval, ResourceLoader resourceLoader) {
+ public RanVesDataProvider(@Value("${ves.defaultInterval}") Integer defaultInterval,
+ @Value("${ves.defaultReportingMethod}") String defaultReportingMethod,
+ ResourceLoader resourceLoader) {
this.defaultInterval = defaultInterval;
+ this.defaultReportingMethod = defaultReportingMethod;
this.resourceLoader = resourceLoader;
}
@@ -66,6 +72,14 @@ public class RanVesDataProvider {
return interval;
}
+ public String getReportingMethod() {
+ if (reportingMethod == null) {
+ return defaultReportingMethod;
+ }
+
+ return reportingMethod;
+ }
+
public Integer getFailureVesInterval() {
return defaultInterval;
}
diff --git a/src/main/java/org/onap/a1pesimulator/service/ves/RanVesHolder.java b/src/main/java/org/onap/a1pesimulator/service/ves/RanVesHolder.java
index c647811..92d30e4 100644
--- a/src/main/java/org/onap/a1pesimulator/service/ves/RanVesHolder.java
+++ b/src/main/java/org/onap/a1pesimulator/service/ves/RanVesHolder.java
@@ -156,12 +156,12 @@ public class RanVesHolder {
return !periodicEventsCache.isEmpty();
}
- VesEvent getEventStructure(String identifier) {
+ RanPeriodicEvent getPeriodicEventForCell(String identifier) {
if (!periodicEventsCache.containsKey(identifier)) {
throw new IllegalArgumentException(
MessageFormat.format("Cannot find event for given source {0}", identifier));
}
- return periodicEventsCache.get(identifier).getEvent();
+ return periodicEventsCache.get(identifier);
}
private static class ThreadCacheUpdateFunction
@@ -203,7 +203,7 @@ public class RanVesHolder {
ScheduledFuture<?> scheduledFuture =
vesPmThreadPoolTaskScheduler.scheduleAtFixedRate(ranRunnable, interval * 1000L);
- return RanPeriodicEvent.builder().event(vesEvent).interval(interval).scheduledFuture(scheduledFuture)
+ return RanPeriodicEvent.builder().event(vesEvent).interval(interval).reportingMethod(reportingMethod.getValue()).scheduledFuture(scheduledFuture)
.ranRunnable(ranRunnable).build();
}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 0228b87..da9eccd 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -17,6 +17,7 @@ ves.collector.protocol=https
ves.collector.endpoint=/eventListener/v7
ves.pm.maxPoolSize=10
ves.defaultInterval=10
+ves.defaultReportingMethod=FILE_READY
ves.defaultFailureDuration=120
ves.failing.throughput=1
ves.failing.latency=500
diff --git a/src/test/java/org/onap/a1pesimulator/service/ves/RanVesHolderTest.java b/src/test/java/org/onap/a1pesimulator/service/ves/RanVesHolderTest.java
index 20cb392..7f6258c 100644
--- a/src/test/java/org/onap/a1pesimulator/service/ves/RanVesHolderTest.java
+++ b/src/test/java/org/onap/a1pesimulator/service/ves/RanVesHolderTest.java
@@ -130,12 +130,14 @@ class RanVesHolderTest extends CommonFileReady {
void getEventStructure() {
VesEvent testedEvent = loadEventFromFile();
ranCellsHolder.startSendingVesEvents(TEST_CELL_ID, testedEvent, 10, ReportingMethodEnum.FILE_READY);
- VesEvent event = ranCellsHolder.getEventStructure(TEST_CELL_ID);
- assertThat(event).isEqualTo(testedEvent);
+ RanPeriodicEvent event = ranCellsHolder.getPeriodicEventForCell(TEST_CELL_ID);
+ assertThat(event.getEvent()).isEqualTo(testedEvent);
+ assertThat(event.getInterval()).isEqualTo(10);
+ assertThat(event.getReportingMethod()).isEqualTo(ReportingMethodEnum.FILE_READY.getValue());
}
@Test
void getEventStructureError() {
- assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> ranCellsHolder.getEventStructure(TEST_CELL_ID));
+ assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> ranCellsHolder.getPeriodicEventForCell(TEST_CELL_ID));
}
} \ No newline at end of file
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index ff09a40..77adba6 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -16,6 +16,7 @@ ves.collector.protocol=someProtocol
ves.collector.endpoint=/somePath
ves.pm.maxPoolSize=10
ves.defaultInterval=10
+ves.defaultReportingMethod=FILE_READY
ves.defaultFailureDuration=120
ves.failing.throughput=1
ves.failing.latency=500