blob: edd3c85eb8c4dca04a50e683e54cb25f391ca797 [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.api.flowmanager;
2
3import java.util.Collection;
4import java.util.EventListener;
5
6import 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 */
19public interface IFlowManagerService {
20 /**
21 * Adds IFlow object, calculates match-action plan and executes it.
22 *
23 * @param flow IFlow object to be added.
24 * @return true if succeeded, false otherwise.
25 */
26 boolean addFlow(IFlow flow);
27
28 /**
29 * Removes IFlow object, calculates match-action plan and executes it.
30 *
31 * @param id ID for IFlow object to be removed.
32 * @return true if succeeded, false otherwise.
33 */
34 boolean removeFlow(String id);
35
36 /**
37 * Updates IFlow object, calculates match-action plan and executes it.
38 * <p>
39 * The IFlow object having the ID which is the same to the ID of the IFlow
40 * object specified by the parameter will be updated.
41 *
42 * @param flow new IFlow object for the update.
43 * @return true if succeeded, false otherwise.
44 */
45 boolean updateFlow(IFlow flow);
46
47 /**
48 * Gets IFlow object.
49 *
50 * @param id ID of IFlow object.
51 * @return IFlow object if found, null otherwise.
52 */
53 IFlow getFlow(String id);
54
55 /**
56 * Gets All IFlow objects.
57 *
58 * @return the collection of IFlow objects.
59 */
60 Collection<IFlow> getFlows();
61
62 /**
63 * Executes batch operation of IFlow object.
64 *
65 * @param ops FlowOperations to be executed.
66 * @return true if succeeded, false otherwise.
67 */
68 boolean executeBatch(BatchOperation<IFlow> ops);
69
70 /**
71 * Sets a conflict detection policy.
72 *
73 * @param policy ConflictDetectionPolicy object to be set.
74 */
75 void setConflictDetectionPolicy(ConflictDetectionPolicy policy);
76
77 /**
78 * Gets the conflict detection policy.
79 *
80 * @return ConflictDetectionPolicy object being applied currently.
81 */
82 ConflictDetectionPolicy getConflictDetectionPolicy();
83
84 /**
85 * Adds event listener to this service.
86 *
87 * @param listener EventListener to be added.
88 */
89 void addEventListener(EventListener listener);
90
91 /**
92 * Removes event listener from this service.
93 *
94 * @param listener EventListener to be removed.
95 */
96 void removeEventListener(EventListener listener);
97}