tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.flow; |
| 2 | |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 3 | import java.util.List; |
| 4 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 5 | import org.onlab.onos.net.DeviceId; |
| 6 | |
| 7 | /** |
| 8 | * Service for injecting flow rules into the environment and for obtaining |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 9 | * information about flow rules already in the environment. This implements |
| 10 | * semantics of a distributed authoritative flow table where the master copy |
| 11 | * of the flow rules lies with the controller and the devices hold only the |
| 12 | * 'cached' copy. |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 13 | */ |
| 14 | public interface FlowRuleService { |
| 15 | |
| 16 | /** |
| 17 | * Returns the collection of flow entries applied on the specified device. |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 18 | * This will include flow rules which may not yet have been applied to |
| 19 | * the device. |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 20 | * |
| 21 | * @param deviceId device identifier |
| 22 | * @return collection of flow rules |
| 23 | */ |
| 24 | Iterable<FlowEntry> getFlowEntries(DeviceId deviceId); |
| 25 | |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame^] | 26 | // TODO: add createFlowRule factory method and execute operations method |
| 27 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 28 | /** |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 29 | * Applies the specified flow rules onto their respective devices. These |
| 30 | * flow rules will be retained by the system and re-applied anytime the |
| 31 | * device reconnects to the controller. |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 32 | * |
| 33 | * @param flowRules one or more flow rules |
| 34 | * throws SomeKindOfException that indicates which ones were applied and |
| 35 | * which ones failed |
| 36 | */ |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 37 | List<FlowEntry> applyFlowRules(FlowRule... flowRules); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 38 | |
| 39 | /** |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 40 | * Removes the specified flow rules from their respective devices. If the |
| 41 | * device is not presently connected to the controller, these flow will |
| 42 | * be removed once the device reconnects. |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 43 | * |
| 44 | * @param flowRules one or more flow rules |
| 45 | * throws SomeKindOfException that indicates which ones were removed and |
| 46 | * which ones failed |
| 47 | */ |
| 48 | void removeFlowRules(FlowRule... flowRules); |
| 49 | |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 50 | |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 51 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 52 | * Adds the specified flow rule listener. |
| 53 | * |
| 54 | * @param listener flow rule listener |
| 55 | */ |
| 56 | void addListener(FlowRuleListener listener); |
| 57 | |
| 58 | /** |
| 59 | * Removes the specified flow rule listener. |
| 60 | * |
| 61 | * @param listener flow rule listener |
| 62 | */ |
| 63 | void removeListener(FlowRuleListener listener); |
| 64 | |
| 65 | } |