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; |
Toshio Koide | 3738ee5 | 2014-02-12 14:57:39 -0800 | [diff] [blame^] | 6 | import net.onrc.onos.intent.Intent; |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 7 | import net.onrc.onos.ofcontroller.flowmanager.IFlowEventHandlerService; |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 8 | import net.onrc.onos.ofcontroller.proxyarp.ArpReplyNotification; |
| 9 | import net.onrc.onos.ofcontroller.proxyarp.IArpReplyEventHandler; |
| 10 | import net.onrc.onos.ofcontroller.proxyarp.IPacketOutEventHandler; |
| 11 | import net.onrc.onos.ofcontroller.proxyarp.PacketOutNotification; |
Pavlin Radoslavov | aaace7f | 2013-10-25 19:42:00 -0700 | [diff] [blame] | 12 | import net.onrc.onos.ofcontroller.topology.TopologyElement; |
Pavlin Radoslavov | 909da3c | 2014-01-09 04:04:33 -0800 | [diff] [blame] | 13 | import net.onrc.onos.ofcontroller.util.Dpid; |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 14 | import net.onrc.onos.ofcontroller.util.FlowEntry; |
| 15 | import net.onrc.onos.ofcontroller.util.FlowEntryId; |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 16 | import net.onrc.onos.ofcontroller.util.FlowId; |
| 17 | import net.onrc.onos.ofcontroller.util.FlowPath; |
Pavlin Radoslavov | a9c0c3b | 2014-01-09 10:54:45 -0800 | [diff] [blame] | 18 | import net.onrc.onos.ofcontroller.util.Pair; |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 19 | |
Pavlin Radoslavov | 1eee2c8 | 2013-10-15 02:30:32 -0700 | [diff] [blame] | 20 | /** |
| 21 | * Interface for providing Datagrid Service to other modules. |
| 22 | */ |
| 23 | public interface IDatagridService extends IFloodlightService { |
Toshio Koide | 3738ee5 | 2014-02-12 14:57:39 -0800 | [diff] [blame^] | 24 | /* |
| 25 | * register all the intents as one batch |
| 26 | */ |
| 27 | void registerIntent(Collection<Intent> intents); |
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 | * Register Flow Event Handler Service for receiving Flow-related |
Pavlin Radoslavov | 6b79f2b | 2013-10-26 21:31:10 -0700 | [diff] [blame] | 30 | * notifications. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 31 | * |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 32 | * NOTE: Only a single Flow Event Handler Service can be registered. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 33 | * |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 34 | * @param flowEventHandlerService the Flow Event Handler Service to register. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 35 | */ |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 36 | void registerFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService); |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 37 | |
| 38 | /** |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 39 | * De-register Flow Event Handler Service for receiving Flow-related |
Pavlin Radoslavov | 6b79f2b | 2013-10-26 21:31:10 -0700 | [diff] [blame] | 40 | * notifications. |
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 | * NOTE: Only a single Flow Event Handler Service can be registered. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 43 | * |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 44 | * @param flowEventHandlerService the Flow Event Handler Service to |
Pavlin Radoslavov | 6b79f2b | 2013-10-26 21:31:10 -0700 | [diff] [blame] | 45 | * de-register. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 46 | */ |
Pavlin Radoslavov | 9a85902 | 2013-10-30 10:08:24 -0700 | [diff] [blame] | 47 | void deregisterFlowEventHandlerService(IFlowEventHandlerService flowEventHandlerService); |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 48 | |
| 49 | /** |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 50 | * Register event handler for packet-out events. |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 51 | * |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 52 | * @param packetOutEventHandler The packet-out event handler to register. |
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 | public void registerPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler); |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 55 | |
| 56 | /** |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 57 | * Deregister event handler service for packet-out events. |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 58 | * |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 59 | * @param packetOutEventHandler The packet-out event handler to deregister. |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 60 | */ |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 61 | public void deregisterPacketOutEventHandler(IPacketOutEventHandler packetOutEventHandler); |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 62 | |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 63 | /** |
| 64 | * Register event handler for ARP reply events. |
| 65 | * |
| 66 | * @param packetOutEventHandler The ARP reply event handler to register. |
| 67 | */ |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 68 | public void registerArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler); |
| 69 | |
Jonathan Hart | c632562 | 2014-01-14 16:37:50 -0800 | [diff] [blame] | 70 | /** |
| 71 | * Deregister event handler service for ARP reply events. |
| 72 | * |
| 73 | * @param packetOutEventHandler The ARP reply event handler to deregister. |
| 74 | */ |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 75 | public void deregisterArpReplyEventHandler(IArpReplyEventHandler arpReplyEventHandler); |
Pavlin Radoslavov | 379c904 | 2013-11-26 15:40:49 -0800 | [diff] [blame] | 76 | |
Jonathan Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 77 | /** |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 78 | * 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 Radoslavov | 379c904 | 2013-11-26 15:40:49 -0800 | [diff] [blame] | 85 | * 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 Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 93 | * Send a notification that a Flow is added. |
| 94 | * |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 95 | * @param flowPath the Flow that is added. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 96 | */ |
| 97 | void notificationSendFlowAdded(FlowPath flowPath); |
| 98 | |
| 99 | /** |
| 100 | * Send a notification that a Flow is removed. |
| 101 | * |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 102 | * @param flowId the Flow ID of the Flow that is removed. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 103 | */ |
| 104 | void notificationSendFlowRemoved(FlowId flowId); |
| 105 | |
| 106 | /** |
| 107 | * Send a notification that a Flow is updated. |
| 108 | * |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 109 | * @param flowPath the Flow that is updated. |
Pavlin Radoslavov | 1308dc6 | 2013-10-25 15:54:31 -0700 | [diff] [blame] | 110 | */ |
| 111 | void notificationSendFlowUpdated(FlowPath flowPath); |
| 112 | |
| 113 | /** |
| 114 | * Send a notification that all Flows are removed. |
| 115 | */ |
| 116 | void notificationSendAllFlowsRemoved(); |
Pavlin Radoslavov | aaace7f | 2013-10-25 19:42:00 -0700 | [diff] [blame] | 117 | |
| 118 | /** |
Pavlin Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 119 | * 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 Radoslavov | 379c904 | 2013-11-26 15:40:49 -0800 | [diff] [blame] | 126 | * 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 Radoslavov | b750684 | 2013-10-29 17:46:54 -0700 | [diff] [blame] | 134 | * 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 Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 160 | * Get all Flow IDs that are currently in the datagrid. |
| 161 | * |
Pavlin Radoslavov | a9c0c3b | 2014-01-09 10:54:45 -0800 | [diff] [blame] | 162 | * @return all Flow IDs that ae currently in the datagrid. |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 163 | */ |
Pavlin Radoslavov | 2194d11 | 2014-01-10 13:36:00 -0800 | [diff] [blame] | 164 | Collection<Pair<FlowId, Dpid>> getAllFlowIds(); |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 165 | |
| 166 | /** |
| 167 | * Send a notification that a FlowId is added. |
| 168 | * |
| 169 | * @param flowId the FlowId that is added. |
Pavlin Radoslavov | 2194d11 | 2014-01-10 13:36:00 -0800 | [diff] [blame] | 170 | * @param dpid the Source Switch Dpid. |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 171 | */ |
Pavlin Radoslavov | 2194d11 | 2014-01-10 13:36:00 -0800 | [diff] [blame] | 172 | void notificationSendFlowIdAdded(FlowId flowId, Dpid dpid); |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 173 | |
| 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 Radoslavov | 2194d11 | 2014-01-10 13:36:00 -0800 | [diff] [blame] | 185 | * @param dpid the Source Switch Dpid. |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 186 | */ |
Pavlin Radoslavov | 2194d11 | 2014-01-10 13:36:00 -0800 | [diff] [blame] | 187 | void notificationSendFlowIdUpdated(FlowId flowId, Dpid dpid); |
Pavlin Radoslavov | 2004fa0 | 2014-01-07 14:46:42 -0800 | [diff] [blame] | 188 | |
| 189 | /** |
| 190 | * Send a notification that all Flow IDs are removed. |
| 191 | */ |
| 192 | void notificationSendAllFlowIdsRemoved(); |
| 193 | |
| 194 | /** |
Pavlin Radoslavov | a9c0c3b | 2014-01-09 10:54:45 -0800 | [diff] [blame] | 195 | * 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 Radoslavov | 909da3c | 2014-01-09 04:04:33 -0800 | [diff] [blame] | 202 | * 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 Radoslavov | aaace7f | 2013-10-25 19:42:00 -0700 | [diff] [blame] | 231 | * 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 Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 262 | |
| 263 | /** |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 264 | * 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 Hart | 18ad55c | 2013-11-11 22:49:55 -0800 | [diff] [blame] | 272 | */ |
Jonathan Hart | 7804bea | 2014-01-07 10:50:52 -0800 | [diff] [blame] | 273 | 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 Radoslavov | 1eee2c8 | 2013-10-15 02:30:32 -0700 | [diff] [blame] | 281 | } |