ofp_event: add a function to find Event class for given OFP class

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
YAMAMOTO Takashi 2014-03-26 13:04:19 +09:00 committed by FUJITA Tomonori
parent a4a77546d8
commit 5f57cfd16a

View File

@ -40,8 +40,12 @@ def _ofp_msg_name_to_ev_name(msg_name):
def ofp_msg_to_ev(msg):
name = _ofp_msg_name_to_ev_name(msg.__class__.__name__)
return _OFP_MSG_EVENTS[name](msg)
return ofp_msg_to_ev_cls(msg.__class__)(msg)
def ofp_msg_to_ev_cls(msg_cls):
name = _ofp_msg_name_to_ev_name(msg_cls.__name__)
return _OFP_MSG_EVENTS[name]
def _create_ofp_msg_ev_class(msg_cls):