From 20c0ececebb4e62f1b00f456de2d92d6a38dbbe3 Mon Sep 17 00:00:00 2001 From: Santiago Rodriguez Date: Sun, 14 Jun 2020 16:13:22 +0100 Subject: [PATCH] doc: Consider null buffer_id in first example If the switch does not buffer the packet (like when using mininet), the example does not work. For such cases, include the packet contents in OFPPacketOut --- doc/source/writing_ryu_app.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/source/writing_ryu_app.rst b/doc/source/writing_ryu_app.rst index a4d1830a..c2f71526 100644 --- a/doc/source/writing_ryu_app.rst +++ b/doc/source/writing_ryu_app.rst @@ -67,11 +67,16 @@ the ports. dp = msg.datapath ofp = dp.ofproto ofp_parser = dp.ofproto_parser - + actions = [ofp_parser.OFPActionOutput(ofp.OFPP_FLOOD)] + + data = None + if msg.buffer_id == ofp.OFP_NO_BUFFER + data = msg.data + out = ofp_parser.OFPPacketOut( datapath=dp, buffer_id=msg.buffer_id, in_port=msg.in_port, - actions=actions) + actions=actions, data = data) dp.send_msg(out)