From 5f57cfd16aa541f55c246ff5d1dfb7c3bd8c208c Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 26 Mar 2014 13:04:19 +0900 Subject: [PATCH] ofp_event: add a function to find Event class for given OFP class Signed-off-by: YAMAMOTO Takashi Signed-off-by: FUJITA Tomonori --- ryu/controller/ofp_event.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ryu/controller/ofp_event.py b/ryu/controller/ofp_event.py index 2175e50a..43e7113b 100644 --- a/ryu/controller/ofp_event.py +++ b/ryu/controller/ofp_event.py @@ -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):