[pox-dev] When controller collecting statistics, can it know which switch the statistics come from?
Weiyang Mo
moweiyang1988 at gmail.com
Tue Oct 2 09:02:16 PDT 2012
Hi,
I used following definition to send request and listen to reply:
def counter_request ():
swnum = 0
for connection in core.openflow._connections.values():
swnum += 1
connection.send(of.ofp_stats_request(body=of.ofp_flow_stats_request()))
connection.send(of.ofp_stats_request(body=of.ofp_port_stats_request()))
time.sleep(0.1)
global switchnum
switchnum = swnum
print "total %i switches" % switchnum
global requestcycle
requestcycle +=1
def handle_PortStatsReceived(event):
"main body"
def launch ():
core.openflow.addListenerByName("PortStatsReceived",
handle_PortStatsReceived)
Timer(5, counter_request, recurring=True)
However I met with difficulties distinguishing switches when receving port
status. The "PortStatsReceived" function will be triggered whenever a
switch replys back, however the controller doesn't know which switch. I
also need switch information to distinguish the statistics, for example,
put switch1 stats into table 1, switch2 stats into table2..
Since I have no knowledge that the reply is from which switch, I play a
trick when I program "counter_request" to set a time interval for sending
each switch ( e.g switch1's request is sent on 0.1s,5.1s... switch is on
0.2s,5.2s), then assume I receive "ports status reply" in this switch
sequence. However this trick cannot help with too many switches, and it may
not work after a long timeline since each switch has a difference respoding
time.
Is there any approach to get the switch information (especially dpid) from
reply back when receving ports status?
Thanks very much.
Weiyang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/private.cgi/pox-dev-noxrepo.org/attachments/20121002/0180c775/attachment.htm>
More information about the pox-dev
mailing list