Pavlin Radoslavov | 1eee2c8 | 2013-10-15 02:30:32 -0700 | [diff] [blame] | 1 | package net.onrc.onos.datagrid; |
| 2 | |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 3 | import java.util.Collection; |
| 4 | |
Pavlin Radoslavov | 1eee2c8 | 2013-10-15 02:30:32 -0700 | [diff] [blame] | 5 | import net.floodlightcontroller.core.module.IFloodlightService; |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 6 | import net.onrc.onos.ofcontroller.flowmanager.IFlowEventHandlerService; |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 7 | import net.onrc.onos.ofcontroller.proxyarp.ArpReplyNotification; |
| 8 | import net.onrc.onos.ofcontroller.proxyarp.IArpReplyEventHandler; |
| 9 | import net.onrc.onos.ofcontroller.proxyarp.IPacketOutEventHandler; |
| 10 | import net.onrc.onos.ofcontroller.proxyarp.PacketOutNotification; |
Pavlin Radoslavov | aaace7f | 2013-10-25 19:42:00 -0700 | [diff] [blame] | 11 | import net.onrc.onos.ofcontroller.topology.TopologyElement; |
Pavlin Radoslavov | 909da3c | 2014-01-09 04:04:33 -0800 | [diff] [blame] | 12 | import net.onrc.onos.ofcontroller.util.Dpid; |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 13 | import net.onrc.onos.ofcontroller.util.FlowEntry; |
| 14 | import net.onrc.onos.ofcontroller.util.FlowEntryId; |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 15 | import net.onrc.onos.ofcontroller.util.FlowId; |
| 16 | import net.onrc.onos.ofcontroller.util.FlowPath; |
Pavlin Radoslavov | a9c0c3b | 2014-01-09 10:54:45 -0800 | [diff] [blame] | 17 | import net.onrc.onos.ofcontroller.util.Pair; |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 18 | |
Pavlin Radoslavov | 1eee2c8 | 2013-10-15 02:30:32 -0700 | [diff] [blame] | 19 | /** |
| 20 | * Interface for providing Datagrid Service to other modules. |
| 21 | */ |
| 22 | public interface IDatagridService extends IFloodlightService { |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 23 | /** |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 24 | * Register Flow Event Handler Service for receiving Flow-related |
Pavlin Radoslavov | 6b79f2b | 2013-10-26 21:31:10 -0700 | [diff] [blame] | 25 | * notifications. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 26 | * |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 27 | * NOTE: Only a single Flow Event Handler Service can be registered. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 28 | * |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 29 | * @param flowEventHandlerService the Flow Event Handler Service to register. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 30 | */ |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 31 | void registerFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService); |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 34 | * De-register Flow Event Handler Service for receiving Flow-related |
Pavlin Radoslavov | 6b79f2b | 2013-10-26 21:31:10 -0700 | [diff] [blame] | 35 | * notifications. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 36 | * |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 37 | * NOTE: Only a single Flow Event Handler Service can be registered. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 38 | * |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 39 | * @param flowEventHandlerService the Flow Event Handler Service to |
Pavlin Radoslavov | 6b79f2b | 2013-10-26 21:31:10 -0700 | [diff] [blame] | 40 | * de-register. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 41 | */ |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 42 | void deregisterFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService); |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 45 | * Register event handler for packet-out events. |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 46 | * |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 47 | * @param packetOutEventHandler The packet-out event handler to register. |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 48 | */ |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 49 | public void registerPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler); |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 50 | |
| 51 | /** |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 52 | * Deregister event handler service for packet-out events. |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 53 | * |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 54 | * @param packetOutEventHandler The packet-out event handler to deregister. |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 55 | */ |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 56 | public void deregisterPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler); |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 57 | |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 58 | /** |
| 59 | * Register event handler for ARP reply events. |
| 60 | * |
| 61 | * @param packetOutEventHandler The ARP reply event handler to register. |
| 62 | */ |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 63 | public void registerArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler); |
| 64 | |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 65 | /** |
| 66 | * Deregister event handler service for ARP reply events. |
| 67 | * |
| 68 | * @param packetOutEventHandler The ARP reply event handler to deregister. |
| 69 | */ |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 70 | public void deregisterArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler); |
Pavlin Radoslavov | 379c904 | 2013-11-26 15:40:49 -0800 | [diff] [blame] | 71 | |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 72 | /** |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 73 | * Get all Flows that are currently in the datagrid. |
| 74 | * |
| 75 | * @return all Flows that are currently in the datagrid. |
| 76 | */ |
| 77 | Collection<FlowPath> getAllFlows(); |
| 78 | |
| 79 | /** |
Pavlin Radoslavov | 379c904 | 2013-11-26 15:40:49 -0800 | [diff] [blame] | 80 | * Get a Flow for a given Flow ID. |
| 81 | * |
| 82 | * @param flowId the Flow ID of the Flow to get. |
| 83 | * @return the Flow if found, otherwise null. |
| 84 | */ |
| 85 | FlowPath getFlow(FlowId flowId); |
| 86 | |
| 87 | /** |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 88 | * Send a notification that a Flow is added. |
| 89 | * |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 90 | * @param flowPath the Flow that is added. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 91 | */ |
| 92 | void notificationSendFlowAdded(FlowPath flowPath); |
| 93 | |
| 94 | /** |
| 95 | * Send a notification that a Flow is removed. |
| 96 | * |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 97 | * @param flowId the Flow ID of the Flow that is removed. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 98 | */ |
| 99 | void notificationSendFlowRemoved(FlowId flowId); |
| 100 | |
| 101 | /** |
| 102 | * Send a notification that a Flow is updated. |
| 103 | * |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 104 | * @param flowPath the Flow that is updated. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 105 | */ |
| 106 | void notificationSendFlowUpdated(FlowPath flowPath); |
| 107 | |
| 108 | /** |
| 109 | * Send a notification that all Flows are removed. |
| 110 | */ |
| 111 | void notificationSendAllFlowsRemoved(); |
Pavlin Radoslavov | aaace7f | 2013-10-25 19:42:00 -0700 | [diff] [blame] | 112 | |
| 113 | /** |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 114 | * Get all Flow Entries that are currently in the datagrid. |
| 115 | * |
| 116 | * @return all Flow Entries that are currently in the datagrid. |
| 117 | */ |
| 118 | Collection<FlowEntry> getAllFlowEntries(); |
| 119 | |
| 120 | /** |
Pavlin Radoslavov | 379c904 | 2013-11-26 15:40:49 -0800 | [diff] [blame] | 121 | * Get a Flow Entry for a given Flow Entry ID. |
| 122 | * |
| 123 | * @param flowEntryId the Flow Entry ID of the Flow Entry to get. |
| 124 | * @return the Flow Entry if found, otherwise null. |
| 125 | */ |
| 126 | FlowEntry getFlowEntry(FlowEntryId flowEntryId); |
| 127 | |
| 128 | /** |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 129 | * Send a notification that a FlowEntry is added. |
| 130 | * |
| 131 | * @param flowEntry the FlowEntry that is added. |
| 132 | */ |
| 133 | void notificationSendFlowEntryAdded(FlowEntry flowEntry); |
| 134 | |
| 135 | /** |
| 136 | * Send a notification that a FlowEntry is removed. |
| 137 | * |
| 138 | * @param flowEntryId the FlowEntry ID of the FlowEntry that is removed. |
| 139 | */ |
| 140 | void notificationSendFlowEntryRemoved(FlowEntryId flowEntryId); |
| 141 | |
| 142 | /** |
| 143 | * Send a notification that a FlowEntry is updated. |
| 144 | * |
| 145 | * @param flowEntry the FlowEntry that is updated. |
| 146 | */ |
| 147 | void notificationSendFlowEntryUpdated(FlowEntry flowEntry); |
| 148 | |
| 149 | /** |
| 150 | * Send a notification that all Flow Entries are removed. |
| 151 | */ |
| 152 | void notificationSendAllFlowEntriesRemoved(); |
| 153 | |
| 154 | /** |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 155 | * Get all Flow IDs that are currently in the datagrid. |
| 156 | * |
Pavlin Radoslavov | a9c0c3b | 2014-01-09 10:54:45 -0800 | [diff] [blame] | 157 | * @return all Flow IDs that ae currently in the datagrid. |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 158 | */ |
Pavlin Radoslavov | 2194d11 | 2014-01-10 13:36:00 -0800 | [diff] [blame] | 159 | Collection<Pair<FlowId, Dpid>> getAllFlowIds(); |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 160 | |
| 161 | /** |
| 162 | * Send a notification that a FlowId is added. |
| 163 | * |
| 164 | * @param flowId the FlowId that is added. |
Pavlin Radoslavov | 2194d11 | 2014-01-10 13:36:00 -0800 | [diff] [blame] | 165 | * @param dpid the Source Switch Dpid. |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 166 | */ |
Pavlin Radoslavov | 2194d11 | 2014-01-10 13:36:00 -0800 | [diff] [blame] | 167 | void notificationSendFlowIdAdded(FlowId flowId, Dpid dpid); |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 168 | |
| 169 | /** |
| 170 | * Send a notification that a FlowId is removed. |
| 171 | * |
| 172 | * @param flowId the FlowId that is removed. |
| 173 | */ |
| 174 | void notificationSendFlowIdRemoved(FlowId flowId); |
| 175 | |
| 176 | /** |
| 177 | * Send a notification that a FlowId is updated. |
| 178 | * |
| 179 | * @param flowId the FlowId that is updated. |
Pavlin Radoslavov | 2194d11 | 2014-01-10 13:36:00 -0800 | [diff] [blame] | 180 | * @param dpid the Source Switch Dpid. |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 181 | */ |
Pavlin Radoslavov | 2194d11 | 2014-01-10 13:36:00 -0800 | [diff] [blame] | 182 | void notificationSendFlowIdUpdated(FlowId flowId, Dpid dpid); |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 183 | |
| 184 | /** |
| 185 | * Send a notification that all Flow IDs are removed. |
| 186 | */ |
| 187 | void notificationSendAllFlowIdsRemoved(); |
| 188 | |
| 189 | /** |
Pavlin Radoslavov | a9c0c3b | 2014-01-09 10:54:45 -0800 | [diff] [blame] | 190 | * Get all Flow Entry IDs that are currently in the datagrid. |
| 191 | * |
| 192 | * @return all Flow Entry IDs that ae currently in the datagrid. |
| 193 | */ |
| 194 | Collection<Pair<FlowEntryId, Dpid>> getAllFlowEntryIds(); |
| 195 | |
| 196 | /** |
Pavlin Radoslavov | 909da3c | 2014-01-09 04:04:33 -0800 | [diff] [blame] | 197 | * Send a notification that a FlowEntryId is added. |
| 198 | * |
| 199 | * @param flowEntryId the FlowEntryId that is added. |
| 200 | * @param dpid the Switch Dpid. |
| 201 | */ |
| 202 | void notificationSendFlowEntryIdAdded(FlowEntryId flowEntryId, Dpid dpid); |
| 203 | |
| 204 | /** |
| 205 | * Send a notification that a FlowEntryId is removed. |
| 206 | * |
| 207 | * @param flowEntryId the FlowEntryId that is removed. |
| 208 | */ |
| 209 | void notificationSendFlowEntryIdRemoved(FlowEntryId flowEntryId); |
| 210 | |
| 211 | /** |
| 212 | * Send a notification that a FlowEntryId is updated. |
| 213 | * |
| 214 | * @param flowEntryId the FlowEntryId that is updated. |
| 215 | * @param dpid the Switch Dpid. |
| 216 | */ |
| 217 | void notificationSendFlowEntryIdUpdated(FlowEntryId flowEntryId, |
| 218 | Dpid dpid); |
| 219 | |
| 220 | /** |
| 221 | * Send a notification that all Flow Entry IDs are removed. |
| 222 | */ |
| 223 | void notificationSendAllFlowEntryIdsRemoved(); |
| 224 | |
| 225 | /** |
Pavlin Radoslavov | aaace7f | 2013-10-25 19:42:00 -0700 | [diff] [blame] | 226 | * Get all Topology Elements that are currently in the datagrid. |
| 227 | * |
| 228 | * @return all Topology Elements that are currently in the datagrid. |
| 229 | */ |
| 230 | Collection<TopologyElement> getAllTopologyElements(); |
| 231 | |
| 232 | /** |
| 233 | * Send a notification that a Topology Element is added. |
| 234 | * |
| 235 | * @param topologyElement the Topology Element that is added. |
| 236 | */ |
| 237 | void notificationSendTopologyElementAdded(TopologyElement topologyElement); |
| 238 | |
| 239 | /** |
| 240 | * Send a notification that a Topology Element is removed. |
| 241 | * |
| 242 | * @param topologyElement the Topology Element that is removed. |
| 243 | */ |
| 244 | void notificationSendTopologyElementRemoved(TopologyElement topologyElement); |
| 245 | |
| 246 | /** |
| 247 | * Send a notification that a Topology Element is updated. |
| 248 | * |
| 249 | * @param topologyElement the Topology Element that is updated. |
| 250 | */ |
| 251 | void notificationSendTopologyElementUpdated(TopologyElement topologyElement); |
| 252 | |
| 253 | /** |
| 254 | * Send a notification that all Topology Elements are removed. |
| 255 | */ |
| 256 | void notificationSendAllTopologyElementsRemoved(); |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 257 | |
| 258 | /** |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 259 | * Send a packet-out notification to other ONOS instances. This informs |
| 260 | * other instances that they should send this packet out some of the ports |
| 261 | * they control. Not all notifications are applicable to all instances |
| 262 | * (i.e. some notifications specify a single port to send the packet out), |
| 263 | * so each instance must determine whether it needs to take action when it |
| 264 | * receives the notification. |
| 265 | * |
| 266 | * @param packetOutNotification The packet notification to send |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 267 | */ |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 268 | public void sendPacketOutNotification(PacketOutNotification packetOutNotification); |
| 269 | |
| 270 | /** |
| 271 | * Send notification to other ONOS instances that an ARP reply has been |
| 272 | * received. |
| 273 | * @param arpReply The notification of the ARP reply |
| 274 | */ |
| 275 | public void sendArpReplyNotification(ArpReplyNotification arpReply); |
Pavlin Radoslavov | 1eee2c8 | 2013-10-15 02:30:32 -0700 | [diff] [blame] | 276 | } |