I am using simple_switch.py from app folder as

{noformat}
ryu-manager ryu/app/simple_switch.py
{noformat}

I want to use the functions from the file ryu/topology/api.py inside
simple_switch.py above.

If I try to use it inside __init__ function fo SimpleSwitch class as below

{noformat}
   def __init__(self, *args, **kwargs):
        super(SimpleSwitch, self).__init__(*args, **kwargs)
        self.mac_to_port = {}
        s_list = get_all_switch(app_manager)
{noformat}

I get the following error.

{noformat}
loading app ryu/app/simple_switch.py
loading app ryu.controller.ofp_handler
instantiating app ryu.controller.ofp_handler of OFPHandler
instantiating app ryu/app/simple_switch.py of SimpleSwitch
Traceback (most recent call last):
  File "/usr/local/bin/ryu-manager", line 9, in <module>
    load_entry_point('ryu==3.8', 'console_scripts', 'ryu-manager')()
  File "/usr/local/lib/python2.7/dist-packages/ryu/cmd/manager.py", line
73, in main
    services.extend(app_mgr.instantiate_apps(**contexts))
  File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
line 434, in instantiate_apps
    self._instantiate(app_name, cls, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
line 420, in _instantiate
    app = cls(*args, **kwargs)
  File "/home/karthik/Projects/ryu/ryu/app/simple_switch.py", line 35, in
__init__
    s_list = get_all_switch(app_manager)
NameError: global name 'get_all_switch' is not defined
{noformat}

My questions are as follows.

1) Can I get the topology information about my mininet topology using
                               - get_all_switch() and
                               - get_all_link()  defined in
ryu/topology/api.py?

2) If yes,Why isn't the code above not working as expected?

Thanks & Regards,
Karthik.
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to