blob: 3a8a947a638c9d8c7d55f544cc97cc1d06a35fda [file] [log] [blame]
HIGUCHI Yuta60a10142013-06-14 15:50:10 -07001package net.onrc.onos.ofcontroller.flowmanager;
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -08002
3import java.util.ArrayList;
Pavlin Radoslavovab3f8862013-12-04 18:35:53 -08004import java.util.Collection;
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -08005
Brian O'Connor4f0b60c2013-11-26 15:00:04 -08006import net.floodlightcontroller.core.IOFSwitch;
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -08007import net.floodlightcontroller.core.module.IFloodlightService;
Pavlin Radoslavoved0f4a82013-11-04 16:38:36 -08008import net.onrc.onos.ofcontroller.topology.Topology;
HIGUCHI Yuta356086e2013-06-12 15:21:19 -07009import net.onrc.onos.ofcontroller.util.CallerId;
10import net.onrc.onos.ofcontroller.util.DataPathEndpoints;
Pavlin Radoslavovda0ab442013-12-04 14:08:58 -080011import net.onrc.onos.ofcontroller.util.FlowEntry;
Pavlin Radoslavov4df85ae2013-11-26 14:48:32 -080012import net.onrc.onos.ofcontroller.util.FlowEntryId;
HIGUCHI Yuta356086e2013-06-12 15:21:19 -070013import net.onrc.onos.ofcontroller.util.FlowId;
14import net.onrc.onos.ofcontroller.util.FlowPath;
Pavlin Radoslavovab3f8862013-12-04 18:35:53 -080015import net.onrc.onos.ofcontroller.util.Pair;
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080016
17/**
HIGUCHI Yutaeb567aa2013-10-08 19:27:35 -070018 * Interface for providing Flow Service to other modules.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080019 */
20public interface IFlowService extends IFloodlightService {
21 /**
22 * Add a flow.
23 *
24 * Internally, ONOS will automatically register the installer for
25 * receiving Flow Path Notifications for that path.
26 *
27 * @param flowPath the Flow Path to install.
28 * @param flowId the return-by-reference Flow ID as assigned internally.
29 * @return true on success, otherwise false.
30 */
Pavlin Radoslavovbcc86ef2013-10-26 12:06:25 -070031 boolean addFlow(FlowPath flowPath, FlowId flowId);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080032
33 /**
Pavlin Radoslavovbaea9242013-05-08 00:20:09 +000034 * Delete all previously added flows.
35 *
36 * @return true on success, otherwise false.
37 */
38 boolean deleteAllFlows();
39
40 /**
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080041 * Delete a previously added flow.
42 *
43 * @param flowId the Flow ID of the flow to delete.
44 * @return true on success, otherwise false.
45 */
46 boolean deleteFlow(FlowId flowId);
47
48 /**
49 * Get a previously added flow.
50 *
51 * @param flowId the Flow ID of the flow to get.
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080052 * @return the Flow Path if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080053 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080054 FlowPath getFlow(FlowId flowId);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080055
56 /**
Pavlin Radoslavov661c86f2013-10-21 12:40:40 -070057 * Get all installed flows by all installers.
58 *
59 * @return the Flow Paths if found, otherwise null.
60 */
61 ArrayList<FlowPath> getAllFlows();
62
63 /**
Pavlin Radoslavov706df052013-03-06 10:49:07 -080064 * Get all previously added flows by a specific installer for a given
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080065 * data path endpoints.
66 *
67 * @param installerId the Caller ID of the installer of the flow to get.
68 * @param dataPathEndpoints the data path endpoints of the flow to get.
Pavlin Radoslavov706df052013-03-06 10:49:07 -080069 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080070 */
Pavlin Radoslavov706df052013-03-06 10:49:07 -080071 ArrayList<FlowPath> getAllFlows(CallerId installerId,
72 DataPathEndpoints dataPathEndpoints);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080073
74 /**
75 * Get all installed flows by all installers for given data path endpoints.
76 *
77 * @param dataPathEndpoints the data path endpoints of the flows to get.
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080078 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080079 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080080 ArrayList<FlowPath> getAllFlows(DataPathEndpoints dataPathEndpoints);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080081
82 /**
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070083 * Get summary of all installed flows by all installers.
84 *
HIGUCHI Yutaeb567aa2013-10-08 19:27:35 -070085 * @param flowId starting flow Id of the range
86 * @param maxFlows number of flows to return
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070087 * @return the Flow Paths if found, otherwise null.
88 */
Pavlin Radoslavov4ef6ba22013-11-22 19:32:58 -080089 ArrayList<FlowPath> getAllFlowsSummary(FlowId flowId, int maxFlows);
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070090
91 /**
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -070092 * Add and maintain a shortest-path flow.
93 *
Pavlin Radoslavove0575292013-03-28 05:35:25 -070094 * NOTE: The Flow Path argument does NOT contain all flow entries.
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -070095 * Instead, it contains a single dummy flow entry that is used to
96 * store the matching condition(s).
97 * That entry is replaced by the appropriate entries from the
98 * internally performed shortest-path computation.
99 *
100 * @param flowPath the Flow Path with the endpoints and the match
101 * conditions to install.
Pavlin Radoslavove0575292013-03-28 05:35:25 -0700102 * @return the added shortest-path flow on success, otherwise null.
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -0700103 */
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700104 FlowPath addAndMaintainShortestPathFlow(FlowPath flowPath);
Pavlin Radoslavoved0f4a82013-11-04 16:38:36 -0800105
106 /**
107 * Get the network topology.
108 *
109 * @return the network topology.
110 */
111 Topology getTopology();
Pavlin Radoslavovda0ab442013-12-04 14:08:58 -0800112
Jonathan Hart97099912013-11-14 13:40:16 -0800113 /**
114 * Get a globally unique flow ID from the flow service.
115 * NOTE: Not currently guaranteed to be globally unique.
116 *
117 * @return unique flow ID
118 */
119 public long getNextFlowEntryId();
Pavlin Radoslavov4df85ae2013-11-26 14:48:32 -0800120
121 /**
122 * Inform the Flow Manager that a Flow Entry on switch expired.
123 *
Pavlin Radoslavov3bd5ccf2013-11-26 15:10:21 -0800124 * @param sw the switch the Flow Entry expired on.
Pavlin Radoslavov4df85ae2013-11-26 14:48:32 -0800125 * @param flowEntryId the Flow Entry ID of the expired Flow Entry.
126 */
Brian O'Connor4f0b60c2013-11-26 15:00:04 -0800127 public void flowEntryOnSwitchExpired(IOFSwitch sw, FlowEntryId flowEntryId);
Pavlin Radoslavovda0ab442013-12-04 14:08:58 -0800128
129 /**
Pavlin Radoslavovab3f8862013-12-04 18:35:53 -0800130 * Inform the Flow Manager that a collection of Flow Entries have been
131 * pushed to a switch.
Pavlin Radoslavovda0ab442013-12-04 14:08:58 -0800132 *
Pavlin Radoslavovab3f8862013-12-04 18:35:53 -0800133 * @param entries the collection of <IOFSwitch, FlowEntry> pairs
134 * that have been pushed.
Pavlin Radoslavovda0ab442013-12-04 14:08:58 -0800135 */
Pavlin Radoslavovab3f8862013-12-04 18:35:53 -0800136 public void flowEntriesPushedToSwitch(
137 Collection<Pair<IOFSwitch, FlowEntry>> entries);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -0800138}