blob: c53a32dc836c38e065af35276b8fb64422f668b6 [file] [log] [blame]
tombe988312014-09-19 18:38:47 -07001package org.onlab.onos.net.flow;
2
Madan Jampani117aaae2014-10-23 10:04:05 -07003import java.util.concurrent.Future;
4
alshabiba68eb962014-09-24 20:34:13 -07005import org.onlab.onos.ApplicationId;
tombe988312014-09-19 18:38:47 -07006import org.onlab.onos.net.DeviceId;
tomc78acee2014-09-24 15:16:55 -07007import org.onlab.onos.store.Store;
tombe988312014-09-19 18:38:47 -07008
9/**
tome4729872014-09-23 00:37:37 -070010 * Manages inventory of flow rules; not intended for direct use.
tombe988312014-09-19 18:38:47 -070011 */
Madan Jampani117aaae2014-10-23 10:04:05 -070012public interface FlowRuleStore extends Store<FlowRuleBatchEvent, FlowRuleStoreDelegate> {
tombe988312014-09-19 18:38:47 -070013
14 /**
tom9b4030d2014-10-06 10:39:03 -070015 * Returns the number of flow rule in the store.
16 *
17 * @return number of flow rules
18 */
19 int getFlowRuleCount();
20
21 /**
alshabiba68eb962014-09-24 20:34:13 -070022 * Returns the stored flow.
tom9b4030d2014-10-06 10:39:03 -070023 *
alshabiba68eb962014-09-24 20:34:13 -070024 * @param rule the rule to look for
25 * @return a flow rule
26 */
alshabib1c319ff2014-10-04 20:29:09 -070027 FlowEntry getFlowEntry(FlowRule rule);
alshabiba68eb962014-09-24 20:34:13 -070028
29 /**
tombe988312014-09-19 18:38:47 -070030 * Returns the flow entries associated with a device.
31 *
32 * @param deviceId the device ID
33 * @return the flow entries
34 */
alshabib1c319ff2014-10-04 20:29:09 -070035 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
tombe988312014-09-19 18:38:47 -070036
37 /**
alshabiba68eb962014-09-24 20:34:13 -070038 * Returns the flow entries associated with an application.
39 *
40 * @param appId the application id
41 * @return the flow entries
42 */
alshabib1c319ff2014-10-04 20:29:09 -070043 Iterable<FlowRule> getFlowRulesByAppId(ApplicationId appId);
alshabiba68eb962014-09-24 20:34:13 -070044
45 /**
Madan Jampani117aaae2014-10-23 10:04:05 -070046 // TODO: Better description of method behavior.
alshabib219ebaa2014-09-22 15:41:24 -070047 * Stores a new flow rule without generating events.
tombe988312014-09-19 18:38:47 -070048 *
49 * @param rule the flow rule to add
tombe988312014-09-19 18:38:47 -070050 */
Madan Jampani117aaae2014-10-23 10:04:05 -070051 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);
alshabib219ebaa2014-09-22 15:41:24 -070066
67 /**
alshabib1c319ff2014-10-04 20:29:09 -070068 * Marks a flow rule for deletion. Actual deletion will occur
69 * when the provider indicates that the flow has been removed.
alshabib219ebaa2014-09-22 15:41:24 -070070 *
71 * @param rule the flow rule to delete
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070072 * @return true if the rule should be handled locally
alshabib219ebaa2014-09-22 15:41:24 -070073 */
Madan Jampani117aaae2014-10-23 10:04:05 -070074 void deleteFlowRule(FlowRule rule);
tombe988312014-09-19 18:38:47 -070075
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 */
alshabib1c319ff2014-10-04 20:29:09 -070082 FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070083
84 /**
alshabib1c319ff2014-10-04 20:29:09 -070085 * @param rule the flow entry to remove
tombe988312014-09-19 18:38:47 -070086 * @return flow_removed event, or null if nothing removed
87 */
alshabib1c319ff2014-10-04 20:29:09 -070088 FlowRuleEvent removeFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070089}