blob: 20a6249b1cde5c3ba624641e1e936dc6259717eb [file] [log] [blame]
Naoki Shiotaaea88582013-11-12 17:58:34 -08001package net.onrc.onos.ofcontroller.flowprogrammer;
Naoki Shiota8ee48d52013-11-11 15:51:17 -08002
Naoki Shiotac1601d32013-11-20 10:47:34 -08003import org.openflow.protocol.OFBarrierReply;
4import org.openflow.protocol.OFMessage;
5
Naoki Shiota8ee48d52013-11-11 15:51:17 -08006import net.floodlightcontroller.core.IOFSwitch;
Naoki Shiotac1601d32013-11-20 10:47:34 -08007import net.floodlightcontroller.core.internal.OFMessageFuture;
Naoki Shiota8ee48d52013-11-11 15:51:17 -08008import net.floodlightcontroller.core.module.IFloodlightService;
Brian O'Connor8c166a72013-11-14 18:41:48 -08009import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
10import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
11import net.onrc.onos.ofcontroller.util.FlowEntry;
12import net.onrc.onos.ofcontroller.util.FlowPath;
Naoki Shiota8ee48d52013-11-11 15:51:17 -080013
Naoki Shiotab485d412013-11-26 12:04:19 -080014/**
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 Shiota8ee48d52013-11-11 15:51:17 -080023public interface IFlowPusherService extends IFloodlightService {
24 /**
Naoki Shiotae3199732013-11-25 16:14:43 -080025 * 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 Shiotab485d412013-11-26 12:04:19 -080043 * @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 Shiotae3199732013-11-25 16:14:43 -080048 */
Naoki Shiotab485d412013-11-26 12:04:19 -080049 boolean deleteQueue(IOFSwitch sw, boolean forceStop);
Naoki Shiotae3199732013-11-25 16:14:43 -080050
51 /**
Naoki Shiotac1601d32013-11-20 10:47:34 -080052 * 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 Shiota8ee48d52013-11-11 15:51:17 -080056 */
Brian O'Connor8c166a72013-11-14 18:41:48 -080057 boolean add(IOFSwitch sw, OFMessage msg);
Naoki Shiotac1601d32013-11-20 10:47:34 -080058
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'Connor8c166a72013-11-14 18:41:48 -080066 boolean add(IOFSwitch sw, FlowPath flowPath, FlowEntry flowEntry);
Naoki Shiotac1601d32013-11-20 10:47:34 -080067
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'Connor8c166a72013-11-14 18:41:48 -080075 boolean add(IOFSwitch sw, IFlowPath flowObj, IFlowEntry flowEntryObj);
Naoki Shiotac1601d32013-11-20 10:47:34 -080076
77 /**
Naoki Shiotae3199732013-11-25 16:14:43 -080078 * 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 Shiotac1601d32013-11-20 10:47:34 -080085 * 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 Shiota8ee48d52013-11-11 15:51:17 -080097
98 /**
99 * Suspend pushing message to a switch.
Naoki Shiotac1601d32013-11-20 10:47:34 -0800100 * @param sw Switch to be suspended pushing message.
Naoki Shiota8ee48d52013-11-11 15:51:17 -0800101 * @return true if success
102 */
Brian O'Connor8c166a72013-11-14 18:41:48 -0800103 boolean suspend(IOFSwitch sw);
Naoki Shiota8ee48d52013-11-11 15:51:17 -0800104
105 /**
106 * Resume pushing message to a switch.
Naoki Shiotac1601d32013-11-20 10:47:34 -0800107 * @param sw Switch to be resumed pushing message.
Naoki Shiota8ee48d52013-11-11 15:51:17 -0800108 * @return true if success
109 */
Brian O'Connor8c166a72013-11-14 18:41:48 -0800110 boolean resume(IOFSwitch sw);
Naoki Shiota8ee48d52013-11-11 15:51:17 -0800111
112 /**
113 * Get whether pushing of message is suspended or not.
Naoki Shiotac1601d32013-11-20 10:47:34 -0800114 * @param sw Switch to be checked.
115 * @return true if suspended.
Naoki Shiota8ee48d52013-11-11 15:51:17 -0800116 */
Brian O'Connor8c166a72013-11-14 18:41:48 -0800117 boolean isSuspended(IOFSwitch sw);
Naoki Shiota8ee48d52013-11-11 15:51:17 -0800118}