backing up
[vsorcdistro/.git] / ryu / build / lib.linux-armv7l-2.7 / ryu / app / gui_topology / gui_topology.py
diff --git a/ryu/build/lib.linux-armv7l-2.7/ryu/app/gui_topology/gui_topology.py b/ryu/build/lib.linux-armv7l-2.7/ryu/app/gui_topology/gui_topology.py
new file mode 100644 (file)
index 0000000..9cff8d4
--- /dev/null
@@ -0,0 +1,69 @@
+# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+Usage example
+
+1. Join switches (use your favorite method):
+$ sudo mn --controller remote --topo tree,depth=3
+
+2. Run this application:
+$ PYTHONPATH=. ./bin/ryu run \
+    --observe-links ryu/app/gui_topology/gui_topology.py
+
+3. Access http://<ip address of ryu host>:8080 with your web browser.
+"""
+
+import os
+
+from webob.static import DirectoryApp
+
+from ryu.app.wsgi import ControllerBase, WSGIApplication, route
+from ryu.base import app_manager
+
+
+PATH = os.path.dirname(__file__)
+
+
+# Serving static files
+class GUIServerApp(app_manager.RyuApp):
+    _CONTEXTS = {
+        'wsgi': WSGIApplication,
+    }
+
+    def __init__(self, *args, **kwargs):
+        super(GUIServerApp, self).__init__(*args, **kwargs)
+
+        wsgi = kwargs['wsgi']
+        wsgi.register(GUIServerController)
+
+
+class GUIServerController(ControllerBase):
+    def __init__(self, req, link, data, **config):
+        super(GUIServerController, self).__init__(req, link, data, **config)
+        path = "%s/html/" % PATH
+        self.static_app = DirectoryApp(path)
+ #agregado para buscar otra ruta
+    @route('topology', '/{filename:[^/]*}')
+    def static_handler(self, req, **kwargs):
+        if kwargs['filename']:
+            req.path_info = kwargs['filename']
+        return self.static_app(req)
+
+
+app_manager.require_app('ryu.app.rest_topology')
+app_manager.require_app('ryu.app.ws_topology')
+app_manager.require_app('ryu/app/ofctl_rest.py') ##aqui cambie los puntos por slash/
+app_manager.require_app('ryu/app/simple_switch_13.py') #Agregue esta linea, Felix