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

Murphy McCauley murphy.mccauley at gmail.com
Mon Oct 8 19:09:25 PDT 2012


Hey, Sam.

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".

I think this addresses your problem.  Feedback?

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.

-- Murphy

On Oct 8, 2012, at 6:59 PM, Sam Russell wrote:

> 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/pipermail/pox-dev-noxrepo.org/attachments/20121008/23bca38b/attachment-0002.htm>


More information about the pox-dev mailing list