On Tue, 25 Dec 2018 22:21:38 +0900,
Edison Albuquerque wrote:
> I need to write an api to process data collected from the switch, via
> simplemonitor13.
> The attribute I need to process is "body" of the statreply message.
> I happens that body is a local variable.
> Since I am still learning Python, I need someone to teach me how to write a
> code that will capture the body content.
> I solved the problem tweaking simplemonitor13 to send body content to an
> open file that I can read from my code. But there must be a better way.
> Thanks and MERRY XMAS.

Of course there are.

It depends on how and where your API code is written, but several
possible solutions are:

1. Use global variables or a global class instance
   cf. 
https://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
2. If your API code resides in SimpleMonitor13 or its derived class,
   store the data as a class variable
3. If you want to send statrequests synchronously from your API code,
   kill _request_stats and use send_msg with a reply_cls arg

Merry christmas and a happy new year

--
IWAMOTO Toshihiro


_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to