[ONOS-7114] Meter Subsystem Refactoring
Changes:
- Moves meter counters in the store
- Uses atomic counter map for meter counters
- Implements atomic counter map adapter and test atomic counter map
- Introduces free meter id
- Changes allocate meter id
- Implements unit tests for MeterManager and MeterStore
Change-Id: I45e3debc0e43ca7edcf6e3b4065866634f76f9f7
diff --git a/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java b/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java
index 3d007071..9b5eae8 100644
--- a/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java
+++ b/core/api/src/main/java/org/onosproject/net/meter/MeterStore.java
@@ -42,7 +42,6 @@
*/
CompletableFuture<MeterStoreResult> deleteMeter(Meter meter);
-
/**
* Adds the meter features to the store.
*
@@ -59,7 +58,6 @@
*/
MeterStoreResult deleteMeterFeatures(DeviceId deviceId);
-
/**
* Updates a meter whose meter id is the same as the passed meter.
*
@@ -124,13 +122,20 @@
long getMaxMeters(MeterFeaturesKey key);
/**
- * Returns the first available MeterId from previously removed meter.
- * This method allows allocating MeterIds below the actual meterIdCounter
- * value.
+ * Allocates the first available MeterId.
*
* @param deviceId the device id
- * @return the meter Id or null if none exist
+ * @return the meter Id or null if it was not possible
+ * to allocate a meter id
*/
- MeterId firstReusableMeterId(DeviceId deviceId);
+ MeterId allocateMeterId(DeviceId deviceId);
+
+ /**
+ * Frees the given meter id.
+ *
+ * @param deviceId the device id
+ * @param meterId the id to be freed
+ */
+ void freeMeterId(DeviceId deviceId, MeterId meterId);
}