X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Fcontrollers%2FRicRepositoryController.java;h=1064c6f07022519641cf970213e61e39089d48c7;hb=c683cd55dff59dd3d67cf409e397298bee5b7b91;hp=a96766d308f848620a26f4685d11a87df7e444ad;hpb=889b38fd05bc9143647827742e3a8e0f10783bc8;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java index a96766d3..1064c6f0 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java @@ -63,18 +63,18 @@ public class RicRepositoryController { @ApiOperation(value = "Returns the name of a RIC managing one Mananged Element") @ApiResponses( value = { // - @ApiResponse(code = 200, message = "RIC is fond", response = String.class), // - @ApiResponse(code = 404, message = "RIC is not fond", response = String.class) // + @ApiResponse(code = 200, message = "RIC is found", response = String.class), // + @ApiResponse(code = 404, message = "RIC is not found", response = String.class) // }) public ResponseEntity getRic( - @RequestParam(name = "managedElementId", required = false, defaultValue = "") String managedElementId) { + @RequestParam(name = "managedElementId", required = true) String managedElementId) { Optional ric = this.rics.lookupRicForManagedElement(managedElementId); if (ric.isPresent()) { return new ResponseEntity<>(ric.get().name(), HttpStatus.OK); } else { - return new ResponseEntity<>("", HttpStatus.NOT_FOUND); + return new ResponseEntity<>("No RIC found", HttpStatus.NOT_FOUND); } } @@ -82,7 +82,7 @@ public class RicRepositoryController { * @return a Json array of all RIC data Example: http://localhost:8081/ric */ @GetMapping("/rics") - @ApiOperation(value = "Query NearRT RIC information") + @ApiOperation(value = "Query Near-RT RIC information") @ApiResponses( value = { // @ApiResponse(code = 200, message = "OK", response = RicInfo.class, responseContainer = "List"), // @@ -95,11 +95,10 @@ public class RicRepositoryController { } List result = new ArrayList<>(); - synchronized (rics) { - for (Ric ric : rics.getRics()) { - if (supportingPolicyType == null || ric.isSupportingType(supportingPolicyType)) { - result.add(new RicInfo(ric.name(), ric.getManagedElementIds(), ric.getSupportedPolicyTypeNames())); - } + for (Ric ric : rics.getRics()) { + if (supportingPolicyType == null || ric.isSupportingType(supportingPolicyType)) { + result.add(new RicInfo(ric.name(), ric.getManagedElementIds(), ric.getSupportedPolicyTypeNames(), + ric.getState().toString())); } }