Hi,

Ryu uses oslo.config library.
You can use default Ryu configuration file (etc/ryu/ryu.conf) as follow.

# Set params
$ vi etc/ryu/ryu.conf
 ...
 test_param1=12345
 test_param2='test'
 ...

# Get params in your App
$ vi yourapp.py
 ...
   :
 from ryu import cfg
   :
 class SimpleSwitch13(app_manager.RyuApp):
     def __init__(self, *args, **kwargs):
         super(SimpleSwitch13, self).__init__(*args, **kwargs)
           :
         CONF = cfg.CONF
         CONF.register_opts([
             cfg.IntOpt('test-param1', default=0),
             cfg.StrOpt('test-param2', default='default')])
         print 'test_param1 = %d' % CONF.test_param1
         print 'test_param2 = %s' % CONF.test_param2
 ...

# Reinstall ryu
$ sudo python setup.py install

# Run
$ ryu-manager ryu.app.simple_switch_13
loading app ryu.app.simple_switch_13
loading app ryu.controller.ofp_handler
instantiating app ryu.app.simple_switch_13 of SimpleSwitch13
instantiating app ryu.controller.ofp_handler of OFPHandler
test_param1 = 12345
test_param2 = test

Thanks

On 2015年02月13日 08:05, A Sydney wrote:
> Hi Ryu folks,
>                     I'd like to pass a configuration file to an OF 1.3 app 
> (perhaps containing information of dpids and corresponding ports). The 
> documentation says I could use "--config-file" to pass a file to an 
> application, but how do I go about creating the file and extracting the 
> contents from the application?  Can I use json/xml?  Perhaps someone can 
> share an example of a config file?
> 
> Thanks,
> Ali
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to