I have found same problem when I use rest_topology and ws_topology.
And this patch fixed it.

(2014/05/29 13:40), Yoshihiro Kaneko wrote:
> For example, app-A has app-X in CONTEXTS, and app-B depends on app-X as
> SERVICE.  When app-B is specified in the app-lists before app-A, the
> instantiating app-X fails by an assertion.
> 
> $ PYTHONPATH=. bin/ryu-manager ryu.app.quantum_adapter ryu.app.gre_tunnel
> loading app ryu.app.quantum_adapter
> loading app ryu.app.gre_tunnel
> loading app ryu.controller.dpset
> loading app ryu.controller.ofp_handler
> loading app ryu.controller.ofp_handler
> loading app ryu.controller.ofp_handler
> instantiating app None of QuantumIfaces
> creating context quantum_ifaces
> instantiating app None of ConfSwitchSet
> creating context conf_switch
> instantiating app None of Network
> creating context network
> instantiating app None of Tunnels
> creating context tunnels
> instantiating app None of DPSet
> creating context dpset
> instantiating app ryu.app.gre_tunnel of GRETunnel
> instantiating app ryu.controller.dpset of DPSet
> Traceback (most recent call last):
>    File "/opt/stack/ryu/bin/ryu-manager", line 19, in <module>
>      main()
>    File "/opt/stack/ryu/ryu/cmd/manager.py", line 77, in main
>      services.extend(app_mgr.instantiate_apps(**contexts))
>    File "/opt/stack/ryu/ryu/base/app_manager.py", line 434, in 
> instantiate_apps
>      self._instantiate(app_name, cls, *args, **kwargs)
>    File "/opt/stack/ryu/ryu/base/app_manager.py", line 421, in _instantiate
>      register_app(app)
>    File "/opt/stack/ryu/ryu/base/app_manager.py", line 50, in register_app
>      assert app.name not in SERVICE_BRICKS
> AssertionError
> 
> This patch avoid the double loading of app in context and service.
> 
> Signed-off-by: Yoshihiro Kaneko <[email protected]>
> ---
>   ryu/base/app_manager.py |   11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
> index 25b043a..f97a923 100644
> --- a/ryu/base/app_manager.py
> +++ b/ryu/base/app_manager.py
> @@ -344,6 +344,11 @@ class AppManager(object):
>           while len(app_lists) > 0:
>               app_cls_name = app_lists.pop(0)
>   
> +            context_modules = map(lambda x: x.__module__,
> +                                  self.contexts_cls.values())
> +            if app_cls_name in context_modules:
> +                continue
> +
>               LOG.info('loading app %s', app_cls_name)
>   
>               cls = self.load_app(app_cls_name)
> @@ -356,19 +361,19 @@ class AppManager(object):
>               for key, context_cls in cls.context_iteritems():
>                   v = self.contexts_cls.setdefault(key, context_cls)
>                   assert v == context_cls
> +                context_modules.append(context_cls.__module__)
>   
>                   if issubclass(context_cls, RyuApp):
>                       services.extend(get_dependent_services(context_cls))
>   
>               # we can't load an app that will be initiataed for
>               # contexts.
> -            context_modules = map(lambda x: x.__module__,
> -                                  self.contexts_cls.values())
>               for i in get_dependent_services(cls):
>                   if i not in context_modules:
>                       services.append(i)
>               if services:
> -                app_lists.extend(services)
> +                app_lists.extend([s for s in set(services)
> +                                  if s not in app_lists])
>   
>       def create_contexts(self):
>           for key, cls in self.contexts_cls.items():
> 


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to