Search in sources :

Example 1 with GetPacketInOutStatsResponse

use of org.openkilda.messaging.info.grpc.GetPacketInOutStatsResponse in project open-kilda by telstra.

the class StatsTopologyTest method packetInOutStatsTest.

@Test
public void packetInOutStatsTest() {
    PacketInOutStatsDto data = new PacketInOutStatsDto();
    data.setPacketInTotalPackets(1);
    data.setPacketInTotalPacketsDataplane(2);
    data.setPacketInNoMatchPackets(3);
    data.setPacketInApplyActionPackets(4);
    data.setPacketInInvalidTtlPackets(5);
    data.setPacketInActionSetPackets(6);
    data.setPacketInGroupPackets(7);
    data.setPacketInPacketOutPackets(8);
    data.setPacketOutTotalPacketsDataplane(9);
    data.setPacketOutTotalPacketsHost(10);
    data.setPacketOutEth0InterfaceUp(true);
    sendStatsMessage(new GetPacketInOutStatsResponse(SWITCH_ID_1, data));
    List<Datapoint> datapoints = pollDatapoints(11);
    Map<String, Datapoint> map = createDatapointMap(datapoints);
    assertMetric(data.getPacketInTotalPackets(), "switch.packet-in.total-packets", map);
    assertMetric(data.getPacketInTotalPacketsDataplane(), "switch.packet-in.total-packets.dataplane", map);
    assertMetric(data.getPacketInNoMatchPackets(), "switch.packet-in.no-match.packets", map);
    assertMetric(data.getPacketInApplyActionPackets(), "switch.packet-in.apply-action.packets", map);
    assertMetric(data.getPacketInInvalidTtlPackets(), "switch.packet-in.invalid-ttl.packets", map);
    assertMetric(data.getPacketInActionSetPackets(), "switch.packet-in.action-set.packets", map);
    assertMetric(data.getPacketInGroupPackets(), "switch.packet-in.group.packets", map);
    assertMetric(data.getPacketInPacketOutPackets(), "switch.packet-in.packet-out.packets", map);
    assertMetric(data.getPacketOutTotalPacketsHost(), "switch.packet-out.total-packets.host", map);
    assertMetric(data.getPacketOutTotalPacketsDataplane(), "switch.packet-out.total-packets.dataplane", map);
    assertMetric(1, "switch.packet-out.eth0-interface-up", map);
    datapoints.forEach(datapoint -> {
        assertEquals(1, datapoint.getTags().size());
        assertEquals(SWITCH_ID_1.toOtsdFormat(), datapoint.getTags().get("switchid"));
        assertEquals(timestamp, datapoint.getTime().longValue());
    });
}
Also used : Datapoint(org.openkilda.messaging.info.Datapoint) GetPacketInOutStatsResponse(org.openkilda.messaging.info.grpc.GetPacketInOutStatsResponse) PacketInOutStatsDto(org.openkilda.messaging.model.grpc.PacketInOutStatsDto) AbstractStormTest(org.openkilda.wfm.AbstractStormTest) Test(org.junit.Test)

Example 2 with GetPacketInOutStatsResponse

use of org.openkilda.messaging.info.grpc.GetPacketInOutStatsResponse in project open-kilda by telstra.

the class SpeakerStatsRouterBolt method handleInput.

