Search in sources :

Example 1 with FlowInfoJsonCodec

use of org.onosproject.openstacktelemetry.codec.rest.FlowInfoJsonCodec in project onos by opennetworkinglab.

the class OpenstackRestCodecRegister method activate.

@Activate
protected void activate() {
    codecService.registerCodec(StatsInfo.class, new StatsInfoJsonCodec());
    codecService.registerCodec(FlowInfo.class, new FlowInfoJsonCodec());
    codecService.registerCodec(StatsFlowRule.class, new StatsFlowRuleJsonCodec());
    codecService.registerCodec(TelemetryConfig.class, new TelemetryConfigJsonCodec());
    log.info("Started");
}
Also used : TelemetryConfigJsonCodec(org.onosproject.openstacktelemetry.codec.rest.TelemetryConfigJsonCodec) StatsInfoJsonCodec(org.onosproject.openstacktelemetry.codec.rest.StatsInfoJsonCodec) StatsFlowRuleJsonCodec(org.onosproject.openstacktelemetry.codec.rest.StatsFlowRuleJsonCodec) FlowInfoJsonCodec(org.onosproject.openstacktelemetry.codec.rest.FlowInfoJsonCodec) Activate(org.osgi.service.component.annotations.Activate)

Example 2 with FlowInfoJsonCodec

use of org.onosproject.openstacktelemetry.codec.rest.FlowInfoJsonCodec in project onos by opennetworkinglab.

the class OpenstackTelemetryWebResource method getFlowInfoBulk.

/**
 * Get flow information list.
 *
 * @return Flow information list
 */
@GET
@Path("list")
@Produces(MediaType.APPLICATION_JSON)
public Response getFlowInfoBulk() {
    log.info("GET BULK FLOW RULE");
    Set<FlowInfo> flowInfoSet;
    flowInfoSet = statsFlowRuleService.getOverlayFlowInfos();
    JsonCodec<FlowInfo> flowInfoCodec = new FlowInfoJsonCodec();
    ObjectNode nodeJson;
    int idx = 0;
    for (FlowInfo flowInfo : flowInfoSet) {
        nodeJson = flowInfoCodec.encode(flowInfo, this);
        root.put("FlowInfo" + idx++, nodeJson.toString());
    }
    return ok(root).build();
}
Also used : FlowInfo(org.onosproject.openstacktelemetry.api.FlowInfo) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) FlowInfoJsonCodec(org.onosproject.openstacktelemetry.codec.rest.FlowInfoJsonCodec) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

FlowInfoJsonCodec (org.onosproject.openstacktelemetry.codec.rest.FlowInfoJsonCodec)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 FlowInfo (org.onosproject.openstacktelemetry.api.FlowInfo)1 StatsFlowRuleJsonCodec (org.onosproject.openstacktelemetry.codec.rest.StatsFlowRuleJsonCodec)1 StatsInfoJsonCodec (org.onosproject.openstacktelemetry.codec.rest.StatsInfoJsonCodec)1 TelemetryConfigJsonCodec (org.onosproject.openstacktelemetry.codec.rest.TelemetryConfigJsonCodec)1 Activate (org.osgi.service.component.annotations.Activate)1