Merge "Changed in config will add and recover Rics"
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / controllers / RicRepositoryController.java
index db17fb2..6b413b2 100644 (file)
@@ -64,7 +64,7 @@ public class RicRepositoryController {
      * Example: http://localhost:8080/rics?managedElementId=kista_1
      */
     @GetMapping("/ric")
-    @ApiOperation(value = "Returns the name of a RIC managing one Mananged Element")
+    @ApiOperation(value = "Returns the name of a RIC managing one Mananged Element", response = String.class)
     @ApiResponses(
         value = { //
             @ApiResponse(code = 200, message = "RIC is fond"), //
@@ -87,21 +87,24 @@ public class RicRepositoryController {
      *         Example: http://localhost:8080/ric
      */
     @GetMapping("/rics")
-    @ApiOperation(value = "Returns defined NearRT RIC:s as Json")
+    @ApiOperation(value = "Returns defined NearRT RIC:s as Json", response = RicInfo.class)
     @ApiResponses(
         value = { //
-            @ApiResponse(code = 200, message = "OK") //
+            @ApiResponse(code = 200, message = "OK", response = RicInfo.class) //
         })
     public ResponseEntity<String> getRics(
         @RequestParam(name = "policyType", required = false) String supportingPolicyType) {
+
         Vector<RicInfo> result = new Vector<>();
-        for (Ric ric : rics.getRics()) {
-            if (supportingPolicyType == null || ric.isSupportingType(supportingPolicyType)) {
-                result.add(ImmutableRicInfo.builder() //
-                    .name(ric.name()) //
-                    .nodeNames(ric.getManagedNodes()) //
-                    .policyTypes(ric.getSupportedPolicyTypeNames()) //
-                    .build());
+        synchronized (rics) {
+            for (Ric ric : rics.getRics()) {
+                if (supportingPolicyType == null || ric.isSupportingType(supportingPolicyType)) {
+                    result.add(ImmutableRicInfo.builder() //
+                        .name(ric.name()) //
+                        .managedElementIds(ric.getManagedElementIds()) //
+                        .policyTypes(ric.getSupportedPolicyTypeNames()) //
+                        .build());
+                }
             }
         }