blob: 2f550a733f4ea8e0d8412a32bcff29492a01c6d1 [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.util.FlowEntry;
Naoki Shiota8ee48d52013-11-11 15:51:17 -080010
Naoki Shiotab485d412013-11-26 12:04:19 -080011/**
12 * FlowPusherService is a service to send message to switches in proper rate.
13 * Conceptually a queue is attached to each switch, and FlowPusherService
14 * read a message from queue and send it to switch in order.
15 * To guarantee message has been installed, FlowPusherService can add barrier
16 * message to queue and can notify when barrier message is sent to switch.
17 * @author Naoki Shiota
18 *
19 */
Naoki Shiota8ee48d52013-11-11 15:51:17 -080020public interface IFlowPusherService extends IFloodlightService {
21 /**
Naoki Shiotae3199732013-11-25 16:14:43 -080022 * Create a queue correspondent to the switch.
23 * @param sw Switch to which new queue is attached.
24 * @return true if new queue is successfully created.
25 */
26 boolean createQueue(IOFSwitch sw);
27
28 /**
29 * Delete a queue correspondent to the switch.
30 * Messages remains in queue will be all sent before queue is deleted.
31 * @param sw Switch of which queue is deleted.
32 * @return true if queue is successfully deleted.
33 */
34 boolean deleteQueue(IOFSwitch sw);
35
36 /**
37 * Delete a queue correspondent to the switch.
38 * By setting force flag on, queue will be deleted immediately.
39 * @param sw Switch of which queue is deleted.
Naoki Shiotab485d412013-11-26 12:04:19 -080040 * @param forceStop If this flag is set to true, queue will be deleted
41 * immediately regardless of any messages in the queue.
42 * If false, all messages will be sent to switch and queue will
43 * be deleted after that.
44 * @return true if queue is successfully deleted or flagged to be deleted.
Naoki Shiotae3199732013-11-25 16:14:43 -080045 */
Naoki Shiotab485d412013-11-26 12:04:19 -080046 boolean deleteQueue(IOFSwitch sw, boolean forceStop);
Naoki Shiotae3199732013-11-25 16:14:43 -080047
48 /**
Naoki Shiotac1601d32013-11-20 10:47:34 -080049 * Add a message to the queue of the switch.
50 * @param sw Switch to which message is pushed.
51 * @param msg Message object to be added.
52 * @return true if message is successfully added to a queue.
Naoki Shiota8ee48d52013-11-11 15:51:17 -080053 */
Brian O'Connor8c166a72013-11-14 18:41:48 -080054 boolean add(IOFSwitch sw, OFMessage msg);
Naoki Shiotac1601d32013-11-20 10:47:34 -080055
56 /**
57 * Create a message from FlowEntry and add it to the queue of the switch.
58 * @param sw Switch to which message is pushed.
Naoki Shiotac1601d32013-11-20 10:47:34 -080059 * @param flowEntry FlowEntry object used for creating message.
60 * @return true if message is successfully added to a queue.
61 */
Pavlin Radoslavov6bfaea62013-12-03 14:55:57 -080062 boolean add(IOFSwitch sw, FlowEntry flowEntry);
Naoki Shiotac1601d32013-11-20 10:47:34 -080063
64 /**
Naoki Shiotae3199732013-11-25 16:14:43 -080065 * Set sending rate to a switch.
66 * @param sw Switch.
67 * @param rate Rate in bytes/ms.
68 */
69 public void setRate(IOFSwitch sw, long rate);
70
71 /**
Naoki Shiotac1601d32013-11-20 10:47:34 -080072 * Add BARRIER message to queue and wait for reply.
73 * @param sw Switch to which barrier message is pushed.
74 * @return BARRIER_REPLY message sent from switch.
75 */
76 OFBarrierReply barrier(IOFSwitch sw);
77
78 /**
79 * Add BARRIER message to queue asynchronously.
80 * @param sw Switch to which barrier message is pushed.
81 * @return Future object of BARRIER_REPLY message which will be sent from switch.
82 */
83 OFMessageFuture<OFBarrierReply> barrierAsync(IOFSwitch sw);
Naoki Shiota8ee48d52013-11-11 15:51:17 -080084
85 /**
86 * Suspend pushing message to a switch.
Naoki Shiotac1601d32013-11-20 10:47:34 -080087 * @param sw Switch to be suspended pushing message.
Naoki Shiota8ee48d52013-11-11 15:51:17 -080088 * @return true if success
89 */
Brian O'Connor8c166a72013-11-14 18:41:48 -080090 boolean suspend(IOFSwitch sw);
Naoki Shiota8ee48d52013-11-11 15:51:17 -080091
92 /**
93 * Resume pushing message to a switch.
Naoki Shiotac1601d32013-11-20 10:47:34 -080094 * @param sw Switch to be resumed pushing message.
Naoki Shiota8ee48d52013-11-11 15:51:17 -080095 * @return true if success
96 */
Brian O'Connor8c166a72013-11-14 18:41:48 -080097 boolean resume(IOFSwitch sw);
Naoki Shiota8ee48d52013-11-11 15:51:17 -080098
99 /**
100 * Get whether pushing of message is suspended or not.
Naoki Shiotac1601d32013-11-20 10:47:34 -0800101 * @param sw Switch to be checked.
102 * @return true if suspended.
Naoki Shiota8ee48d52013-11-11 15:51:17 -0800103 */
Brian O'Connor8c166a72013-11-14 18:41:48 -0800104 boolean isSuspended(IOFSwitch sw);
Naoki Shiota8ee48d52013-11-11 15:51:17 -0800105}