blob: d6e67ce3608e0f45bfe91b7b2211712a46660dc5 [file] [log] [blame]
Matteo Scandolofcf842e2017-08-08 13:05:25 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
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 implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Rizwan Haider30b33792016-08-18 02:11:18 -040017# admin.py - MetroNetworkService Django Admin
18
19from core.admin import ReadOnlyAwareAdmin
Rizwan Haidereb2cc772016-09-08 12:14:55 -040020from core.admin import XOSBaseAdmin
Rizwan Haider30b33792016-08-18 02:11:18 -040021from django.contrib import admin
Rizwan Haidereb2cc772016-09-08 12:14:55 -040022from django import forms
Rizwan Haider30b33792016-08-18 02:11:18 -040023from services.metronetwork.models import *
24
25
Rizwan Haider65baf552016-09-28 16:47:28 -040026class MetroNetworkSystemAdmin(ReadOnlyAwareAdmin):
27 model = MetroNetworkSystem
28 verbose_name = "MetroNetwork System"
29 verbose_name_plural = "MetroNetwork System"
Rizwan Haider30b33792016-08-18 02:11:18 -040030 list_display = ("name", "administrativeState")
31 list_display_links = ('name',)
32 fieldsets = [(None, {
33 'fields': ['name', 'administrativeState', 'description'],
34 'classes': ['suit-tab suit-tab-general']})]
35
Rizwan Haidereb2cc772016-09-08 12:14:55 -040036class NetworkDeviceAdminForm(forms.ModelForm):
37
38 password = forms.CharField(required=False, widget = forms.PasswordInput(render_value=True))
39
40 class Meta:
41 model = NetworkDevice
42 fields = '__all__'
43
44
45class NetworkDeviceAdmin(XOSBaseAdmin):
Rizwan Haider65baf552016-09-28 16:47:28 -040046 verbose_name = "Network Device"
47 verbose_name_plural = "Network Devices"
Rizwan Haidereb2cc772016-09-08 12:14:55 -040048 form = NetworkDeviceAdminForm
49 list_display = ('id', 'restCtrlUrl', 'administrativeState', 'username')
50 list_display_links = ('id', 'restCtrlUrl', 'administrativeState', 'username')
51
52 fields = ('id', 'restCtrlUrl', 'administrativeState', 'username', 'password')
53
Rizwan Haidereb2cc772016-09-08 12:14:55 -040054class NetworkEdgePortAdmin(XOSBaseAdmin):
Rizwan Haider65baf552016-09-28 16:47:28 -040055 verbose_name = "Network Edge Port"
56 verbose_name_plural = "Network Edge Ports"
Rizwan Haidereb2cc772016-09-08 12:14:55 -040057 list_display = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir', 'name', 'location', 'latlng')
58 list_display_links = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir')
59
60 fields = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir', 'name', 'location', 'latlng')
61 readonly_fields = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir')
62
Rizwan Haider65baf552016-09-28 16:47:28 -040063class NetworkEdgeToEdgePointConnectionAdmin(XOSBaseAdmin):
64 verbose_name = "Metro Network E-Line Service"
65 verbose_name_plural = "Metro Network E-Line Services"
Rizwan Haidere6ffdc02016-11-08 13:43:48 -050066 list_display = ('id', 'name', 'sid', 'type', 'vlanid', 'uni1', 'uni2', 'adminstate', 'operstate')
67 list_display_links = ('id', 'name', 'sid', 'type', 'vlanid', 'uni1', 'uni2', 'adminstate', 'operstate')
Rizwan Haidereb2cc772016-09-08 12:14:55 -040068
Rizwan Haidere6ffdc02016-11-08 13:43:48 -050069 fields = ('id', 'name', 'sid', 'type', 'vlanid', 'uni1', 'uni2', 'adminstate', 'operstate', 'backend_status')
70 readonly_fields = ('id', 'sid', 'backend_status')
Rizwan Haidereb2cc772016-09-08 12:14:55 -040071
Rizwan Haider65baf552016-09-28 16:47:28 -040072class NetworkMultipointToMultipointConnectionAdmin(XOSBaseAdmin):
73 verbose_name = "Metro Network E-LAN Service"
74 verbose_name_plural = "Metro Network E-LAN Services"
Rizwan Haidere6ffdc02016-11-08 13:43:48 -050075 list_display = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate')
76 list_display_links = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate')
Rizwan Haidereb2cc772016-09-08 12:14:55 -040077
Rizwan Haidere6ffdc02016-11-08 13:43:48 -050078 fields = ('id', 'name', 'sid', 'type', 'vlanid', 'eps', 'adminstate', 'operstate', 'backend_status')
79 readonly_fields = ('id', 'sid', 'backend_status')
Rizwan Haider30b33792016-08-18 02:11:18 -040080
Rizwan Haider65baf552016-09-28 16:47:28 -040081class NetworkEdgeToMultipointConnectionAdmin(XOSBaseAdmin):
82 verbose_name = "Metro Network E-Tree Service"
83 verbose_name_plural = "Metro Network E-Tree Services"
Rizwan Haidere6ffdc02016-11-08 13:43:48 -050084 list_display = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate')
85 list_display_links = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate')
Rizwan Haider65baf552016-09-28 16:47:28 -040086
Rizwan Haidere6ffdc02016-11-08 13:43:48 -050087 fields = ('id', 'name', 'sid', 'type', 'vlanid', 'root', 'eps', 'adminstate', 'operstate', 'backend_status')
88 readonly_fields = ('id', 'sid', 'backend_status')
89
90class RemotePortAdmin(XOSBaseAdmin):
91 verbose_name = "Remote Port"
92 verbose_name_plural = "Remote Ports"
93 list_display = ('name', 'remoteportsite', 'edgeport')
94 list_display_links = ('name', 'remoteportsite', 'edgeport')
95
96 fields = ('name', 'remoteportsite', 'edgeport')
97
98class BandwidthProfileAdmin(XOSBaseAdmin):
99 verbose_name = "Bandwidth Profile"
100 verbose_name_plural = "Bandwidth Profiles"
101 list_display = ('bwpcfgcbs', 'bwpcfgebs', 'bwpcfgcir', 'bwpcfgeir', 'name')
102 list_display_links = ('bwpcfgcbs', 'bwpcfgebs', 'bwpcfgcir', 'bwpcfgeir', 'name')
103
104 fields = ('bwpcfgcbs', 'bwpcfgebs', 'bwpcfgcir', 'bwpcfgeir', 'name')
105
106class ServiceSpokeAdmin(XOSBaseAdmin):
107 verbose_name = "Service Spoke"
108 verbose_name_plural = "Service Spokes"
109 list_display = ('name','vnodlocalsite', 'remotesubscriber', 'adminstate', 'operstate', 'autoattached')
110 list_display_links = ('name','vnodlocalsite', 'remotesubscriber', 'adminstate', 'operstate', 'autoattached')
111
112 fields = ('name', 'id','vnodlocalsite', 'vnodlocalport', 'remotesubscriber', 'adminstate', 'operstate', 'backend_status', 'autoattached')
113 readonly_fields = ('id', 'remotesubscriber', 'adminstate', 'operstate', 'backend_status')
114
115class VnodGlobalServiceAdmin(XOSBaseAdmin):
116 verbose_name = "VNOD Global Service"
117 verbose_name_plural = "VNOD Global Services"
118 list_display = ('servicehandle', 'vlanid', 'type','operstate', 'adminstate')
119 list_display_links = ('servicehandle', 'vlanid', 'type','operstate', 'adminstate')
120
121 fields = (
122 'id', 'servicehandle', 'vlanid', 'type', 'metronetworkmultipoint', 'metronetworkpointtopoint', 'metronetworkroottomultipoint', 'operstate', 'adminstate', 'spokes', 'bandwidthProfile')
123 readonly_fields = (
124 'id', 'operstate', 'backend_status', 'metronetworkmultipoint', 'metronetworkpointtopoint', 'metronetworkroottomultipoint')
Rizwan Haider65baf552016-09-28 16:47:28 -0400125
126admin.site.register(MetroNetworkSystem, MetroNetworkSystemAdmin)
Rizwan Haidereb2cc772016-09-08 12:14:55 -0400127admin.site.register(NetworkDevice, NetworkDeviceAdmin)
Rizwan Haidereb2cc772016-09-08 12:14:55 -0400128admin.site.register(NetworkEdgePort, NetworkEdgePortAdmin)
Rizwan Haider65baf552016-09-28 16:47:28 -0400129admin.site.register(NetworkEdgeToEdgePointConnection, NetworkEdgeToEdgePointConnectionAdmin)
130admin.site.register(NetworkMultipointToMultipointConnection, NetworkMultipointToMultipointConnectionAdmin)
131admin.site.register(NetworkEdgeToMultipointConnection, NetworkEdgeToMultipointConnectionAdmin)
Rizwan Haidere6ffdc02016-11-08 13:43:48 -0500132admin.site.register(BandwidthProfile, BandwidthProfileAdmin)
133admin.site.register(ServiceSpoke, ServiceSpokeAdmin)
134admin.site.register(VnodGlobalService, VnodGlobalServiceAdmin)
135admin.site.register(RemotePort, RemotePortAdmin)
136
137
138
139