I worked my way using your example as a base for what I wanted. Thank you!
On 20 October 2017 at 01:33, Fujimoto Satoshi <satoshi.fujimo...@gmail.com> wrote: > Hi, Carlos > > You can pass any arguments to your application, by adding arguments to CONF. > >> from ryu.cmd import manager >> from ryu import cfg >> >> CONF = cfg.CONF >> CONF.register_cli_opts([ >> cfg.StrOpt('additional-opt', default=None, >> help='Additional option'), >> ]) >> >> manager.main(args=['--additional-opt', 'hoge', >> 'ryu.app.simple_switch_13']) > > Then you can get 'hoge' from 'CONF.additional_opt' in the application. > > Thanks, > Fujimoto > > > On 2017年10月19日 20:04, Carlos Ferreira wrote: >> >> Is there a way to pass initialisation arguments to an application, by >> just sharing a global variable, for example? >> >> When I use the example you have provided, the application module is >> reloaded, resetting global variables and settings. >> >> Using CONF is quite limited to me, since I want to start an >> application myself, which will eventually start the controller and I >> use argparse instead of CONF. >> >> Thank you! >> Carlos >> >> >> >> On 13 October 2017 at 01:43, Fujimoto Satoshi >> <satoshi.fujimo...@gmail.com> wrote: >>> >>> Hi, Carlos >>> >>> Yes, you can instantiate app_manager.RyuApp with ryu/cmd/manager.py. >>> You can pass the argument list like the below. >>> In this, you should specify the application by name: >>> from ryu.cmd import manager >>> >>> manager.main(args=['--verbose', 'ryu.app.simple_switch_13']) >>> >>> Or, if you have a module of the application, >>> you can get the name from the module by using '__module__'. >>> from ryu.cmd import manager >>> from ryu.app.simple_switch_13 import SimpleSwitch13 >>> >>> manager.main(args=['--verbose', SimpleSwitch13().__module__]) >>> >>> Thanks, >>> Fujimoto >>> >>> >>> >>> On 2017年10月12日 21:26, Carlos Ferreira wrote: >>>> >>>> Hello to all, >>>> >>>> I have been dwelling through the Ryu code and I wonder, is it possible >>>> for me to instantiate a Ryu Application without using the ryu-manager? >>>> >>>> For example, can I instantiate a app_manager.RyuApp class from a >>>> regular Python Application? >>>> >>>> Thank you! >>>> Carlos Ferreira >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> 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 > > ------------------------------------------------------------------------------ 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