blob: 85d56801a4d94ff58bae38e6cc69264507a2eca4 [file] [log] [blame]
tom8bb16062014-09-12 14:47:46 -07001package org.onlab.onos.net.flow;
2
3import org.onlab.onos.net.DeviceId;
4
5/**
6 * Service for injecting flow rules into the environment and for obtaining
tom4d0c6632014-09-15 23:27:01 -07007 * information about flow rules already in the environment. This implements
8 * semantics of a distributed authoritative flow table where the master copy
9 * of the flow rules lies with the controller and the devices hold only the
10 * 'cached' copy.
tom8bb16062014-09-12 14:47:46 -070011 */
12public interface FlowRuleService {
13
14 /**
15 * Returns the collection of flow entries applied on the specified device.
tom4d0c6632014-09-15 23:27:01 -070016 * This will include flow rules which may not yet have been applied to
17 * the device.
tom8bb16062014-09-12 14:47:46 -070018 *
19 * @param deviceId device identifier
20 * @return collection of flow rules
21 */
22 Iterable<FlowEntry> getFlowEntries(DeviceId deviceId);
23
24 /**
tom4d0c6632014-09-15 23:27:01 -070025 * Applies the specified flow rules onto their respective devices. These
26 * flow rules will be retained by the system and re-applied anytime the
27 * device reconnects to the controller.
tom8bb16062014-09-12 14:47:46 -070028 *
29 * @param flowRules one or more flow rules
30 * throws SomeKindOfException that indicates which ones were applied and
31 * which ones failed
32 */
33 void applyFlowRules(FlowRule... flowRules);
34
35 /**
tom4d0c6632014-09-15 23:27:01 -070036 * Removes the specified flow rules from their respective devices. If the
37 * device is not presently connected to the controller, these flow will
38 * be removed once the device reconnects.
alshabib369d2942014-09-12 17:59:35 -070039 *
40 * @param flowRules one or more flow rules
41 * throws SomeKindOfException that indicates which ones were removed and
42 * which ones failed
43 */
44 void removeFlowRules(FlowRule... flowRules);
45
tom4d0c6632014-09-15 23:27:01 -070046
47 // void addInitialFlowContributor(InitialFlowContributor contributor);
48 // void removeInitialFlowContributor(InitialFlowContributor contributor);
49
alshabib369d2942014-09-12 17:59:35 -070050 /**
tom8bb16062014-09-12 14:47:46 -070051 * Adds the specified flow rule listener.
52 *
53 * @param listener flow rule listener
54 */
55 void addListener(FlowRuleListener listener);
56
57 /**
58 * Removes the specified flow rule listener.
59 *
60 * @param listener flow rule listener
61 */
62 void removeListener(FlowRuleListener listener);
63
64}