tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.flow; |
| 2 | |
| 3 | import org.onlab.onos.net.DeviceId; |
| 4 | |
| 5 | /** |
| 6 | * Service for injecting flow rules into the environment and for obtaining |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 7 | * 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. |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 11 | */ |
| 12 | public interface FlowRuleService { |
| 13 | |
| 14 | /** |
| 15 | * Returns the collection of flow entries applied on the specified device. |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 16 | * This will include flow rules which may not yet have been applied to |
| 17 | * the device. |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 18 | * |
| 19 | * @param deviceId device identifier |
| 20 | * @return collection of flow rules |
| 21 | */ |
Ayaka Koshibe | d4e53e1 | 2014-09-18 14:24:55 -0700 | [diff] [blame] | 22 | Iterable<FlowRule> getFlowEntries(DeviceId deviceId); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 23 | |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 24 | // TODO: add createFlowRule factory method and execute operations method |
| 25 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 26 | /** |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 27 | * 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. |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 30 | * |
| 31 | * @param flowRules one or more flow rules |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 32 | */ |
alshabib | 219ebaa | 2014-09-22 15:41:24 -0700 | [diff] [blame] | 33 | void applyFlowRules(FlowRule... flowRules); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 36 | * 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. |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 39 | * |
| 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 | |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 46 | |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 47 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 48 | * 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 | } |