Re: [Ryu-devel] Passing config file to Ryu app
Brought to you by:
nz_gizmoguy
From: A S. <asy...@gm...> - 2015-02-13 15:34:37
|
Thanks for the quick reply :) Perhaps I should expound a bit... Below is an example of such a config file I'd like to pass to my ryu application: for each dpid, I'd like to track the associated VLANs allocated on each port (Please use the codepad link below if the format below is messed up). As shown, this config file can change quite a bit and hence reinstalling ryu after every change may not be ideal. Perhaps the "--config-file <fileLocation>" parameter can help? If yes, how would I use it? { "switches" : [ { "dpid" : "b6-ad-fb-ca-08-45", "ports" : [ { "port-number" : 1, "vlans" : [101, 102, 103] }, { "port-number" : 2, "vlans" : [105] } ] } ] } REF(same as above): http://codepad.org/ZvMY9ySy Thanks, Ali On Fri, Feb 13, 2015 at 3:36 AM, Yusuke Iwase <iwa...@gm...> wrote: > 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 > > Ryu...@li... > > https://lists.sourceforge.net/lists/listinfo/ryu-devel > > > |