Hello Iwase,
thank you for taking the time to reply. 

Yes, correct. I was hoping to be able to interact with the running my_app 
application ($ryu-manager my_app.py) from another Python script. E.g. be able 
to instantiate the class of the running app and make calls to functions 
residing there.

I will try out the method you described below. Thank you.

​Mvh,

Frode​

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On 26 February 2018 1:23 AM, Iwase Yusuke <iwase.yusu...@gmail.com> wrote:

> ​​
> 
> Hi Frode,
> 
> You mean "how to or is it possible to get an instance of a running Ryu
> 
> application from another Python process?", right?
> 
> Hmmm... as far as I know, it is very difficult...
> 
> If "to get an instance from another Ryu application", you can use the API of
> 
> "ryu.base.app_manager" module.
> 
> $ cat my_app.py
> 
> from ryu.base import app_manager
> 
> app\_manager.require\_app('ryu.app.simple\_switch\_13')
> 
> class MyApp(app_manager.RyuApp):
> 
> def init(self, \*args, \*\*kwargs):
> 
> super(MyApp, self).init(args, kwargs)
> 
> self.simple\_switch = app\_manager.lookup\_service\_brick('SimpleSwitch13')
> 
> self.logger.info(' app %s', self.simple_switch)
> 
> $
> 
> $ ryu-manager my_app.py
> 
> loading app my_app.py
> 
> loading app ryu.app.simple\_switch\_13
> 
> loading app ryu.controller.ofp_handler
> 
> instantiating app ryu.app.simple\_switch\_13 of SimpleSwitch13
> 
> instantiating app my_app.py of MyApp
> 
> \*\*\* app <ryu.app.simple\_switch\_13.SimpleSwitch13 object at 
> 0x7f484c990898>
> 
> instantiating app ryu.controller.ofp_handler of OFPHandler
> 
> ...(snip)...
> 
> In this case, please confirm that application which you want is already
> 
> instantiated before calling "app\_manager.lookup\_service_brick()",
> 
> If you need to get it from another Python process, I guess it is required to
> 
> interrupt "ryu-manager" process like debugger...
> 
> Thanks,
> 
> Iwase
> 
> On 2018年02月23日 16:50, Frode via Ryu-devel wrote:
> 
> > Hello,
> > 
> > first off kudos for this cool, and free, controller software. Second, I 
> > wanted
> > 
> > to ask you guys how I can instantiate an app which have been sent to 
> > ryu-manager
> > 
> > upon start?
> > 
> > e.g. if I run
> > 
> > $ ryu-manager simple\_switch\_13.py
> > 
> > How can I then instantiate "class SimpleSwitch13(app_manager.RyuApp):" from 
> > for
> > 
> > example the interpreter or another python script when Ryu is running?
> > 
> > Kind regards,
> > 
> > Frode
> > 
> > Check out the vibrant tech community on one of the world's most
> > 
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > 
> > Ryu-devel mailing list
> > 
> > Ryu-devel@lists.sourceforge.net
> > 
> > https://lists.sourceforge.net/lists/listinfo/ryu-devel



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to