tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.flow; |
| 2 | |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 3 | import org.onlab.onos.ApplicationId; |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 4 | import org.onlab.onos.net.DeviceId; |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 5 | import org.onlab.onos.store.Store; |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 6 | |
| 7 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 8 | * Manages inventory of flow rules; not intended for direct use. |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 9 | */ |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 10 | public interface FlowRuleStore extends Store<FlowRuleEvent, FlowRuleStoreDelegate> { |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 11 | |
| 12 | /** |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 13 | * Returns the number of flow rule in the store. |
| 14 | * |
| 15 | * @return number of flow rules |
| 16 | */ |
| 17 | int getFlowRuleCount(); |
| 18 | |
| 19 | /** |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 20 | * Returns the stored flow. |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 21 | * |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 22 | * @param rule the rule to look for |
| 23 | * @return a flow rule |
| 24 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 25 | FlowEntry getFlowEntry(FlowRule rule); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 26 | |
| 27 | /** |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 28 | * Returns the flow entries associated with a device. |
| 29 | * |
| 30 | * @param deviceId the device ID |
| 31 | * @return the flow entries |
| 32 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 33 | Iterable<FlowEntry> getFlowEntries(DeviceId deviceId); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 36 | * Returns the flow entries associated with an application. |
| 37 | * |
| 38 | * @param appId the application id |
| 39 | * @return the flow entries |
| 40 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 41 | Iterable<FlowRule> getFlowRulesByAppId(ApplicationId appId); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 42 | |
| 43 | /** |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 44 | * Stores a new flow rule without generating events. |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 45 | * |
| 46 | * @param rule the flow rule to add |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 47 | */ |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 48 | void storeFlowRule(FlowRule rule); |
| 49 | |
| 50 | /** |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 51 | * Marks a flow rule for deletion. Actual deletion will occur |
| 52 | * when the provider indicates that the flow has been removed. |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 53 | * |
| 54 | * @param rule the flow rule to delete |
| 55 | */ |
| 56 | void deleteFlowRule(FlowRule rule); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 57 | |
| 58 | /** |
| 59 | * Stores a new flow rule, or updates an existing entry. |
| 60 | * |
| 61 | * @param rule the flow rule to add or update |
| 62 | * @return flow_added event, or null if just an update |
| 63 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 64 | FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 65 | |
| 66 | /** |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 67 | * @param rule the flow entry to remove |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 68 | * @return flow_removed event, or null if nothing removed |
| 69 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 70 | FlowRuleEvent removeFlowRule(FlowEntry rule); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 71 | } |