use of org.onosproject.segmentrouting.policy.api.DropPolicy in project trellis-control by opennetworkinglab.
the class PolicyWebResource method getDropPolicies.
/**
* Get all Drop Policies.
*
* @return 200 OK will a collection of Dop Policies
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("drop")
public Response getDropPolicies() {
PolicyService policyService = get(PolicyService.class);
ObjectNode root = mapper().createObjectNode();
ArrayNode policiesArr = root.putArray(POLICY);
Set<PolicyType> policyTypes = Set.of(PolicyType.DROP);
for (PolicyData policyData : policyService.policies(policyTypes)) {
Policy policy = policyData.policy();
policiesArr.add(codec(DropPolicy.class).encode((DropPolicy) policy, this));
}
return Response.ok(root).build();
}
Aggregations