Search in sources :

Example 1 with OFMeterBandStats

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());
}
Also used : OFMeterBandStats(org.projectfloodlight.openflow.protocol.OFMeterBandStats) MeterStatsData(org.openkilda.messaging.info.stats.MeterStatsData) OFMeterStats(org.projectfloodlight.openflow.protocol.OFMeterStats) OFFactoryVer13(org.projectfloodlight.openflow.protocol.ver13.OFFactoryVer13) OFMeterStatsReply(org.projectfloodlight.openflow.protocol.OFMeterStatsReply) MeterStatsEntry(org.openkilda.messaging.info.stats.MeterStatsEntry) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 MeterStatsData (org.openkilda.messaging.info.stats.MeterStatsData)1 MeterStatsEntry (org.openkilda.messaging.info.stats.MeterStatsEntry)1 OFMeterBandStats (org.projectfloodlight.openflow.protocol.OFMeterBandStats)1 OFMeterStats (org.projectfloodlight.openflow.protocol.OFMeterStats)1 OFMeterStatsReply (org.projectfloodlight.openflow.protocol.OFMeterStatsReply)1 OFFactoryVer13 (org.projectfloodlight.openflow.protocol.ver13.OFFactoryVer13)1