blob: 8d2b7979ba7dd5256d276ad59ca263730018e2f2 [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 Radoslavov4df85ae2013-11-26 14:48:32 -080010import net.onrc.onos.ofcontroller.util.FlowEntryId;
HIGUCHI Yuta356086e2013-06-12 15:21:19 -070011import net.onrc.onos.ofcontroller.util.FlowId;
12import net.onrc.onos.ofcontroller.util.FlowPath;
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080013
14/**
HIGUCHI Yutaeb567aa2013-10-08 19:27:35 -070015 * Interface for providing Flow Service to other modules.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080016 */
17public interface IFlowService extends IFloodlightService {
18 /**
19 * Add a flow.
20 *
21 * Internally, ONOS will automatically register the installer for
22 * receiving Flow Path Notifications for that path.
23 *
24 * @param flowPath the Flow Path to install.
25 * @param flowId the return-by-reference Flow ID as assigned internally.
26 * @return true on success, otherwise false.
27 */
Pavlin Radoslavovbcc86ef2013-10-26 12:06:25 -070028 boolean addFlow(FlowPath flowPath, FlowId flowId);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080029
30 /**
Pavlin Radoslavovbaea9242013-05-08 00:20:09 +000031 * Delete all previously added flows.
32 *
33 * @return true on success, otherwise false.
34 */
35 boolean deleteAllFlows();
36
37 /**
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080038 * Delete a previously added flow.
39 *
40 * @param flowId the Flow ID of the flow to delete.
41 * @return true on success, otherwise false.
42 */
43 boolean deleteFlow(FlowId flowId);
44
45 /**
46 * Get a previously added flow.
47 *
48 * @param flowId the Flow ID of the flow to get.
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080049 * @return the Flow Path if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080050 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080051 FlowPath getFlow(FlowId flowId);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080052
53 /**
Pavlin Radoslavov661c86f2013-10-21 12:40:40 -070054 * Get all installed flows by all installers.
55 *
56 * @return the Flow Paths if found, otherwise null.
57 */
58 ArrayList<FlowPath> getAllFlows();
59
60 /**
Pavlin Radoslavov706df052013-03-06 10:49:07 -080061 * Get all previously added flows by a specific installer for a given
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080062 * data path endpoints.
63 *
64 * @param installerId the Caller ID of the installer of the flow to get.
65 * @param dataPathEndpoints the data path endpoints of the flow to get.
Pavlin Radoslavov706df052013-03-06 10:49:07 -080066 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080067 */
Pavlin Radoslavov706df052013-03-06 10:49:07 -080068 ArrayList<FlowPath> getAllFlows(CallerId installerId,
69 DataPathEndpoints dataPathEndpoints);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080070
71 /**
72 * Get all installed flows by all installers for given data path endpoints.
73 *
74 * @param dataPathEndpoints the data path endpoints of the flows to get.
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080075 * @return the Flow Paths if found, otherwise null.
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080076 */
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080077 ArrayList<FlowPath> getAllFlows(DataPathEndpoints dataPathEndpoints);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -080078
79 /**
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070080 * Get summary of all installed flows by all installers.
81 *
HIGUCHI Yutaeb567aa2013-10-08 19:27:35 -070082 * @param flowId starting flow Id of the range
83 * @param maxFlows number of flows to return
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070084 * @return the Flow Paths if found, otherwise null.
85 */
Pavlin Radoslavov4ef6ba22013-11-22 19:32:58 -080086 ArrayList<FlowPath> getAllFlowsSummary(FlowId flowId, int maxFlows);
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070087
88 /**
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -070089 * Add and maintain a shortest-path flow.
90 *
Pavlin Radoslavove0575292013-03-28 05:35:25 -070091 * NOTE: The Flow Path argument does NOT contain all flow entries.
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -070092 * Instead, it contains a single dummy flow entry that is used to
93 * store the matching condition(s).
94 * That entry is replaced by the appropriate entries from the
95 * internally performed shortest-path computation.
96 *
97 * @param flowPath the Flow Path with the endpoints and the match
98 * conditions to install.
Pavlin Radoslavove0575292013-03-28 05:35:25 -070099 * @return the added shortest-path flow on success, otherwise null.
Pavlin Radoslavovb9fe6b42013-03-27 16:25:05 -0700100 */
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700101 FlowPath addAndMaintainShortestPathFlow(FlowPath flowPath);
Pavlin Radoslavoved0f4a82013-11-04 16:38:36 -0800102
103 /**
104 * Get the network topology.
105 *
106 * @return the network topology.
107 */
108 Topology getTopology();
Jonathan Hart97099912013-11-14 13:40:16 -0800109
110 /**
111 * Get a globally unique flow ID from the flow service.
112 * NOTE: Not currently guaranteed to be globally unique.
113 *
114 * @return unique flow ID
115 */
116 public long getNextFlowEntryId();
Pavlin Radoslavov4df85ae2013-11-26 14:48:32 -0800117
118 /**
119 * Inform the Flow Manager that a Flow Entry on switch expired.
120 *
Pavlin Radoslavov3bd5ccf2013-11-26 15:10:21 -0800121 * @param sw the switch the Flow Entry expired on.
Pavlin Radoslavov4df85ae2013-11-26 14:48:32 -0800122 * @param flowEntryId the Flow Entry ID of the expired Flow Entry.
123 */
Brian O'Connor4f0b60c2013-11-26 15:00:04 -0800124 public void flowEntryOnSwitchExpired(IOFSwitch sw, FlowEntryId flowEntryId);
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -0800125}