The code explicitly adds up the stats from the individual entries in a loop and 
prints a summary.  If you want results on the individual flows, just log each 
entry in the loop instead of adding it up.

-- Murphy

On Jun 27, 2013, at 8:57 AM, nibble nibble wrote:

> I got what is the problem, thanks a lot.
> 
> Just another question:
> How can get these info per flow. I mean instead of having:
> 
> [flow_stats      ] Web traffic from 00-00-00-00-00-01: 100 bytes (5 packets) 
> over 3 flows.
> 
> I would like to have something like
> 
> 
> [flow_stats      ] Web traffic from 00-00-00-00-00-01: 0 bytes (0 packets) 
> for flow f1.
> [flow_stats      ] Web traffic from 00-00-00-00-00-01: 80 bytes (2 packets) 
> for flow f2.
> [flow_stats      ] Web traffic from 00-00-00-00-00-01: 20 bytes (3 packets) 
> for flow f3.
>  
> Thanks,
> Nibble
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Thu, Jun 27, 2013 at 11:42 AM, Alison Chan <[email protected]> wrote:
> Is the traffic they are sending http traffic? Istr that William's flow stats 
> example, the line that prints that looks for TCP port 80 flows.
> 
> Cheers,
> 
> Alison Chan
> (sent from my tablet)
> 
> On 27 Jun 2013 10:14, "nibble nibble" <[email protected]> wrote:
> Thanks a lot for your replies.
> 
> I used the script and it seems it is working, the only thing is that it 
> always prints:
> 
> 
> [flow_stats      ] Web traffic from 00-00-00-00-00-01: 0 bytes (0 packets) 
> over 0 flows.
> 
> although hosts are sending packets to each other, it always shows 0 packets.
> 
> 
> 
> Thanks,
> Nibble
> 
> 
> On Wed, Jun 26, 2013 at 7:32 PM, Murphy McCauley <[email protected]> 
> wrote:
> I think a fair number of people have versions of POX from the OpenFlow 
> Tutorial VM and stuff and haven't updated them.  I guess your suggestion 
> would at least help people who have updated but are stuck on an old branch 
> not realizing there are newer ones even though it's mentioned in the 
> troubleshooting section of the FAQ.
> 
> I do sort of hate to put this sort of meta stuff into the repository, but it 
> might be worth it.  Right now the branch name/version is in the repository.  
> I guess this would just be updating that to also keep whether it's the 
> current active, most recent release, or old release.  For active or current, 
> just mention it in the up log message.  For old release, log a warning.
> 
> -- Murphy
> 
> On Jun 26, 2013, at 1:55 PM, Peter Peresini wrote:
> 
>> Hi Murphy,
>>  over the course of time I see a lot of "using old version/branch of POX" 
>> replies. Maybe it could be solved by adding 
>> log.warning("Using old git branch, for better support try updating to  xyz") 
>> to the pox.core of all old branches. What do you thing?
>> 
>> 
>> On Wed, Jun 26, 2013 at 1:33 PM, Murphy McCauley <[email protected]> 
>> wrote:
>> You're using a very old version/branch of POX.  See the manual for more info 
>> on this.  You should really update to at least the current version of the 
>> betta branch.
>> 
>> Sidenote: it should be a simple modification to remove the dependency on 
>> of_json -- it's only used to print the stuff out in JSON instead of its 
>> usual (more verbose) string formatting.
>> 
>> -- Murphy
>> 
>> On Jun 26, 2013, at 8:23 AM, nibble nibble wrote:
>> 
>>> Thanks, 
>>> 
>>> I want to query switches every few seconds. and I found the script to get 
>>> the statics from here and because I did not have of_json.py, I got it from 
>>> here.  Now I am getting the error:
>>> 
>>> from pox.openflow.of_json import *
>>>   File "/home/mininet/pox/pox/openflow/of_json.py", line 25, in <module>
>>>     from pox.lib.util import fields_of,is_scalar
>>> ImportError: cannot import name fields_of
>>> 
>>> 
>>> Which I do not have any idea what is wrong with pox?
>>> 
>>> Thanks,
>>> Nibble
>>> 
>>> 
>>> On Tue, Jun 25, 2013 at 6:54 PM, Murphy McCauley 
>>> <[email protected]> wrote:
>>> 
>>> On Jun 25, 2013, at 3:28 PM, nibble nibble wrote:
>>> 
>>>> Hi,
>>>> 
>>>> I want to send a message from Pox controller to all the switches and ask 
>>>> them to send back their flow table's Statics. I found a script to do it.
>>>> 
>>>> from pox.core import core
>>>> 
>>>> #from pox.lib.util import dpid_to_str
>>>>  
>>>> log = core.getLogger()
>>>>  
>>>> class MyComponent (object):
>>>>   def __init__ (self):
>>>>     core.openflow.addListeners(self)
>>>>  
>>>>   def _handle_ConnectionUp (self, event):
>>>>     log.debug("Switch %s has come up.", dpid_to_str(event.dpid))
>>>>  
>>>> def launch ():
>>>>   core.registerNew(MyComponent)
>>>> #  core.registerNew(openlow_connections)
>>> 
>>> What's the point of the MyComponent class here?  It doesn't do anything but 
>>> print out when switches connect (which the OpenFlow component already does).
>>> 
>>>> launch()
>>> 
>>> You shouldn't call launch() directly.  It will be called automatically when 
>>> POX loads the component.
>>> 
>>>> # Listen for flow stats
>>>> core.openflow.addListenerByName("FlowStatsReceived", handle_flow_stats)
>>>>  
>>>> # Now actually request flow stats from all switches
>>>> core.registerNew(core.openflow._connections.values())
>>>> for con in core.openflow._connections.keys(): # make this 
>>>> _connections.keys() for pre-betta
>>>>     con.send(of.ofp_stats_request(body=of.ofp_flow_stats_request()))
>>> 
>>> The example you found from the POX manual wiki is for running at the 
>>> interactive prompt (with the "py" component), not for direct inclusion in a 
>>> component.  The way you have it here will try to execute it when the module 
>>> is loaded.  Even if this worked (which I won't swear to), it would be 
>>> useless because no switches will have connected yet.  When do you want to 
>>> query switches?  When they connect?  Every few seconds?  At some other 
>>> time?  You need to figure that out and run this code at the correct time 
>>> (e.g., in response to some event).
>>> 
>>>> But I am getting the following error:
>>>> 
>>>> core.registerNew(core.openflow._connections.values())
>>> 
>>> It appears you or someone else added this line to the example code from the 
>>> wiki.  It's causing an exception because it doesn't make any sense.  
>>> core.registerNew() creates a new instance of a class and registers it on 
>>> core.  core.openflow._connections.values() isn't a class, and you wouldn't 
>>> want to register it on core.
>>> 
>>> 
>>> Try looking at the "Statistics Collector Example" on the POX wiki in the 
>>> "Third-Party" section.  It queries connected switches every few seconds.
>>> 
>>> -- Murphy
>>> 
>> 
>> 
> 
> 
> 

Reply via email to