A likely candidate...

send_packet() appears to be victim to a copy/paste error or something.  The end 
of it is duplicated and it's sending the packet_out message twice.  The first 
time works.  The switch sends the buffered packet referenced by the buffer_id, 
and then throws away the buffer. The second time... the switch has thrown away 
the buffer, so you get the OFPBRC_BUFFER_EMPTY error.

This is mostly harmless, but fixing it is as simple as removing the duplicate 
send.

Examining the OpenFlow traffic with Wireshark, you'll likely see two 
packet_outs sent back to back with the same XID, which is suspicious.

-- Murphy

On Sep 16, 2014, at 10:25 AM, Choma Joshua <joshua.ch...@gmail.com> wrote:

> 
> Hi 
> 
> I am using the Ubuntu 12.04.5 LTS, Oracle VM VirtualBox and Virtual Machine 
> Image (OVF format, 64-bit, Mininet 2.0). 
> 
> General
> 
> Name:                  Mininet
> Operating System:Ubuntu (32 bit)
> 
> System
> Base Memory:      512 MB
> Boot order:           Floppy, CD/DVD, Hard Disk
> Acceleration:        PAE/NX
> 
> Display
> Video Memory: 12 MB
> Remote Desktop Server: Disabled
> Video Capture: Disabled
> 
> I am at the "Open Hub Code and Begin" step and the error i am getting is:
> 
> INFO:openflow.of_01:[00-00-00-00-00-01 1] connected
> DEBUG:misc.of_tutorial:Controlling [00-00-00-00-00-01 1]
> ERROR:openflow.of_01:[00-00-00-00-00-01 1] OpenFlow Error:
> [00-00-00-00-00-01 1] Error: header: 
> [00-00-00-00-00-01 1] Error:   version: 1
> [00-00-00-00-00-01 1] Error:   type:    1 (OFPT_ERROR)
> [00-00-00-00-00-01 1] Error:   length:  36
> [00-00-00-00-00-01 1] Error:   xid:     6
> [00-00-00-00-00-01 1] Error: type: OFPET_BAD_REQUEST (1)
> [00-00-00-00-00-01 1] Error: code: OFPBRC_BUFFER_EMPTY (7)
> [00-00-00-00-00-01 1] Error: datalen: 24
> 
> 
> I have been using the POX code below:
> 
> from pox.core import core
> import pox.openflow.libopenflow_01 as of
> import re
> 
> log = core.getLogger()
> 
> 
> 
> class Tutorial (object):
>   """
>   A Tutorial object is created for each switch that connects.
>   A Connection object for that switch is passed to the __init__ function.
>   """
>   def __init__ (self, connection):
>     # Keep track of the connection to the switch so that we can
>     # send it messages!
>     self.connection = connection
> 
>     # This binds our PacketIn event listener
>     connection.addListeners(self)
> 
>     # Use this table to keep track of which ethernet address is on
>     # which switch port (keys are MACs, values are ports).
>     self.mac_to_port = {}
>     self.matrix={} # this will keep track of the traffic matrix.
>                    # matrix[i][j]=number of times a packet from i went to j
> 
>   def send_packet (self,buffer_id, raw_data, out_port, in_port):
>     """
>     Sends a packet out of the specified switch port.
>     If buffer_id is a valid buffer on the switch, use that. Otherwise , send 
> the raw data in a raw data.
>     The "in_port" is the  port number that the packet arrived on. Use 
> OFPP_NONE if you are generating this packet
>     """
>     msg = of.ofp_packet_out()
>     msg.in_port = in_port
>     if buffer_id != -1 and buffer_id is not None:
>       # We got a buffer ID from the switch, use that
>       msg.buffer_id = buffer_id
>     else:
>       # No buffer ID from switch -- we got the raw data
>       if raw_data is None:
>         # No raw_data specified -- nothing to send!
>         return
>       msg.data = raw_data
>  action = of.ofp_action_output(port = out_port)
>     msg.actions.append(action)
> 
>     # Send message to switch
>     self.connection.send(msg)
> 
> 
> 
>     # Send message to switch
>     self.connection.send(msg)
> 
> 
>   def act_like_hub (self, packet, packet_in):
>     """
>     Implement hub-like behavior -- send all packets to all ports besides
>     the input port.
>     """
>     #Flood packet on all port
>     self.send_packet(packet_in.buffer_id, packet_in.data, of.OFPP_FLOOD, 
> packet_in.in_port)
>      # Note that if we didn't get a valid buffer_id, a slightly better
>     # implementation would check that we got the full data before
>     # sending it (len(packet_in.data) should be == packet_in.total_len)).
> 
> 
>   def act_like_switch (self, packet, packet_in):
>     """
>     Implement switch-like behavior.
>     """
> 
>     """ # DELETE THIS LINE TO START WORKING ON THIS (AND THE ONE BELOW!) #
> 
>     # Here's some psuedocode to start you off implementing a learning
>     # switch.  You'll need to rewrite it as real Python code.
> 
>     # Learn the port for the source MAC
>     self.mac_to_port ... <add or update entry>
> 
>     if the port associated with the destination MAC of the packet is known:
>       # Send packet out the associated port
>       self.resend_packet(packet_in, ...)
> 
>       # Once you have the above working, try pushing a flow entry
>       # instead of resending the packet (comment out the above and
>       # uncomment and complete the below.)
> 
> 
>             log.debug("Installing flow...")
>       # Maybe the log statement should have source/destination/port?
> 
>       #msg = of.ofp_flow_mod()
>       #
>       ## Set fields to match received packet
>       #msg.match = of.ofp_match.from_packet(packet)
>       #
>       #< Set other fields of flow_mod (timeouts? buffer_id?) >
>       #
>       #< Add an output action, and send -- similar to resend_packet() >
> 
>     else:
>       # Flood the packet out everything but the input port
>         # This part looks familiar, right?
>       self.resend_packet(packet_in, of.OFPP_ALL)
> 
>     """ # DELETE THIS LINE TO START WORKING ON THIS #
>     # Learn the port for the source MAC
>     self.mac_to_port[packet.src]=packet_in.in_port
>     # Add the entry to the traffic matrix
>     if self.mac_to_port.get(packet.dst)!=None:
>        # Send packet out the associated port
>        self.send_packet(packet_in.buffer_id, packet_in.data, 
> self.mac_to_port[packet.dst],packet_in.in_port)
>     else:
>        # Flood the packet out everything but the input port (same as hub)
>        self.send_packet(packet_in.buffer_id, packet_in.data, of.OFPP_FLOOD, 
> packet_in.in_port)
> 
> 
>   def _handle_PacketIn (self, event):
>     """
>     Handles packet in messages from the switch.
>     ''"" 
> 
>     packet = event.parsed # This is the parsed packet data.
>     if not packet.parsed:
>       log.warning("Ignoring incomplete packet")
>       return
> 
>     packet_in = event.ofp # The actual ofp_packet_in message.
> 
>     # Comment out the following line and uncomment the one after
>     # when starting the exercise.
>     self.act_like_hub(packet, packet_in)
>     #self.act_like_switch(packet, packet_in)
> 
> 
> 
> def launch ():
>   """
>   Starts the component
>   """
>   def start_switch (event):
>     log.debug("Controlling %s" % (event.connection,))
>     Tutorial(event.connection)
>   core.openflow.addListenerByName("ConnectionUp", start_switch)
>           
> 
> 
> 
> Please do assist with the error, i am new to mininet.
> 
> Regards
> Joshua Choma
> South Africa, University of Witwatersrand                                     
>                                                            
> 
> _______________________________________________
> openflow-discuss mailing list
> openflow-discuss@lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/openflow-discuss

_______________________________________________
openflow-discuss mailing list
openflow-discuss@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/openflow-discuss

Reply via email to