@Override
protected void handleInput(Tuple tuple) throws Exception {
    log.debug("Ingoing tuple: {}", tuple);
    if (active) {
        Message message = pullValue(tuple, FIELD_ID_PAYLOAD, Message.class);
        if (!(message instanceof InfoMessage)) {
            return;
        }
        InfoMessage infoMessage = (InfoMessage) message;
        final InfoData data = infoMessage.getData();
        if (data instanceof PortStatsData) {
            log.debug("Port stats message: {}", infoMessage);
            emitWithContext(PORT_STATS_STREAM, tuple, new Values(infoMessage));
        } else if (data instanceof MeterConfigStatsData) {
            log.debug("Meter config stats message: {}", infoMessage);
            emitWithContext(METER_CFG_STATS_STREAM, tuple, new Values(infoMessage));
        } else if (data instanceof MeterStatsData) {
            log.debug("Meter stats message: {}", infoMessage);
            emitWithContext(TO_CACHE_STREAM, tuple, new Values(data));
        } else if (data instanceof FlowStatsData) {
            log.debug("Flow stats message: {}", infoMessage);
            ImmutablePair<FlowStatsData, FlowStatsData> splitData = splitSystemRuleStatsAndFlowStats((FlowStatsData) data);
            emitWithContext(SYSTEM_RULES_STATS_STREAM, tuple, new Values(splitData.getKey()));
            emitWithContext(TO_CACHE_STREAM, tuple, new Values(splitData.getValue()));
        } else if (data instanceof SwitchTableStatsData) {
            log.debug("Table stats message: {}", infoMessage);
            emitWithContext(TABLE_STATS_STREAM, tuple, new Values(data));
        } else if (data instanceof GetPacketInOutStatsResponse) {
            log.debug("Packet in out stats message: {}", infoMessage);
            emitWithContext(PACKET_IN_OUT_STATS_STREAM, tuple, new Values(data));
        } else {
        // FIXME (ncherevko): we might receive few unexpected messages here,
        // need to fix it and uncomment below line
        // unhandledInput(tuple);
        }
    }
}
Also used : MeterStatsData(org.openkilda.messaging.info.stats.MeterStatsData) InfoMessage(org.openkilda.messaging.info.InfoMessage) Message(org.openkilda.messaging.Message) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) GetPacketInOutStatsResponse(org.openkilda.messaging.info.grpc.GetPacketInOutStatsResponse) MeterConfigStatsData(org.openkilda.messaging.info.stats.MeterConfigStatsData) FlowStatsData(org.openkilda.messaging.info.stats.FlowStatsData) InfoMessage(org.openkilda.messaging.info.InfoMessage) InfoData(org.openkilda.messaging.info.InfoData) Values(org.apache.storm.tuple.Values) PortStatsData(org.openkilda.messaging.info.stats.PortStatsData) SwitchTableStatsData(org.openkilda.messaging.info.stats.SwitchTableStatsData)

Example 3 with GetPacketInOutStatsResponse

use of org.openkilda.messaging.info.grpc.GetPacketInOutStatsResponse in project open-kilda by telstra.

the class PacketInOutMetricGenBolt method handleInput.

@Override
protected void handleInput(Tuple input) throws Exception {
    GetPacketInOutStatsResponse response = pullValue(input, STATS_FIELD, GetPacketInOutStatsResponse.class);
    emit(response);
}
Also used : GetPacketInOutStatsResponse(org.openkilda.messaging.info.grpc.GetPacketInOutStatsResponse)

Aggregations

GetPacketInOutStatsResponse (org.openkilda.messaging.info.grpc.GetPacketInOutStatsResponse)3 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)1 Values (org.apache.storm.tuple.Values)1 Test (org.junit.Test)1 Message (org.openkilda.messaging.Message)1 Datapoint (org.openkilda.messaging.info.Datapoint)1 InfoData (org.openkilda.messaging.info.InfoData)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 FlowStatsData (org.openkilda.messaging.info.stats.FlowStatsData)1 MeterConfigStatsData (org.openkilda.messaging.info.stats.MeterConfigStatsData)1 MeterStatsData (org.openkilda.messaging.info.stats.MeterStatsData)1 PortStatsData (org.openkilda.messaging.info.stats.PortStatsData)1 SwitchTableStatsData (org.openkilda.messaging.info.stats.SwitchTableStatsData)1 PacketInOutStatsDto (org.openkilda.messaging.model.grpc.PacketInOutStatsDto)1 AbstractStormTest (org.openkilda.wfm.AbstractStormTest)1