<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><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><div><br></div><div>-- Murphy</div><div><br><div><div>On Oct 8, 2012, at 6:59 PM, Sam Russell wrote:</div><br class="Apple-interchange-newline"><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/">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></body></html>