tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.flow; |
| 2 | |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame^] | 3 | import java.util.concurrent.Future; |
| 4 | |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 5 | import org.onlab.onos.ApplicationId; |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 6 | import org.onlab.onos.net.DeviceId; |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 7 | import org.onlab.onos.store.Store; |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 8 | |
| 9 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 10 | * Manages inventory of flow rules; not intended for direct use. |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 11 | */ |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame^] | 12 | public interface FlowRuleStore extends Store<FlowRuleBatchEvent, FlowRuleStoreDelegate> { |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 13 | |
| 14 | /** |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 15 | * Returns the number of flow rule in the store. |
| 16 | * |
| 17 | * @return number of flow rules |
| 18 | */ |
| 19 | int getFlowRuleCount(); |
| 20 | |
| 21 | /** |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 22 | * Returns the stored flow. |
tom | 9b4030d | 2014-10-06 10:39:03 -0700 | [diff] [blame] | 23 | * |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 24 | * @param rule the rule to look for |
| 25 | * @return a flow rule |
| 26 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 27 | FlowEntry getFlowEntry(FlowRule rule); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 30 | * Returns the flow entries associated with a device. |
| 31 | * |
| 32 | * @param deviceId the device ID |
| 33 | * @return the flow entries |
| 34 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 35 | Iterable<FlowEntry> getFlowEntries(DeviceId deviceId); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 36 | |
| 37 | /** |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 38 | * Returns the flow entries associated with an application. |
| 39 | * |
| 40 | * @param appId the application id |
| 41 | * @return the flow entries |
| 42 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 43 | Iterable<FlowRule> getFlowRulesByAppId(ApplicationId appId); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 44 | |
| 45 | /** |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame^] | 46 | // TODO: Better description of method behavior. |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 47 | * Stores a new flow rule without generating events. |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 48 | * |
| 49 | * @param rule the flow rule to add |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 50 | */ |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame^] | 51 | void storeFlowRule(FlowRule rule); |
| 52 | |
| 53 | /** |
| 54 | * Stores a batch of flow rules. |
| 55 | * @param batchOperation batch of flow rules. |
| 56 | * @return Future response indicating success/failure of the batch operation |
| 57 | * all the way down to the device. |
| 58 | */ |
| 59 | Future<CompletedBatchOperation> storeBatch(FlowRuleBatchOperation batchOperation); |
| 60 | |
| 61 | /** |
| 62 | * Invoked on the completion of a storeBatch operation. |
| 63 | * @param result |
| 64 | */ |
| 65 | void batchOperationComplete(FlowRuleBatchEvent event); |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 66 | |
| 67 | /** |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 68 | * Marks a flow rule for deletion. Actual deletion will occur |
| 69 | * when the provider indicates that the flow has been removed. |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 70 | * |
| 71 | * @param rule the flow rule to delete |
Yuta HIGUCHI | f3d51bd | 2014-10-21 01:05:33 -0700 | [diff] [blame] | 72 | * @return true if the rule should be handled locally |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 73 | */ |
Madan Jampani | 117aaae | 2014-10-23 10:04:05 -0700 | [diff] [blame^] | 74 | void deleteFlowRule(FlowRule rule); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 75 | |
| 76 | /** |
| 77 | * Stores a new flow rule, or updates an existing entry. |
| 78 | * |
| 79 | * @param rule the flow rule to add or update |
| 80 | * @return flow_added event, or null if just an update |
| 81 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 82 | FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 83 | |
| 84 | /** |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 85 | * @param rule the flow entry to remove |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 86 | * @return flow_removed event, or null if nothing removed |
| 87 | */ |
alshabib | 1c319ff | 2014-10-04 20:29:09 -0700 | [diff] [blame] | 88 | FlowRuleEvent removeFlowRule(FlowEntry rule); |
tom | be98831 | 2014-09-19 18:38:47 -0700 | [diff] [blame] | 89 | } |