Re: [Ryu-devel] 404 error when using ryu gui. Is it a bug?
Brought to you by:
nz_gizmoguy
From: IWAMOTO T. <iw...@va...> - 2018-05-09 02:05:17
|
On Tue, 08 May 2018 19:27:42 +0900, 林佳烁 wrote: > > [1 <text/plain; GBK (base64)>] > 在 2018-05-08 16:31:30,"IWAMOTO Toshihiro" <iw...@va...> 写道: > >On Tue, 08 May 2018 11:39:38 +0900, > >林佳烁 wrote: > >> > >> [1 <multipart/alternative (7bit)>] > >> [1.1 <text/plain; GBK (base64)>] > >> Hi, > >> > >> > >> I want to integrate gui_topology.py which is in ryu/app/gui_topology/ with myapp.py. > >> However, I recieve 404 responses after I add a line of code into a copy version of gui_topology.py in a new folder. > >> > >> > >> My operation to the scripts is as follow: > >> $ cd ~/ryu > >> $ cp -r ryu/app/gui_topology ryu/app/myfolder > >> $ cp ryu/app/simple_switch_13.py ryu/app/myfolder/ > >> Then I add a line of code, " app_manager.require_app(PATH + '/simple_switch_13.py') ", at the bottom of gui_topology.py. > >> $ PYTHONPATH=. ./bin/ryu run ryu/app/myfolder/gui_topology.py --observe-links > >> > >> > >> Then I access http://localhost:8080 with my web browser and I get these reponses in the terminal of the controller. > >> 127.0.0.1 - - [08/May/2018 10:27:34] "GET / HTTP/1.1" 200 515 0.011610 > >> 127.0.0.1 - - [08/May/2018 10:27:34] "GET /ryu.topology.css HTTP/1.1" 200 514 0.000825 > >> (7006) accepted ('127.0.0.1', 51232) > >> 127.0.0.1 - - [08/May/2018 10:27:34] "GET /ryu.topology.js HTTP/1.1" 200 8652 0.003208 > >> 127.0.0.1 - - [08/May/2018 10:27:35] "GET /v1.0/topology/switches HTTP/1.1" 404 319 0.000844 > >> (7006) accepted ('127.0.0.1', 51238) > >> 127.0.0.1 - - [08/May/2018 10:27:35] "GET /v1.0/topology/ws HTTP/1.1" 404 339 0.001272 > >> 127.0.0.1 - - [08/May/2018 10:27:35] "GET /v1.0/topology/links HTTP/1.1" 404 316 0.000961 > >> > >> > >> However, after I rename the folder frome myfolder to gui_topo. It works fine! > > > >Is it gui_topo or gui_topology? > > It is gui_topo. In fact, I have tried to rename the folder differently for several times. Some names can work fine and some can not. > In the example above, gui_topo works fine andmyfolder not. As IWASE-san said, this seems to be a routes issue. I'm not sure how a directory name change affects, but could you try the following patch before copying gui_topology.py? diff --git a/ryu/app/gui_topology/gui_topology.py b/ryu/app/gui_topology/gui_topology.py index ed4857a5..52f42166 100644 --- a/ryu/app/gui_topology/gui_topology.py +++ b/ryu/app/gui_topology/gui_topology.py @@ -56,7 +56,7 @@ class GUIServerController(ControllerBase): path = "%s/html/" % PATH self.static_app = DirectoryApp(path) - @route('topology', '/{filename:.*}') + @route('topology', '/{filename}') def static_handler(self, req, **kwargs): if kwargs['filename']: req.path_info = kwargs['filename'] -- IWAMOTO Toshihiro |