blob: a534410563e31242b4334202e63dcd987c2304f5 [file] [log] [blame]
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -08001package net.floodlightcontroller.flowcache;
2
3import java.util.ArrayList;
4
Jonathan Hart01f2d272013-04-04 20:03:46 -07005import net.floodlightcontroller.core.INetMapTopologyObjects.IFlowPath;
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -08006import net.floodlightcontroller.core.module.IFloodlightService;
7import net.floodlightcontroller.util.CallerId;
8import net.floodlightcontroller.util.DataPathEndpoints;
9import net.floodlightcontroller.util.FlowId;
10import net.floodlightcontroller.util.FlowPath;
11
12/**
13 * @short Interface for providing Flow Service to other modules.
14 */
15public interface IFlowService extends IFloodlightService {
16 /**
17 * Add a flow.
18 *
19 * Internally, ONOS will automatically register the installer for
20 * receiving Flow Path Notifications for that path.
21 *
22 * @param flowPath the Flow Path to install.
23 * @param flowId the return-by-reference Flow ID as assigned internally.
Pavlin Radoslavovdbaaf2e2013-03-29 04:25:55 -070024 * @param dataPathSummaryStr the data path summary string if the added
25 * flow will be maintained internally, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080026 * @return true on success, otherwise false.
27 */
Pavlin Radoslavovdbaaf2e2013-03-29 04:25:55 -070028 boolean addFlow(FlowPath flowPath, FlowId flowId,
29 String dataPathSummaryStr);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080030
31 /**
32 * Delete a previously added flow.
33 *
34 * @param flowId the Flow ID of the flow to delete.
35 * @return true on success, otherwise false.
36 */
37 boolean deleteFlow(FlowId flowId);
38
39 /**
Pavlin Radoslavov916832f2013-03-14 17:48:41 -070040 * Clear the state for a previously added flow.
41 *
42 * @param flowId the Flow ID of the flow to clear.
43 * @return true on success, otherwise false.
44 */
45 boolean clearFlow(FlowId flowId);
46
47 /**
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080048 * Get a previously added flow.
49 *
50 * @param flowId the Flow ID of the flow to get.
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080051 * @return the Flow Path if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080052 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080053 FlowPath getFlow(FlowId flowId);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080054
55 /**
Pavlin Radoslavov706df052013-03-06 10:49:07 -080056 * Get all previously added flows by a specific installer for a given
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080057 * data path endpoints.
58 *
59 * @param installerId the Caller ID of the installer of the flow to get.
60 * @param dataPathEndpoints the data path endpoints of the flow to get.
Pavlin Radoslavov706df052013-03-06 10:49:07 -080061 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080062 */
Pavlin Radoslavov706df052013-03-06 10:49:07 -080063 ArrayList<FlowPath> getAllFlows(CallerId installerId,
64 DataPathEndpoints dataPathEndpoints);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080065
66 /**
67 * Get all installed flows by all installers for given data path endpoints.
68 *
69 * @param dataPathEndpoints the data path endpoints of the flows to get.
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080070 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080071 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080072 ArrayList<FlowPath> getAllFlows(DataPathEndpoints dataPathEndpoints);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080073
74 /**
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070075 * Get summary of all installed flows by all installers.
76 *
77 * @param flowId: starting flow Id of the range
78 * @param maxFlows: number of flows to return
79 * @return the Flow Paths if found, otherwise null.
80 */
Jonathan Hart01f2d272013-04-04 20:03:46 -070081 ArrayList<IFlowPath> getAllFlowsSummary(FlowId flowId, int maxFlows);
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070082
83 /**
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080084 * Get all installed flows by all installers.
85 *
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080086 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080087 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080088 ArrayList<FlowPath> getAllFlows();
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -070089
90 /**
91 * Add and maintain a shortest-path flow.
92 *
Pavlin Radoslavove0575292013-03-28 05:35:25 -070093 * NOTE: The Flow Path argument does NOT contain all flow entries.
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -070094 * Instead, it contains a single dummy flow entry that is used to
95 * store the matching condition(s).
96 * That entry is replaced by the appropriate entries from the
97 * internally performed shortest-path computation.
98 *
99 * @param flowPath the Flow Path with the endpoints and the match
100 * conditions to install.
Pavlin Radoslavove0575292013-03-28 05:35:25 -0700101 * @return the added shortest-path flow on success, otherwise null.
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -0700102 */
Pavlin Radoslavove0575292013-03-28 05:35:25 -0700103 public FlowPath addAndMaintainShortestPathFlow(FlowPath flowPath);
Pavlin Radoslavov4ef543e2013-05-07 13:36:57 -0700104
105 /**
106 * Store a path flow for measurement purpose.
107 *
108 * NOTE: The Flow Path argument does NOT contain flow entries.
109 *
110 * @param flowPath the Flow Path with the endpoints and the match
111 * conditions to store.
112 * @return the stored shortest-path flow on success, otherwise null.
113 */
114 public FlowPath measurementStorePathFlow(FlowPath flowPath);
115
116 /**
117 * Install path flows for measurement purpose.
118 *
119 * @param numThreads the number of threads to use to install the path
120 * flows.
121 * @return true on success, otherwise false.
122 */
123 public boolean measurementInstallPaths(Integer numThreads);
124
125 /**
126 * Get the measurement time that took to install the path flows.
127 *
128 * @return the measurement time (in nanoseconds) it took to install
129 * the path flows.
130 */
131 public Long measurementGetInstallPathsTimeNsec();
132
133 /**
134 * Clear the path flows stored for measurement purpose.
135 *
136 * @return true on success, otherwise false.
137 */
138 public boolean measurementClearAllPaths();
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -0800139}