blob: 6aae88bb0b4efe7527f9c550735562279bef25ed [file] [log] [blame]
Rizwan Haider30b33792016-08-18 02:11:18 -04001# admin.py - MetroNetworkService Django Admin
2
3from core.admin import ReadOnlyAwareAdmin
Rizwan Haidereb2cc772016-09-08 12:14:55 -04004from core.admin import XOSBaseAdmin
Rizwan Haider30b33792016-08-18 02:11:18 -04005from django.contrib import admin
Rizwan Haidereb2cc772016-09-08 12:14:55 -04006from django import forms
Rizwan Haider30b33792016-08-18 02:11:18 -04007from services.metronetwork.models import *
8
9
Rizwan Haider65baf552016-09-28 16:47:28 -040010class MetroNetworkSystemAdmin(ReadOnlyAwareAdmin):
11 model = MetroNetworkSystem
12 verbose_name = "MetroNetwork System"
13 verbose_name_plural = "MetroNetwork System"
Rizwan Haider30b33792016-08-18 02:11:18 -040014 list_display = ("name", "administrativeState")
15 list_display_links = ('name',)
16 fieldsets = [(None, {
17 'fields': ['name', 'administrativeState', 'description'],
18 'classes': ['suit-tab suit-tab-general']})]
19
Rizwan Haidereb2cc772016-09-08 12:14:55 -040020class NetworkDeviceAdminForm(forms.ModelForm):
21
22 password = forms.CharField(required=False, widget = forms.PasswordInput(render_value=True))
23
24 class Meta:
25 model = NetworkDevice
26 fields = '__all__'
27
28
29class NetworkDeviceAdmin(XOSBaseAdmin):
Rizwan Haider65baf552016-09-28 16:47:28 -040030 verbose_name = "Network Device"
31 verbose_name_plural = "Network Devices"
Rizwan Haidereb2cc772016-09-08 12:14:55 -040032 form = NetworkDeviceAdminForm
33 list_display = ('id', 'restCtrlUrl', 'administrativeState', 'username')
34 list_display_links = ('id', 'restCtrlUrl', 'administrativeState', 'username')
35
36 fields = ('id', 'restCtrlUrl', 'administrativeState', 'username', 'password')
37
Rizwan Haidereb2cc772016-09-08 12:14:55 -040038class NetworkEdgePortAdmin(XOSBaseAdmin):
Rizwan Haider65baf552016-09-28 16:47:28 -040039 verbose_name = "Network Edge Port"
40 verbose_name_plural = "Network Edge Ports"
Rizwan Haidereb2cc772016-09-08 12:14:55 -040041 list_display = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir', 'name', 'location', 'latlng')
42 list_display_links = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir')
43
44 fields = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir', 'name', 'location', 'latlng')
45 readonly_fields = ('id', 'pid', 'element', 'bwpCfgCbs', 'bwpCfgEbs', 'bwpCfgCir', 'bwpCfgEir')
46
Rizwan Haider65baf552016-09-28 16:47:28 -040047class NetworkEdgeToEdgePointConnectionAdmin(XOSBaseAdmin):
48 verbose_name = "Metro Network E-Line Service"
49 verbose_name_plural = "Metro Network E-Line Services"
Rizwan Haidereb2cc772016-09-08 12:14:55 -040050 list_display = ('id', 'sid', 'type', 'uni1', 'uni2', 'adminstate', 'operstate')
51 list_display_links = ('id', 'sid', 'type', 'uni1', 'uni2', 'adminstate', 'operstate')
52
53 fields = ('id', 'sid', 'type', 'uni1', 'uni2', 'adminstate', 'operstate', 'backend_status')
54 readonly_fields = ('id', 'type', 'uni1', 'uni2', 'operstate', 'backend_status')
55
Rizwan Haider65baf552016-09-28 16:47:28 -040056class NetworkMultipointToMultipointConnectionAdmin(XOSBaseAdmin):
57 verbose_name = "Metro Network E-LAN Service"
58 verbose_name_plural = "Metro Network E-LAN Services"
59 list_display = ('id', 'sid', 'type', 'adminstate', 'operstate')
60 list_display_links = ('id', 'sid', 'type', 'adminstate', 'operstate')
Rizwan Haidereb2cc772016-09-08 12:14:55 -040061
Rizwan Haider65baf552016-09-28 16:47:28 -040062 fields = ('id', 'sid', 'type', 'eps', 'adminstate', 'operstate', 'backend_status')
63 readonly_fields = ('id', 'sid', 'type', 'eps', 'adminstate', 'operstate', 'backend_status')
Rizwan Haider30b33792016-08-18 02:11:18 -040064
Rizwan Haider65baf552016-09-28 16:47:28 -040065class NetworkEdgeToMultipointConnectionAdmin(XOSBaseAdmin):
66 verbose_name = "Metro Network E-Tree Service"
67 verbose_name_plural = "Metro Network E-Tree Services"
68 list_display = ('id', 'sid', 'type', 'adminstate', 'operstate')
69 list_display_links = ('id', 'sid', 'type', 'adminstate', 'operstate')
70
71 fields = ('id', 'sid', 'type', 'root', 'eps', 'adminstate', 'operstate', 'backend_status')
72 readonly_fields = ('id', 'sid', 'type', 'root', 'eps', 'adminstate', 'operstate', 'backend_status')
73
74admin.site.register(MetroNetworkSystem, MetroNetworkSystemAdmin)
Rizwan Haidereb2cc772016-09-08 12:14:55 -040075admin.site.register(NetworkDevice, NetworkDeviceAdmin)
Rizwan Haidereb2cc772016-09-08 12:14:55 -040076admin.site.register(NetworkEdgePort, NetworkEdgePortAdmin)
Rizwan Haider65baf552016-09-28 16:47:28 -040077admin.site.register(NetworkEdgeToEdgePointConnection, NetworkEdgeToEdgePointConnectionAdmin)
78admin.site.register(NetworkMultipointToMultipointConnection, NetworkMultipointToMultipointConnectionAdmin)
79admin.site.register(NetworkEdgeToMultipointConnection, NetworkEdgeToMultipointConnectionAdmin)