blob: 6c19fd0e825a12da96fac4247e7b7639aff48fb2 [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 /**
Pavlin Radoslavovbaea9242013-05-08 00:20:09 +000032 * Delete all previously added flows.
33 *
34 * @return true on success, otherwise false.
35 */
36 boolean deleteAllFlows();
37
38 /**
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080039 * Delete a previously added flow.
40 *
41 * @param flowId the Flow ID of the flow to delete.
42 * @return true on success, otherwise false.
43 */
44 boolean deleteFlow(FlowId flowId);
45
46 /**
Pavlin Radoslavovbaea9242013-05-08 00:20:09 +000047 * Clear the state for all previously added flows.
48 *
49 * @return true on success, otherwise false.
50 */
51 boolean clearAllFlows();
52
53 /**
Pavlin Radoslavov916832f2013-03-14 17:48:41 -070054 * Clear the state for a previously added flow.
55 *
56 * @param flowId the Flow ID of the flow to clear.
57 * @return true on success, otherwise false.
58 */
59 boolean clearFlow(FlowId flowId);
60
61 /**
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080062 * Get a previously added flow.
63 *
64 * @param flowId the Flow ID of the flow to get.
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080065 * @return the Flow Path if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080066 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080067 FlowPath getFlow(FlowId flowId);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080068
69 /**
Pavlin Radoslavov706df052013-03-06 10:49:07 -080070 * Get all previously added flows by a specific installer for a given
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080071 * data path endpoints.
72 *
73 * @param installerId the Caller ID of the installer of the flow to get.
74 * @param dataPathEndpoints the data path endpoints of the flow to get.
Pavlin Radoslavov706df052013-03-06 10:49:07 -080075 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080076 */
Pavlin Radoslavov706df052013-03-06 10:49:07 -080077 ArrayList<FlowPath> getAllFlows(CallerId installerId,
78 DataPathEndpoints dataPathEndpoints);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080079
80 /**
81 * Get all installed flows by all installers for given data path endpoints.
82 *
83 * @param dataPathEndpoints the data path endpoints of the flows to get.
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080084 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080085 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080086 ArrayList<FlowPath> getAllFlows(DataPathEndpoints dataPathEndpoints);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080087
88 /**
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070089 * Get summary of all installed flows by all installers.
90 *
91 * @param flowId: starting flow Id of the range
92 * @param maxFlows: number of flows to return
93 * @return the Flow Paths if found, otherwise null.
94 */
Jonathan Hart01f2d272013-04-04 20:03:46 -070095 ArrayList<IFlowPath> getAllFlowsSummary(FlowId flowId, int maxFlows);
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070096
97 /**
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080098 * Get all installed flows by all installers.
99 *
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -0800100 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -0800101 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -0800102 ArrayList<FlowPath> getAllFlows();
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -0700103
104 /**
105 * Add and maintain a shortest-path flow.
106 *
Pavlin Radoslavove0575292013-03-28 05:35:25 -0700107 * NOTE: The Flow Path argument does NOT contain all flow entries.
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -0700108 * Instead, it contains a single dummy flow entry that is used to
109 * store the matching condition(s).
110 * That entry is replaced by the appropriate entries from the
111 * internally performed shortest-path computation.
112 *
113 * @param flowPath the Flow Path with the endpoints and the match
114 * conditions to install.
Pavlin Radoslavove0575292013-03-28 05:35:25 -0700115 * @return the added shortest-path flow on success, otherwise null.
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -0700116 */
Pavlin Radoslavove0575292013-03-28 05:35:25 -0700117 public FlowPath addAndMaintainShortestPathFlow(FlowPath flowPath);
Pavlin Radoslavov4ef543e2013-05-07 13:36:57 -0700118
119 /**
120 * Store a path flow for measurement purpose.
121 *
122 * NOTE: The Flow Path argument does NOT contain flow entries.
123 *
124 * @param flowPath the Flow Path with the endpoints and the match
125 * conditions to store.
126 * @return the stored shortest-path flow on success, otherwise null.
127 */
128 public FlowPath measurementStorePathFlow(FlowPath flowPath);
129
130 /**
131 * Install path flows for measurement purpose.
132 *
133 * @param numThreads the number of threads to use to install the path
134 * flows.
135 * @return true on success, otherwise false.
136 */
137 public boolean measurementInstallPaths(Integer numThreads);
138
139 /**
140 * Get the measurement time that took to install the path flows.
141 *
142 * @return the measurement time (in nanoseconds) it took to install
143 * the path flows.
144 */
145 public Long measurementGetInstallPathsTimeNsec();
146
147 /**
Pavlin Radoslavovf5d80412013-05-24 05:14:07 +0000148 * Get the measurement install time per Flow.
149 *
150 * @return a multi-line string with the following format per line:
151 * ThreadAndTimePerFlow <ThreadId> <TotalThreads> <Time(ns)>
152 */
153 public String measurementGetPerFlowInstallTime();
154
155 /**
Pavlin Radoslavov4ef543e2013-05-07 13:36:57 -0700156 * Clear the path flows stored for measurement purpose.
157 *
158 * @return true on success, otherwise false.
159 */
160 public boolean measurementClearAllPaths();
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -0800161}