blob: 0c79b8134ded34262d1ba738988ad657f689d6e7 [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;
TeruU80ce5062014-03-03 17:16:13 -08007import net.onrc.onos.ofcontroller.devicemanager.IDeviceEventHandler;
8import net.onrc.onos.ofcontroller.devicemanager.OnosDevice;
Pavlin Radoslavov9a859022013-10-30 10:08:24 -07009import net.onrc.onos.ofcontroller.flowmanager.IFlowEventHandlerService;
Jonathan Hart7804bea2014-01-07 10:50:52 -080010import net.onrc.onos.ofcontroller.proxyarp.ArpReplyNotification;
11import net.onrc.onos.ofcontroller.proxyarp.IArpReplyEventHandler;
12import net.onrc.onos.ofcontroller.proxyarp.IPacketOutEventHandler;
13import net.onrc.onos.ofcontroller.proxyarp.PacketOutNotification;
Pavlin Radoslavovaaace7f2013-10-25 19:42:00 -070014import net.onrc.onos.ofcontroller.topology.TopologyElement;
Pavlin Radoslavov909da3c2014-01-09 04:04:33 -080015import net.onrc.onos.ofcontroller.util.Dpid;
Pavlin Radoslavovb7506842013-10-29 17:46:54 -070016import net.onrc.onos.ofcontroller.util.FlowEntry;
17import net.onrc.onos.ofcontroller.util.FlowEntryId;
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070018import net.onrc.onos.ofcontroller.util.FlowId;
19import net.onrc.onos.ofcontroller.util.FlowPath;
Pavlin Radoslavova9c0c3b2014-01-09 10:54:45 -080020import net.onrc.onos.ofcontroller.util.Pair;
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070021
Pavlin Radoslavov1eee2c82013-10-15 02:30:32 -070022/**
23 * Interface for providing Datagrid Service to other modules.
24 */
25public interface IDatagridService extends IFloodlightService {
Pavlin Radoslavov7940b652014-02-13 19:42:05 -080026 /**
27 * Create an event channel.
28 *
29 * If the channel already exists, just return it.
30 * NOTE: The channel is started automatically.
31 *
32 * @param channelName the event channel name.
33 * @param typeK the type of the Key in the Key-Value store.
34 * @param typeV the type of the Value in the Key-Value store.
35 * @return the event channel for the channel name.
36 */
37 <K, V> IEventChannel<K, V> createChannel(String channelName,
38 Class<K> typeK, Class<V> typeV);
39
40 /**
41 * Add event channel listener.
42 *
43 * NOTE: The channel is started automatically right after the listener
44 * is added.
45 *
46 * @param channelName the event channel name.
47 * @param listener the listener to add.
48 * @param typeK the type of the Key in the Key-Value store.
49 * @param typeV the type of the Value in the Key-Value store.
50 * @return the event channel for the channel name.
51 */
52 <K, V> IEventChannel<K, V> addListener(String channelName,
53 IEventChannelListener<K, V> listener,
54 Class<K> typeK, Class<V> typeV);
55
56 /**
57 * Remove event channel listener.
58 *
59 * @param channelName the event channel name.
60 * @param listener the listener to remove.
61 */
62 <K, V> void removeListener(String channelName,
63 IEventChannelListener<K, V> listener);
64
Toshio Koide3738ee52014-02-12 14:57:39 -080065 /*
66 * register all the intents as one batch
67 */
68 void registerIntent(Collection<Intent> intents);
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070069 /**
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070070 * Register Flow Event Handler Service for receiving Flow-related
Pavlin Radoslavov6b79f2b2013-10-26 21:31:10 -070071 * notifications.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070072 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070073 * NOTE: Only a single Flow Event Handler Service can be registered.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070074 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070075 * @param flowEventHandlerService the Flow Event Handler Service to register.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070076 */
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070077 void registerFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService);
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070078
79 /**
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070080 * De-register Flow Event Handler Service for receiving Flow-related
Pavlin Radoslavov6b79f2b2013-10-26 21:31:10 -070081 * notifications.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070082 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070083 * NOTE: Only a single Flow Event Handler Service can be registered.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070084 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070085 * @param flowEventHandlerService the Flow Event Handler Service to
Pavlin Radoslavov6b79f2b2013-10-26 21:31:10 -070086 * de-register.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070087 */
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070088 void deregisterFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService);
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070089
90 /**
Jonathan Hartc6325622014-01-14 16:37:50 -080091 * Register event handler for packet-out events.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080092 *
Jonathan Hartc6325622014-01-14 16:37:50 -080093 * @param packetOutEventHandler The packet-out event handler to register.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080094 */
Jonathan Hartc6325622014-01-14 16:37:50 -080095 public void registerPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler);
Jonathan Hart18ad55c2013-11-11 22:49:55 -080096
97 /**
Jonathan Hartc6325622014-01-14 16:37:50 -080098 * Deregister event handler service for packet-out events.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080099 *
Jonathan Hartc6325622014-01-14 16:37:50 -0800100 * @param packetOutEventHandler The packet-out event handler to deregister.
Jonathan Hart18ad55c2013-11-11 22:49:55 -0800101 */
Jonathan Hartc6325622014-01-14 16:37:50 -0800102 public void deregisterPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler);
Jonathan Hart7804bea2014-01-07 10:50:52 -0800103
Jonathan Hartc6325622014-01-14 16:37:50 -0800104 /**
105 * Register event handler for ARP reply events.
106 *
107 * @param packetOutEventHandler The ARP reply event handler to register.
108 */
Jonathan Hart7804bea2014-01-07 10:50:52 -0800109 public void registerArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler);
110
Jonathan Hartc6325622014-01-14 16:37:50 -0800111 /**
112 * Deregister event handler service for ARP reply events.
113 *
114 * @param packetOutEventHandler The ARP reply event handler to deregister.
115 */
Jonathan Hart7804bea2014-01-07 10:50:52 -0800116 public void deregisterArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler);
Pavlin Radoslavov379c9042013-11-26 15:40:49 -0800117
Jonathan Hart18ad55c2013-11-11 22:49:55 -0800118 /**
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700119 * Get all Flows that are currently in the datagrid.
120 *
121 * @return all Flows that are currently in the datagrid.
122 */
123 Collection<FlowPath> getAllFlows();
124
125 /**
Pavlin Radoslavov379c9042013-11-26 15:40:49 -0800126 * Get a Flow for a given Flow ID.
127 *
128 * @param flowId the Flow ID of the Flow to get.
129 * @return the Flow if found, otherwise null.
130 */
131 FlowPath getFlow(FlowId flowId);
132
133 /**
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700134 * Send a notification that a Flow is added.
135 *
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700136 * @param flowPath the Flow that is added.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700137 */
138 void notificationSendFlowAdded(FlowPath flowPath);
139
140 /**
141 * Send a notification that a Flow is removed.
142 *
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700143 * @param flowId the Flow ID of the Flow that is removed.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700144 */
145 void notificationSendFlowRemoved(FlowId flowId);
146
147 /**
148 * Send a notification that a Flow is updated.
149 *
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700150 * @param flowPath the Flow that is updated.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700151 */
152 void notificationSendFlowUpdated(FlowPath flowPath);
153
154 /**
155 * Send a notification that all Flows are removed.
156 */
157 void notificationSendAllFlowsRemoved();
Pavlin Radoslavovaaace7f2013-10-25 19:42:00 -0700158
159 /**
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700160 * Get all Flow Entries that are currently in the datagrid.
161 *
162 * @return all Flow Entries that are currently in the datagrid.
163 */
164 Collection<FlowEntry> getAllFlowEntries();
165
166 /**
Pavlin Radoslavov379c9042013-11-26 15:40:49 -0800167 * Get a Flow Entry for a given Flow Entry ID.
168 *
169 * @param flowEntryId the Flow Entry ID of the Flow Entry to get.
170 * @return the Flow Entry if found, otherwise null.
171 */
172 FlowEntry getFlowEntry(FlowEntryId flowEntryId);
173
174 /**
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700175 * Send a notification that a FlowEntry is added.
176 *
177 * @param flowEntry the FlowEntry that is added.
178 */
179 void notificationSendFlowEntryAdded(FlowEntry flowEntry);
180
181 /**
182 * Send a notification that a FlowEntry is removed.
183 *
184 * @param flowEntryId the FlowEntry ID of the FlowEntry that is removed.
185 */
186 void notificationSendFlowEntryRemoved(FlowEntryId flowEntryId);
187
188 /**
189 * Send a notification that a FlowEntry is updated.
190 *
191 * @param flowEntry the FlowEntry that is updated.
192 */
193 void notificationSendFlowEntryUpdated(FlowEntry flowEntry);
194
195 /**
196 * Send a notification that all Flow Entries are removed.
197 */
198 void notificationSendAllFlowEntriesRemoved();
199
200 /**
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800201 * Get all Flow IDs that are currently in the datagrid.
202 *
Pavlin Radoslavova9c0c3b2014-01-09 10:54:45 -0800203 * @return all Flow IDs that ae currently in the datagrid.
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800204 */
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800205 Collection<Pair<FlowId, Dpid>> getAllFlowIds();
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800206
207 /**
208 * Send a notification that a FlowId is added.
209 *
210 * @param flowId the FlowId that is added.
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800211 * @param dpid the Source Switch Dpid.
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800212 */
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800213 void notificationSendFlowIdAdded(FlowId flowId, Dpid dpid);
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800214
215 /**
216 * Send a notification that a FlowId is removed.
217 *
218 * @param flowId the FlowId that is removed.
219 */
220 void notificationSendFlowIdRemoved(FlowId flowId);
221
222 /**
223 * Send a notification that a FlowId is updated.
224 *
225 * @param flowId the FlowId that is updated.
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800226 * @param dpid the Source Switch Dpid.
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800227 */
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800228 void notificationSendFlowIdUpdated(FlowId flowId, Dpid dpid);
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800229
230 /**
231 * Send a notification that all Flow IDs are removed.
232 */
233 void notificationSendAllFlowIdsRemoved();
234
235 /**
Pavlin Radoslavova9c0c3b2014-01-09 10:54:45 -0800236 * Get all Flow Entry IDs that are currently in the datagrid.
237 *
238 * @return all Flow Entry IDs that ae currently in the datagrid.
239 */
240 Collection<Pair<FlowEntryId, Dpid>> getAllFlowEntryIds();
241
242 /**
Pavlin Radoslavov909da3c2014-01-09 04:04:33 -0800243 * Send a notification that a FlowEntryId is added.
244 *
245 * @param flowEntryId the FlowEntryId that is added.
246 * @param dpid the Switch Dpid.
247 */
248 void notificationSendFlowEntryIdAdded(FlowEntryId flowEntryId, Dpid dpid);
249
250 /**
251 * Send a notification that a FlowEntryId is removed.
252 *
253 * @param flowEntryId the FlowEntryId that is removed.
254 */
255 void notificationSendFlowEntryIdRemoved(FlowEntryId flowEntryId);
256
257 /**
258 * Send a notification that a FlowEntryId is updated.
259 *
260 * @param flowEntryId the FlowEntryId that is updated.
261 * @param dpid the Switch Dpid.
262 */
263 void notificationSendFlowEntryIdUpdated(FlowEntryId flowEntryId,
264 Dpid dpid);
265
266 /**
267 * Send a notification that all Flow Entry IDs are removed.
268 */
269 void notificationSendAllFlowEntryIdsRemoved();
270
271 /**
Pavlin Radoslavovaaace7f2013-10-25 19:42:00 -0700272 * Get all Topology Elements that are currently in the datagrid.
273 *
274 * @return all Topology Elements that are currently in the datagrid.
275 */
276 Collection<TopologyElement> getAllTopologyElements();
277
278 /**
279 * Send a notification that a Topology Element is added.
280 *
281 * @param topologyElement the Topology Element that is added.
282 */
283 void notificationSendTopologyElementAdded(TopologyElement topologyElement);
284
285 /**
286 * Send a notification that a Topology Element is removed.
287 *
288 * @param topologyElement the Topology Element that is removed.
289 */
290 void notificationSendTopologyElementRemoved(TopologyElement topologyElement);
291
292 /**
293 * Send a notification that a Topology Element is updated.
294 *
295 * @param topologyElement the Topology Element that is updated.
296 */
297 void notificationSendTopologyElementUpdated(TopologyElement topologyElement);
298
299 /**
300 * Send a notification that all Topology Elements are removed.
301 */
302 void notificationSendAllTopologyElementsRemoved();
Jonathan Hart18ad55c2013-11-11 22:49:55 -0800303
304 /**
Jonathan Hart7804bea2014-01-07 10:50:52 -0800305 * Send a packet-out notification to other ONOS instances. This informs
306 * other instances that they should send this packet out some of the ports
307 * they control. Not all notifications are applicable to all instances
308 * (i.e. some notifications specify a single port to send the packet out),
309 * so each instance must determine whether it needs to take action when it
310 * receives the notification.
311 *
312 * @param packetOutNotification The packet notification to send
Jonathan Hart18ad55c2013-11-11 22:49:55 -0800313 */
Jonathan Hart7804bea2014-01-07 10:50:52 -0800314 public void sendPacketOutNotification(PacketOutNotification packetOutNotification);
315
316 /**
317 * Send notification to other ONOS instances that an ARP reply has been
318 * received.
319 * @param arpReply The notification of the ARP reply
320 */
321 public void sendArpReplyNotification(ArpReplyNotification arpReply);
TeruU80ce5062014-03-03 17:16:13 -0800322
323 void sendNotificationDeviceAdded(Long mac, OnosDevice dev);
324
325 void sendNotificationDeviceDeleted(OnosDevice dev);
326
327 void registerMapDeviceEventHandler(IDeviceEventHandler deviceEventHandler);
328
329 void deregisterMapDeviceEventHandler(IDeviceEventHandler deviceEventHandler);
330
Pavlin Radoslavov1eee2c82013-10-15 02:30:32 -0700331}