Hi,

I want to send a message from Pox controller to all the switches and ask
them to send back their flow table's Statics. I found a script to do it.

from pox.core import core
>
> #from pox.lib.util import dpid_to_str
>
> log = core.getLogger()
>
> class MyComponent (object):
>   def __init__ (self):
>     core.openflow.addListeners(self)
>
>   def _handle_ConnectionUp (self, event):
>     log.debug("Switch %s has come up.", dpid_to_str(event.dpid))
>
> def launch ():
>   core.registerNew(MyComponent)
> #  core.registerNew(openlow_connections)
>
> launch()
>
>
> # When we get flow stats, print stuff out
> def handle_flow_stats (event):
>   web_bytes = 0
>   web_flows = 0
>   for f in event.stats:
>     if f.match.tp_dst == 80 or f.match.tp_src == 80:
>       web_bytes += f.byte_count
>       web_flows += 1
>   log.info("Web traffic: %s bytes over %s flows", web_bytes, web_flows)
>
> # Listen for flow stats
> core.openflow.addListenerByName("FlowStatsReceived", handle_flow_stats)
>
> # Now actually request flow stats from all switches
> core.registerNew(core.openflow._connections.values())
> for con in core.openflow._connections.keys(): # make this
> _connections.keys() for pre-betta
>     con.send(of.ofp_stats_request(body=of.ofp_flow_stats_request()))
>


But I am getting the following error:

core.registerNew(core.openflow._connections.values())
> File "home/mininetpox/pox/core.py", line 292, in registerNew name =
> __componentClass.__name__
> AttributeError: 'list' object has no attribute '__name__'
>


I am wondering what is the problem. Am I doing something wrong or is there
any other way to do this?

Thanks.

Reply via email to