diff options
author | Stanislav Marszalek <s.marszalek2@partner.samsung.com> | 2021-08-06 11:12:26 +0200 |
---|---|---|
committer | k.kedron <k.kedron@partner.samsung.com> | 2021-08-10 15:21:15 +0200 |
commit | deabb9bd3f5ba86cafa978954356e5d4ba8a4ab3 (patch) | |
tree | c6c9090bdcbfd5608c80d55a0bcdcd5771d6d04d /src/main/java/org/onap/a1pesimulator/controller/RanCellController.java | |
parent | 6bbd0749c646e79c7e686e7cd4be06667ab65736 (diff) |
O1 PM Bulk support - Unknown cell handling
Issue-ID: INT-1945
Signed-off-by: Stanislav Marszalek <s.marszalek2@partner.samsung.com>
Change-Id: I02d3684c98d563d7f386de2fdf032e930ac12b3f
Diffstat (limited to 'src/main/java/org/onap/a1pesimulator/controller/RanCellController.java')
-rw-r--r-- | src/main/java/org/onap/a1pesimulator/controller/RanCellController.java | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/main/java/org/onap/a1pesimulator/controller/RanCellController.java b/src/main/java/org/onap/a1pesimulator/controller/RanCellController.java index ae20f1c..f79cb64 100644 --- a/src/main/java/org/onap/a1pesimulator/controller/RanCellController.java +++ b/src/main/java/org/onap/a1pesimulator/controller/RanCellController.java @@ -60,10 +60,6 @@ public class RanCellController { @GetMapping(value = "/{identifier}") public ResponseEntity<CellDetails> getCellById(final @PathVariable String identifier) { - - if (!ranCellService.getCellIds().contains(identifier)) { - return ResponseEntity.notFound().build(); - } return ResponseEntity.ok(ranCellService.getCellById(identifier)); } @@ -71,7 +67,7 @@ public class RanCellController { @PostMapping(value = "/{identifier}/startFailure") public ResponseEntity<String> startSendingFailureVesEvents(@ApiParam(value = "Cell Id") final @PathVariable String identifier, @ApiParam(value = "Reporting Method", defaultValue = "FILE_READY", required = true) final @RequestParam() ReportingMethodEnum reportingMethod) { - + checkIfCellExistOrThrowException(identifier); ranCellService.failure(identifier); ranVesBrokerService.startSendingFailureVesEvents(identifier, reportingMethod); ranCellStateService.failingState(identifier); @@ -82,7 +78,7 @@ public class RanCellController { @ApiOperation("Stop sending failure VES events for specific cell") @PostMapping(value = "/{identifier}/stopFailure") public ResponseEntity<Void> stopSendingFailureVesEvents(@ApiParam(value = "Cell Id") final @PathVariable String identifier) { - + checkIfCellExistOrThrowException(identifier); ranCellService.recoverFromFailure(identifier); Optional<RanPeriodicEvent> vesEvent = ranVesBrokerService.stopSendingVesEvents(identifier); @@ -101,8 +97,9 @@ public class RanCellController { @ApiParam(value = "Cell Id") final @PathVariable String identifier, @ApiParam(value = "Granularity period in seconds", example = "60") final @RequestParam(required = false) Integer interval, @ApiParam(value = "Reporting Method", defaultValue = "FILE_READY", required = true) final @RequestParam() ReportingMethodEnum reportingMethod) { - log.info("Start sending ves events every {} seconds for {} ", getInterval(interval), identifier); + checkIfCellExistOrThrowException(identifier); + log.info("Start sending ves events every {} seconds for {} ", getInterval(interval), identifier); VesEvent vesEvent = vesEventOpt.orElse(ranVesBrokerService.getGlobalPmVesStructure()); ResponseEntity<String> responseEntity = @@ -118,6 +115,7 @@ public class RanCellController { @ApiOperation("Stop sending normal VES events for specific cell") @PostMapping(value = "/{identifier}/stop") public ResponseEntity<Void> stopSendingVesEvents(@ApiParam(value = "Cell Id") final @PathVariable String identifier) { + checkIfCellExistOrThrowException(identifier); log.info("Stop sending custom ves events for {}", identifier); Optional<RanPeriodicEvent> vesEvent = ranVesBrokerService.stopSendingVesEvents(identifier); if (!vesEvent.isPresent()) { @@ -130,6 +128,7 @@ public class RanCellController { @GetMapping(value = "/{identifier}/eventStructure") public ResponseEntity<VesEvent> getVesEventStructure(final @PathVariable String identifier) { + checkIfCellExistOrThrowException(identifier); if (!ranVesBrokerService.getEnabledEventElementIdentifiers().contains(identifier)) { return ResponseEntity.notFound().build(); } @@ -142,4 +141,13 @@ public class RanCellController { } return requested; } + + /** + * Check if cell exists otherwise getCellById() throws CellNotFoundException which is catched by RestExceptionHandler.class + * + * @param identifier cellId + */ + private void checkIfCellExistOrThrowException(String identifier) { + ranCellService.getCellById(identifier); + } } |