blob: d3cf98e59f7753eef9171af4de8cb8b71ae092c4 [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 {
Toshio Koide3738ee52014-02-12 14:57:39 -080024 /*
25 * register all the intents as one batch
26 */
27 void registerIntent(Collection<Intent> intents);
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070028 /**
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070029 * Register Flow Event Handler Service for receiving Flow-related
Pavlin Radoslavov6b79f2b2013-10-26 21:31:10 -070030 * notifications.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070031 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070032 * NOTE: Only a single Flow Event Handler Service can be registered.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070033 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070034 * @param flowEventHandlerService the Flow Event Handler Service to register.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070035 */
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070036 void registerFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService);
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070037
38 /**
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070039 * De-register Flow Event Handler Service for receiving Flow-related
Pavlin Radoslavov6b79f2b2013-10-26 21:31:10 -070040 * notifications.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070041 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070042 * NOTE: Only a single Flow Event Handler Service can be registered.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070043 *
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070044 * @param flowEventHandlerService the Flow Event Handler Service to
Pavlin Radoslavov6b79f2b2013-10-26 21:31:10 -070045 * de-register.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070046 */
Pavlin Radoslavov9a859022013-10-30 10:08:24 -070047 void deregisterFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService);
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070048
49 /**
Jonathan Hartc6325622014-01-14 16:37:50 -080050 * Register event handler for packet-out events.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080051 *
Jonathan Hartc6325622014-01-14 16:37:50 -080052 * @param packetOutEventHandler The packet-out event handler to register.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080053 */
Jonathan Hartc6325622014-01-14 16:37:50 -080054 public void registerPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler);
Jonathan Hart18ad55c2013-11-11 22:49:55 -080055
56 /**
Jonathan Hartc6325622014-01-14 16:37:50 -080057 * Deregister event handler service for packet-out events.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080058 *
Jonathan Hartc6325622014-01-14 16:37:50 -080059 * @param packetOutEventHandler The packet-out event handler to deregister.
Jonathan Hart18ad55c2013-11-11 22:49:55 -080060 */
Jonathan Hartc6325622014-01-14 16:37:50 -080061 public void deregisterPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler);
Jonathan Hart7804bea2014-01-07 10:50:52 -080062
Jonathan Hartc6325622014-01-14 16:37:50 -080063 /**
64 * Register event handler for ARP reply events.
65 *
66 * @param packetOutEventHandler The ARP reply event handler to register.
67 */
Jonathan Hart7804bea2014-01-07 10:50:52 -080068 public void registerArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler);
69
Jonathan Hartc6325622014-01-14 16:37:50 -080070 /**
71 * Deregister event handler service for ARP reply events.
72 *
73 * @param packetOutEventHandler The ARP reply event handler to deregister.
74 */
Jonathan Hart7804bea2014-01-07 10:50:52 -080075 public void deregisterArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler);
Pavlin Radoslavov379c9042013-11-26 15:40:49 -080076
Jonathan Hart18ad55c2013-11-11 22:49:55 -080077 /**
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070078 * Get all Flows that are currently in the datagrid.
79 *
80 * @return all Flows that are currently in the datagrid.
81 */
82 Collection<FlowPath> getAllFlows();
83
84 /**
Pavlin Radoslavov379c9042013-11-26 15:40:49 -080085 * Get a Flow for a given Flow ID.
86 *
87 * @param flowId the Flow ID of the Flow to get.
88 * @return the Flow if found, otherwise null.
89 */
90 FlowPath getFlow(FlowId flowId);
91
92 /**
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070093 * Send a notification that a Flow is added.
94 *
Pavlin Radoslavovb7506842013-10-29 17:46:54 -070095 * @param flowPath the Flow that is added.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -070096 */
97 void notificationSendFlowAdded(FlowPath flowPath);
98
99 /**
100 * Send a notification that a Flow is removed.
101 *
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700102 * @param flowId the Flow ID of the Flow that is removed.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700103 */
104 void notificationSendFlowRemoved(FlowId flowId);
105
106 /**
107 * Send a notification that a Flow is updated.
108 *
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700109 * @param flowPath the Flow that is updated.
Pavlin Radoslavov1308dc62013-10-25 15:54:31 -0700110 */
111 void notificationSendFlowUpdated(FlowPath flowPath);
112
113 /**
114 * Send a notification that all Flows are removed.
115 */
116 void notificationSendAllFlowsRemoved();
Pavlin Radoslavovaaace7f2013-10-25 19:42:00 -0700117
118 /**
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700119 * Get all Flow Entries that are currently in the datagrid.
120 *
121 * @return all Flow Entries that are currently in the datagrid.
122 */
123 Collection<FlowEntry> getAllFlowEntries();
124
125 /**
Pavlin Radoslavov379c9042013-11-26 15:40:49 -0800126 * Get a Flow Entry for a given Flow Entry ID.
127 *
128 * @param flowEntryId the Flow Entry ID of the Flow Entry to get.
129 * @return the Flow Entry if found, otherwise null.
130 */
131 FlowEntry getFlowEntry(FlowEntryId flowEntryId);
132
133 /**
Pavlin Radoslavovb7506842013-10-29 17:46:54 -0700134 * Send a notification that a FlowEntry is added.
135 *
136 * @param flowEntry the FlowEntry that is added.
137 */
138 void notificationSendFlowEntryAdded(FlowEntry flowEntry);
139
140 /**
141 * Send a notification that a FlowEntry is removed.
142 *
143 * @param flowEntryId the FlowEntry ID of the FlowEntry that is removed.
144 */
145 void notificationSendFlowEntryRemoved(FlowEntryId flowEntryId);
146
147 /**
148 * Send a notification that a FlowEntry is updated.
149 *
150 * @param flowEntry the FlowEntry that is updated.
151 */
152 void notificationSendFlowEntryUpdated(FlowEntry flowEntry);
153
154 /**
155 * Send a notification that all Flow Entries are removed.
156 */
157 void notificationSendAllFlowEntriesRemoved();
158
159 /**
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800160 * Get all Flow IDs that are currently in the datagrid.
161 *
Pavlin Radoslavova9c0c3b2014-01-09 10:54:45 -0800162 * @return all Flow IDs that ae currently in the datagrid.
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800163 */
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800164 Collection<Pair<FlowId, Dpid>> getAllFlowIds();
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800165
166 /**
167 * Send a notification that a FlowId is added.
168 *
169 * @param flowId the FlowId that is added.
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800170 * @param dpid the Source Switch Dpid.
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800171 */
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800172 void notificationSendFlowIdAdded(FlowId flowId, Dpid dpid);
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800173
174 /**
175 * Send a notification that a FlowId is removed.
176 *
177 * @param flowId the FlowId that is removed.
178 */
179 void notificationSendFlowIdRemoved(FlowId flowId);
180
181 /**
182 * Send a notification that a FlowId is updated.
183 *
184 * @param flowId the FlowId that is updated.
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800185 * @param dpid the Source Switch Dpid.
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800186 */
Pavlin Radoslavov2194d112014-01-10 13:36:00 -0800187 void notificationSendFlowIdUpdated(FlowId flowId, Dpid dpid);
Pavlin Radoslavov2004fa02014-01-07 14:46:42 -0800188
189 /**
190 * Send a notification that all Flow IDs are removed.
191 */
192 void notificationSendAllFlowIdsRemoved();
193
194 /**
Pavlin Radoslavova9c0c3b2014-01-09 10:54:45 -0800195 * Get all Flow Entry IDs that are currently in the datagrid.
196 *
197 * @return all Flow Entry IDs that ae currently in the datagrid.
198 */
199 Collection<Pair<FlowEntryId, Dpid>> getAllFlowEntryIds();
200
201 /**
Pavlin Radoslavov909da3c2014-01-09 04:04:33 -0800202 * Send a notification that a FlowEntryId is added.
203 *
204 * @param flowEntryId the FlowEntryId that is added.
205 * @param dpid the Switch Dpid.
206 */
207 void notificationSendFlowEntryIdAdded(FlowEntryId flowEntryId, Dpid dpid);
208
209 /**
210 * Send a notification that a FlowEntryId is removed.
211 *
212 * @param flowEntryId the FlowEntryId that is removed.
213 */
214 void notificationSendFlowEntryIdRemoved(FlowEntryId flowEntryId);
215
216 /**
217 * Send a notification that a FlowEntryId is updated.
218 *
219 * @param flowEntryId the FlowEntryId that is updated.
220 * @param dpid the Switch Dpid.
221 */
222 void notificationSendFlowEntryIdUpdated(FlowEntryId flowEntryId,
223 Dpid dpid);
224
225 /**
226 * Send a notification that all Flow Entry IDs are removed.
227 */
228 void notificationSendAllFlowEntryIdsRemoved();
229
230 /**
Pavlin Radoslavovaaace7f2013-10-25 19:42:00 -0700231 * Get all Topology Elements that are currently in the datagrid.
232 *
233 * @return all Topology Elements that are currently in the datagrid.
234 */
235 Collection<TopologyElement> getAllTopologyElements();
236
237 /**
238 * Send a notification that a Topology Element is added.
239 *
240 * @param topologyElement the Topology Element that is added.
241 */
242 void notificationSendTopologyElementAdded(TopologyElement topologyElement);
243
244 /**
245 * Send a notification that a Topology Element is removed.
246 *
247 * @param topologyElement the Topology Element that is removed.
248 */
249 void notificationSendTopologyElementRemoved(TopologyElement topologyElement);
250
251 /**
252 * Send a notification that a Topology Element is updated.
253 *
254 * @param topologyElement the Topology Element that is updated.
255 */
256 void notificationSendTopologyElementUpdated(TopologyElement topologyElement);
257
258 /**
259 * Send a notification that all Topology Elements are removed.
260 */
261 void notificationSendAllTopologyElementsRemoved();
Jonathan Hart18ad55c2013-11-11 22:49:55 -0800262
263 /**
Jonathan Hart7804bea2014-01-07 10:50:52 -0800264 * Send a packet-out notification to other ONOS instances. This informs
265 * other instances that they should send this packet out some of the ports
266 * they control. Not all notifications are applicable to all instances
267 * (i.e. some notifications specify a single port to send the packet out),
268 * so each instance must determine whether it needs to take action when it
269 * receives the notification.
270 *
271 * @param packetOutNotification The packet notification to send
Jonathan Hart18ad55c2013-11-11 22:49:55 -0800272 */
Jonathan Hart7804bea2014-01-07 10:50:52 -0800273 public void sendPacketOutNotification(PacketOutNotification packetOutNotification);
274
275 /**
276 * Send notification to other ONOS instances that an ARP reply has been
277 * received.
278 * @param arpReply The notification of the ARP reply
279 */
280 public void sendArpReplyNotification(ArpReplyNotification arpReply);
Pavlin Radoslavov1eee2c82013-10-15 02:30:32 -0700281}