private boolean isRateSimilar(long onosRate, long deviceRate) {
        double lowerEnd = (double) onosRate * (1.0 - RATE_ERROR);
        double upperEnd = (double) onosRate * (1.0 + RATE_ERROR);

        if (log.isDebugEnabled()) {
            log.debug("isRateSimilar {} in [{}, {}]", deviceRate, lowerEnd, upperEnd);
        }

        return deviceRate >= lowerEnd && deviceRate <= upperEnd;
    }
@Test
    public void testIsRateSimilar() {
        PiMeterBand onosMeterBand;
        PiMeterBand deviceMeterBand;
        PiMeterCellConfig onosMeter;
        PiMeterCellConfig deviceMeter;
        for (Map.Entry<Long, Long> entry : RATES.entrySet()) {
            onosMeterBand = new PiMeterBand(PiMeterBandType.COMMITTED, entry.getKey(), 0);
            deviceMeterBand = new PiMeterBand(PiMeterBandType.COMMITTED, entry.getValue(), 0);
            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));
        }
    }