blob: 5ce7eb173581784c138fd8e65906030ad63100df [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
tombe988312014-09-19 18:38:47 -070047 */
alshabib219ebaa2014-09-22 15:41:24 -070048 void storeFlowRule(FlowRule rule);
49
50 /**
alshabib1c319ff2014-10-04 20:29:09 -070051 * Marks a flow rule for deletion. Actual deletion will occur
52 * when the provider indicates that the flow has been removed.
alshabib219ebaa2014-09-22 15:41:24 -070053 *
54 * @param rule the flow rule to delete
55 */
56 void deleteFlowRule(FlowRule rule);
tombe988312014-09-19 18:38:47 -070057
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 */
alshabib1c319ff2014-10-04 20:29:09 -070064 FlowRuleEvent addOrUpdateFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070065
66 /**
alshabib1c319ff2014-10-04 20:29:09 -070067 * @param rule the flow entry to remove
tombe988312014-09-19 18:38:47 -070068 * @return flow_removed event, or null if nothing removed
69 */
alshabib1c319ff2014-10-04 20:29:09 -070070 FlowRuleEvent removeFlowRule(FlowEntry rule);
tombe988312014-09-19 18:38:47 -070071}