HIGUCHI Yuta | 60a1014 | 2013-06-14 15:50:10 -0700 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.flowmanager; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 2 | |
| 3 | import java.util.ArrayList; |
| 4 | |
Brian O'Connor | 4f0b60c | 2013-11-26 15:00:04 -0800 | [diff] [blame] | 5 | import net.floodlightcontroller.core.IOFSwitch; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 6 | import net.floodlightcontroller.core.module.IFloodlightService; |
Pavlin Radoslavov | ed0f4a8 | 2013-11-04 16:38:36 -0800 | [diff] [blame] | 7 | import net.onrc.onos.ofcontroller.topology.Topology; |
HIGUCHI Yuta | 356086e | 2013-06-12 15:21:19 -0700 | [diff] [blame] | 8 | import net.onrc.onos.ofcontroller.util.CallerId; |
| 9 | import net.onrc.onos.ofcontroller.util.DataPathEndpoints; |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame^] | 10 | import net.onrc.onos.ofcontroller.util.FlowEntry; |
Pavlin Radoslavov | 4df85ae | 2013-11-26 14:48:32 -0800 | [diff] [blame] | 11 | import net.onrc.onos.ofcontroller.util.FlowEntryId; |
HIGUCHI Yuta | 356086e | 2013-06-12 15:21:19 -0700 | [diff] [blame] | 12 | import net.onrc.onos.ofcontroller.util.FlowId; |
| 13 | import net.onrc.onos.ofcontroller.util.FlowPath; |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 14 | |
| 15 | /** |
HIGUCHI Yuta | eb567aa | 2013-10-08 19:27:35 -0700 | [diff] [blame] | 16 | * Interface for providing Flow Service to other modules. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 17 | */ |
| 18 | public interface IFlowService extends IFloodlightService { |
| 19 | /** |
| 20 | * Add a flow. |
| 21 | * |
| 22 | * Internally, ONOS will automatically register the installer for |
| 23 | * receiving Flow Path Notifications for that path. |
| 24 | * |
| 25 | * @param flowPath the Flow Path to install. |
| 26 | * @param flowId the return-by-reference Flow ID as assigned internally. |
| 27 | * @return true on success, otherwise false. |
| 28 | */ |
Pavlin Radoslavov | bcc86ef | 2013-10-26 12:06:25 -0700 | [diff] [blame] | 29 | boolean addFlow(FlowPath flowPath, FlowId flowId); |
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 | /** |
| 47 | * Get a previously added flow. |
| 48 | * |
| 49 | * @param flowId the Flow ID of the flow to get. |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 50 | * @return the Flow Path if found, otherwise null. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 51 | */ |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 52 | FlowPath getFlow(FlowId flowId); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 53 | |
| 54 | /** |
Pavlin Radoslavov | 661c86f | 2013-10-21 12:40:40 -0700 | [diff] [blame] | 55 | * Get all installed flows by all installers. |
| 56 | * |
| 57 | * @return the Flow Paths if found, otherwise null. |
| 58 | */ |
| 59 | ArrayList<FlowPath> getAllFlows(); |
| 60 | |
| 61 | /** |
Pavlin Radoslavov | 706df05 | 2013-03-06 10:49:07 -0800 | [diff] [blame] | 62 | * Get all previously added flows by a specific installer for a given |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 63 | * data path endpoints. |
| 64 | * |
| 65 | * @param installerId the Caller ID of the installer of the flow to get. |
| 66 | * @param dataPathEndpoints the data path endpoints of the flow to get. |
Pavlin Radoslavov | 706df05 | 2013-03-06 10:49:07 -0800 | [diff] [blame] | 67 | * @return the Flow Paths if found, otherwise null. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 68 | */ |
Pavlin Radoslavov | 706df05 | 2013-03-06 10:49:07 -0800 | [diff] [blame] | 69 | ArrayList<FlowPath> getAllFlows(CallerId installerId, |
| 70 | DataPathEndpoints dataPathEndpoints); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * Get all installed flows by all installers for given data path endpoints. |
| 74 | * |
| 75 | * @param dataPathEndpoints the data path endpoints of the flows to get. |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 76 | * @return the Flow Paths if found, otherwise null. |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 77 | */ |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 78 | ArrayList<FlowPath> getAllFlows(DataPathEndpoints dataPathEndpoints); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 79 | |
| 80 | /** |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 81 | * Get summary of all installed flows by all installers. |
| 82 | * |
HIGUCHI Yuta | eb567aa | 2013-10-08 19:27:35 -0700 | [diff] [blame] | 83 | * @param flowId starting flow Id of the range |
| 84 | * @param maxFlows number of flows to return |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 85 | * @return the Flow Paths if found, otherwise null. |
| 86 | */ |
Pavlin Radoslavov | 4ef6ba2 | 2013-11-22 19:32:58 -0800 | [diff] [blame] | 87 | ArrayList<FlowPath> getAllFlowsSummary(FlowId flowId, int maxFlows); |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 88 | |
| 89 | /** |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 90 | * Add and maintain a shortest-path flow. |
| 91 | * |
Pavlin Radoslavov | e057529 | 2013-03-28 05:35:25 -0700 | [diff] [blame] | 92 | * NOTE: The Flow Path argument does NOT contain all flow entries. |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 93 | * Instead, it contains a single dummy flow entry that is used to |
| 94 | * store the matching condition(s). |
| 95 | * That entry is replaced by the appropriate entries from the |
| 96 | * internally performed shortest-path computation. |
| 97 | * |
| 98 | * @param flowPath the Flow Path with the endpoints and the match |
| 99 | * conditions to install. |
Pavlin Radoslavov | e057529 | 2013-03-28 05:35:25 -0700 | [diff] [blame] | 100 | * @return the added shortest-path flow on success, otherwise null. |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 101 | */ |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 102 | FlowPath addAndMaintainShortestPathFlow(FlowPath flowPath); |
Pavlin Radoslavov | ed0f4a8 | 2013-11-04 16:38:36 -0800 | [diff] [blame] | 103 | |
| 104 | /** |
| 105 | * Get the network topology. |
| 106 | * |
| 107 | * @return the network topology. |
| 108 | */ |
| 109 | Topology getTopology(); |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame^] | 110 | |
Jonathan Hart | 9709991 | 2013-11-14 13:40:16 -0800 | [diff] [blame] | 111 | /** |
| 112 | * Get a globally unique flow ID from the flow service. |
| 113 | * NOTE: Not currently guaranteed to be globally unique. |
| 114 | * |
| 115 | * @return unique flow ID |
| 116 | */ |
| 117 | public long getNextFlowEntryId(); |
Pavlin Radoslavov | 4df85ae | 2013-11-26 14:48:32 -0800 | [diff] [blame] | 118 | |
| 119 | /** |
| 120 | * Inform the Flow Manager that a Flow Entry on switch expired. |
| 121 | * |
Pavlin Radoslavov | 3bd5ccf | 2013-11-26 15:10:21 -0800 | [diff] [blame] | 122 | * @param sw the switch the Flow Entry expired on. |
Pavlin Radoslavov | 4df85ae | 2013-11-26 14:48:32 -0800 | [diff] [blame] | 123 | * @param flowEntryId the Flow Entry ID of the expired Flow Entry. |
| 124 | */ |
Brian O'Connor | 4f0b60c | 2013-11-26 15:00:04 -0800 | [diff] [blame] | 125 | public void flowEntryOnSwitchExpired(IOFSwitch sw, FlowEntryId flowEntryId); |
Pavlin Radoslavov | da0ab44 | 2013-12-04 14:08:58 -0800 | [diff] [blame^] | 126 | |
| 127 | /** |
| 128 | * Inform the Flow Manager that a Flow Entry has been pushed to a switch. |
| 129 | * |
| 130 | * @param sw the switch the Flow Entry has been pushed to. |
| 131 | * @param flowEntry the Flow Entry that has been pushed. |
| 132 | */ |
| 133 | void flowEntryPushedToSwitch(IOFSwitch sw, FlowEntry flowEntry); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 134 | } |