This patch fixes the following exception.

ryu/controller/ofp_event.py: update
cd /opt/stack/ryu && /opt/stack/ryu/bin/ryu-mana ^Mger --config-file 
/etc/ryu/ryu.conf || touch "/opt/stack/status/stack/ryu.failur ^Me"
> Traceback (most recent call last):
>   File "/opt/stack/ryu/bin/ryu-manager", line 41, in <module>
>     from ryu.base.app_manager import AppManager
>   File "/opt/stack/ryu/ryu/base/app_manager.py", line 22, in <module>
>     from ryu.controller.handler import register_instance
>   File "/opt/stack/ryu/ryu/controller/handler.py", line 20, in <module>
>     from ryu.controller import ofp_event
>   File "/opt/stack/ryu/ryu/controller/ofp_event.py", line 69, in <module>
>     for ofp_mods in ofproto.get_ofp_module():
> TypeError: get_ofp_module() takes exactly 1 argument (0 given)

Reported-by: YAMAMOTO Takashi <[email protected]>
Signed-off-by: Isaku Yamahata <[email protected]>
---
 ryu/controller/ofp_event.py |    7 +++----
 ryu/ofproto/__init__.py     |    7 +++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ryu/controller/ofp_event.py b/ryu/controller/ofp_event.py
index d76e2cd..566b834 100644
--- a/ryu/controller/ofp_event.py
+++ b/ryu/controller/ofp_event.py
@@ -57,16 +57,15 @@ def _create_ofp_msg_ev_class(msg_cls):
     _OFP_MSG_EVENTS[name] = cls
 
 
-def _create_ofp_msg_ev_from_module(modname):
-    mod = utils.import_module(modname)
+def _create_ofp_msg_ev_from_module(ofp_praser):
     # print mod
-    for _k, cls in inspect.getmembers(mod, inspect.isclass):
+    for _k, cls in inspect.getmembers(ofp_parser, inspect.isclass):
         if not hasattr(cls, 'cls_msg_type'):
             continue
         _create_ofp_msg_ev_class(cls)
 
 
-for ofp_mods in ofproto.get_ofp_module():
+for ofp_mods in ofproto.get_ofp_modules().values():
     ofp_parser = ofp_mods[1]
     # print 'loading module %s' % ofp_parser
     _create_ofp_msg_ev_from_module(ofp_parser)
diff --git a/ryu/ofproto/__init__.py b/ryu/ofproto/__init__.py
index 6eec046..90ead38 100644
--- a/ryu/ofproto/__init__.py
+++ b/ryu/ofproto/__init__.py
@@ -43,6 +43,13 @@ for parser_file_name in _OFPROTO_PARSER_FILE_NAMES:
     _OFPROTO_MODULES[consts_mod.OFP_VERSION] = (consts_mod, parser_mod)
 
 
+def get_ofp_modules():
+    """get modules pair for the constants and parser of OF-wire of
+    a given OF version.
+    """
+    return _OFPROTO_MODULES
+
+
 def get_ofp_module(ofp_version):
     """get modules pair for the constants and parser of OF-wire of
     a given OF version.
-- 
1.7.10.4


------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to