On Wed, 7 Aug 2013 14:13:04 -0300
Tonhão - Antonio Brasolin <[email protected]> wrote:

> Sorry to bother you again, i still can't quite get it to work.
> 
> I tried to use the method defined there, but the stats always returns empty.
> 
> How i tried:
> .
> .
> .
> def getPeriodicStats(dp):
>     """show periodic stats on screen
> 
>     :param dp: the datapath from which the stats shall be shown
>     """
>     waiters = {}
>     while True:
>         stats = get_flow_stats(dp, waiters)
>         print stats

The above doesn't work since get_flow_stats works asynchronously. IOW,
it just sends a request. The response will be delivered later. You
need to a handler fo catch the response:

https://github.com/osrg/ryu/blob/master/ryu/app/ofctl_rest.py#L243


>         time.sleep(1)
> .
> .
> .
> 
>     def dp_handler(self, ev):
>     .
>     .
>     .
>     if ev.enter:
>             self.topo.add_node(ev.dp.id)
>             thread.start_new(getPeriodicStats, (ev.dp,))
> 
> 
> Am i doing something wrong? Also, i'm not sure what is the use for the
> waiter dictionary.

As I wrote, get_flow_stats works asynchronosuly so when a request is
sent, its xid is sored in the 'waiter' dictionary. Then the response
is delivered, you can find the corresponding request.

> 
> On Tue, Aug 6, 2013 at 10:44 PM, FUJITA Tomonori <
> [email protected]> wrote:
> 
>> On Tue, 6 Aug 2013 13:31:20 -0300
>> Tonhão - Antonio Brasolin <[email protected]> wrote:
>>
>> > The purpose of this code is to use a lot of resources from ryu without
>> > doing anything specific, to serve as a reference/example for many things.
>> > We wanted to make a statistic request/reply but are not sure how, can you
>> > help us on that matter?
>>
>> The following code would help?
>>
>> https://github.com/osrg/ryu/blob/master/ryu/lib/ofctl_v1_0.py
>>
>> > After finishing this, we are going to make a tutorial that teaches how to
>> > use the many resources and serve as a reference to what events, contexts
>> > and messages there are and what classes represent each.
>> >
>> > Possible advanced topics in the course may include QoS and security, for
>> > which we may create sample applications.
>>
> 
> 
> 
> -- 
> El Psy Congroo,
> Antonio Añon Brasolin,
> Masters Degree Student in Universidade Federal de São Carlos

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to