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 web UI |
| 18 | # |
| 19 | |
| 20 | from django.shortcuts import render_to_response, render |
| 21 | from django.utils import simplejson |
| 22 | from django.http import HttpResponse |
| 23 | from django.contrib.auth.decorators import login_required |
| 24 | from django.contrib.auth.models import User |
| 25 | from django.template import RequestContext |
| 26 | from django.template.loader import render_to_string |
| 27 | from sdncon.apploader import AppLoader, AppLister |
| 28 | from sdncon.clusterAdmin.utils import conditionally, isCloudBuild |
| 29 | from sdncon.clusterAdmin.models import Customer, Cluster, CustomerUser |
| 30 | from scripts.showswitch import show_switch_data |
| 31 | from scripts.buildtopology import build_topology_data |
| 32 | from scripts.showlink import show_link_data |
| 33 | from scripts.showtunnel import show_tunnel_data |
| 34 | from scripts.showhost import show_host_data |
| 35 | import os |
| 36 | |
| 37 | |
| 38 | JSON_CONTENT_TYPE = 'application/json' |
| 39 | |
| 40 | # --- View for the root page of any application |
| 41 | def index(request): |
| 42 | return render_to_response('ui/templates/index.html') |
| 43 | |
| 44 | def show_switch(request): |
| 45 | html = show_switch_data(request) |
| 46 | return HttpResponse(html) |
| 47 | |
| 48 | def show_link(request): |
| 49 | html = show_link_data(request) |
| 50 | return HttpResponse(html) |
| 51 | |
| 52 | def show_host(request): |
| 53 | html = show_host_data(request) |
| 54 | return HttpResponse(html) |
| 55 | |
| 56 | def show_tunnel(request): |
| 57 | html = show_tunnel_data(request) |
| 58 | return HttpResponse(html) |
| 59 | |
| 60 | |
| 61 | def build_topology(request): |
| 62 | html = build_topology_data(request) |
| 63 | return HttpResponse(html) |
| 64 | |
| 65 | |
| 66 | |