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());
});
}
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);
}
}
}
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);
}
Aggregations