Hi Markku, Thank you for your report! Great! I've not found it out!
As you said, if ofctl_rest is loaded or instantiated "before" gui_topology, I could call the APIs of ofctl_rest, $ PYTHONPATH=. ryu-manager --observe-links ryu.app.ofctl_rest ryu.app.gui_topology.gui_topology Registered VCS backend: git Registered VCS backend: hg Registered VCS backend: svn Registered VCS backend: bzr loading app ryu.app.ofctl_rest # <--- loaded before gui_topology loading app ryu.app.gui_topology.gui_topology loading app ryu.controller.ofp_handler loading app ryu.app.ofctl_rest loading app ryu.app.rest_topology loading app ryu.app.ws_topology loading app ryu.controller.ofp_handler instantiating app None of DPSet creating context dpset creating context wsgi instantiating app None of Switches creating context switches instantiating app ryu.app.ofctl_rest of RestStatsApi instantiating app ryu.app.gui_topology.gui_topology of GUIServerApp instantiating app ryu.app.rest_topology of TopologyAPI instantiating app ryu.controller.ofp_handler of OFPHandler instantiating app ryu.app.ws_topology of WebSocketTopology (26069) wsgi starting up on http://0.0.0.0:8080 (26069) accepted ('127.0.0.1', 60672) 127.0.0.1 - - [19/May/2017 15:21:23] "GET /stats/flow/1 HTTP/1.1" 200 409 0.021489 ... $ curl -X GET http://localhost:8080/stats/flow/1 {"1": [{"packet_count": 73, "priority": 65535, "byte_count": 4380, "duration_sec": 2, "idle_timeout": 0, "actions": ["OUTPUT:CONTROLLER"], "cookie": 0, "flags": 0, "table_id": 0, "match": {"dl_type": 35020, "dl_dst": "01:80:c2:00:00:0e"}, "hard_timeout": 0, "duration_nsec": 47000000, "length": 96}]} OTOH, if "after" gui_topology, I could NOT call them, although the command is the same! $ PYTHONPATH=. ryu-manager --observe-links ryu.app.ofctl_rest ryu.app.gui_topology.gui_topology Registered VCS backend: git Registered VCS backend: hg Registered VCS backend: svn Registered VCS backend: bzr loading app ryu.app.ofctl_rest loading app ryu.app.gui_topology.gui_topology loading app ryu.controller.ofp_handler loading app ryu.app.ws_topology loading app ryu.app.ofctl_rest loading app ryu.app.rest_topology loading app ryu.controller.ofp_handler creating context wsgi instantiating app None of Switches creating context switches instantiating app None of DPSet creating context dpset instantiating app ryu.app.ws_topology of WebSocketTopology instantiating app ryu.app.gui_topology.gui_topology of GUIServerApp instantiating app ryu.app.ofctl_rest of RestStatsApi instantiating app ryu.app.rest_topology of TopologyAPI instantiating app ryu.controller.ofp_handler of OFPHandler (26373) wsgi starting up on http://0.0.0.0:8080 (26373) accepted ('127.0.0.1', 34958) 127.0.0.1 - - [19/May/2017 15:31:03] "GET /stats/flow/1 HTTP/1.1" 404 341 0.018494 ... $ curl -X GET http://localhost:8080/stats/flow/1 <html> <head> <title>404 Not Found</title> </head> <body> <h1>404 Not Found</h1> The resource could not be found.<br /><br /> <!-- /home/iwase/ryu/ryu/app/gui_topology/html/stats/flow/1 --> </body> </html> Very dirty codes and not enough though, the following fixes this problem. $ git diff diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py index f684259..ef20d4a 100644 --- a/ryu/base/app_manager.py +++ b/ryu/base/app_manager.py @@ -505,8 +505,15 @@ class AppManager(object): return app def instantiate_apps(self, *args, **kwargs): + # HACK: Because gui_topology will register itself to interrupt all + # REST calls, instantiate it later. + gui_topology = self.applications_cls.pop( + 'ryu.app.gui_topology.gui_topology', None) for app_name, cls in self.applications_cls.items(): self._instantiate(app_name, cls, *args, **kwargs) + if gui_topology: + self._instantiate('ryu.app.gui_topology.gui_topology', + gui_topology, *args, **kwargs) self._update_bricks() self.report_bricks() Thanks, Iwase On 2017年05月18日 21:08, Markku Savela wrote: > When loading multiple modules with ryu_manager, then the order of > modules in command line ("loading app ryu.app...") does not always match > the order of instantiations ("instantiating app ryu.app...."). > > This causes problems with modules like "gui_topology" which match all > paths. The rest api of any module instantiated *after* gui_topology will > not work. > > [this was the problem with my earlier issue of ofctl_rest not working, > moving that module front helped... (but qos_rest_router stopped working...)] > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Ryu-devel mailing list > Ryu-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ryu-devel > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel