Hey Toshihiro and Iwase,

Thanks for useful suggestion. 
I fixed this problem by adding some codes into ryu/base/app_manager.py.
Here is my modification. Very dirty but useful. 
Reference: 
https://www.mail-archive.com/ryu-devel@lists.sourceforge.net/msg13533.html


$ git diff 1c0080 ryu/base/app_manager.py
diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
index f684259..016c38c 100644
--- a/ryu/base/app_manager.py
+++ b/ryu/base/app_manager.py
@@ -505,8 +505,19 @@ 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_cls = 'gui_topology'
+        for applications_cls in self.applications_cls.keys():
+            if applications_cls.find('gui_topology') != -1:
+                gui_cls = applications_cls
+                break
+        gui_topology = self.applications_cls.pop(
+            gui_cls, None)
         for app_name, cls in self.applications_cls.items():
             self._instantiate(app_name, cls, *args, **kwargs)
+        if gui_topology:
+            self._instantiate(gui_cls, gui_topology, *args, **kwargs)
         self._update_bricks()
         self.report_bricks()


Thanks,
Lam




At 2018-05-09 08:16:33, "Iwase Yusuke" <iwase.yusu...@gmail.com> wrote:
>Hi,
>
>Excuse me for jumping in.
>
>This issue hits this bug?
>https://www.mail-archive.com/ryu-devel@lists.sourceforge.net/msg13533.html
>
>"gui_topology" seems to cover all wsgi routes, then other wsgi apps can not
>register their methods.
>
>Thanks,
>Iwase
>
>
>On 2018年05月08日 17:31, IWAMOTO Toshihiro wrote:
>> 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?
>> 
>>> Is it a bug? Is there anyone can help me?
>> 
>> Sounds like an import issue. Please check your error messages for any
>> import errors. And also double check you are actually importing
>> the intended files. It is possible files under /usr/lib/python or so
>> are imported unintentionally.
>> 
>> 
>> --
>> IWAMOTO Toshihiro
>> ------------------------------------------------------------------------------
>> 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

Reply via email to