noxrepo / pox

The POX network software platform
https://noxrepo.github.io/pox-doc/html/
Apache License 2.0
624 stars 471 forks source link

SDN POX Controller PortStat #228

Closed simounical closed 4 years ago

simounical commented 5 years ago

Hi everyone, I'm trying to write some code for a personal project. I'm using def _handle_portstats_received (event): stats = flow_stats_to_list(event.stats) log.debug("PortStatsReceived from %s: %s", dpidToStr(event.connection.dpid), stats)

to get statistics from port.

In my topology there are 3 switches, but I'd like to get the information just from Switch#1. How can I do that? The code above prints statics from all switches.

Thank you

simounical commented 5 years ago

@MurphyMc

MurphyMc commented 5 years ago

As mentioned in the manual, the events generally have a .connection and a .dpid property, either of which can be used to help differentiate between events raised by different switches. Additionally, you could add the event listener to a particular connection (in the connection up handler) rather than to the OpenFlow nexus (which is what I assume you're doing), and it'll only fire for that connection.