Extended flow rule service with get flow entries by state method
Change-Id: Ie5fecebe3a4f0d15a1ea1c3e844dd084eebf831a
diff --git a/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java b/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java
index faa581e..a4cfdfd 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java
@@ -64,6 +64,18 @@
return Iterables.filter(getFlowEntries(deviceId), fe -> fe.liveType() == liveType);
}
+ /**
+ * Returns a list of rules filtered by device id and flow state.
+ *
+ * @param deviceId the device id to lookup
+ * @param flowState the flow state to lookup
+ * @return collection of flow entries
+ */
+ default Iterable<FlowEntry> getFlowEntriesByState(DeviceId deviceId,
+ FlowEntry.FlowEntryState flowState) {
+ return Iterables.filter(getFlowEntries(deviceId), fe -> fe.state() == flowState);
+ }
+
// TODO: add createFlowRule factory method and execute operations method
/**