Naoki Shiota | aea8858 | 2013-11-12 17:58:34 -0800 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.flowprogrammer; |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 2 | |
Naoki Shiota | c1601d3 | 2013-11-20 10:47:34 -0800 | [diff] [blame] | 3 | import org.openflow.protocol.OFBarrierReply; |
| 4 | import org.openflow.protocol.OFMessage; |
| 5 | |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 6 | import net.floodlightcontroller.core.IOFSwitch; |
Naoki Shiota | c1601d3 | 2013-11-20 10:47:34 -0800 | [diff] [blame] | 7 | import net.floodlightcontroller.core.internal.OFMessageFuture; |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 8 | import net.floodlightcontroller.core.module.IFloodlightService; |
Brian O'Connor | 8c166a7 | 2013-11-14 18:41:48 -0800 | [diff] [blame] | 9 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry; |
| 10 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath; |
| 11 | import net.onrc.onos.ofcontroller.util.FlowEntry; |
| 12 | import net.onrc.onos.ofcontroller.util.FlowPath; |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 13 | |
Naoki Shiota | b485d41 | 2013-11-26 12:04:19 -0800 | [diff] [blame^] | 14 | /** |
| 15 | * FlowPusherService is a service to send message to switches in proper rate. |
| 16 | * Conceptually a queue is attached to each switch, and FlowPusherService |
| 17 | * read a message from queue and send it to switch in order. |
| 18 | * To guarantee message has been installed, FlowPusherService can add barrier |
| 19 | * message to queue and can notify when barrier message is sent to switch. |
| 20 | * @author Naoki Shiota |
| 21 | * |
| 22 | */ |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 23 | public interface IFlowPusherService extends IFloodlightService { |
| 24 | /** |
Naoki Shiota | e319973 | 2013-11-25 16:14:43 -0800 | [diff] [blame] | 25 | * Create a queue correspondent to the switch. |
| 26 | * @param sw Switch to which new queue is attached. |
| 27 | * @return true if new queue is successfully created. |
| 28 | */ |
| 29 | boolean createQueue(IOFSwitch sw); |
| 30 | |
| 31 | /** |
| 32 | * Delete a queue correspondent to the switch. |
| 33 | * Messages remains in queue will be all sent before queue is deleted. |
| 34 | * @param sw Switch of which queue is deleted. |
| 35 | * @return true if queue is successfully deleted. |
| 36 | */ |
| 37 | boolean deleteQueue(IOFSwitch sw); |
| 38 | |
| 39 | /** |
| 40 | * Delete a queue correspondent to the switch. |
| 41 | * By setting force flag on, queue will be deleted immediately. |
| 42 | * @param sw Switch of which queue is deleted. |
Naoki Shiota | b485d41 | 2013-11-26 12:04:19 -0800 | [diff] [blame^] | 43 | * @param forceStop If this flag is set to true, queue will be deleted |
| 44 | * immediately regardless of any messages in the queue. |
| 45 | * If false, all messages will be sent to switch and queue will |
| 46 | * be deleted after that. |
| 47 | * @return true if queue is successfully deleted or flagged to be deleted. |
Naoki Shiota | e319973 | 2013-11-25 16:14:43 -0800 | [diff] [blame] | 48 | */ |
Naoki Shiota | b485d41 | 2013-11-26 12:04:19 -0800 | [diff] [blame^] | 49 | boolean deleteQueue(IOFSwitch sw, boolean forceStop); |
Naoki Shiota | e319973 | 2013-11-25 16:14:43 -0800 | [diff] [blame] | 50 | |
| 51 | /** |
Naoki Shiota | c1601d3 | 2013-11-20 10:47:34 -0800 | [diff] [blame] | 52 | * Add a message to the queue of the switch. |
| 53 | * @param sw Switch to which message is pushed. |
| 54 | * @param msg Message object to be added. |
| 55 | * @return true if message is successfully added to a queue. |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 56 | */ |
Brian O'Connor | 8c166a7 | 2013-11-14 18:41:48 -0800 | [diff] [blame] | 57 | boolean add(IOFSwitch sw, OFMessage msg); |
Naoki Shiota | c1601d3 | 2013-11-20 10:47:34 -0800 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Create a message from FlowEntry and add it to the queue of the switch. |
| 61 | * @param sw Switch to which message is pushed. |
| 62 | * @param flowPath FlowPath object used for creating message. |
| 63 | * @param flowEntry FlowEntry object used for creating message. |
| 64 | * @return true if message is successfully added to a queue. |
| 65 | */ |
Brian O'Connor | 8c166a7 | 2013-11-14 18:41:48 -0800 | [diff] [blame] | 66 | boolean add(IOFSwitch sw, FlowPath flowPath, FlowEntry flowEntry); |
Naoki Shiota | c1601d3 | 2013-11-20 10:47:34 -0800 | [diff] [blame] | 67 | |
| 68 | /** |
| 69 | * Create a message from IFlowEntry and add it to the queue of the switch. |
| 70 | * @param sw Switch to which message is pushed. |
| 71 | * @param flowObj IFlowPath object used for creating message. |
| 72 | * @param flowEntryObj IFlowEntry object used for creating message. |
| 73 | * @return true if message is successfully added to a queue. |
| 74 | */ |
Brian O'Connor | 8c166a7 | 2013-11-14 18:41:48 -0800 | [diff] [blame] | 75 | boolean add(IOFSwitch sw, IFlowPath flowObj, IFlowEntry flowEntryObj); |
Naoki Shiota | c1601d3 | 2013-11-20 10:47:34 -0800 | [diff] [blame] | 76 | |
| 77 | /** |
Naoki Shiota | e319973 | 2013-11-25 16:14:43 -0800 | [diff] [blame] | 78 | * Set sending rate to a switch. |
| 79 | * @param sw Switch. |
| 80 | * @param rate Rate in bytes/ms. |
| 81 | */ |
| 82 | public void setRate(IOFSwitch sw, long rate); |
| 83 | |
| 84 | /** |
Naoki Shiota | c1601d3 | 2013-11-20 10:47:34 -0800 | [diff] [blame] | 85 | * Add BARRIER message to queue and wait for reply. |
| 86 | * @param sw Switch to which barrier message is pushed. |
| 87 | * @return BARRIER_REPLY message sent from switch. |
| 88 | */ |
| 89 | OFBarrierReply barrier(IOFSwitch sw); |
| 90 | |
| 91 | /** |
| 92 | * Add BARRIER message to queue asynchronously. |
| 93 | * @param sw Switch to which barrier message is pushed. |
| 94 | * @return Future object of BARRIER_REPLY message which will be sent from switch. |
| 95 | */ |
| 96 | OFMessageFuture<OFBarrierReply> barrierAsync(IOFSwitch sw); |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 97 | |
| 98 | /** |
| 99 | * Suspend pushing message to a switch. |
Naoki Shiota | c1601d3 | 2013-11-20 10:47:34 -0800 | [diff] [blame] | 100 | * @param sw Switch to be suspended pushing message. |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 101 | * @return true if success |
| 102 | */ |
Brian O'Connor | 8c166a7 | 2013-11-14 18:41:48 -0800 | [diff] [blame] | 103 | boolean suspend(IOFSwitch sw); |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 104 | |
| 105 | /** |
| 106 | * Resume pushing message to a switch. |
Naoki Shiota | c1601d3 | 2013-11-20 10:47:34 -0800 | [diff] [blame] | 107 | * @param sw Switch to be resumed pushing message. |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 108 | * @return true if success |
| 109 | */ |
Brian O'Connor | 8c166a7 | 2013-11-14 18:41:48 -0800 | [diff] [blame] | 110 | boolean resume(IOFSwitch sw); |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 111 | |
| 112 | /** |
| 113 | * Get whether pushing of message is suspended or not. |
Naoki Shiota | c1601d3 | 2013-11-20 10:47:34 -0800 | [diff] [blame] | 114 | * @param sw Switch to be checked. |
| 115 | * @return true if suspended. |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 116 | */ |
Brian O'Connor | 8c166a7 | 2013-11-14 18:41:48 -0800 | [diff] [blame] | 117 | boolean isSuspended(IOFSwitch sw); |
Naoki Shiota | 8ee48d5 | 2013-11-11 15:51:17 -0800 | [diff] [blame] | 118 | } |