[VOL-3096] Purging all meters for store on OLT delete
Change-Id: I99c348b044c98059f98a463d05bbddd43f3dcab3
diff --git a/app/src/main/java/org/opencord/olt/impl/OltMeterService.java b/app/src/main/java/org/opencord/olt/impl/OltMeterService.java
index 65a72f0..3cbdbd7 100644
--- a/app/src/main/java/org/opencord/olt/impl/OltMeterService.java
+++ b/app/src/main/java/org/opencord/olt/impl/OltMeterService.java
@@ -15,7 +15,6 @@
*/
package org.opencord.olt.impl;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
@@ -267,34 +266,8 @@
@Override
public void clearMeters(DeviceId deviceId) {
- List<Map.Entry<String, MeterKey>> meters = bpInfoToMeter.stream()
- .filter(e -> e.getValue().deviceId().equals(deviceId))
- .collect(Collectors.toList());
-
- //TODO move to purgeMeters from ONOS 2.2.3-SNAPSHOT
- meters.forEach(e -> bpInfoToMeter.remove(e.getKey(), e.getValue()));
- List<Meter> metersToRemove = ImmutableList.copyOf(meterService.getMeters(deviceId));
- metersToRemove.forEach(meter -> {
- MeterRequest mq = DefaultMeterRequest.builder().fromApp(appId)
- .forDevice(deviceId).withBands(meter.bands())
- .withUnit(meter.unit())
- .withContext(new MeterContext() {
- @Override
- public void onSuccess(MeterRequest op) {
- log.debug("Meter {} is removed from the device {}",
- meter.meterCellId(), deviceId);
- }
-
- @Override
- public void onError(MeterRequest op, MeterFailReason reason) {
- log.error("Meter {} failed to be removed from the device {}",
- meter.meterCellId(), deviceId);
- }
- })
- .burst()
- .remove();
- meterService.withdraw(mq, meter.id());
- });
+ log.debug("Removing all meters for device {}", deviceId);
+ meterService.purgeMeters(deviceId);
}
private List<Band> createMeterBands(BandwidthProfileInformation bpInfo) {
diff --git a/pom.xml b/pom.xml
index e611221..c325bdf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-dependencies</artifactId>
- <version>2.2.2</version>
+ <version>2.2.3-b1</version>
</parent>
<groupId>org.opencord</groupId>