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