blob: 118cbfa08c4da4859376f9eafa5c20bc88eb8cd2 [file] [log] [blame]
Pavlin Radoslavov1eee2c82013-10-15 02:30:32 -07001package net.onrc.onos.datagrid;
2
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -07003import java.util.Collection;
4
Pavlin Radoslavov1eee2c82013-10-15 02:30:32 -07005import net.floodlightcontroller.core.module.IFloodlightService;
Toshio Koide3738ee52014-02-12 14:57:39 -08006import net.onrc.onos.intent.Intent;
Pavlin Radoslavov9a859022013-10-30 10:08:24 -07007import net.onrc.onos.ofcontroller.flowmanager.IFlowEventHandlerService;
Jonathan Hart7804bea2014-01-07 10:50:52 -08008import net.onrc.onos.ofcontroller.proxyarp.ArpReplyNotification;
9import net.onrc.onos.ofcontroller.proxyarp.IArpReplyEventHandler;
10import net.onrc.onos.ofcontroller.proxyarp.IPacketOutEventHandler;
11import net.onrc.onos.ofcontroller.proxyarp.PacketOutNotification;
Pavlin Radoslavovaaace7f2013-10-25 19:42:00 -070012import net.onrc.onos.ofcontroller.topology.TopologyElement;
Pavlin Radoslavov909da3c2014-01-09 04:04:33 -080013import net.onrc.onos.ofcontroller.util.Dpid;
Pavlin Radoslavovb7506842013-10-29 17:46:54 -070014import net.onrc.onos.ofcontroller.util.FlowEntry;
15import net.onrc.onos.ofcontroller.util.FlowEntryId;
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070016import net.onrc.onos.ofcontroller.util.FlowId;
17import net.onrc.onos.ofcontroller.util.FlowPath;
Pavlin Radoslavova9c0c3b2014-01-09 10:54:45 -080018import net.onrc.onos.ofcontroller.util.Pair;
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070019
Pavlin Radoslavov1eee2c82013-10-15 02:30:32 -070020/**
21 * Interface for providing Datagrid Service to other modules.
22 */
23public interface IDatagridService extends IFloodlightService {
Pavlin Radoslavov7940b652014-02-13 19:42:05 -080024 /**
25 * Create an event channel.
26 *
27 * If the channel already exists, just return it.
28 * NOTE: The channel is started automatically.
29 *
30 * @param channelName the event channel name.
31 * @param typeK the type of the Key in the Key-Value store.
32 * @param typeV the type of the Value in the Key-Value store.
33 * @return the event channel for the channel name.
34 */
35 <K, V> IEventChannel<K, V> createChannel(String channelName,
36 Class<K> typeK, Class<V> typeV);
37
38 /**
39 * Add event channel listener.
40 *
41 * NOTE: The channel is started automatically right after the listener
42 * is added.
43 *
44 * @param channelName the event channel name.
45 * @param listener the listener to add.
46 * @param typeK the type of the Key in the Key-Value store.
47 * @param typeV the type of the Value in the Key-Value store.
48 * @return the event channel for the channel name.
49 */
50 <K, V> IEventChannel<K, V> addListener(String channelName,
51 IEventChannelListener<K, V> listener,
52 Class<K> typeK, Class<V> typeV);
53
54 /**
55 * Remove event channel listener.
56 *
57 * @param channelName the event channel name.
58 * @param listener the listener to remove.
59 */
60 <K, V> void removeListener(String channelName,
61 IEventChannelListener<K, V> listener);
62
Toshio Koide3738ee52014-02-12 14:57:39 -080063 /*
64 * register all the intents as one batch
65 */
66 void registerIntent(Collection<Intent> intents);
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070067 /**
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070068 * Register Flow Event Handler Service for receiving Flow-related
Pavlin Radoslavov6b79f2b2013-10-26 21:31:10 -070069 * notifications.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070070 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070071 * NOTE: Only a single Flow Event Handler Service can be registered.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070072 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070073 * @param flowEventHandlerService the Flow Event Handler Service to register.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070074 */
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070075 void registerFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService);
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070076
77 /**
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070078 * De-register Flow Event Handler Service for receiving Flow-related
Pavlin Radoslavov6b79f2b2013-10-26 21:31:10 -070079 * notifications.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070080 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070081 * NOTE: Only a single Flow Event Handler Service can be registered.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070082 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070083 * @param flowEventHandlerService the Flow Event Handler Service to
Pavlin Radoslavov6b79f2b2013-10-26 21:31:10 -070084 * de-register.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070085 */
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070086 void deregisterFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService);
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070087
88 /**
Jonathan Hartc6325622014-01-14 16:37:50 -080089 * Register event handler for packet-out events.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080090 *
Jonathan Hartc6325622014-01-14 16:37:50 -080091 * @param packetOutEventHandler The packet-out event handler to register.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080092 */
Jonathan Hartc6325622014-01-14 16:37:50 -080093 public void registerPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler);
Jonathan Hart18ad55c2013-11-11 22:49:55 -080094
95 /**
Jonathan Hartc6325622014-01-14 16:37:50 -080096 * Deregister event handler service for packet-out events.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080097 *
Jonathan Hartc6325622014-01-14 16:37:50 -080098 * @param packetOutEventHandler The packet-out event handler to deregister.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080099 */
Jonathan Hartc6325622014-01-14 16:37:50 -0800100 public void deregisterPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler);
Jonathan Hart7804bea2014-01-07 10:50:52 -0800101
Jonathan Hartc6325622014-01-14 16:37:50 -0800102 /**
103 * Register event handler for ARP reply events.
104 *
105 * @param packetOutEventHandler The ARP reply event handler to register.
106 */
Jonathan Hart7804bea2014-01-07 10:50:52 -0800107 public void registerArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler);
108
Jonathan Hartc6325622014-01-14 16:37:50 -0800109 /**
110 * Deregister event handler service for ARP reply events.
111 *
112 * @param packetOutEventHandler The ARP reply event handler to deregister.
113 */
Jonathan Hart7804bea2014-01-07 10:50:52 -0800114 public void deregisterArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler);
Pavlin Radoslavov379c9042013-11-26 15:40:49 -0800115
Jonathan Hart18ad55c2013-11-11 22:49:55 -0800116 /**
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700117 * Get all Flows that are currently in the datagrid.
118 *
119 * @return all Flows that are currently in the datagrid.
120 */
121 Collection<FlowPath> getAllFlows();
122
123 /**
Pavlin Radoslavov379c9042013-11-26 15:40:49 -0800124 * Get a Flow for a given Flow ID.
125 *
126 * @param flowId the Flow ID of the Flow to get.
127 * @return the Flow if found, otherwise null.
128 */
129 FlowPath getFlow(FlowId flowId);
130
131 /**
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700132 * Send a notification that a Flow is added.
133 *
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700134 * @param flowPath the Flow that is added.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700135 */
136 void notificationSendFlowAdded(FlowPath flowPath);
137
138 /**
139 * Send a notification that a Flow is removed.
140 *
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700141 * @param flowId the Flow ID of the Flow that is removed.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700142 */
143 void notificationSendFlowRemoved(FlowId flowId);
144
145 /**
146 * Send a notification that a Flow is updated.
147 *
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700148 * @param flowPath the Flow that is updated.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700149 */
150 void notificationSendFlowUpdated(FlowPath flowPath);
151
152 /**
153 * Send a notification that all Flows are removed.
154 */
155 void notificationSendAllFlowsRemoved();
Pavlin Radoslavovaaace7f2013-10-25 19:42:00 -0700156
157 /**
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700158 * Get all Flow Entries that are currently in the datagrid.
159 *
160 * @return all Flow Entries that are currently in the datagrid.
161 */
162 Collection<FlowEntry> getAllFlowEntries();
163
164 /**
Pavlin Radoslavov379c9042013-11-26 15:40:49 -0800165 * Get a Flow Entry for a given Flow Entry ID.
166 *
167 * @param flowEntryId the Flow Entry ID of the Flow Entry to get.
168 * @return the Flow Entry if found, otherwise null.
169 */
170 FlowEntry getFlowEntry(FlowEntryId flowEntryId);
171
172 /**
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700173 * Send a notification that a FlowEntry is added.
174 *
175 * @param flowEntry the FlowEntry that is added.
176 */
177 void notificationSendFlowEntryAdded(FlowEntry flowEntry);
178
179 /**
180 * Send a notification that a FlowEntry is removed.
181 *
182 * @param flowEntryId the FlowEntry ID of the FlowEntry that is removed.
183 */
184 void notificationSendFlowEntryRemoved(FlowEntryId flowEntryId);
185
186 /**
187 * Send a notification that a FlowEntry is updated.
188 *
189 * @param flowEntry the FlowEntry that is updated.
190 */
191 void notificationSendFlowEntryUpdated(FlowEntry flowEntry);
192
193 /**
194 * Send a notification that all Flow Entries are removed.
195 */
196 void notificationSendAllFlowEntriesRemoved();
197
198 /**
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800199 * Get all Flow IDs that are currently in the datagrid.
200 *
Pavlin Radoslavova9c0c3b2014-01-09 10:54:45 -0800201 * @return all Flow IDs that ae currently in the datagrid.
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800202 */
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800203 Collection<Pair<FlowId, Dpid>> getAllFlowIds();
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800204
205 /**
206 * Send a notification that a FlowId is added.
207 *
208 * @param flowId the FlowId that is added.
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800209 * @param dpid the Source Switch Dpid.
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800210 */
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800211 void notificationSendFlowIdAdded(FlowId flowId, Dpid dpid);
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800212
213 /**
214 * Send a notification that a FlowId is removed.
215 *
216 * @param flowId the FlowId that is removed.
217 */
218 void notificationSendFlowIdRemoved(FlowId flowId);
219
220 /**
221 * Send a notification that a FlowId is updated.
222 *
223 * @param flowId the FlowId that is updated.
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800224 * @param dpid the Source Switch Dpid.
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800225 */
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800226 void notificationSendFlowIdUpdated(FlowId flowId, Dpid dpid);
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800227
228 /**
229 * Send a notification that all Flow IDs are removed.
230 */
231 void notificationSendAllFlowIdsRemoved();
232
233 /**
Pavlin Radoslavova9c0c3b2014-01-09 10:54:45 -0800234 * Get all Flow Entry IDs that are currently in the datagrid.
235 *
236 * @return all Flow Entry IDs that ae currently in the datagrid.
237 */
238 Collection<Pair<FlowEntryId, Dpid>> getAllFlowEntryIds();
239
240 /**
Pavlin Radoslavov909da3c2014-01-09 04:04:33 -0800241 * Send a notification that a FlowEntryId is added.
242 *
243 * @param flowEntryId the FlowEntryId that is added.
244 * @param dpid the Switch Dpid.
245 */
246 void notificationSendFlowEntryIdAdded(FlowEntryId flowEntryId, Dpid dpid);
247
248 /**
249 * Send a notification that a FlowEntryId is removed.
250 *
251 * @param flowEntryId the FlowEntryId that is removed.
252 */
253 void notificationSendFlowEntryIdRemoved(FlowEntryId flowEntryId);
254
255 /**
256 * Send a notification that a FlowEntryId is updated.
257 *
258 * @param flowEntryId the FlowEntryId that is updated.
259 * @param dpid the Switch Dpid.
260 */
261 void notificationSendFlowEntryIdUpdated(FlowEntryId flowEntryId,
262 Dpid dpid);
263
264 /**
265 * Send a notification that all Flow Entry IDs are removed.
266 */
267 void notificationSendAllFlowEntryIdsRemoved();
268
269 /**
Pavlin Radoslavovaaace7f2013-10-25 19:42:00 -0700270 * Get all Topology Elements that are currently in the datagrid.
271 *
272 * @return all Topology Elements that are currently in the datagrid.
273 */
274 Collection<TopologyElement> getAllTopologyElements();
275
276 /**
277 * Send a notification that a Topology Element is added.
278 *
279 * @param topologyElement the Topology Element that is added.
280 */
281 void notificationSendTopologyElementAdded(TopologyElement topologyElement);
282
283 /**
284 * Send a notification that a Topology Element is removed.
285 *
286 * @param topologyElement the Topology Element that is removed.
287 */
288 void notificationSendTopologyElementRemoved(TopologyElement topologyElement);
289
290 /**
291 * Send a notification that a Topology Element is updated.
292 *
293 * @param topologyElement the Topology Element that is updated.
294 */
295 void notificationSendTopologyElementUpdated(TopologyElement topologyElement);
296
297 /**
298 * Send a notification that all Topology Elements are removed.
299 */
300 void notificationSendAllTopologyElementsRemoved();
Jonathan Hart18ad55c2013-11-11 22:49:55 -0800301
302 /**
Jonathan Hart7804bea2014-01-07 10:50:52 -0800303 * Send a packet-out notification to other ONOS instances. This informs
304 * other instances that they should send this packet out some of the ports
305 * they control. Not all notifications are applicable to all instances
306 * (i.e. some notifications specify a single port to send the packet out),
307 * so each instance must determine whether it needs to take action when it
308 * receives the notification.
309 *
310 * @param packetOutNotification The packet notification to send
Jonathan Hart18ad55c2013-11-11 22:49:55 -0800311 */
Jonathan Hart7804bea2014-01-07 10:50:52 -0800312 public void sendPacketOutNotification(PacketOutNotification packetOutNotification);
313
314 /**
315 * Send notification to other ONOS instances that an ARP reply has been
316 * received.
317 * @param arpReply The notification of the ARP reply
318 */
319 public void sendArpReplyNotification(ArpReplyNotification arpReply);
Pavlin Radoslavov1eee2c82013-10-15 02:30:32 -0700320}