<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"></head><body>Same here. Still trying to find out what is wrong. <div>"Sent on the move."</div><hr/><div><b>From: </b> Weiyang Mo <moweiyang1988@gmail.com>
</div><div><b>Date: </b>Thu, 20 Sep 2012 14:53:44 -0700</div><div><b>To: </b>William Emmanuel Yu<wyu@ateneo.edu>; Murphy McCauley<murphy.mccauley@gmail.com></div><div><b>Cc: </b><pox-dev@lists.noxrepo.org></div><div><b>Subject: </b>Re: [pox-dev] How can POX get packet counts (or beta transferred)
from a switch within a timeline.</div><div><br/></div><div>Hi,William</div><div> </div><div>I got the same problems on my side. I already tried both on "betta" and Murphy fork.</div><div> </div><div>It seems that whatever the traffic goes through switches, the returned switch port number is always "65534" and bytes_rx always 0 thus I cannot get packet counts from a specific port correctly.</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>
Yes. You should be using port stats for that. So I tried it myself but<br>
now I do not get any port stats data. Here is my code. It's empty. I am<br>
using the Murphy fork.<br>
<br>
On the multiple listeners, yes you can specify various actions within<br>
the callback function. In my emailed sample, I just log.debug() the<br>
output but you can do anything you like such as write to a database and<br>
the like.<br>
<br>
Good luck!<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, 2012-09-20 at 15:10 +1200, Sam Russell wrote:<br>
> What would it take to get your mods back into mainstream? Is there any<br>
> tidying or the like that we can help with?<br>
><br>
> Sent from my iPhone<br>
><br>
> On Sep 20, 2012, at 3:07 PM, Murphy McCauley<br>
> <<a href="mailto:murphy.mccauley@gmail.com">murphy.mccauley@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> > I think that's a known problem.<br>
> ><br>
> ><br>
> > The official noxrepo fork currently has a number of known bugs which<br>
> > are addressed in my fork (MurphyMc/pox), and my fork has a number of<br>
> > other improvements. One of these days, the changes in my fork will<br>
> > be upstreamed, but for the moment, you should really just pull POX<br>
> > from me instead of noxrepo.<br>
> ><br>
> ><br>
> > -- Murphy<br>
> ><br>
> ><br>
> > On Sep 19, 2012, at 7:33 PM, Weiyang Mo wrote:<br>
> ><br>
> > > Hi, William,<br>
> > ><br>
> > > Thanks very much. But I still have some questions about getting<br>
> > > statistics.<br>
> > ><br>
> > > As mentioned in POX wiki, We can use different statistics event to<br>
> > > get different types of statistics. What I want to get from a<br>
> > > switch is (1) it's switch ID (DPID) (2) all packet counts on each<br>
> > > port<br>
> > ><br>
> > > If I only use<br>
> > > "core.openflow.addListenerByName("FlowStatsReceived",<br>
> > > statsreceived)", the things I can get is that the total packet<br>
> > > counts from all ports, but no DPID or inport number. Thus I guess<br>
> > > I may need use<br>
> > > "of.ofp_port_stats_request()" and<br>
> > > core.openflow.addListenerByName("PortStatsReceived",<br>
> > > statsreceived)<br>
> > > But here I meet with a problem. I tried similar things as<br>
> > > ofp_flow_stats_request() as follows:<br>
> > ><br>
> > > def countrequest ():<br>
> > > swnum = 0<br>
> > > for connection in core.openflow._connections.values():<br>
> > > req1 = of.ofp_port_stats_request()<br>
> > > re1 = of.ofp_stats_request(body = req1)<br>
> > > connection.send(re1)<br>
> > ><br>
> > > -----------------------------------<br>
> > > In the launch() function, I do the following:<br>
> > > Timer(5, countrequest, recurring = True)<br>
> > > It reports an error which will not happend to<br>
> > > ofp_flow_stats_request()<br>
> > ><br>
> > > Traceback (most recent call last):<br>
> > > File "/home/openflow/pox/pox/lib/recoco/recoco.py", line 276, in<br>
> > > cycle<br>
> > > rv = t.execute()<br>
> > > File "/home/openflow/pox/pox/lib/recoco/recoco.py", line 94, in<br>
> > > execute<br>
> > > return self.gen.send(v)<br>
> > > File "/home/openflow/pox/pox/lib/recoco/recoco.py", line 751, in<br>
> > > run<br>
> > > rv = self._callback(*self._args,**self._kw)<br>
> > > File "/home/openflow/pox/ext/test1stat.py", line 270, in<br>
> > > countrequest<br>
> > > connection.send(re1)<br>
> > > File "/home/openflow/pox/pox/openflow/of_01.py", line 573, in<br>
> > > send<br>
> > > data = data.pack()<br>
> > > File "/home/openflow/pox/pox/openflow/libopenflow_01.py", line<br>
> > > 2136, in pack<br>
> > > packed += struct.pack("!HH", self.type, self.flags)<br>
> > > error: cannot convert argument to integer<br>
> > ><br>
> > ><br>
> > > Is there anything that I don't do correctly?<br>
> > ><br>
> > > And my another question is that even assuming I can add<br>
> > > portstatlistener and flowstatlistener as :<br>
> > ><br>
> > > core.openflow.addListenerByName("PortStatsReceived",<br>
> > > statsreceived)<br>
> > > core.openflow.addListenerByName("FlowStatsReceived",<br>
> > > statsreceived)<br>
> > ><br>
> > > Can I distinguish through statsreceived which event is which? Or<br>
> > > can I combine these two listeners together?<br>
> > ><br>
> > > Thanks very much.<br>
> > ><br>
> > > Weiyang<br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > 2012/9/19 William Emmanuel Yu <<a href="mailto:wyu@ateneo.edu">wyu@ateneo.edu</a>><br>
> > > Hi,<br>
> > ><br>
> > > Attached is a flow_stats.py file that contains a sample<br>
> > > for getting<br>
> > > stats from all switches connected to the controller<br>
> > > (flow_stats.py).<br>
> > > Attached is also a file of_json.py (from Murphy) which is<br>
> > > a helper<br>
> > > library to convert the output into JSON format (which is<br>
> > > much more<br>
> > > readable than the current classes).<br>
> > ><br>
> > > Good luck!<br>
> > ><br>
> > > On Wed, 2012-09-19 at 10:41 -0700, Weiyang Mo wrote:<br>
> > > > Hi, Seungwon,<br>
> > > ><br>
> > > > Thanks very much.<br>
> > > ><br>
> > > > Now it works and I can make some logical programming to<br>
> > > do my routing<br>
> > > > algorithm.<br>
> > > ><br>
> > > > Best<br>
> > > ><br>
> > > > Weiyang<br>
> > > ><br>
> > > ><br>
> > > > 2012/9/19 Seungwon Shin <<a href="mailto:seungwon.shin@gmail.com">seungwon.shin@gmail.com</a>><br>
> > > > Hi, Weiyang<br>
> > > ><br>
> > > ><br>
> > > > In the case of collecting the statistical<br>
> > > information for a<br>
> > > > flow table<br>
> > > > You can register your listener like<br>
> > > > --><br>
> > > core.openflow.addListenerByName("TableStatsReceived",<br>
> > > > <your handler>)<br>
> > > ><br>
> > > ><br>
> > > > and your handler can parse..<br>
> > > ><br>
> > > ><br>
> > > > def <your handler>(event):<br>
> > > > for item in event.stats<br>
> > > > print item.wildcards<br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > > You can find more information by looking at the<br>
> > > following<br>
> > > > classes in POX source code (libopenflow_01.py)<br>
> > > ><br>
> > > ><br>
> > > > class ofp_flow_stats<br>
> > > ><br>
> > > ><br>
> > > > class ofp_table_stats<br>
> > > ><br>
> > > ><br>
> > > > ….<br>
> > > ><br>
> > > ><br>
> > > > Each class has its __init__ function, and you<br>
> > > will find all<br>
> > > > variables for stats in the function.<br>
> > > > The variables that you are looking for should be<br>
> > > one of them.<br>
> > > > (E.g., wildcards is an initial variable of<br>
> > > ofp_table_stats<br>
> > > > class).<br>
> > > ><br>
> > > ><br>
> > > > Best,<br>
> > > > Seungwon<br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > > On Sep 19, 2012, at 11:49 AM, Weiyang Mo<br>
> > > > <<a href="mailto:moweiyang1988@gmail.com">moweiyang1988@gmail.com</a>> wrote:<br>
> > > ><br>
> > > > > Hi,William,<br>
> > > > ><br>
> > > > > Thanks for your advice and that's what I<br>
> > > already did. What I<br>
> > > > > meant is that although I sent such request, I<br>
> > > don't have<br>
> > > > > ideas how to get the reply back. I do<br>
> > > modifications as<br>
> > > > > follows in forwarding.l2_learning, which sends<br>
> > > request right<br>
> > > > > after sending flow entry request.<br>
> > > > ><br>
> > > > > msg = of.ofp_flow_mod()<br>
> > > > > msg.match =<br>
> > > of.ofp_match.from_packet(packet)<br>
> > > > > msg.match.in_port =<br>
> > > packet_in.in_port<br>
> > > > > msg.idle_timeout = 30<br>
> > > > > msg.hard_timeout = 30<br>
> > > > ><br>
> > > msg.actions.append(of.ofp_action_output(port =<br>
> > > > > out_port))<br>
> > > > > self.connection.send(msg)<br>
> > > > ><br>
> > > > ><br>
> > > "-----------------------------------------------------"<br>
> > > > > req = of.ofp_flow_stats_request()<br>
> > > > > re = of.ofp_stats_request(body =<br>
> > > req)<br>
> > > > > self.connection.send(re)<br>
> > > > ><br>
> > > > > When I try pinging between hosts, it works<br>
> > > correctly and the<br>
> > > > > statistics request has been sent. The question<br>
> > > is that the<br>
> > > > > switches sent "stats reply back" to<br>
> > > controller ( I detect<br>
> > > > > them through wireshark) however from<br>
> > > controller side, I<br>
> > > > > don't now how to catch the reply packet and<br>
> > > parse it as I<br>
> > > > > want.<br>
> > > > ><br>
> > > > > Any advice?<br>
> > > > ><br>
> > > > > Thanks very much.<br>
> > > > ><br>
> > > > > Weiyang<br>
> > > > ><br>
> > > > ><br>
> > > > > 2012/9/19 William Emmanuel Yu <<a href="mailto:wyu@ateneo.edu">wyu@ateneo.edu</a>><br>
> > > > > Hi Weiyang,<br>
> > > > ><br>
> > > > > Did you check out<br>
> > > ofp_flow_stats_request()?<br>
> > > > ><br>
> > > > > import pox.openflow.libopenflow_01 as<br>
> > > 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>
> > > > ><br>
> > > <a href="https://groups.google.com/forum/?fromgroups=#" target="_blank">https://groups.google.com/forum/?fromgroups=#</a>!<br>
> > > > > topic/pox_dev/sSlfqm5Okls<br>
> > > > ><br>
> > > > > Good luck!<br>
> > > > ><br>
> > > > > On Tue, 2012-09-18 at 08:21 -0700,<br>
> > > Weiyang Mo wrote:<br>
> > > > > > Hi,All,<br>
> > > > > ><br>
> > > > > > I try to use packet counts from<br>
> > > switches within a<br>
> > > > > time period (e.g<br>
> > > > > > 10secs) to do some routing. In the<br>
> > > documentation<br>
> > > > > ><br>
> > > <a href="https://openflow.stanford.edu/display/ONL/POX" target="_blank">https://openflow.stanford.edu/display/ONL/POX</a><br>
> > > > ><br>
> > > > > > +Wiki#POXWiki-StatisticEvent it<br>
> > > mentions that it's<br>
> > > > > possible to do this<br>
> > > > > > using a timer. I guess using 'time<br>
> > > to wake' to<br>
> > > > > call a counting<br>
> > > > > > function may help.<br>
> > > > > ><br>
> > > > > > However I'm not famiiar with getting<br>
> > > statistics<br>
> > > > > from a switch. More<br>
> > > > > > than one flow, I want to get total<br>
> > > packet counts<br>
> > > > > within 10 seconds<br>
> > > > > > from all flow entries. Could you<br>
> > > please help to<br>
> > > > > give me a simple<br>
> > > > > > examples about this?<br>
> > > > > ><br>
> > > > > > Thanks very much.<br>
> > > > > ><br>
> > > > > > Best<br>
> > > > > ><br>
> > > > > > Weiyang<br>
> > > > > ><br>
> > > > > ><br>
> > > > ><br>
> > > > ><br>
> > > > > --<br>
> > > > ><br>
> > > -------------------------------------------------------<br>
> > > > > William Emmanuel S. Yu, Ph.D. (杨怀义)<br>
> > > > > Department of Information Systems and<br>
> > > Computer<br>
> > > > > 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 :<br>
> > > <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 :<br>
> > > <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<br>
> > > is intended<br>
> > > > > only for the use of the<br>
> > > > > addressee and may contain information<br>
> > > that is<br>
> > > > > privileged and<br>
> > > > > confidential. If you are not the<br>
> > > intended recipient,<br>
> > > > > you are hereby<br>
> > > > > notified that any use or dissemination<br>
> > > of this<br>
> > > > > communication is strictly<br>
> > > > > prohibited. If you have received this<br>
> > > communication<br>
> > > > > in error, please<br>
> > > > > notify us immediately by reply and<br>
> > > delete this<br>
> > > > > message from your system.<br>
> > > > ><br>
> > > > ><br>
> > > ><br>
> > > ><br>
> > > ><br>
> > ><br>
> > > --<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<br>
> > > the use of the<br>
> > > addressee and may contain information that is privileged<br>
> > > and<br>
> > > confidential. If you are not the intended recipient, you<br>
> > > are hereby<br>
> > > notified that any use or dissemination of this<br>
> > > communication is strictly<br>
> > > prohibited. If you have received this communication in<br>
> > > error, please<br>
> > > notify us immediately by reply and delete this message<br>
> > > from your system.<br>
> > ><br>
> > ><br>
> ><br>
> ><br>
<br>
--<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>
</div></div></blockquote></div><br>
</body></html>