blob: 6d6043e585f39886e8e47fcf8fd146d331cc7804 [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;
4
Brian O'Connor4f0b60c2013-11-26 15:00:04 -08005import net.floodlightcontroller.core.IOFSwitch;
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -08006import net.floodlightcontroller.core.module.IFloodlightService;
Pavlin Radoslavoved0f4a82013-11-04 16:38:36 -08007import net.onrc.onos.ofcontroller.topology.Topology;
HIGUCHI Yuta356086e2013-06-12 15:21:19 -07008import net.onrc.onos.ofcontroller.util.CallerId;
9import net.onrc.onos.ofcontroller.util.DataPathEndpoints;
Pavlin Radoslavovda0ab442013-12-04 14:08:58 -080010import net.onrc.onos.ofcontroller.util.FlowEntry;
Pavlin Radoslavov4df85ae2013-11-26 14:48:32 -080011import net.onrc.onos.ofcontroller.util.FlowEntryId;
HIGUCHI Yuta356086e2013-06-12 15:21:19 -070012import net.onrc.onos.ofcontroller.util.FlowId;
13import net.onrc.onos.ofcontroller.util.FlowPath;
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080014
15/**
HIGUCHI Yutaeb567aa2013-10-08 19:27:35 -070016 * Interface for providing Flow Service to other modules.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080017 */
18public 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 Radoslavovbcc86ef2013-10-26 12:06:25 -070029 boolean addFlow(FlowPath flowPath, FlowId flowId);
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 /**
47 * Get a previously added flow.
48 *
49 * @param flowId the Flow ID of the flow to get.
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080050 * @return the Flow Path if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080051 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080052 FlowPath getFlow(FlowId flowId);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080053
54 /**
Pavlin Radoslavov661c86f2013-10-21 12:40:40 -070055 * 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 Radoslavov706df052013-03-06 10:49:07 -080062 * Get all previously added flows by a specific installer for a given
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080063 * 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 Radoslavov706df052013-03-06 10:49:07 -080067 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080068 */
Pavlin Radoslavov706df052013-03-06 10:49:07 -080069 ArrayList<FlowPath> getAllFlows(CallerId installerId,
70 DataPathEndpoints dataPathEndpoints);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080071
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 Radoslavovb6f53542013-03-01 16:02:14 -080076 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080077 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080078 ArrayList<FlowPath> getAllFlows(DataPathEndpoints dataPathEndpoints);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080079
80 /**
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070081 * Get summary of all installed flows by all installers.
82 *
HIGUCHI Yutaeb567aa2013-10-08 19:27:35 -070083 * @param flowId starting flow Id of the range
84 * @param maxFlows number of flows to return
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070085 * @return the Flow Paths if found, otherwise null.
86 */
Pavlin Radoslavov4ef6ba22013-11-22 19:32:58 -080087 ArrayList<FlowPath> getAllFlowsSummary(FlowId flowId, int maxFlows);
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070088
89 /**
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -070090 * Add and maintain a shortest-path flow.
91 *
Pavlin Radoslavove0575292013-03-28 05:35:25 -070092 * NOTE: The Flow Path argument does NOT contain all flow entries.
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -070093 * 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 Radoslavove0575292013-03-28 05:35:25 -0700100 * @return the added shortest-path flow on success, otherwise null.
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -0700101 */
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700102 FlowPath addAndMaintainShortestPathFlow(FlowPath flowPath);
Pavlin Radoslavoved0f4a82013-11-04 16:38:36 -0800103
104 /**
105 * Get the network topology.
106 *
107 * @return the network topology.
108 */
109 Topology getTopology();
Pavlin Radoslavovda0ab442013-12-04 14:08:58 -0800110
Jonathan Hart97099912013-11-14 13:40:16 -0800111 /**
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 Radoslavov4df85ae2013-11-26 14:48:32 -0800118
119 /**
120 * Inform the Flow Manager that a Flow Entry on switch expired.
121 *
Pavlin Radoslavov3bd5ccf2013-11-26 15:10:21 -0800122 * @param sw the switch the Flow Entry expired on.
Pavlin Radoslavov4df85ae2013-11-26 14:48:32 -0800123 * @param flowEntryId the Flow Entry ID of the expired Flow Entry.
124 */
Brian O'Connor4f0b60c2013-11-26 15:00:04 -0800125 public void flowEntryOnSwitchExpired(IOFSwitch sw, FlowEntryId flowEntryId);
Pavlin Radoslavovda0ab442013-12-04 14:08:58 -0800126
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 Radoslavov9e5344c2013-02-18 09:58:30 -0800134}