Signed-off-by: Simon Horman <[email protected]>
---
ryu/ofproto/ofproto_v1_4_parser.py | 92 ++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py
b/ryu/ofproto/ofproto_v1_4_parser.py
index 6ccb25a..2bd2427 100644
--- a/ryu/ofproto/ofproto_v1_4_parser.py
+++ b/ryu/ofproto/ofproto_v1_4_parser.py
@@ -137,6 +137,98 @@ class OFPHelloElemVersionBitmap(StringifyMixin):
return elem
+@_register_parser
+@_set_msg_type(ofproto.OFPT_ECHO_REQUEST)
+class OFPEchoRequest(MsgBase):
+ """
+ Echo request message
+
+ This message is handled by the Ryu framework, so the Ryu application
+ do not need to process this typically.
+
+ ========== =========================================================
+ Attribute Description
+ ========== =========================================================
+ data An arbitrary length data
+ ========== =========================================================
+
+ Example::
+
+ def send_echo_request(self, datapath, data):
+ ofp = datapath.ofproto
+ ofp_parser = datapath.ofproto_parser
+
+ req = ofp_parser.OFPEchoRequest(datapath, data)
+ datapath.send_msg(req)
+
+ @set_ev_cls(ofp_event.EventOFPEchoRequest,
+ [HANDSHAKE_DISPATCHER, CONFIG_DISPATCHER, MAIN_DISPATCHER])
+ def echo_request_handler(self, ev):
+ self.logger.debug('OFPEchoRequest received: data=%s',
+ utils.hex_array(ev.msg.data))
+ """
+ def __init__(self, datapath, data=None):
+ super(OFPEchoRequest, self).__init__(datapath)
+ self.data = data
+
+ @classmethod
+ def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
+ msg = super(OFPEchoRequest, cls).parser(datapath, version, msg_type,
+ msg_len, xid, buf)
+ msg.data = msg.buf[ofproto.OFP_HEADER_SIZE:]
+ return msg
+
+ def _serialize_body(self):
+ if self.data is not None:
+ self.buf += self.data
+
+
+@_register_parser
+@_set_msg_type(ofproto.OFPT_ECHO_REPLY)
+class OFPEchoReply(MsgBase):
+ """
+ Echo reply message
+
+ This message is handled by the Ryu framework, so the Ryu application
+ do not need to process this typically.
+
+ ========== =========================================================
+ Attribute Description
+ ========== =========================================================
+ data An arbitrary length data
+ ========== =========================================================
+
+ Example::
+
+ def send_echo_reply(self, datapath, data):
+ ofp = datapath.ofproto
+ ofp_parser = datapath.ofproto_parser
+
+ reply = ofp_parser.OFPEchoReply(datapath, data)
+ datapath.send_msg(reply)
+
+ @set_ev_cls(ofp_event.EventOFPEchoReply,
+ [HANDSHAKE_DISPATCHER, CONFIG_DISPATCHER, MAIN_DISPATCHER])
+ def echo_reply_handler(self, ev):
+ self.logger.debug('OFPEchoReply received: data=%s',
+ utils.hex_array(ev.msg.data))
+ """
+ def __init__(self, datapath, data=None):
+ super(OFPEchoReply, self).__init__(datapath)
+ self.data = data
+
+ @classmethod
+ def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
+ msg = super(OFPEchoReply, cls).parser(datapath, version, msg_type,
+ msg_len, xid, buf)
+ msg.data = msg.buf[ofproto.OFP_HEADER_SIZE:]
+ return msg
+
+ def _serialize_body(self):
+ assert self.data is not None
+ self.buf += self.data
+
+
@_set_msg_type(ofproto.OFPT_FEATURES_REQUEST)
class OFPFeaturesRequest(MsgBase):
"""
--
1.8.5.2
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends. Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel