Search in sources :

Example 11 with FlowInfo

use of org.onosproject.openstacktelemetry.api.FlowInfo in project onos by opennetworkinglab.

the class TinaFlowInfoByteBufferCodecTest method testEncodeDecode.

@Test
public void testEncodeDecode() {
    ByteBuffer buffer = codec.encode(info);
    FlowInfo decoded = codec.decode(ByteBuffer.wrap(buffer.array()));
    new EqualsTester().addEqualityGroup(info, decoded).testEquals();
}
Also used : DefaultFlowInfo(org.onosproject.openstacktelemetry.api.DefaultFlowInfo) FlowInfo(org.onosproject.openstacktelemetry.api.FlowInfo) EqualsTester(com.google.common.testing.EqualsTester) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 12 with FlowInfo

use of org.onosproject.openstacktelemetry.api.FlowInfo 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

FlowInfo (org.onosproject.openstacktelemetry.api.FlowInfo)12 DefaultFlowInfo (org.onosproject.openstacktelemetry.api.DefaultFlowInfo)8 DefaultStatsInfo (org.onosproject.openstacktelemetry.api.DefaultStatsInfo)6 StatsInfo (org.onosproject.openstacktelemetry.api.StatsInfo)6 Device (org.onosproject.net.Device)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 EqualsTester (com.google.common.testing.EqualsTester)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 IpAddress (org.onlab.packet.IpAddress)2 ConnectPoint (org.onosproject.net.ConnectPoint)2 Host (org.onosproject.net.Host)2 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)2 FlowEntry (org.onosproject.net.flow.FlowEntry)2 TrafficSelector (org.onosproject.net.flow.TrafficSelector)2 IPCriterion (org.onosproject.net.flow.criteria.IPCriterion)2 IPProtocolCriterion (org.onosproject.net.flow.criteria.IPProtocolCriterion)2 TcpPortCriterion (org.onosproject.net.flow.criteria.TcpPortCriterion)2 UdpPortCriterion (org.onosproject.net.flow.criteria.UdpPortCriterion)2 Maps (com.google.common.collect.Maps)1