<html><head><meta http-equiv="Content-Type" content="text/html charset=GB2312"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi, Weiyang</div><div><br></div><div>In the case of collecting the statistical information for a flow table </div><div>You can register your listener like</div><div>--> core.openflow.addListenerByName("TableStatsReceived", <your handler>)</div><div><br></div><div>and your handler can parse..</div><div><br></div><div>def <your handler>(event):</div><div> for item in event.stats</div><div> print item.wildcards</div><div><br></div><div><br></div><div>You can find more information by looking at the following classes in POX source code (libopenflow_01.py)</div><div><br></div><div>class ofp_flow_stats</div><div><br></div><div>class ofp_table_stats</div><div><br></div><div>¡.</div><div><br></div><div>Each class has its __init__ function, and you will find all variables for stats in the function.</div><div>The variables that you are looking for should be one of them.</div><div>(E.g., wildcards is an initial variable of ofp_table_stats class).</div><div><br></div><div>Best,</div><div>Seungwon </div><div><br></div><br><div><div>On Sep 19, 2012, at 11:49 AM, Weiyang Mo <<a href="mailto:moweiyang1988@gmail.com">moweiyang1988@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,William,</div><div> </div><div>Thanks for your advice and that's what I already did. What I meant is that although I sent such request, I don't have ideas how to get the reply back. I do modifications as follows in forwarding.l2_learning, which sends request right after sending flow entry request.</div>
<div> </div><div> msg = of.ofp_flow_mod()<br> msg.match = of.ofp_match.from_packet(packet)<br> msg.match.in_port = packet_in.in_port<br> msg.idle_timeout = 30<br> msg.hard_timeout = 30<br>
msg.actions.append(of.ofp_action_output(port = out_port))<br> self.connection.send(msg)</div><div> </div><div>"-----------------------------------------------------"<br> req = of.ofp_flow_stats_request()<br>
re = of.ofp_stats_request(body = req)<br> self.connection.send(re)</div><div> </div><div>When I try pinging between hosts, it works correctly and the statistics request has been sent. The question is that the switches sent "stats reply back" to controller ( I detect them through wireshark) however from controller side, I don't now how to catch the reply packet and parse it as I want.</div>
<div> </div><div>Any advice?</div><div> </div><div>Thanks very much.</div><div> </div><div>Weiyang <br><br></div><div class="gmail_quote">2012/9/19 William Emmanuel Yu <span dir="ltr"><<a href="mailto:wyu@ateneo.edu" target="_blank">wyu@ateneo.edu</a>></span><br>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">Hi Weiyang,<br>
<br>
Did you check out ofp_flow_stats_request()?<br>
<br>
import pox.openflow.libopenflow_01 as of<br>
fsr = of.ofp_flow_stats_request()<br>
sr = of.ofp_stats_request(body = fsr)<br>
switch.send(sr)<br>
<br>
Check out:<br>
<a href="https://groups.google.com/forum/?fromgroups=#!topic/pox_dev/sSlfqm5Okls" target="_blank">https://groups.google.com/forum/?fromgroups=#!topic/pox_dev/sSlfqm5Okls</a><br>
<br>
Good luck!<br>
<div class="im"><br>
On Tue, 2012-09-18 at 08:21 -0700, Weiyang Mo wrote:<br>
> Hi,All,<br>
><br>
> I try to use packet counts from switches within a time period (e.g<br>
> 10secs) to do some routing. In the documentation<br>
> <a href="https://openflow.stanford.edu/display/ONL/POX" target="_blank">https://openflow.stanford.edu/display/ONL/POX</a><br>
</div>> +Wiki#POXWiki-StatisticEvent it mentions that it's possible to do this<br>
<div class="im">> using a timer. I guess using 'time to wake' to call a counting<br>
> function may help.<br>
><br>
> However I'm not famiiar with getting statistics from a switch. More<br>
> than one flow, I want to get total packet counts within 10 seconds<br>
> from all flow entries. Could you please help to give me a simple<br>
> examples about this?<br>
><br>
> Thanks very much.<br>
><br>
> Best<br>
><br>
> Weiyang<br>
><br>
><br>
<br>
</div>--<br>
-------------------------------------------------------<br>
William Emmanuel S. Yu, Ph.D. (ÑÒå)<br>
Department of Information Systems and Computer Science<br>
Ateneo de Manila University<br>
email : wyu at ateneo dot edu<br>
blog : <a href="http://hip2b2.yutivo.org/" target="_blank">http://hip2b2.yutivo.org/</a><br>
web : <a href="http://cng.ateneo.edu/cng/wyu/" target="_blank">http://CNG.ateneo.edu/cng/wyu/</a><br>
phone : <a href="tel:%2B63%282%294266001" value="+6324266001">+63(2)4266001</a> loc. 4186<br>
GPG : <a href="http://cng.ateneo.net/cng/wyu/wyy.pgp" target="_blank">http://CNG.ateneo.net/cng/wyu/wyy.pgp</a><br>
<br>
Confidentiality Issue: This message is intended only for the use of the<br>
addressee and may contain information that is privileged and<br>
confidential. If you are not the intended recipient, you are hereby<br>
notified that any use or dissemination of this communication is strictly<br>
prohibited. If you have received this communication in error, please<br>
notify us immediately by reply and delete this message from your system.<br>
<br>
</blockquote></div><br>
</blockquote></div><br></body></html>