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
This commit is contained in:
Santiago Rodriguez 2020-06-14 16:13:22 +01:00
parent 861587c8ed
commit 20c0ececeb

View File

@ -67,11 +67,16 @@ the ports.
dp = msg.datapath dp = msg.datapath
ofp = dp.ofproto ofp = dp.ofproto
ofp_parser = dp.ofproto_parser ofp_parser = dp.ofproto_parser
actions = [ofp_parser.OFPActionOutput(ofp.OFPP_FLOOD)] actions = [ofp_parser.OFPActionOutput(ofp.OFPP_FLOOD)]
data = None
if msg.buffer_id == ofp.OFP_NO_BUFFER
data = msg.data
out = ofp_parser.OFPPacketOut( out = ofp_parser.OFPPacketOut(
datapath=dp, buffer_id=msg.buffer_id, in_port=msg.in_port, datapath=dp, buffer_id=msg.buffer_id, in_port=msg.in_port,
actions=actions) actions=actions, data = data)
dp.send_msg(out) dp.send_msg(out)