X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dashboard%2Fwebapp-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fric%2Fportal%2Fdashboard%2Fcontroller%2FPolicyController.java;h=410ad1df85afe2bc3d3ef525e10f0e0372e35ef7;hb=bbc4aa48f60dc70154ff07c2143918053f1c9154;hp=8af4e97aaaf0be88bf334855506ebb290cba9aea;hpb=f0273617b916cdc8633382291b9986e33cc13fa1;p=nonrtric.git diff --git a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/PolicyController.java b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/PolicyController.java index 8af4e97a..410ad1df 100644 --- a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/PolicyController.java +++ b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/PolicyController.java @@ -49,8 +49,9 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; - +import java.util.Collection; import io.swagger.annotations.ApiOperation; /** @@ -126,10 +127,11 @@ public class PolicyController { + "}") @Secured({ DashboardConstants.ROLE_ADMIN }) public void putPolicyInstance(@PathVariable(POLICY_TYPE_ID_NAME) String policyTypeIdString, + @RequestParam(name = "ric", required = true) String ric, @PathVariable(POLICY_INSTANCE_ID_NAME) String policyInstanceId, @RequestBody String instance) { logger.debug("putPolicyInstance typeId: {}, instanceId: {}, instance: {}", policyTypeIdString, policyInstanceId, instance); - this.policyAgentApi.putPolicy(policyTypeIdString, policyInstanceId, instance); + this.policyAgentApi.putPolicy(policyTypeIdString, policyInstanceId, instance, ric); } @ApiOperation(value = "Deletes the policy instances for the given policy type.") @@ -158,4 +160,17 @@ public class PolicyController { throw new HttpNotImplementedException("Not Implemented Exception"); } } -} + + @ApiOperation(value = "Returns the rics supporting the given policy type.") + @GetMapping("/rics") + @Secured({ DashboardConstants.ROLE_ADMIN, DashboardConstants.ROLE_STANDARD }) + public String getRicsSupportingType( + @RequestParam(name = "policyType", required = true) String supportingPolicyType) { + logger.debug("getRicsSupportingType {}", supportingPolicyType); + + Collection result = this.policyAgentApi.getRicsSupportingType(supportingPolicyType); + String json = gson.toJson(result); + return json; + } + +};