Try putting the attached in the pox ext directory and then running ./pox.py log.level --DEBUG l2_pairs_debug

Do a ping test and post the log.

-- Murphy

# Copyright 2012 James McCauley
#
# This file is part of POX.
#
# POX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# POX is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with POX.  If not, see <http://www.gnu.org/licenses/>.

"""
A super simple OpenFlow learning switch that installs rules for
each pair of L2 addresses.
"""

# These next two imports are common POX convention
from pox.core import core
import pox.openflow.libopenflow_01 as of


# Even a simple usage of the logger is much nicer than print!
log = core.getLogger()


# This table maps (switch,MAC-addr) pairs to the port on 'switch' at
# which we last saw a packet *from* 'MAC-addr'.
# (In this case, we use a Connection object for the switch.)
table = {}


# Handle messages the switch has sent us because it has no
# matching rule.
def _handle_PacketIn (event):
  packet = event.parsed

  # Learn the source
  if (event.connection,packet.src) not in table:
    log.info("%s: %s on %s" % (event.connection, packet.src, event.connection.ports[event.port]))
  elif table[(event.connection,packet.src)] != event.port:
    log.info("%s: %s moved to %s" % (event.connection, packet.src, event.connection.ports[event.port]))
  table[(event.connection,packet.src)] = event.port

  dst_port = table.get((event.connection,packet.dst))

  if dst_port is None:
    # We don't know where the destination is yet.  So, we'll just
    # send the packet out all ports (except the one it came in on!)
    # and hope the destination is out there somewhere. :)
    # To send out all ports, we can use either of the special ports
    # OFPP_FLOOD or OFPP_ALL.  We'd like to just use OFPP_FLOOD,
    # but it's not clear if all switches support this. :(
    msg = of.ofp_packet_out(data = event.ofp)
    msg.actions.append(of.ofp_action_output(port = of.OFPP_ALL))
    event.connection.send(msg)
  else:
    # Since we know the switch ports for both the source and dest
    # MACs, we can install rules for both directions.
    msg = of.ofp_flow_mod()
    msg.match.dl_dst = packet.src
    msg.match.dl_src = packet.dst
    msg.actions.append(of.ofp_action_output(port = event.port))
    event.connection.send(msg)
    
    # This is the packet that just came in -- we want to
    # install the rule and also resend the packet.
    msg = of.ofp_flow_mod()
    msg.data = event.ofp # Forward the incoming packet
    msg.match.dl_src = packet.src
    msg.match.dl_dst = packet.dst
    msg.actions.append(of.ofp_action_output(port = dst_port))
    event.connection.send(msg)

    log.debug("Installing %s <-> %s" % (packet.src, packet.dst))


def launch ():
  core.openflow.addListenerByName("PacketIn", _handle_PacketIn)

  log.info("Pair-Learning switch running.")

On Feb 6, 2013, at 1:39 AM, Shabbir Ahmed wrote:

Yes, I have two hosts connected to the switch and you're trying to ping across the switch. even if i dont ping the two hosts, as the it conntects to a controller it starts displaying this msg. the ping works but i think due to the switch's self learning process and not through OpenFlow bcaz in the absense of controller the ping should not work? am i right? I was recieving the same msg with mininet then i refreshed the git clone after which it started working, when i try to ping host in mininet it displays the mac addresses and then displays msg adding entry.

wat logs do you want me to send.

1 more thing i can use enable_learning '0' in switch configuration on openwrt but it doesnt effect any thing, where i think of this statement as disable default learning of the switch. the switch chip installed is 'rtl8366rb'. I have a rb450g and i have ported the latest openwrt and followed pantou but same error.

thanks alot,
Shabbir.

please...


On Wed, Feb 6, 2013 at 1:03 PM, Murphy McCauley <[email protected]> wrote:
On Feb 5, 2013, at 11:52 PM, Shabbir Ahmed wrote:
> I am trying to set up openflow, openwrt on tp-link, here i have issue, if i run pox forwarding.l2_learning with mininet it works fine, but when i try to use it on tp-link, it gives the following msg,
>
> port of (mac address of tplink switch) unknown --- flooding,

By itself, this message is not particularly meaningful -- it shows up when you run under Mininet too.
Please post the rest of the log.
When do you see this (that is, what are you trying to do when this happens)?
Do you have two hosts connected to the switch and you're trying to ping across the switch?
What else have you tried?  What does and does not work?
Have you tried with the betta branch of POX?

Also, take a look through the troubleshooting section of the FAQ:
http://tinyurl.com/helppox

-- Murphy


Reply via email to