[VOL-3260] Purging all meter state on OLT delete
Change-Id: I6323779d584b341d33cc91231197504b80a91fc4
diff --git a/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceFlowService.java b/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceFlowService.java
index 362b154..d4cc09f 100644
--- a/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceFlowService.java
+++ b/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceFlowService.java
@@ -145,4 +145,10 @@
PortNumber subscriberPort,
MeterId downstreamMeterId,
UniTagInformation tagInformation);
+
+ /**
+ * Clears pending mappings and state for device.
+ * @param deviceId the device id
+ */
+ void clearDeviceState(DeviceId deviceId);
}
diff --git a/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceMeterService.java b/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceMeterService.java
index bad2e5b..4b921fb 100644
--- a/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceMeterService.java
+++ b/app/src/main/java/org/opencord/olt/internalapi/AccessDeviceMeterService.java
@@ -70,31 +70,41 @@
/**
* Adds the DeviceBandwidthProfile to the pendingMeters.
*
- * @param deviceBandwidthProfile the device to bandwidth profile mapping
+ * @param deviceId the device
+ * @param bwpInfo the bandwidth profile info
*/
- void addToPendingMeters(DeviceBandwidthProfile deviceBandwidthProfile);
+ void addToPendingMeters(DeviceId deviceId, BandwidthProfileInformation bwpInfo);
/**
* Removes the DeviceBandwidthProfile from the pendingMeters.
*
- * @param deviceBandwidthProfile the device to bandwidth profile mapping
+ * @param deviceId the device
+ * @param bwpInfo the bandwidth profile info
*
*/
- void removeFromPendingMeters(DeviceBandwidthProfile deviceBandwidthProfile);
+ void removeFromPendingMeters(DeviceId deviceId, BandwidthProfileInformation bwpInfo);
/**
* Checks if DeviceBandwidthProfile is pending.
*
- * @param deviceBandwidthProfile the device to bandwidth profile mapping
+ * @param deviceId the device
+ * @param bwpInfo the bandwidth profile info
*
* @return true if pending.
*/
- boolean isMeterPending(DeviceBandwidthProfile deviceBandwidthProfile);
+ boolean isMeterPending(DeviceId deviceId, BandwidthProfileInformation bwpInfo);
/**
- * Clears out bandwidth profile to meter mappings for the given device.
+ * Clears out meters for the given device.
*
* @param deviceId device ID
*/
void clearMeters(DeviceId deviceId);
+
+ /**
+ * Clears out local state for the given device.
+ *
+ * @param deviceId device ID
+ */
+ void clearDeviceState(DeviceId deviceId);
}
diff --git a/app/src/main/java/org/opencord/olt/internalapi/DeviceBandwidthProfile.java b/app/src/main/java/org/opencord/olt/internalapi/DeviceBandwidthProfile.java
deleted file mode 100644
index 8f676ec..0000000
--- a/app/src/main/java/org/opencord/olt/internalapi/DeviceBandwidthProfile.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2020-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.opencord.olt.internalapi;
-
-import org.onosproject.net.DeviceId;
-import org.opencord.sadis.BandwidthProfileInformation;
-
-import java.util.Objects;
-
-/**
- * Class containing a mapping of DeviceId to BandwidthProfileInformation.
- */
-public class DeviceBandwidthProfile {
- private final DeviceId devId;
- private BandwidthProfileInformation bwInfo;
-
- /**
- * Creates the Mapping.
- *
- * @param devId the device id
- * @param bwInfo the bandwidth profile information
- */
- public DeviceBandwidthProfile(DeviceId devId, BandwidthProfileInformation bwInfo) {
- this.devId = devId;
- this.bwInfo = bwInfo;
- }
-
- /**
- * Returns the device id.
- *
- * @return device id.
- */
- public DeviceId getDevId() {
- return devId;
- }
-
- /**
- * Returns the Bandwidth profile for this device.
- *
- * @return bandwidth profile information
- */
- public BandwidthProfileInformation getBwInfo() {
- return bwInfo;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- DeviceBandwidthProfile that = (DeviceBandwidthProfile) o;
- return devId.equals(that.devId)
- && bwInfo.equals(that.bwInfo);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(devId, bwInfo);
- }
-
- @Override
- public String toString() {
- return com.google.common.base.MoreObjects.toStringHelper(this)
- .add("devId", devId)
- .add("bwInfo", bwInfo)
- .toString();
- }
-}