[pox-dev] Dealing with buffer ID = -1, i.e. no buffered packet

Sam Russell sam.h.russell at gmail.com
Mon Oct 8 18:59:26 PDT 2012


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.

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.

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 ;)

Is this a good way to deal with it, or is there a better one (possibly
already implemented in POX somewhere?)

 def _handle_PacketIn (self, event):
[..]
    def flood ():
      """ Floods the packet """
      msg = of.ofp_packet_out()
      if event.ofp.buffer_id == -1:
        #log.warning("Not flooding unbuffered packet on %s",
        #            dpidToStr(event.dpid))
        #return

        # Ideally we'll set a flow to flood AND send to controller
        #    for multicast packets, but for now we'll just make
        #    sure that they can get through
        # If buffer ID == -1 then we have the whole packet
        msg._set_data(packet)

      if time.time() - self.connection.connect_time > FLOOD_DELAY:
        # Only flood if we've been connected for a little while...
        #log.debug("%i: flood %s -> %s", event.dpid, packet.src, packet.dst)
        msg.actions.append(of.ofp_action_output(port = of.OFPP_FLOOD))
      else:
        pass
        #log.info("Holding down flood for %s", dpidToStr(event.dpid))
      msg.buffer_id = event.ofp.buffer_id
      msg.in_port = event.port
      self.connection.send(msg)
[..]
        # 6
        log.debug("installing flow for %s.%i -> %s.%i" %
                  (packet.src, event.port, packet.dst, port))
        msg = of.ofp_flow_mod()
        msg.match = of.ofp_match.from_packet(packet)
        msg.idle_timeout = 10
        msg.hard_timeout = 30
        msg.actions.append(of.ofp_action_output(port = port))
        msg.buffer_id = event.ofp.buffer_id # 6a
        self.connection.send(msg)

        if event.ofp.buffer_id == -1:
          # do a packet send message too since we can't tag this on the
          #    mod_flow message
          msg = of.ofp_packet_out()
          msg._set_data(packet)
          msg.actions.append(of.ofp_action_output(port = port))
          msg.buffer_id = event.ofp.buffer_id
          msg.in_port = event.port
          self.connection.send(msg)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/private.cgi/pox-dev-noxrepo.org/attachments/20121009/61d5c9db/attachment.htm>


More information about the pox-dev mailing list