1 # Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
19 1. Join switches (use your favorite method):
20 $ sudo mn --controller remote --topo tree,depth=3
22 2. Run this application:
23 $ PYTHONPATH=. ./bin/ryu run \
24 --observe-links ryu/app/gui_topology/gui_topology.py
26 3. Access http://<ip address of ryu host>:8080 with your web browser.
31 from webob.static import DirectoryApp
33 from ryu.app.wsgi import ControllerBase, WSGIApplication, route
34 from ryu.base import app_manager
37 PATH = os.path.dirname(__file__)
40 # Serving static files
41 class GUIServerApp(app_manager.RyuApp):
43 'wsgi': WSGIApplication,
46 def __init__(self, *args, **kwargs):
47 super(GUIServerApp, self).__init__(*args, **kwargs)
50 wsgi.register(GUIServerController)
53 class GUIServerController(ControllerBase):
54 def __init__(self, req, link, data, **config):
55 super(GUIServerController, self).__init__(req, link, data, **config)
56 path = "%s/html/" % PATH
57 self.static_app = DirectoryApp(path)
58 #agregado para buscar otra ruta
59 @route('topology', '/{filename:[^/]*}')
60 def static_handler(self, req, **kwargs):
61 if kwargs['filename']:
62 req.path_info = kwargs['filename']
63 return self.static_app(req)
66 app_manager.require_app('ryu.app.rest_topology')
67 app_manager.require_app('ryu.app.ws_topology')
68 app_manager.require_app('ryu/app/ofctl_rest.py') ##aqui cambie los puntos por slash/
69 app_manager.require_app('ryu/app/simple_switch_13.py') #Agregue esta linea, Felix