From d00268a6feb2fb2407306de16b502af3f31258a1 Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Tue, 14 May 2013 11:13:33 +0900 Subject: 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 > from ryu.base.app_manager import AppManager > File "/opt/stack/ryu/ryu/base/app_manager.py", line 22, in > from ryu.controller.handler import register_instance > File "/opt/stack/ryu/ryu/controller/handler.py", line 20, in > from ryu.controller import ofp_event > File "/opt/stack/ryu/ryu/controller/ofp_event.py", line 69, in > for ofp_mods in ofproto.get_ofp_module(): > TypeError: get_ofp_module() takes exactly 1 argument (0 given) Reported-by: YAMAMOTO Takashi Signed-off-by: Isaku Yamahata Signed-off-by: FUJITA Tomonori --- 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 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. -- cgit v1.2.3