use of org.onosproject.net.pi.runtime.PiMeterBand in project onos by opennetworkinglab.
the class TofinoMeterProgrammableTest method testWrongIsBurstSimilar.
/**
* Test wrong isBurstSimilar of the tofino behavior.
*/
@Test
public void testWrongIsBurstSimilar() {
PiMeterBand onosMeterBand;
PiMeterBand deviceMeterBand;
PiMeterCellConfig onosMeter;
PiMeterCellConfig deviceMeter;
for (Map.Entry<Long, Long> entry : WRONG_BURSTS.entrySet()) {
onosMeterBand = new PiMeterBand(PiMeterBandType.COMMITTED, 0, entry.getKey());
deviceMeterBand = new PiMeterBand(PiMeterBandType.COMMITTED, 0, entry.getValue());
onosMeter = PiMeterCellConfig.builder().withMeterCellId(meterCellId).withMeterBand(onosMeterBand).withMeterBand(new PiMeterBand(PiMeterBandType.PEAK, 0, 0)).build();
deviceMeter = PiMeterCellConfig.builder().withMeterCellId(meterCellId).withMeterBand(deviceMeterBand).withMeterBand(new PiMeterBand(PiMeterBandType.PEAK, 0, 0)).build();
assertFalse(meterProgrammable.isSimilar(onosMeter, deviceMeter));
}
}
use of org.onosproject.net.pi.runtime.PiMeterBand in project onos by opennetworkinglab.
the class TofinoMeterProgrammableTest method testIsBurstSimilar.
/**
* Test isBurstSimilar of the tofino behavior.
*/
@Test
public void testIsBurstSimilar() {
PiMeterBand onosMeterBand;
PiMeterBand deviceMeterBand;
PiMeterCellConfig onosMeter;
PiMeterCellConfig deviceMeter;
for (Map.Entry<Long, Long> entry : BURSTS.entrySet()) {
onosMeterBand = new PiMeterBand(PiMeterBandType.COMMITTED, 0, entry.getKey());
deviceMeterBand = new PiMeterBand(PiMeterBandType.COMMITTED, 0, entry.getValue());
onosMeter = PiMeterCellConfig.builder().withMeterCellId(meterCellId).withMeterBand(onosMeterBand).withMeterBand(new PiMeterBand(PiMeterBandType.PEAK, 0, 0)).build();
deviceMeter = PiMeterCellConfig.builder().withMeterCellId(meterCellId).withMeterBand(deviceMeterBand).withMeterBand(new PiMeterBand(PiMeterBandType.PEAK, 0, 0)).build();
assertTrue(meterProgrammable.isSimilar(onosMeter, deviceMeter));
}
}
Aggregations