srikanth | 116e6e8 | 2014-08-19 07:22:37 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2013 Big Switch Networks, Inc. |
| 3 | # |
| 4 | # Licensed under the Eclipse Public License, Version 1.0 (the |
| 5 | # "License"); you may not use this file except in compliance with the |
| 6 | # License. You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.eclipse.org/legal/epl-v10.html |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 13 | # implied. See the License for the specific language governing |
| 14 | # permissions and limitations under the License. |
| 15 | # |
| 16 | |
| 17 | # Views for the application |
| 18 | # |
| 19 | |
| 20 | from django.shortcuts import render_to_response |
| 21 | from sdncon.apploader import AppLoader, AppLister |
| 22 | from sdncon.controller.models import Switch |
| 23 | import os |
| 24 | |
| 25 | def bsc_app_init(): |
| 26 | # By default, App Name is the same as directory name. Change if needed. |
| 27 | APP_NAME = os.path.dirname(__file__).split("/")[-1] |
| 28 | |
| 29 | # Create the App. Parameters are |
| 30 | # - Name: the id, lowercase letters only |
| 31 | # - Label: Human readable discription for the menu to the left |
| 32 | # - Priority: determines ranking the menu to the left), One-line description |
| 33 | # - Description: One line description of the app |
| 34 | app = AppLister(APP_NAME, "Controller Stats", 5, "Controller Stats") |
| 35 | |
| 36 | # Add Tabs. Parameters are: |
| 37 | # - Name: the id, lowercase letters only |
| 38 | # - Label: Human readable discription for the menu to the left |
| 39 | # - View: name of the python function that contains the django view (see below) |
| 40 | app.addTab("openflow_graphs", "OpenFlow Graphs", flow_graphs_view) |
| 41 | app.addTab("system_graphs", "System Graphs", system_stats_graph_view) |
| 42 | AppLoader.addApp(app) |
| 43 | |
| 44 | def system_stats_graph_view(request): |
| 45 | return render_to_response('apps/cstats/templates/graphs.html', {} ) |
| 46 | |
| 47 | def flow_graphs_view(request): |
| 48 | return render_to_response('apps/cstats/templates/openflowgraphs.html', {} ) |
| 49 | |