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; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 4 | |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 5 | /** |
| 6 | * An interface class for flow manager. The role of the flow manager is to |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 7 | * manage a set of Match-Action entries based on the specified Flow objects. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 8 | * <p> |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 9 | * It compiles accepted Flow objects to Match-Action entries by calculating the |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 10 | * match-action operation phases and allocating resources based on the |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 11 | * constrains described in the Flow objects, and executes calculated phases |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 12 | * using Match-Action Service. |
| 13 | * <p> |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 14 | * TODO: add more getter with filter for Flow objects. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 15 | */ |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 16 | public interface FlowManagerService { |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 17 | /** |
Toshio Koide | fc5acc7 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 18 | * Adds Flow object, calculates match-action plan and executes it |
| 19 | * asynchronously. |
| 20 | * <p> |
| 21 | * To track the execution result, use the returned FlowBatchHandle object. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 22 | * |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 23 | * @param flow Flow object to be added |
Toshio Koide | fc5acc7 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 24 | * @return FlowBatchHandle object if succeeded, null otherwise |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 25 | */ |
Toshio Koide | fc5acc7 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 26 | FlowBatchHandle addFlow(Flow flow); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 27 | |
| 28 | /** |
Toshio Koide | fc5acc7 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 29 | * Removes Flow object, calculates match-action plan and executes it |
| 30 | * asynchronously. |
| 31 | * <p> |
| 32 | * To track the execution result, use the returned FlowBatchHandle object. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 33 | * |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 34 | * @param id ID for Flow object to be removed |
Toshio Koide | fc5acc7 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 35 | * @return FlowBatchHandle object if succeeded, null otherwise |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 36 | */ |
Toshio Koide | fc5acc7 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 37 | FlowBatchHandle removeFlow(FlowId id); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 38 | |
| 39 | /** |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 40 | * Gets Flow object. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 41 | * |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 42 | * @param id ID of Flow object |
| 43 | * @return Flow object if found, null otherwise |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 44 | */ |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 45 | Flow getFlow(FlowId id); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 46 | |
| 47 | /** |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 48 | * Gets All Flow objects. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 49 | * |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 50 | * @return the collection of Flow objects |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 51 | */ |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 52 | Collection<Flow> getFlows(); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 53 | |
| 54 | /** |
Toshio Koide | fc5acc7 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 55 | * Executes batch operation of Flow object asynchronously. |
| 56 | * <p> |
| 57 | * To track the execution result, use the returned FlowBatchHandle object. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 58 | * |
Toshio Koide | 4ea8419 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 59 | * @param ops flow operations to be executed |
Toshio Koide | fc5acc7 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 60 | * @return FlowBatchHandle object if succeeded, null otherwise |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 61 | */ |
Toshio Koide | fc5acc7 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 62 | FlowBatchHandle executeBatch(FlowBatchOperation ops); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 63 | |
| 64 | /** |
Toshio Koide | 079d57c | 2014-08-21 18:03:58 -0700 | [diff] [blame] | 65 | * Gets ID generator for Flow objects. |
| 66 | * @return the ID generator for Flow objects |
| 67 | */ |
| 68 | FlowIdGenerator getFlowIdGenerator(); |
| 69 | |
| 70 | /** |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 71 | * Sets a conflict detection policy. |
| 72 | * |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 73 | * @param policy ConflictDetectionPolicy object to be set |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 74 | */ |
| 75 | void setConflictDetectionPolicy(ConflictDetectionPolicy policy); |
| 76 | |
| 77 | /** |
| 78 | * Gets the conflict detection policy. |
| 79 | * |
Toshio Koide | a8e8c54 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 80 | * @return ConflictDetectionPolicy object being applied currently |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 81 | */ |
| 82 | ConflictDetectionPolicy getConflictDetectionPolicy(); |
| 83 | |
| 84 | /** |
| 85 | * Adds event listener to this service. |
| 86 | * |
Toshio Koide | b8cea26 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 87 | * @param listener the listener to be added |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 88 | */ |
Toshio Koide | b8cea26 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 89 | void addListener(FlowManagerListener listener); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 90 | |
| 91 | /** |
| 92 | * Removes event listener from this service. |
| 93 | * |
Toshio Koide | b8cea26 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 94 | * @param listener the listener to be removed |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 95 | */ |
Toshio Koide | b8cea26 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 96 | void removeListener(FlowManagerListener listener); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 97 | } |