blob: 347c5fa9c24737d871792d57bcdc8f67dc37a659 [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.api.flowmanager;
2
3import java.util.Collection;
Toshio Koidea03915e2014-07-01 18:39:52 -07004
Toshio Koidea03915e2014-07-01 18:39:52 -07005/**
6 * An interface class for flow manager. The role of the flow manager is to
Toshio Koide7894ca02014-08-15 14:30:13 -07007 * manage a set of Match-Action entries based on the specified Flow objects.
Toshio Koidea03915e2014-07-01 18:39:52 -07008 * <p>
Toshio Koide7894ca02014-08-15 14:30:13 -07009 * It compiles accepted Flow objects to Match-Action entries by calculating the
Toshio Koidea03915e2014-07-01 18:39:52 -070010 * match-action operation phases and allocating resources based on the
Toshio Koide7894ca02014-08-15 14:30:13 -070011 * constrains described in the Flow objects, and executes calculated phases
Toshio Koidea03915e2014-07-01 18:39:52 -070012 * using Match-Action Service.
13 * <p>
Toshio Koide7894ca02014-08-15 14:30:13 -070014 * TODO: add more getter with filter for Flow objects.
Toshio Koidea03915e2014-07-01 18:39:52 -070015 */
Toshio Koidefad1cd52014-08-07 17:10:07 -070016public interface FlowManagerService {
Toshio Koidea03915e2014-07-01 18:39:52 -070017 /**
Toshio Koidefc5acc72014-08-12 18:45:46 -070018 * 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 Koidea03915e2014-07-01 18:39:52 -070022 *
Toshio Koide7894ca02014-08-15 14:30:13 -070023 * @param flow Flow object to be added
Toshio Koidefc5acc72014-08-12 18:45:46 -070024 * @return FlowBatchHandle object if succeeded, null otherwise
Toshio Koidea03915e2014-07-01 18:39:52 -070025 */
Toshio Koidefc5acc72014-08-12 18:45:46 -070026 FlowBatchHandle addFlow(Flow flow);
Toshio Koidea03915e2014-07-01 18:39:52 -070027
28 /**
Toshio Koidefc5acc72014-08-12 18:45:46 -070029 * 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 Koidea03915e2014-07-01 18:39:52 -070033 *
Toshio Koide7894ca02014-08-15 14:30:13 -070034 * @param id ID for Flow object to be removed
Toshio Koidefc5acc72014-08-12 18:45:46 -070035 * @return FlowBatchHandle object if succeeded, null otherwise
Toshio Koidea03915e2014-07-01 18:39:52 -070036 */
Toshio Koidefc5acc72014-08-12 18:45:46 -070037 FlowBatchHandle removeFlow(FlowId id);
Toshio Koidea03915e2014-07-01 18:39:52 -070038
39 /**
Toshio Koide7894ca02014-08-15 14:30:13 -070040 * Gets Flow object.
Toshio Koidea03915e2014-07-01 18:39:52 -070041 *
Toshio Koide7894ca02014-08-15 14:30:13 -070042 * @param id ID of Flow object
43 * @return Flow object if found, null otherwise
Toshio Koidea03915e2014-07-01 18:39:52 -070044 */
Toshio Koidefad1cd52014-08-07 17:10:07 -070045 Flow getFlow(FlowId id);
Toshio Koidea03915e2014-07-01 18:39:52 -070046
47 /**
Toshio Koide7894ca02014-08-15 14:30:13 -070048 * Gets All Flow objects.
Toshio Koidea03915e2014-07-01 18:39:52 -070049 *
Toshio Koide7894ca02014-08-15 14:30:13 -070050 * @return the collection of Flow objects
Toshio Koidea03915e2014-07-01 18:39:52 -070051 */
Toshio Koidefad1cd52014-08-07 17:10:07 -070052 Collection<Flow> getFlows();
Toshio Koidea03915e2014-07-01 18:39:52 -070053
54 /**
Toshio Koidefc5acc72014-08-12 18:45:46 -070055 * Executes batch operation of Flow object asynchronously.
56 * <p>
57 * To track the execution result, use the returned FlowBatchHandle object.
Toshio Koidea03915e2014-07-01 18:39:52 -070058 *
Toshio Koide4ea84192014-07-31 12:10:12 -070059 * @param ops flow operations to be executed
Toshio Koidefc5acc72014-08-12 18:45:46 -070060 * @return FlowBatchHandle object if succeeded, null otherwise
Toshio Koidea03915e2014-07-01 18:39:52 -070061 */
Toshio Koidefc5acc72014-08-12 18:45:46 -070062 FlowBatchHandle executeBatch(FlowBatchOperation ops);
Toshio Koidea03915e2014-07-01 18:39:52 -070063
64 /**
65 * Sets a conflict detection policy.
66 *
Toshio Koidea8e8c542014-07-31 12:10:12 -070067 * @param policy ConflictDetectionPolicy object to be set
Toshio Koidea03915e2014-07-01 18:39:52 -070068 */
69 void setConflictDetectionPolicy(ConflictDetectionPolicy policy);
70
71 /**
72 * Gets the conflict detection policy.
73 *
Toshio Koidea8e8c542014-07-31 12:10:12 -070074 * @return ConflictDetectionPolicy object being applied currently
Toshio Koidea03915e2014-07-01 18:39:52 -070075 */
76 ConflictDetectionPolicy getConflictDetectionPolicy();
77
78 /**
79 * Adds event listener to this service.
80 *
Toshio Koideb8cea262014-08-12 18:45:46 -070081 * @param listener the listener to be added
Toshio Koidea03915e2014-07-01 18:39:52 -070082 */
Toshio Koideb8cea262014-08-12 18:45:46 -070083 void addListener(FlowManagerListener listener);
Toshio Koidea03915e2014-07-01 18:39:52 -070084
85 /**
86 * Removes event listener from this service.
87 *
Toshio Koideb8cea262014-08-12 18:45:46 -070088 * @param listener the listener to be removed
Toshio Koidea03915e2014-07-01 18:39:52 -070089 */
Toshio Koideb8cea262014-08-12 18:45:46 -070090 void removeListener(FlowManagerListener listener);
Toshio Koidea03915e2014-07-01 18:39:52 -070091}