summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2013-05-14 11:13:33 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-05-14 12:49:30 -0700
commitd00268a6feb2fb2407306de16b502af3f31258a1 (patch)
tree9381350b6111c2ac512301eae91fd887874458ca
parent9d06333da0eaeeca440a4eae728c5dd14d16ba65 (diff)
ofproto: exception during startup related ofp module detaction
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 <yamamoto@valinux.co.jp> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/controller/ofp_event.py7
-rw-r--r--ryu/ofproto/__init__.py7
2 files changed, 10 insertions, 4 deletions
diff --git a/ryu/controller/ofp_event.py b/ryu/controller/ofp_event.py
index d76e2cd9..566b834d 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 6eec0460..90ead385 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.