Search in sources :

Example 6 with PiMeterBand

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));
    }
}
Also used : PiMeterBand(org.onosproject.net.pi.runtime.PiMeterBand) PiMeterCellConfig(org.onosproject.net.pi.runtime.PiMeterCellConfig) ImmutableMap(com.google.common.collect.ImmutableMap) Map(java.util.Map) Test(org.junit.Test)

Example 7 with PiMeterBand

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));
    }
}
Also used : PiMeterBand(org.onosproject.net.pi.runtime.PiMeterBand) PiMeterCellConfig(org.onosproject.net.pi.runtime.PiMeterCellConfig) ImmutableMap(com.google.common.collect.ImmutableMap) Map(java.util.Map) Test(org.junit.Test)

Aggregations

PiMeterBand (org.onosproject.net.pi.runtime.PiMeterBand)7 ImmutableMap (com.google.common.collect.ImmutableMap)4 Map (java.util.Map)4 Test (org.junit.Test)4 PiMeterCellConfig (org.onosproject.net.pi.runtime.PiMeterCellConfig)4 UpfMeter (org.onosproject.net.behaviour.upf.UpfMeter)1 Band (org.onosproject.net.meter.Band)1 DefaultBand (org.onosproject.net.meter.DefaultBand)1 PiMeterId (org.onosproject.net.pi.model.PiMeterId)1 PiMeterCellId (org.onosproject.net.pi.runtime.PiMeterCellId)1