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>
This commit is contained in:
Isaku Yamahata 2013-05-14 11:13:33 +09:00 committed by FUJITA Tomonori
parent 9d06333da0
commit d00268a6fe
2 changed files with 10 additions and 4 deletions

View File

@ -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)

View File

@ -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.