blob: d112dc6cf55288e449b8d3635e2c38539dccb593 [file] [log] [blame]
srikanth116e6e82014-08-19 07:22:37 -07001#
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
17import django.views.generic.simple, os, coreui.models
18from django.conf.urls.defaults import *
19from django.contrib import admin
20from apploader import AppLoader
21
22admin.autodiscover()
23
24urlpatterns = patterns('',
25 # Example:
26 # (r'^sdncon/', include('sdncon.foo.urls')),
27
28 # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
29 # to INSTALLED_APPS to enable admin documentation:
30 #(r'^admin/doc/', include('django.contrib.admindocs.urls')),
31
32 ###################################
33 # Views for the web UI
34 ###################################
35 (r'^$', 'sdncon.ui.views.index'),
36 (r'ui/show_switch', 'sdncon.ui.views.show_switch'),
37 (r'ui/show_host', 'sdncon.ui.views.show_host'),
38 (r'ui/show_link', 'sdncon.ui.views.show_link'),
39 (r'ui/show_tunnel', 'sdncon.ui.views.show_tunnel'),
40 (r'ui/build_topology', 'sdncon.ui.views.build_topology'),
srikanth116e6e82014-08-19 07:22:37 -070041 # Uncomment the next line to enable the admin:
42 (r'^admin/', include(admin.site.urls)),
43 (r'accounts/login/$', 'django.contrib.auth.views.login'),
44 (r'logout/$', 'django.contrib.auth.views.logout'),
45 (r'password_change/$', 'django.contrib.auth.views.password_change'),
46 (r'password_change_done/$', 'django.contrib.auth.views.password_change_done'),
47 (r'token/?$', 'sdncon.clusterAdmin.views.token_view'),
48 (r'token_generate/?$', 'sdncon.clusterAdmin.views.token_generate'),
49
50 ###################################
51 # Views that implement the REST API
52 ###################################
53 (r'^rest/v1/data/?$', 'sdncon.rest.views.do_user_data_list'),
54 (r'^rest/v1/data/(?P<name>[A-Za-z0-9_:./=;\-]+)/$', 'sdncon.rest.views.do_user_data'),
55
56 # APIs to get tenant info and build type
57 (r'^rest/v1/customer/?$', 'sdncon.clusterAdmin.views.session_clusterAdmin'),
58 (r'^rest/v1/personality/?$', 'sdncon.clusterAdmin.views.get_node_personality'),
59
60 # REST API to access statistics counters from sdnplatform
61 (r'^rest/v1/realtimestats/counter/categories/(?P<dpid>[A-Za-z0-9_:.\-]+)/(?P<stattype>[A-Za-z0-9_:.\-]+)/(?P<layer>[0-9])/?$', 'sdncon.rest.views.do_sdnplatform_counter_categories'),
62 (r'^rest/v1/realtimestats/counter/(?P<stattype>[A-Za-z0-9_:.\-]+)/?$', 'sdncon.rest.views.do_sdnplatform_realtimestats'),
63 (r'^rest/v1/realtimestats/counter/(?P<dpid>[A-Za-z0-9_:.\-]+)/(?P<stattype>[A-Za-z]+)/?$', 'sdncon.rest.views.do_sdnplatform_realtimestats'),
64 (r'^rest/v1/realtimestats/(?P<stattype>[A-Za-z]+)/(?P<dpid>[A-Za-z0-9_:./\-]+)/?$', 'sdncon.rest.views.do_realtimestats'),
65 (r'^rest/v1/controller/stats/(?P<stattype>[A-Za-z]+)/?$', 'sdncon.rest.views.do_controller_stats'),
66 (r'^rest/v1/controller/storage/tables/?$', 'sdncon.rest.views.do_controller_storage_table_list'),
67
68 # REST API VNS/device information
69 (r'^rest/v1/device', 'sdncon.rest.views.do_device'),
70 (r'^rest/v1/switches', 'sdncon.rest.views.do_switches'),
71 (r'^rest/v1/links', 'sdncon.rest.views.do_links'),
Fahad Naeem Khan99ce8062014-10-01 11:03:54 -070072 (r'^rest/v1/mastership', 'sdncon.rest.views.do_mastership'),
srikanth116e6e82014-08-19 07:22:37 -070073 (r'^rest/v1/vns/device-interface', 'sdncon.rest.views.do_vns_device_interface'),
74 (r'^rest/v1/vns/interface', 'sdncon.rest.views.do_vns_interface'),
75 (r'^rest/v1/vns/realtimestats/flow/(?P<vnsName>[A-Za-z0-9_:.|\-]+)/?$', 'sdncon.rest.views.do_vns_realtimestats_flow', {'category': 'vns'}),
76 (r'^rest/v1/vns', 'sdncon.rest.views.do_vns'),
77
78 # REST API to access realtime status from sdnplatform
79 (r'^rest/v1/realtimestatus/network/tunnelstatus/all/all/?$', 'sdncon.rest.views.do_topology_tunnel_status'),
80 (r'^rest/v1/realtimestatus/network/tunnelstatus/(?P<srcdpid>[A-Za-z0-9_:.\-]+)/(?P<dstdpid>[A-Za-z0-9_:.\-]+)/?$', 'sdncon.rest.views.do_topology_tunnel_status'),
81 (r'^rest/v1/realtimestatus/network/tunnelverify/(?P<srcdpid>[A-Za-z0-9_:.\-]+)/(?P<dstdpid>[A-Za-z0-9_:.\-]+)/?$', 'sdncon.rest.views.do_topology_tunnel_verify'),
82 (r'^rest/v1/realtimestatus/network/(?P<subcategory>[A-Za-z0-9_:.\-]+)/?$', 'sdncon.rest.views.do_sdnplatform_realtimestatus', {'category': 'network'}),
83
84 # REST API for testing with Explain Packet in realtime
85 (r'^rest/v1/realtimetest/network/(?P<subcategory>[A-Za-z0-9_:.\-]+)/?$', 'sdncon.rest.views.do_sdnplatform_realtimetest', {'category': 'network'}),
86
87 # REST API for accessing controller system information
88 (r'^rest/v1/system/version/?$', 'sdncon.rest.views.do_system_version', {}),
89 (r'^rest/v1/system/interfaces/?$', 'sdncon.rest.views.do_system_inet4_interfaces', {}),
90 (r'^rest/v1/system/uptime/?$', 'sdncon.rest.views.do_system_uptime', {}),
91 (r'^rest/v1/system/clock/utc/?$', 'sdncon.rest.views.do_system_clock', {'local': False}),
92 (r'^rest/v1/system/clock/local/?$', 'sdncon.rest.views.do_system_clock', {'local': True}),
93 (r'^rest/v1/system/timezones/(?P<list_type>[A-Za-z0-9_\-]+)/?$', 'sdncon.rest.views.do_system_time_zone_strings'),
Fahad Naeem Khan99ce8062014-10-01 11:03:54 -070094 (r'^rest/v1/system/controller/?$', 'sdncon.rest.views.do_controller'),
srikanth116e6e82014-08-19 07:22:37 -070095 (r'^rest/v1/system/ha/role/?$', 'sdncon.rest.views.do_local_ha_role'),
96 (r'^rest/v1/system/ha/failback/?$', 'sdncon.rest.views.do_ha_failback'),
97 (r'^rest/v1/system/ha/provision/?$', 'sdncon.rest.views.do_ha_provision'),
98 (r'^rest/v1/system/ha/clustername/?$', 'sdncon.rest.views.do_clustername'),
99 (r'^rest/v1/system/ha/decommission/?$', 'sdncon.rest.views.do_decommission'),
100 (r'^rest/v1/system/ha/decommission-internal/?$', 'sdncon.rest.views.do_decommission_internal'),
101 (r'^rest/v1/system/check-config/?$', 'sdncon.rest.views.do_check_config'),
102 (r'^rest/v1/system/reload/?$', 'sdncon.rest.views.do_reload'),
103 (r'^rest/v1/system/resetbsc/?$', 'sdncon.rest.views.do_resetbsc'),
104 (r'^rest/v1/system/delete-images-passwd/?$', 'sdncon.rest.views.do_delete_images_passwd'),
105 (r'^rest/v1/system/upload-data/?$', 'sdncon.rest.views.do_upload_data'),
106 (r'^rest/v1/system/log/$', 'sdncon.rest.views.do_system_log_list'),
107 (r'^rest/v1/system/log/(?P<log_name>[A-Za-z0-9_\-]+)$', 'sdncon.rest.views.do_system_log'),
108
109 # REST API for upgrades
110 (r'^rest/v1/system/upgrade/extract-image-manifest/?$', 'sdncon.rest.views.do_extract_upgrade_pkg_manifest'),
111 (r'^rest/v1/system/upgrade/image-name/?$', 'sdncon.rest.views.do_get_upgrade_pkg'),
112 (r'^rest/v1/system/upgrade/execute-upgrade-step/?$', 'sdncon.rest.views.do_execute_upgrade_step'),
113 (r'^rest/v1/system/upgrade/cleanup-old-images/?$', 'sdncon.rest.views.do_cleanup_old_pkgs'),
114 (r'^rest/v1/system/upgrade/abort/?$', 'sdncon.rest.views.do_abort_upgrade'),
115
116 # REST API for config rollback
117 (r'^rest/v1/system/rollback/config/?$', 'sdncon.rest.views.do_config_rollback'),
118 (r'^rest/v1/system/rollback/diffconfig/?$', 'sdncon.rest.views.do_diff_config'),
119
120 # Views for the stats REST API
121 (r'^rest/v1/stats/metadata/(?P<cluster>[A-Za-z0-9_:.\-]+)(/(?P<stats_type>[A-Za-z0-9_\-]+))?/?$', 'sdncon.stats.views.do_get_stats_metadata'),
122 (r'^rest/v1/stats/index/(?P<cluster>[A-Za-z0-9_:.\-]+)/(?P<target_type>[A-Za-z0-9_\-]+)/(?P<target_id>[A-Za-z0-9_\:\.\-]+)(/(?P<stats_type>[A-Za-z0-9_\-]+))?/?$', 'sdncon.stats.views.do_get_stats_type_index'),
123 (r'^rest/v1/stats/target/(?P<cluster>[A-Za-z0-9_:.\-]+)/?$', 'sdncon.stats.views.do_get_stats_target_types'),
124 (r'^rest/v1/stats/target/(?P<cluster>[A-Za-z0-9_:.\-]+)/(?P<target_type>[A-Za-z0-9_\-]+)/?$', 'sdncon.stats.views.do_get_stats_targets'),
125 (r'^rest/v1/stats/data/(?P<cluster>[A-Za-z0-9_:.\-]+)/(?P<target_type>[A-Za-z0-9_\-]+)/(?P<target_id>[A-Za-z0-9_\:\.\-]+)/(?P<stats_type>[A-Za-z0-9_\-]+)/?$', 'sdncon.stats.views.do_get_stats'),
126 (r'^rest/v1/stats/data/(?P<cluster>[A-Za-z0-9_:.\-]+)/?$', 'sdncon.stats.views.do_put_stats'),
127 (r'^rest/v1/events/data/(?P<cluster>[A-Za-z0-9_:.\-]+)/(?P<node_id>[A-Za-z0-9_\.\-]+)/?$', 'sdncon.stats.views.do_get_events'),
128 (r'^rest/v1/events/data/(?P<cluster>[A-Za-z0-9_:.\-]+)/?$', 'sdncon.stats.views.do_put_events'),
129
130 # Views for the models
131 (r'^rest/v1/model/(?P<model_name>[A-Za-z0-9_\-]+)(/(?P<id>[A-Za-z0-9_:.\-|]+))?/?$', 'sdncon.rest.views.do_instance'),
132 # Get the model list
133 (r'^rest/v1/model/?$', 'sdncon.rest.views.do_model_list'),
134
135 # Views for the synthesized table
136 (r'^rest/v1/synthetic/(?P<model_name>[A-Za-z0-9_\-]+)(/(?P<id>[A-Za-z0-9_:.\-|]+))?/?$', 'sdncon.rest.views.do_synthetic_instance'),
137
138
139 # REST API for packet tracing
140 (r'^rest/v1/packettrace/?$', 'sdncon.rest.views.do_packettrace'),
141
142 # Views for the coreui (base layout and javascript)
143 (r'^coreui/static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__)+'/coreui','static')}),
144 (r'^coreui/img/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__)+'/coreui','img')}),
145
146 # REST APIs for Performance Monitoring information of SDNPlatform and SDNPlatform
147 (r'^rest/v1/performance-monitor/(?P<type>[A-Za-z0-9_.\-]+)/?$', 'sdncon.rest.views.do_sdnplatform_performance_monitor', {'category':'performance-monitor'}),
148
149 # REST APIs for Internal debugging information of SDNPlatform and SDNPlatform
150 (r'^rest/v1/internal-debugs/(?P<component>[A-Za-z0-9\-]+)/(?P<query>[A-Za-z0-9=:\-]+)?/?$', 'sdncon.rest.views.do_sdnplatform_internal_debugs', {'category':'internal-debugs'}),
151
152 # REST APIs for Event History from SDNPlatform and SDNPlatform
153 (r'^rest/v1/event-history/(?P<evHistName>[A-Za-z0-9\-]+)/(?P<count>[0-9]+)?/?$', 'sdncon.rest.views.do_sdnplatform_event_history', {'category':'event-history'}),
154
155 # REST APIs for displaying the content of Flow Cache in real-time
156 # applName = Application Name (e.g. vns)
157 # applInstName = Application Instance Name (e.g. name of the vns or "all")
158 (r'^rest/v1/flow-cache/(?P<applName>[A-Za-z0-9\-]+)/(?P<applInstName>[A-Za-z0-9:.|\-]+)/(?P<queryType>[A-Za-z0-9\-]+)?/?$', 'sdncon.rest.views.do_flow_cache', {'category':'flow-cache'}),
159 #(r'^rest/v1/flow-cache/(?P<applName>[A-Za-z0-9\-]+)/(?P<applInstName>[A-Za-z0-9:.|\-]+)/(?P<queryType>[A-Za-z0-9\-]+)?/?$', 'sdncon.rest.views.do_local', { 'url' : [ 'flow-cache' ], }),
160
161 # REST APIs for Tunnel manager state from SDNPlatform
162 (r'^rest/v1/tunnel-manager/(?P<dpid>[A-Za-z0-9_:.\-]+)/?$', 'sdncon.rest.views.do_sdnplatform_tunnel_manager'),
163
164 # REST APIs for controller summary statistics
165 (r'^rest/v1/controller/summary$', 'sdncon.rest.views.do_sdnplatform_controller_summary'),
166
167)
168