Hi,<br><br>Thank you Murphy and William!!<br>Flow stats are working now!<br><br>Port stats seem to be trickier...<br>I found this thread on the list: "How can POX get packet counts (or beta transferred) from a switch within a timeline."<br>
With
the command Murphy suggested
[of.ofp_stats_request(body=of.ofp_port_stats_request(port_no =
of.OFPP_NONE))] to work around the problem with port_no, I get following
error:<br><br>Task <Timer/tid41> caused exception and was de-scheduled<br> File "/home/openflow/pox_workspace/OFcontroller/pox/lib/recoco/recoco.py", line 276, in cycle<br> rv = t.execute()<br> File "/home/openflow/pox_workspace/OFcontroller/pox/lib/recoco/recoco.py", line 94, in execute<br>
return self.gen.send(v)<br> File "/home/openflow/pox_workspace/OFcontroller/pox/lib/recoco/recoco.py", line 751, in run<br> rv = self._callback(*self._args,**self._kw)<br> File "/home/openflow/pox_workspace/OFcontroller/pox/thesis/l2_pairs_stats.py", line 111, in periodic_event<br>
switch.send(msg2)<br> File "/home/openflow/pox_workspace/OFcontroller/pox/openflow/topology.py", line 301, in send<br> return self._connection.send(*args, **kw)<br> File "/home/openflow/pox_workspace/OFcontroller/pox/openflow/of_01.py", line 572, in send<br>
data = data.pack()<br> File "/home/openflow/pox_workspace/OFcontroller/pox/openflow/libopenflow_01.py", line 2136, in pack<br> packed += struct.pack("!HH", self.type, self.flags)<br>error: cannot convert argument to integer<br>
<br>Changing port_no directly in the ofp_port_stats_request gives the same result.<br><br>I have to add that I'm still using the stable branch.<br>Betta (0ca0a8b5b5726195aa2c69337af98a146308dab9) always gives following error (no matter which components are loaded):<br>
<br>Traceback (most recent call last):<br> File "/home/openflow/temp_repo/poxrefbetta/pox.py", line 44, in <module><br> from pox.boot import boot<br> File "/home/openflow/temp_repo/poxrefbetta/pox/boot.py", line 55, in <module><br>
import pox.openflow<br> File "/home/openflow/temp_repo/poxrefbetta/pox/openflow/__init__.py", line 41, in <module><br> import libopenflow_01 as of<br> File "/home/openflow/temp_repo/poxrefbetta/pox/openflow/libopenflow_01.py", line 56, in <module><br>
generate_xid = xid_generator()<br> File "/home/openflow/temp_repo/poxrefbetta/pox/openflow/libopenflow_01.py", line 51, in xid_generator<br> return chain.from_iterable(repeat(xrange(start,stop+1))).next<br>
OverflowError: Python int too large to convert to C long<br><br>Do you know what's wrong?<br><br>Thanks!<br><br>Tim<br><br><br><br><br><br><br><div class="gmail_quote">2012/10/4 William Emmanuel S. Yu <span dir="ltr"><<a href="mailto:wyu@ateneo.edu" target="_blank">wyu@ateneo.edu</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Tim,<br>
Check out the flow_stats.py example I posted in the pox wiki.<br>
Good luck!<br>
"Sent on the move."<br>
<div class="HOEnZb"><div class="h5"><br>
-----Original Message-----<br>
From: Murphy McCauley <<a href="mailto:murphy.mccauley@gmail.com">murphy.mccauley@gmail.com</a>><br>
Sender: pox-dev-bounces@lists.noxrepo.orgDate: Thu, 4 Oct 2012 10:31:38<br>
To: <<a href="mailto:Tmusic987@gmail.com">Tmusic987@gmail.com</a>><br>
Cc: <<a href="mailto:pox-dev@lists.noxrepo.org">pox-dev@lists.noxrepo.org</a>><br>
Subject: Re: [pox-dev] Requesting port statistics (problem with connection)<br>
<br>
Sure, the problem is that ofp_port_stats_request is not an OpenFlow
message. It's meant to be the body of an ofp_stats_request, as per the
spec.<br>
<br>
The Wiki has some info on using stats requests (though nothing specific to ofp_port_stats_request at the moment):<br>
<a href="https://openflow.stanford.edu/display/ONL/POX+Wiki#POXWiki-ofpstatsrequest-Requestingstatisticsfromswitches" target="_blank">https://openflow.stanford.edu/display/ONL/POX+Wiki#POXWiki-ofpstatsrequest-Requestingstatisticsfromswitches</a><br>
<br>
(I've just pushed a patch to betta that adds an assertion that the
argument to Connection.send() has to be a subclass of ofp_header, which
would catch on this error -- you're not the first one to have made it.)<br>
<br>
-- Murphy<br>
<br>
On Oct 4, 2012, at 8:39 AM, Tmusic wrote:<br>
<br>
> Hi,<br>
><br>
> I'm trying to query the switches for port statistics, but I experience some problems with the connections to the switches.<br>
><br>
><br>
> #Ask switches for their port stats periodically (ignore the arg, it was for testing the Timer function)<br>
> def periodic_event(arg):<br>
> print 'timer_event:',arg<br>
> Timer(5, periodic_event, args = ['Requesting stats'])<br>
> topology = core.components['topology']<br>
> for switch in topology.getEntitiesOfType(Switch):<br>
> msg=of.ofp_port_stats_request()<br>
> switch.send(msg)<br>
> print 'request send'<br>
><br>
> def _handle_port_stats(event):<br>
> print 'port statistics message received'<br>
><br>
> I get no stats and following output (one switch connected in mininet):<br>
><br>
> timer_event: Requesting stats<br>
> INFO:openflow.of_01:[Con 1/1] closing connection<br>
> request send<br>
> INFO:openflow.of_01:[Con 2/1] Connected to 00-00-00-00-00-01<br>
> WARNING:openflow.topology:Switch 00-00-00-00-00-01 connected, but... it's already connected!<br>
> INFO:openflow.topology:Switch 00-00-00-00-00-01 connected<br>
> timer_event: Requesting stats<br>
> INFO:openflow.of_01:[Con 2/1] closing connection<br>
> request send<br>
> INFO:openflow.of_01:[Con 3/1] Connected to 00-00-00-00-00-01<br>
> WARNING:openflow.topology:Switch 00-00-00-00-00-01 connected, but... it's already connected!<br>
> INFO:openflow.topology:Switch 00-00-00-00-00-01 connected<br>
><br>
> Any ideas?<br>
><br>
> Thank you in advance,<br>
><br>
> Tim<br>
<br>
</div></div></blockquote></div><br><br><br><div class="gmail_quote">2012/10/4 William Emmanuel S. Yu <span dir="ltr"><<a href="mailto:wyu@ateneo.edu" target="_blank">wyu@ateneo.edu</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Tim,<br>
Check out the flow_stats.py example I posted in the pox wiki.<br>
Good luck!<br>
"Sent on the move."<br>
<div class="HOEnZb"><div class="h5"><br>
-----Original Message-----<br>
From: Murphy McCauley <<a href="mailto:murphy.mccauley@gmail.com">murphy.mccauley@gmail.com</a>><br>
Sender: pox-dev-bounces@lists.noxrepo.orgDate: Thu, 4 Oct 2012 10:31:38<br>
To: <<a href="mailto:Tmusic987@gmail.com">Tmusic987@gmail.com</a>><br>
Cc: <<a href="mailto:pox-dev@lists.noxrepo.org">pox-dev@lists.noxrepo.org</a>><br>
Subject: Re: [pox-dev] Requesting port statistics (problem with connection)<br>
<br>
Sure, the problem is that ofp_port_stats_request is not an OpenFlow message. It's meant to be the body of an ofp_stats_request, as per the spec.<br>
<br>
The Wiki has some info on using stats requests (though nothing specific to ofp_port_stats_request at the moment):<br>
<a href="https://openflow.stanford.edu/display/ONL/POX+Wiki#POXWiki-ofpstatsrequest-Requestingstatisticsfromswitches" target="_blank">https://openflow.stanford.edu/display/ONL/POX+Wiki#POXWiki-ofpstatsrequest-Requestingstatisticsfromswitches</a><br>
<br>
(I've just pushed a patch to betta that adds an assertion that the argument to Connection.send() has to be a subclass of ofp_header, which would catch on this error -- you're not the first one to have made it.)<br>
<br>
-- Murphy<br>
<br>
On Oct 4, 2012, at 8:39 AM, Tmusic wrote:<br>
<br>
> Hi,<br>
><br>
> I'm trying to query the switches for port statistics, but I experience some problems with the connections to the switches.<br>
><br>
><br>
> #Ask switches for their port stats periodically (ignore the arg, it was for testing the Timer function)<br>
> def periodic_event(arg):<br>
> print 'timer_event:',arg<br>
> Timer(5, periodic_event, args = ['Requesting stats'])<br>
> topology = core.components['topology']<br>
> for switch in topology.getEntitiesOfType(Switch):<br>
> msg=of.ofp_port_stats_request()<br>
> switch.send(msg)<br>
> print 'request send'<br>
><br>
> def _handle_port_stats(event):<br>
> print 'port statistics message received'<br>
><br>
> I get no stats and following output (one switch connected in mininet):<br>
><br>
> timer_event: Requesting stats<br>
> INFO:openflow.of_01:[Con 1/1] closing connection<br>
> request send<br>
> INFO:openflow.of_01:[Con 2/1] Connected to 00-00-00-00-00-01<br>
> WARNING:openflow.topology:Switch 00-00-00-00-00-01 connected, but... it's already connected!<br>
> INFO:openflow.topology:Switch 00-00-00-00-00-01 connected<br>
> timer_event: Requesting stats<br>
> INFO:openflow.of_01:[Con 2/1] closing connection<br>
> request send<br>
> INFO:openflow.of_01:[Con 3/1] Connected to 00-00-00-00-00-01<br>
> WARNING:openflow.topology:Switch 00-00-00-00-00-01 connected, but... it's already connected!<br>
> INFO:openflow.topology:Switch 00-00-00-00-00-01 connected<br>
><br>
> Any ideas?<br>
><br>
> Thank you in advance,<br>
><br>
> Tim<br>
<br>
</div></div></blockquote></div><br>