Rizwan Haider | 30b3379 | 2016-08-18 02:11:18 -0400 | [diff] [blame] | 1 | # admin.py - MetroNetworkService Django Admin |
| 2 | |
| 3 | from core.admin import ReadOnlyAwareAdmin |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 4 | from core.admin import XOSBaseAdmin |
Rizwan Haider | 30b3379 | 2016-08-18 02:11:18 -0400 | [diff] [blame] | 5 | from django.contrib import admin |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 6 | from django import forms |
Rizwan Haider | 30b3379 | 2016-08-18 02:11:18 -0400 | [diff] [blame] | 7 | from services.metronetwork.models import * |
| 8 | |
| 9 | |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 10 | class MetroNetworkSystemAdmin(ReadOnlyAwareAdmin): |
| 11 | model = MetroNetworkSystem |
| 12 | verbose_name = "MetroNetwork System" |
| 13 | verbose_name_plural = "MetroNetwork System" |
Rizwan Haider | 30b3379 | 2016-08-18 02:11:18 -0400 | [diff] [blame] | 14 | 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 Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 20 | class 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 | |
| 29 | class NetworkDeviceAdmin(XOSBaseAdmin): |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 30 | verbose_name = "Network Device" |
| 31 | verbose_name_plural = "Network Devices" |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 32 | 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 Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 38 | class NetworkEdgePortAdmin(XOSBaseAdmin): |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 39 | verbose_name = "Network Edge Port" |
| 40 | verbose_name_plural = "Network Edge Ports" |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 41 | 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 Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 47 | class NetworkEdgeToEdgePointConnectionAdmin(XOSBaseAdmin): |
| 48 | verbose_name = "Metro Network E-Line Service" |
| 49 | verbose_name_plural = "Metro Network E-Line Services" |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 50 | 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 Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 56 | class 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 Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 61 | |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 62 | fields = ('id', 'sid', 'type', 'eps', 'adminstate', 'operstate', 'backend_status') |
| 63 | readonly_fields = ('id', 'sid', 'type', 'eps', 'adminstate', 'operstate', 'backend_status') |
Rizwan Haider | 30b3379 | 2016-08-18 02:11:18 -0400 | [diff] [blame] | 64 | |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 65 | class 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 | |
| 74 | admin.site.register(MetroNetworkSystem, MetroNetworkSystemAdmin) |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 75 | admin.site.register(NetworkDevice, NetworkDeviceAdmin) |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 76 | admin.site.register(NetworkEdgePort, NetworkEdgePortAdmin) |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 77 | admin.site.register(NetworkEdgeToEdgePointConnection, NetworkEdgeToEdgePointConnectionAdmin) |
| 78 | admin.site.register(NetworkMultipointToMultipointConnection, NetworkMultipointToMultipointConnectionAdmin) |
| 79 | admin.site.register(NetworkEdgeToMultipointConnection, NetworkEdgeToMultipointConnectionAdmin) |