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 | e6ffdc0 | 2016-11-08 13:43:48 -0500 | [diff] [blame^] | 50 | list_display = ('id', 'name', 'sid', 'type', 'vlanid', 'uni1', 'uni2', 'adminstate', 'operstate') |
| 51 | list_display_links = ('id', 'name', 'sid', 'type', 'vlanid', 'uni1', 'uni2', 'adminstate', 'operstate') |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 52 | |
Rizwan Haider | e6ffdc0 | 2016-11-08 13:43:48 -0500 | [diff] [blame^] | 53 | fields = ('id', 'name', 'sid', 'type', 'vlanid', 'uni1', 'uni2', 'adminstate', 'operstate', 'backend_status') |
| 54 | readonly_fields = ('id', 'sid', 'backend_status') |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 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" |
Rizwan Haider | e6ffdc0 | 2016-11-08 13:43:48 -0500 | [diff] [blame^] | 59 | list_display = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate') |
| 60 | list_display_links = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate') |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 61 | |
Rizwan Haider | e6ffdc0 | 2016-11-08 13:43:48 -0500 | [diff] [blame^] | 62 | fields = ('id', 'name', 'sid', 'type', 'vlanid', 'eps', 'adminstate', 'operstate', 'backend_status') |
| 63 | readonly_fields = ('id', 'sid', '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" |
Rizwan Haider | e6ffdc0 | 2016-11-08 13:43:48 -0500 | [diff] [blame^] | 68 | list_display = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate') |
| 69 | list_display_links = ('id', 'name', 'sid', 'type', 'vlanid', 'adminstate', 'operstate') |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 70 | |
Rizwan Haider | e6ffdc0 | 2016-11-08 13:43:48 -0500 | [diff] [blame^] | 71 | fields = ('id', 'name', 'sid', 'type', 'vlanid', 'root', 'eps', 'adminstate', 'operstate', 'backend_status') |
| 72 | readonly_fields = ('id', 'sid', 'backend_status') |
| 73 | |
| 74 | class RemotePortAdmin(XOSBaseAdmin): |
| 75 | verbose_name = "Remote Port" |
| 76 | verbose_name_plural = "Remote Ports" |
| 77 | list_display = ('name', 'remoteportsite', 'edgeport') |
| 78 | list_display_links = ('name', 'remoteportsite', 'edgeport') |
| 79 | |
| 80 | fields = ('name', 'remoteportsite', 'edgeport') |
| 81 | |
| 82 | class BandwidthProfileAdmin(XOSBaseAdmin): |
| 83 | verbose_name = "Bandwidth Profile" |
| 84 | verbose_name_plural = "Bandwidth Profiles" |
| 85 | list_display = ('bwpcfgcbs', 'bwpcfgebs', 'bwpcfgcir', 'bwpcfgeir', 'name') |
| 86 | list_display_links = ('bwpcfgcbs', 'bwpcfgebs', 'bwpcfgcir', 'bwpcfgeir', 'name') |
| 87 | |
| 88 | fields = ('bwpcfgcbs', 'bwpcfgebs', 'bwpcfgcir', 'bwpcfgeir', 'name') |
| 89 | |
| 90 | class ServiceSpokeAdmin(XOSBaseAdmin): |
| 91 | verbose_name = "Service Spoke" |
| 92 | verbose_name_plural = "Service Spokes" |
| 93 | list_display = ('name','vnodlocalsite', 'remotesubscriber', 'adminstate', 'operstate', 'autoattached') |
| 94 | list_display_links = ('name','vnodlocalsite', 'remotesubscriber', 'adminstate', 'operstate', 'autoattached') |
| 95 | |
| 96 | fields = ('name', 'id','vnodlocalsite', 'vnodlocalport', 'remotesubscriber', 'adminstate', 'operstate', 'backend_status', 'autoattached') |
| 97 | readonly_fields = ('id', 'remotesubscriber', 'adminstate', 'operstate', 'backend_status') |
| 98 | |
| 99 | class VnodGlobalServiceAdmin(XOSBaseAdmin): |
| 100 | verbose_name = "VNOD Global Service" |
| 101 | verbose_name_plural = "VNOD Global Services" |
| 102 | list_display = ('servicehandle', 'vlanid', 'type','operstate', 'adminstate') |
| 103 | list_display_links = ('servicehandle', 'vlanid', 'type','operstate', 'adminstate') |
| 104 | |
| 105 | fields = ( |
| 106 | 'id', 'servicehandle', 'vlanid', 'type', 'metronetworkmultipoint', 'metronetworkpointtopoint', 'metronetworkroottomultipoint', 'operstate', 'adminstate', 'spokes', 'bandwidthProfile') |
| 107 | readonly_fields = ( |
| 108 | 'id', 'operstate', 'backend_status', 'metronetworkmultipoint', 'metronetworkpointtopoint', 'metronetworkroottomultipoint') |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 109 | |
| 110 | admin.site.register(MetroNetworkSystem, MetroNetworkSystemAdmin) |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 111 | admin.site.register(NetworkDevice, NetworkDeviceAdmin) |
Rizwan Haider | eb2cc77 | 2016-09-08 12:14:55 -0400 | [diff] [blame] | 112 | admin.site.register(NetworkEdgePort, NetworkEdgePortAdmin) |
Rizwan Haider | 65baf55 | 2016-09-28 16:47:28 -0400 | [diff] [blame] | 113 | admin.site.register(NetworkEdgeToEdgePointConnection, NetworkEdgeToEdgePointConnectionAdmin) |
| 114 | admin.site.register(NetworkMultipointToMultipointConnection, NetworkMultipointToMultipointConnectionAdmin) |
| 115 | admin.site.register(NetworkEdgeToMultipointConnection, NetworkEdgeToMultipointConnectionAdmin) |
Rizwan Haider | e6ffdc0 | 2016-11-08 13:43:48 -0500 | [diff] [blame^] | 116 | admin.site.register(BandwidthProfile, BandwidthProfileAdmin) |
| 117 | admin.site.register(ServiceSpoke, ServiceSpokeAdmin) |
| 118 | admin.site.register(VnodGlobalService, VnodGlobalServiceAdmin) |
| 119 | admin.site.register(RemotePort, RemotePortAdmin) |
| 120 | |
| 121 | |
| 122 | |
| 123 | |