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 | |
| 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 |
| 32 | * throws SomeKindOfException that indicates which ones were applied and |
| 33 | * which ones failed |
| 34 | */ |
Ayaka Koshibe | 08eabaa | 2014-09-17 14:59:25 -0700 | [diff] [blame] | 35 | List<FlowEntry> applyFlowRules(FlowRule... flowRules); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 36 | |
| 37 | /** |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 38 | * Removes the specified flow rules from their respective devices. If the |
| 39 | * device is not presently connected to the controller, these flow will |
| 40 | * be removed once the device reconnects. |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 41 | * |
| 42 | * @param flowRules one or more flow rules |
| 43 | * throws SomeKindOfException that indicates which ones were removed and |
| 44 | * which ones failed |
| 45 | */ |
| 46 | void removeFlowRules(FlowRule... flowRules); |
| 47 | |
tom | 4d0c663 | 2014-09-15 23:27:01 -0700 | [diff] [blame] | 48 | |
| 49 | // void addInitialFlowContributor(InitialFlowContributor contributor); |
| 50 | // void removeInitialFlowContributor(InitialFlowContributor contributor); |
| 51 | |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 52 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 53 | * Adds the specified flow rule listener. |
| 54 | * |
| 55 | * @param listener flow rule listener |
| 56 | */ |
| 57 | void addListener(FlowRuleListener listener); |
| 58 | |
| 59 | /** |
| 60 | * Removes the specified flow rule listener. |
| 61 | * |
| 62 | * @param listener flow rule listener |
| 63 | */ |
| 64 | void removeListener(FlowRuleListener listener); |
| 65 | |
| 66 | } |