blob: 4c19cbdeb867a235ee2804c312ecb63ba61878b7 [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.api.flowmanager;
2
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -07003import net.onrc.onos.core.util.IdGenerator;
4
Toshio Koidea03915e2014-07-01 18:39:52 -07005import java.util.Collection;
Toshio Koidea03915e2014-07-01 18:39:52 -07006
Toshio Koidea03915e2014-07-01 18:39:52 -07007/**
8 * An interface class for flow manager. The role of the flow manager is to
Toshio Koide7894ca02014-08-15 14:30:13 -07009 * manage a set of Match-Action entries based on the specified Flow objects.
Toshio Koidea03915e2014-07-01 18:39:52 -070010 * <p>
Toshio Koide7894ca02014-08-15 14:30:13 -070011 * It compiles accepted Flow objects to Match-Action entries by calculating the
Toshio Koidea03915e2014-07-01 18:39:52 -070012 * match-action operation phases and allocating resources based on the
Toshio Koide7894ca02014-08-15 14:30:13 -070013 * constrains described in the Flow objects, and executes calculated phases
Toshio Koidea03915e2014-07-01 18:39:52 -070014 * using Match-Action Service.
15 * <p>
Toshio Koide7894ca02014-08-15 14:30:13 -070016 * TODO: add more getter with filter for Flow objects.
Toshio Koidea03915e2014-07-01 18:39:52 -070017 */
Toshio Koidefad1cd52014-08-07 17:10:07 -070018public interface FlowManagerService {
Toshio Koidea03915e2014-07-01 18:39:52 -070019 /**
Toshio Koidefc5acc72014-08-12 18:45:46 -070020 * Adds Flow object, calculates match-action plan and executes it
21 * asynchronously.
22 * <p>
23 * To track the execution result, use the returned FlowBatchHandle object.
Toshio Koidea03915e2014-07-01 18:39:52 -070024 *
Toshio Koide7894ca02014-08-15 14:30:13 -070025 * @param flow Flow object to be added
Toshio Koidefc5acc72014-08-12 18:45:46 -070026 * @return FlowBatchHandle object if succeeded, null otherwise
Toshio Koidea03915e2014-07-01 18:39:52 -070027 */
Toshio Koidefc5acc72014-08-12 18:45:46 -070028 FlowBatchHandle addFlow(Flow flow);
Toshio Koidea03915e2014-07-01 18:39:52 -070029
30 /**
Toshio Koidefc5acc72014-08-12 18:45:46 -070031 * Removes Flow object, calculates match-action plan and executes it
32 * asynchronously.
33 * <p>
34 * To track the execution result, use the returned FlowBatchHandle object.
Toshio Koidea03915e2014-07-01 18:39:52 -070035 *
Toshio Koide7894ca02014-08-15 14:30:13 -070036 * @param id ID for Flow object to be removed
Toshio Koidefc5acc72014-08-12 18:45:46 -070037 * @return FlowBatchHandle object if succeeded, null otherwise
Toshio Koidea03915e2014-07-01 18:39:52 -070038 */
Toshio Koidefc5acc72014-08-12 18:45:46 -070039 FlowBatchHandle removeFlow(FlowId id);
Toshio Koidea03915e2014-07-01 18:39:52 -070040
41 /**
Toshio Koide7894ca02014-08-15 14:30:13 -070042 * Gets Flow object.
Toshio Koidea03915e2014-07-01 18:39:52 -070043 *
Toshio Koide7894ca02014-08-15 14:30:13 -070044 * @param id ID of Flow object
45 * @return Flow object if found, null otherwise
Toshio Koidea03915e2014-07-01 18:39:52 -070046 */
Toshio Koidefad1cd52014-08-07 17:10:07 -070047 Flow getFlow(FlowId id);
Toshio Koidea03915e2014-07-01 18:39:52 -070048
49 /**
Toshio Koide7894ca02014-08-15 14:30:13 -070050 * Gets All Flow objects.
Toshio Koidea03915e2014-07-01 18:39:52 -070051 *
Toshio Koide7894ca02014-08-15 14:30:13 -070052 * @return the collection of Flow objects
Toshio Koidea03915e2014-07-01 18:39:52 -070053 */
Toshio Koidefad1cd52014-08-07 17:10:07 -070054 Collection<Flow> getFlows();
Toshio Koidea03915e2014-07-01 18:39:52 -070055
56 /**
Toshio Koidefc5acc72014-08-12 18:45:46 -070057 * Executes batch operation of Flow object asynchronously.
58 * <p>
59 * To track the execution result, use the returned FlowBatchHandle object.
Toshio Koidea03915e2014-07-01 18:39:52 -070060 *
Toshio Koide4ea84192014-07-31 12:10:12 -070061 * @param ops flow operations to be executed
Toshio Koidefc5acc72014-08-12 18:45:46 -070062 * @return FlowBatchHandle object if succeeded, null otherwise
Toshio Koidea03915e2014-07-01 18:39:52 -070063 */
Toshio Koidefc5acc72014-08-12 18:45:46 -070064 FlowBatchHandle executeBatch(FlowBatchOperation ops);
Toshio Koidea03915e2014-07-01 18:39:52 -070065
66 /**
Toshio Koide079d57c2014-08-21 18:03:58 -070067 * Gets ID generator for Flow objects.
68 * @return the ID generator for Flow objects
69 */
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -070070 IdGenerator<FlowId> getFlowIdGenerator();
Toshio Koide079d57c2014-08-21 18:03:58 -070071
72 /**
Toshio Koidea03915e2014-07-01 18:39:52 -070073 * Sets a conflict detection policy.
74 *
Toshio Koidea8e8c542014-07-31 12:10:12 -070075 * @param policy ConflictDetectionPolicy object to be set
Toshio Koidea03915e2014-07-01 18:39:52 -070076 */
77 void setConflictDetectionPolicy(ConflictDetectionPolicy policy);
78
79 /**
80 * Gets the conflict detection policy.
81 *
Toshio Koidea8e8c542014-07-31 12:10:12 -070082 * @return ConflictDetectionPolicy object being applied currently
Toshio Koidea03915e2014-07-01 18:39:52 -070083 */
84 ConflictDetectionPolicy getConflictDetectionPolicy();
85
86 /**
87 * Adds event listener to this service.
88 *
Toshio Koideb8cea262014-08-12 18:45:46 -070089 * @param listener the listener to be added
Toshio Koidea03915e2014-07-01 18:39:52 -070090 */
Toshio Koideb8cea262014-08-12 18:45:46 -070091 void addListener(FlowManagerListener listener);
Toshio Koidea03915e2014-07-01 18:39:52 -070092
93 /**
94 * Removes event listener from this service.
95 *
Toshio Koideb8cea262014-08-12 18:45:46 -070096 * @param listener the listener to be removed
Toshio Koidea03915e2014-07-01 18:39:52 -070097 */
Toshio Koideb8cea262014-08-12 18:45:46 -070098 void removeListener(FlowManagerListener listener);
Toshio Koidea03915e2014-07-01 18:39:52 -070099}