blob: 93a4e6cd4c7612c678380d5f6feba85711ba8c1c [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 /**
Toshio Koide079d57c2014-08-21 18:03:58 -070065 * Gets ID generator for Flow objects.
66 * @return the ID generator for Flow objects
67 */
68 FlowIdGenerator getFlowIdGenerator();
69
70 /**
Toshio Koidea03915e2014-07-01 18:39:52 -070071 * Sets a conflict detection policy.
72 *
Toshio Koidea8e8c542014-07-31 12:10:12 -070073 * @param policy ConflictDetectionPolicy object to be set
Toshio Koidea03915e2014-07-01 18:39:52 -070074 */
75 void setConflictDetectionPolicy(ConflictDetectionPolicy policy);
76
77 /**
78 * Gets the conflict detection policy.
79 *
Toshio Koidea8e8c542014-07-31 12:10:12 -070080 * @return ConflictDetectionPolicy object being applied currently
Toshio Koidea03915e2014-07-01 18:39:52 -070081 */
82 ConflictDetectionPolicy getConflictDetectionPolicy();
83
84 /**
85 * Adds event listener to this service.
86 *
Toshio Koideb8cea262014-08-12 18:45:46 -070087 * @param listener the listener to be added
Toshio Koidea03915e2014-07-01 18:39:52 -070088 */
Toshio Koideb8cea262014-08-12 18:45:46 -070089 void addListener(FlowManagerListener listener);
Toshio Koidea03915e2014-07-01 18:39:52 -070090
91 /**
92 * Removes event listener from this service.
93 *
Toshio Koideb8cea262014-08-12 18:45:46 -070094 * @param listener the listener to be removed
Toshio Koidea03915e2014-07-01 18:39:52 -070095 */
Toshio Koideb8cea262014-08-12 18:45:46 -070096 void removeListener(FlowManagerListener listener);
Toshio Koidea03915e2014-07-01 18:39:52 -070097}