blob: abb9a10b1caf6e2f9b4b7faa9db6053ddfaa343a [file] [log] [blame]
tombe988312014-09-19 18:38:47 -07001package org.onlab.onos.net.flow;
2
alshabiba68eb962014-09-24 20:34:13 -07003import org.onlab.onos.ApplicationId;
tombe988312014-09-19 18:38:47 -07004import org.onlab.onos.net.DeviceId;
tomc78acee2014-09-24 15:16:55 -07005import org.onlab.onos.store.Store;
tombe988312014-09-19 18:38:47 -07006
7/**
tome4729872014-09-23 00:37:37 -07008 * Manages inventory of flow rules; not intended for direct use.
tombe988312014-09-19 18:38:47 -07009 */
tomc78acee2014-09-24 15:16:55 -070010public interface FlowRuleStore extends Store<FlowRuleEvent, FlowRuleStoreDelegate> {
tombe988312014-09-19 18:38:47 -070011
12 /**
tom9b4030d2014-10-06 10:39:03 -070013 * Returns the number of flow rule in the store.
14 *
15 * @return number of flow rules
16 */
17 int getFlowRuleCount();
18
19 /**
alshabiba68eb962014-09-24 20:34:13 -070020 * Returns the stored flow.
tom9b4030d2014-10-06 10:39:03 -070021 *
alshabiba68eb962014-09-24 20:34:13 -070022 * @param rule the rule to look for
23 * @return a flow rule
24 */
alshabib1c319ff2014-10-04 20:29:09 -070025 FlowEntry getFlowEntry(FlowRule rule);
alshabiba68eb962014-09-24 20:34:13 -070026
27 /**
tombe988312014-09-19 18:38:47 -070028 * Returns the flow entries associated with a device.
29 *
30 * @param deviceId the device ID
31 * @return the flow entries
32 */
alshabib1c319ff2014-10-04 20:29:09 -070033 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
tombe988312014-09-19 18:38:47 -070034
35 /**
alshabiba68eb962014-09-24 20:34:13 -070036 * Returns the flow entries associated with an application.
37 *
38 * @param appId the application id
39 * @return the flow entries
40 */
alshabib1c319ff2014-10-04 20:29:09 -070041 Iterable<FlowRule> getFlowRulesByAppId(ApplicationId appId);
alshabiba68eb962014-09-24 20:34:13 -070042
43 /**
alshabib219ebaa2014-09-22 15:41:24 -070044 * Stores a new flow rule without generating events.
tombe988312014-09-19 18:38:47 -070045 *
46 * @param rule the flow rule to add
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070047 * @return true if the rule should be handled locally
tombe988312014-09-19 18:38:47 -070048 */
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070049 boolean storeFlowRule(FlowRule rule);
alshabib219ebaa2014-09-22 15:41:24 -070050
51 /**
alshabib1c319ff2014-10-04 20:29:09 -070052 * Marks a flow rule for deletion. Actual deletion will occur
53 * when the provider indicates that the flow has been removed.
alshabib219ebaa2014-09-22 15:41:24 -070054 *
55 * @param rule the flow rule to delete
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070056 * @return true if the rule should be handled locally
alshabib219ebaa2014-09-22 15:41:24 -070057 */
Yuta HIGUCHIf3d51bd2014-10-21 01:05:33 -070058 boolean deleteFlowRule(FlowRule rule);
tombe988312014-09-19 18:38:47 -070059
60 /**
61 * Stores a new flow rule, or updates an existing entry.
62 *
63 * @param rule the flow rule to add or update
64 * @return flow_added event, or null if just an update
65 */
alshabib1c319ff2014-10-04 20:29:09 -070066 FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070067
68 /**
alshabib1c319ff2014-10-04 20:29:09 -070069 * @param rule the flow entry to remove
tombe988312014-09-19 18:38:47 -070070 * @return flow_removed event, or null if nothing removed
71 */
alshabib1c319ff2014-10-04 20:29:09 -070072 FlowRuleEvent removeFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070073}