[VOL-3186] Fix equality and hash for the SubscriberFlowInfo, removing modifiable/null elements
Change-Id: I9b00b40514668e536d574011871d864162883513
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 80aae4a..be15854 100644
--- a/app/src/main/java/org/opencord/olt/impl/OltMeterService.java
+++ b/app/src/main/java/org/opencord/olt/impl/OltMeterService.java
@@ -225,6 +225,8 @@
@Override
public void onError(MeterRequest op, MeterFailReason reason) {
+ log.error("Failed installing meter {} on {} for {}",
+ meterIdRef.get(), deviceId, bpInfo.id());
bpInfoToMeter.remove(bpInfo.id(),
MeterKey.key(deviceId, meterIdRef.get()));
meterFuture.complete(reason);
@@ -247,12 +249,28 @@
.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()).remove();
+ .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());
});
}
diff --git a/app/src/main/java/org/opencord/olt/impl/SubscriberFlowInfo.java b/app/src/main/java/org/opencord/olt/impl/SubscriberFlowInfo.java
index f923b83..1ac5b08 100644
--- a/app/src/main/java/org/opencord/olt/impl/SubscriberFlowInfo.java
+++ b/app/src/main/java/org/opencord/olt/impl/SubscriberFlowInfo.java
@@ -160,15 +160,13 @@
nniPort.equals(flowInfo.nniPort) &&
uniPort.equals(flowInfo.uniPort) &&
tagInfo.equals(flowInfo.tagInfo) &&
- downId.equals(flowInfo.downId) &&
- upId.equals(flowInfo.upId) &&
downBpInfo.equals(flowInfo.downBpInfo) &&
upBpInfo.equals(flowInfo.upBpInfo);
}
@Override
public int hashCode() {
- return Objects.hash(devId, nniPort, uniPort, tagInfo, downId, upId, downBpInfo, upBpInfo);
+ return Objects.hash(devId, nniPort, uniPort, tagInfo, downBpInfo, upBpInfo);
}
@Override