When registering RyuApps to observers with _EVENTS, it should applied to @set_ev_cls methods, and dispatchers should be honored.
Signed-off-by: Isaku Yamahata <[email protected]> --- ryu/base/app_manager.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py index f285322..3f46dab 100644 --- a/ryu/base/app_manager.py +++ b/ryu/base/app_manager.py @@ -200,19 +200,20 @@ class AppManager(object): for i in SERVICE_BRICKS.values(): for _k, m in inspect.getmembers(i, inspect.ismethod): - if hasattr(m, 'observer'): - # name is module name of ev_cls - name = m.observer.split('.')[-1] - if name in SERVICE_BRICKS: - brick = SERVICE_BRICKS[name] - brick.register_observer(m.ev_cls, i.name, - m.dispatchers) + if not hasattr(m, 'observer'): + continue + + # name is module name of ev_cls + name = m.observer.split('.')[-1] + if name in SERVICE_BRICKS: + brick = SERVICE_BRICKS[name] + brick.register_observer(m.ev_cls, i.name, m.dispatchers) # allow RyuApp and Event class are in different module - if hasattr(m, 'ev_cls'): - for brick in SERVICE_BRICKS.itervalues(): - if m.ev_cls in brick._EVENTS: - brick.register_observer(m.ev_cls, i.name) + for brick in SERVICE_BRICKS.itervalues(): + if m.ev_cls in brick._EVENTS: + brick.register_observer(m.ev_cls, i.name, + m.disptachers) for brick, i in SERVICE_BRICKS.items(): LOG.debug("BRICK %s" % brick) -- 1.7.10.4 ------------------------------------------------------------------------------ Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
