blob: 9db035ad19ce35671eb70555a03dcf7ccf0ac3cf [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 */
Ayaka Koshibed4e53e12014-09-18 14:24:55 -070022 Iterable<FlowRule> getFlowEntries(DeviceId deviceId);
tom8bb16062014-09-12 14:47:46 -070023
tom73d6d1e2014-09-17 20:08:01 -070024 // TODO: add createFlowRule factory method and execute operations method
25
tom8bb16062014-09-12 14:47:46 -070026 /**
tom4d0c6632014-09-15 23:27:01 -070027 * Applies the specified flow rules onto their respective devices. These
28 * flow rules will be retained by the system and re-applied anytime the
29 * device reconnects to the controller.
tom8bb16062014-09-12 14:47:46 -070030 *
31 * @param flowRules one or more flow rules
tom8bb16062014-09-12 14:47:46 -070032 */
alshabib219ebaa2014-09-22 15:41:24 -070033 void applyFlowRules(FlowRule... flowRules);
tom8bb16062014-09-12 14:47:46 -070034
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
alshabib369d2942014-09-12 17:59:35 -070047 /**
tom8bb16062014-09-12 14:47:46 -070048 * Adds the specified flow rule listener.
49 *
50 * @param listener flow rule listener
51 */
52 void addListener(FlowRuleListener listener);
53
54 /**
55 * Removes the specified flow rule listener.
56 *
57 * @param listener flow rule listener
58 */
59 void removeListener(FlowRuleListener listener);
60
61}