<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Another note is that I've updated l2_learning and I think it should now just work for you.<div><br></div><div>-- Murphy</div><div><br><div><div><div>On Oct 8, 2012, at 7:11 PM, Sam Russell wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Sounds good to me. I've just got back from leave so trying to catch up on work before jumping back into this, but I think that's right - I had to explain to a colleague that 4294967295 isn't a valid buffer ID - having the None value will make this much easier. I need to start playing with betta more - and adding your comments to my projects to make them utilise POX more appropriately<br>
<br><div class="gmail_quote">On Tue, Oct 9, 2012 at 3:09 PM, Murphy McCauley <span dir="ltr"><<a href="mailto:murphy.mccauley@gmail.com" target="_blank">murphy.mccauley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>Hey, Sam.</div><div><br></div>l2_learning hasn't been updated for this, but check out l2_pairs in the betta branch, which uses the fact that packet_out and flow_mod can now be passed a packet_in as "data", and they should both "do the right thing".<div>
<br></div><div>I think this addresses your problem. Feedback?</div><div><br></div><div>Also, note that in betta, buffer ID of -1 on the wire comes out as None in Python. I think this is more intuitive, and saying it was "-1" was always questionable anyway, since the buffer ID field is unsigned.</div>
<div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-- Murphy</div></font></span><div><div class="h5"><div><br><div><div>On Oct 8, 2012, at 6:59 PM, Sam Russell wrote:</div><br><blockquote type="cite">I've been working with a vendor implementation of OpenFlow that I can't give any detail about other than to say that they don't buffer packets coming in, and they set the buffer ID field to -1.<div>
<br></div><div>
The good news is that they seem to follow the spec correctly, ignore the miss_send_len field and send the whole packet to the controller, but they do seem to rely on packet_in messages to make sure the first packet in a flow gets delivered.<br>
<br>I've modified l2_learning.py to handle this, not sure if I'm supposed to add attachments here, but the main functions are below. This appears to work on the new implementation, and I think it would be a useful addition to POX as FloodLight apparently handles this out of the box ;)</div>
<div><br></div><div>Is this a good way to deal with it, or is there a better one (possibly already implemented in POX somewhere?)</div><div><br></div><div><div> def _handle_PacketIn (self, event):</div><div>[..]</div><div>
def flood ():</div><div><div> """ Floods the packet """</div><div> msg = of.ofp_packet_out()</div></div><div> if event.ofp.buffer_id == -1:</div><div> #log.warning("Not flooding unbuffered packet on %s",</div>
<div> # dpidToStr(event.dpid))</div><div> #return</div><div> </div><div> # Ideally we'll set a flow to flood AND send to controller</div><div> # for multicast packets, but for now we'll just make</div>
<div> # sure that they can get through</div><div> # If buffer ID == -1 then we have the whole packet</div><div> msg._set_data(packet)</div><div> </div><div> if time.time() - self.connection.connect_time > FLOOD_DELAY:</div>
<div> # Only flood if we've been connected for a little while...</div><div> #log.debug("%i: flood %s -> %s", event.dpid, packet.src, packet.dst)</div><div> msg.actions.append(of.ofp_action_output(port = of.OFPP_FLOOD))</div>
<div> else:</div><div> pass</div><div> #<a href="http://log.info/" target="_blank">log.info</a>("Holding down flood for %s", dpidToStr(event.dpid))</div><div> msg.buffer_id = event.ofp.buffer_id</div>
<div>
msg.in_port = event.port</div><div> self.connection.send(msg)</div></div><div>[..]</div><div><div> # 6</div><div> log.debug("installing flow for %s.%i -> %s.%i" %</div><div> (packet.src, event.port, packet.dst, port))</div>
<div> msg = of.ofp_flow_mod()</div><div> msg.match = of.ofp_match.from_packet(packet)</div><div> msg.idle_timeout = 10</div><div> msg.hard_timeout = 30</div><div> msg.actions.append(of.ofp_action_output(port = port))</div>
<div> msg.buffer_id = event.ofp.buffer_id # 6a</div><div> self.connection.send(msg)</div><div> </div><div> if event.ofp.buffer_id == -1:</div><div> # do a packet send message too since we can't tag this on the</div>
<div> # mod_flow message</div><div> msg = of.ofp_packet_out()</div><div> msg._set_data(packet)</div><div> msg.actions.append(of.ofp_action_output(port = port))</div><div> msg.buffer_id = event.ofp.buffer_id</div>
<div> msg.in_port = event.port</div><div> self.connection.send(msg)</div></div>
</blockquote></div><br></div></div></div></div></div></blockquote></div><br>
</blockquote></div><br></div></div></body></html>