Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.flowmanager; |
| 2 | |
| 3 | import java.util.Collection; |
| 4 | import java.util.EventListener; |
| 5 | |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 6 | /** |
| 7 | * An interface class for flow manager. The role of the flow manager is to |
| 8 | * manage a set of Match-Action entries based on the specified IFlow objects. |
| 9 | * <p> |
| 10 | * It compiles accepted IFlow objects to Match-Action entries by calculating the |
| 11 | * match-action operation phases and allocating resources based on the |
| 12 | * constrains described in the IFlow objects, and executes calculated phases |
| 13 | * using Match-Action Service. |
| 14 | * <p> |
| 15 | * TODO: add more getter with filter for IFlow objects. |
| 16 | */ |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 17 | public interface FlowManagerService { |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 18 | /** |
| 19 | * Adds IFlow object, calculates match-action plan and executes it. |
| 20 | * |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 21 | * @param flow IFlow object to be added |
| 22 | * @return true if succeeded, false otherwise |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 23 | */ |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 24 | boolean addFlow(Flow flow); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * Removes IFlow object, calculates match-action plan and executes it. |
| 28 | * |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 29 | * @param id ID for IFlow object to be removed |
| 30 | * @return true if succeeded, false otherwise |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 31 | */ |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 32 | boolean removeFlow(FlowId id); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 33 | |
| 34 | /** |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 35 | * Gets IFlow object. |
| 36 | * |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 37 | * @param id ID of IFlow object |
| 38 | * @return IFlow object if found, null otherwise |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 39 | */ |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 40 | Flow getFlow(FlowId id); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Gets All IFlow objects. |
| 44 | * |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 45 | * @return the collection of IFlow objects |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 46 | */ |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 47 | Collection<Flow> getFlows(); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 48 | |
| 49 | /** |
| 50 | * Executes batch operation of IFlow object. |
| 51 | * |
Toshio Koide | 4ea8419 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 52 | * @param ops flow operations to be executed |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 53 | * @return true if succeeded, false otherwise |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 54 | */ |
Toshio Koide | 4ea8419 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 55 | boolean executeBatch(FlowBatchOperation ops); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 56 | |
| 57 | /** |
| 58 | * Sets a conflict detection policy. |
| 59 | * |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 60 | * @param policy ConflictDetectionPolicy object to be set |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 61 | */ |
| 62 | void setConflictDetectionPolicy(ConflictDetectionPolicy policy); |
| 63 | |
| 64 | /** |
| 65 | * Gets the conflict detection policy. |
| 66 | * |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 67 | * @return ConflictDetectionPolicy object being applied currently |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 68 | */ |
| 69 | ConflictDetectionPolicy getConflictDetectionPolicy(); |
| 70 | |
| 71 | /** |
| 72 | * Adds event listener to this service. |
| 73 | * |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 74 | * @param listener EventListener to be added |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 75 | */ |
| 76 | void addEventListener(EventListener listener); |
| 77 | |
| 78 | /** |
| 79 | * Removes event listener from this service. |
| 80 | * |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 81 | * @param listener EventListener to be removed |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 82 | */ |
| 83 | void removeEventListener(EventListener listener); |
| 84 | } |