use of org.projectfloodlight.openflow.protocol.OFMeterBandStats in project open-kilda by telstra.
the class OfMeterStatsMapperTest method testToPortStatsDataV13.
@Test
public void testToPortStatsDataV13() {
OFFactoryVer13 factory = new OFFactoryVer13();
OFMeterBandStats bandStats = factory.meterBandStats(U64.of(bandPacketCount), U64.of(bandByteCount));
OFMeterStats meterStats = factory.buildMeterStats().setMeterId(meterId).setByteInCount(// we will put meter byte/packet count
U64.of(meterByteCount)).setPacketInCount(// but we will expect to get band byte/packet count
U64.of(meterPacketCount)).setBandStats(Collections.singletonList(bandStats)).build();
OFMeterStatsReply reply = factory.buildMeterStatsReply().setEntries(Collections.singletonList(meterStats)).build();
MeterStatsData data = OfMeterStatsMapper.INSTANCE.toMeterStatsData(Collections.singletonList(reply), switchId);
assertEquals(switchId, data.getSwitchId());
assertEquals(1, data.getStats().size());
MeterStatsEntry statsEntry = data.getStats().get(0);
// expected band byte/packet count instead of
assertEquals(bandByteCount, statsEntry.getByteInCount());
// meter byte/packet count
assertEquals(bandPacketCount, statsEntry.getPacketsInCount());
}
Aggregations