Hello everyone i need some help for load a costume script:
i picked the script in this link
(http://osrg.github.io/ryu-book/en/html/rest_api.html), but from the last
version of ryu book and i want to use it for import my script.
I have made this changing, but doesn’t work because for it my module doesn’t
exist, and it can’t import
SimpleSwitchRest13.py
...
from ryu.app import simple_switch_13
>from ryu.app import my_demo
class SimpleSwitchRest13(simple_switch_13.SimpleSwitch13)
>class SimpleSwitchRest13(my_demo.Main)
…..
my_demo.py
…
class SimpleSwitch13(app_manager.RyuApp):
>class Main(app_manager.RyuApp):
def __init__(self, *args, **kwargs):
super(SimpleSwitch13, self).__init__(*args, **kwargs)
>super(Main, self).__init__(*args, **kwargs)
self.mac_to_port = {}
…
This is the output when i try to lunch SimpleSwitchRest13.py
(ryu_venv)ubuntu@ubuntu-VirtualBox:~/Desktop/ryu/ryu/app$ ryu-manager --verbose
SimpleSwitchRest13.py
loading app SimpleSwitchRest13.py
Traceback (most recent call last):
File "/home/ubuntu/Desktop/ryu_venv/bin/ryu-manager", line 9, in <module>
load_entry_point('ryu==4.8.1', 'console_scripts', 'ryu-manager')()
File
"/home/ubuntu/Desktop/ryu_venv/local/lib/python2.7/site-packages/ryu/cmd/manager.py",
line 88, in main
app_mgr.load_apps(app_lists)
File
"/home/ubuntu/Desktop/ryu_venv/local/lib/python2.7/site-packages/ryu/base/app_manager.py",
line 415, in load_apps
cls = self.load_app(app_cls_name)
File
"/home/ubuntu/Desktop/ryu_venv/local/lib/python2.7/site-packages/ryu/base/app_manager.py",
line 392, in load_app
mod = utils.import_module(name)
File
"/home/ubuntu/Desktop/ryu_venv/local/lib/python2.7/site-packages/ryu/utils.py",
line 116, in import_module
mod = importlib.import_module(name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/ubuntu/Desktop/ryu/ryu/app/SimpleSwitchRest13.py", line 13, in
<module>
class SimpleSwitchRest13(simple_switch_13.Main):
AttributeError: 'module' object has no attribute 'Main'
I think that is all, i don’t understand why the name of module in my_demo must
be SimpleSwitch13 and not Main or what_i_want.
Thank you for an answer.
Luca Spinazzè
------------------------------------------------------------------------------
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