use of org.onosproject.net.packet.PacketProcessorEntry in project onos by opennetworkinglab.
the class PacketProcessorsWebResource method getPacketProcessors.
/**
* Gets packet processors. Returns array of all packet processors.
*
* @onos.rsModel PacketProcessorsGet
* @return 200 OK with array of all packet processors.
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getPacketProcessors() {
PacketService service = get(PacketService.class);
ObjectNode root = mapper().createObjectNode();
ArrayNode pktProcNode = root.putArray("packet-processors");
List<PacketProcessorEntry> processors = service.getProcessors();
ObjectMapper mapper = new ObjectMapper();
for (PacketProcessorEntry p : processors) {
pktProcNode.add(mapper.createObjectNode().put("priority", priorityFormat(p.priority())).put("class", p.processor().getClass().getName()).put("packets", p.invocations()).put("avgNanos", p.averageNanos()));
}
return ok(root).build();
}
use of org.onosproject.net.packet.PacketProcessorEntry in project onos by opennetworkinglab.
the class PacketProcessorsListCommand method json.
private JsonNode json(List<PacketProcessorEntry> processors) {
ObjectMapper mapper = new ObjectMapper();
ArrayNode result = mapper.createArrayNode();
for (PacketProcessorEntry p : processors) {
result.add(mapper.createObjectNode().put("priority", priorityFormat(p.priority())).put("class", p.processor().getClass().getName()).put("packets", p.invocations()).put("avgNanos", p.averageNanos()));
}
return result;
}
Aggregations