[SDFAB-359] Allow purging flows, groups and meters by device and application ID
Change-Id: I5e507d230789979ac997dbc99697fa0483363f70
(cherry picked from commit cfd774018c0ed926873b1e171c106217cb2ac568)
diff --git a/core/api/src/main/java/org/onosproject/net/meter/MeterService.java b/core/api/src/main/java/org/onosproject/net/meter/MeterService.java
index cf99b5e..6339101 100644
--- a/core/api/src/main/java/org/onosproject/net/meter/MeterService.java
+++ b/core/api/src/main/java/org/onosproject/net/meter/MeterService.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.net.meter;
+import org.onosproject.core.ApplicationId;
import org.onosproject.event.ListenerService;
import org.onosproject.net.DeviceId;
@@ -93,8 +94,18 @@
* Purges all the meters on the specified device.
* @param deviceId device identifier
*/
- default void purgeMeters(DeviceId deviceId){
+ default void purgeMeters(DeviceId deviceId) {
//Default implementation does nothing
}
+ /**
+ * Purges all the meters on the given device and for the given application.
+ *
+ * @param deviceId device identifier
+ * @param appId application identifier
+ */
+ default void purgeMeters(DeviceId deviceId, ApplicationId appId) {
+ throw new UnsupportedOperationException("purgeMeter not implemented");
+ }
+
}
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 2e632ed..811b418 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
@@ -15,6 +15,7 @@
*/
package org.onosproject.net.meter;
+import org.onosproject.core.ApplicationId;
import org.onosproject.net.DeviceId;
import org.onosproject.store.Store;
@@ -196,9 +197,19 @@
/**
* Removes all meters of given device from store.
+ * This API is typically used when the device is offline.
*
* @param deviceId the device id
*/
void purgeMeter(DeviceId deviceId);
+ /**
+ * Removes all meters of given device and for the given application from store.
+ * This API is typically used when the device is offline.
+ *
+ * @param deviceId the device id
+ * @param appId the application id
+ */
+ void purgeMeters(DeviceId deviceId, ApplicationId appId);
+
}