HIGUCHI Yuta | edf81d7 | 2013-06-12 12:06:57 -0700 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.flowcache; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 2 | |
| 3 | import java.util.ArrayList; |
| 4 | |
| 5 | import net.floodlightcontroller.core.module.IFloodlightService; |
| 6 | import net.floodlightcontroller.util.CallerId; |
| 7 | import net.floodlightcontroller.util.DataPathEndpoints; |
| 8 | import net.floodlightcontroller.util.FlowId; |
| 9 | import net.floodlightcontroller.util.FlowPath; |
HIGUCHI Yuta | 2051490 | 2013-06-12 11:24:16 -0700 | [diff] [blame] | 10 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 11 | |
| 12 | /** |
| 13 | * @short Interface for providing Flow Service to other modules. |
| 14 | */ |
| 15 | public 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 Radoslavov | dbaaf2e | 2013-03-29 04:25:55 -0700 | [diff] [blame] | 24 | * @param dataPathSummaryStr the data path summary string if the added |
| 25 | * flow will be maintained internally, otherwise null. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 26 | * @return true on success, otherwise false. |
| 27 | */ |
Pavlin Radoslavov | dbaaf2e | 2013-03-29 04:25:55 -0700 | [diff] [blame] | 28 | boolean addFlow(FlowPath flowPath, FlowId flowId, |
| 29 | String dataPathSummaryStr); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 30 | |
| 31 | /** |
Pavlin Radoslavov | baea924 | 2013-05-08 00:20:09 +0000 | [diff] [blame] | 32 | * Delete all previously added flows. |
| 33 | * |
| 34 | * @return true on success, otherwise false. |
| 35 | */ |
| 36 | boolean deleteAllFlows(); |
| 37 | |
| 38 | /** |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 39 | * 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 Radoslavov | baea924 | 2013-05-08 00:20:09 +0000 | [diff] [blame] | 47 | * Clear the state for all previously added flows. |
| 48 | * |
| 49 | * @return true on success, otherwise false. |
| 50 | */ |
| 51 | boolean clearAllFlows(); |
| 52 | |
| 53 | /** |
Pavlin Radoslavov | 916832f | 2013-03-14 17:48:41 -0700 | [diff] [blame] | 54 | * 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 Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 62 | * Get a previously added flow. |
| 63 | * |
| 64 | * @param flowId the Flow ID of the flow to get. |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 65 | * @return the Flow Path if found, otherwise null. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 66 | */ |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 67 | FlowPath getFlow(FlowId flowId); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 68 | |
| 69 | /** |
Pavlin Radoslavov | 706df05 | 2013-03-06 10:49:07 -0800 | [diff] [blame] | 70 | * Get all previously added flows by a specific installer for a given |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 71 | * 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 Radoslavov | 706df05 | 2013-03-06 10:49:07 -0800 | [diff] [blame] | 75 | * @return the Flow Paths if found, otherwise null. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 76 | */ |
Pavlin Radoslavov | 706df05 | 2013-03-06 10:49:07 -0800 | [diff] [blame] | 77 | ArrayList<FlowPath> getAllFlows(CallerId installerId, |
| 78 | DataPathEndpoints dataPathEndpoints); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 79 | |
| 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 Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 84 | * @return the Flow Paths if found, otherwise null. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 85 | */ |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 86 | ArrayList<FlowPath> getAllFlows(DataPathEndpoints dataPathEndpoints); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 87 | |
| 88 | /** |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 89 | * 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 Hart | 01f2d27 | 2013-04-04 20:03:46 -0700 | [diff] [blame] | 95 | ArrayList<IFlowPath> getAllFlowsSummary(FlowId flowId, int maxFlows); |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 96 | |
| 97 | /** |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 98 | * Get all installed flows by all installers. |
| 99 | * |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 100 | * @return the Flow Paths if found, otherwise null. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 101 | */ |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 102 | ArrayList<FlowPath> getAllFlows(); |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 103 | |
| 104 | /** |
| 105 | * Add and maintain a shortest-path flow. |
| 106 | * |
Pavlin Radoslavov | e057529 | 2013-03-28 05:35:25 -0700 | [diff] [blame] | 107 | * NOTE: The Flow Path argument does NOT contain all flow entries. |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 108 | * 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 Radoslavov | e057529 | 2013-03-28 05:35:25 -0700 | [diff] [blame] | 115 | * @return the added shortest-path flow on success, otherwise null. |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 116 | */ |
Pavlin Radoslavov | e057529 | 2013-03-28 05:35:25 -0700 | [diff] [blame] | 117 | public FlowPath addAndMaintainShortestPathFlow(FlowPath flowPath); |
Pavlin Radoslavov | 4ef543e | 2013-05-07 13:36:57 -0700 | [diff] [blame] | 118 | |
| 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 Radoslavov | f5d8041 | 2013-05-24 05:14:07 +0000 | [diff] [blame] | 148 | * 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 Radoslavov | 4ef543e | 2013-05-07 13:36:57 -0700 | [diff] [blame] | 156 | * Clear the path flows stored for measurement purpose. |
| 157 | * |
| 158 | * @return true on success, otherwise false. |
| 159 | */ |
| 160 | public boolean measurementClearAllPaths(); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 161 | } |