Matteo Scandolo | 4e0e88c | 2017-08-08 13:05:25 -0700 | [diff] [blame] | 1 | |
| 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 Haider | 51fdb3f | 2016-11-09 18:29:32 -0500 | [diff] [blame] | 17 | from core.admin import XOSBaseAdmin |
| 18 | from django.contrib import admin |
| 19 | from services.vnodlocal.models import * |
| 20 | from django import forms |
| 21 | |
| 22 | class VnodLocalServiceAdmin(XOSBaseAdmin): |
| 23 | verbose_name = "VNOD Local Service" |
| 24 | verbose_name_plural = "VNOD Local Services" |
| 25 | list_display = ('servicehandle', 'portid', 'vlanid', 'administrativeState', 'operstate', 'autoattached') |
| 26 | list_display_links = ('servicehandle', 'portid', 'vlanid', 'administrativeState', 'operstate', 'autoattached') |
| 27 | |
| 28 | fields = ('id', 'servicehandle', 'portid', 'vlanid', 'administrativeState', 'operstate', 'autoattached') |
| 29 | readonly_fields = ('id','autoattached') |
| 30 | |
| 31 | |
| 32 | class VnodLocalSystemAdminForm(forms.ModelForm): |
| 33 | |
| 34 | password = forms.CharField(required=False, widget = forms.PasswordInput(render_value=True)) |
| 35 | |
| 36 | class Meta: |
| 37 | model = VnodLocalSystem |
| 38 | fields = '__all__' |
| 39 | |
| 40 | class VnodLocalSystemAdmin(XOSBaseAdmin): |
| 41 | verbose_name = "VNOD Local System" |
| 42 | verbose_name_plural = "VNOD Local Systems" |
| 43 | form = VnodLocalSystemAdminForm |
| 44 | list_display = ('name', 'administrativeState', 'restUrl', 'username', 'pseudowireprovider', 'networkControllerUrl') |
| 45 | list_display_links = ('name', 'administrativeState', 'restUrl', 'username', 'pseudowireprovider', 'networkControllerUrl') |
| 46 | |
| 47 | fields = ('name', 'administrativeState', 'restUrl', 'username', 'password', 'pseudowireprovider', 'networkControllerUrl') |
| 48 | |
| 49 | class VnodLocalPseudowireConnectorServiceAdmin(XOSBaseAdmin): |
| 50 | verbose_name = "VNOD Local Pseudowire Connector Service" |
| 51 | verbose_name_plural = "VNOD Local Pseudowire Connector Service" |
| 52 | list_display = ('servicehandle', 'internalport', 'pseudowirehandle','vnodlocal', 'administrativeState', 'operstate') |
| 53 | list_display_links = ('servicehandle', 'internalport', 'pseudowirehandle','vnodlocal', 'administrativeState', 'operstate') |
| 54 | |
| 55 | fields = ('servicehandle', 'internalport', 'pseudowirehandle','vnodlocal', 'administrativeState', 'operstate') |
| 56 | readonly_fields = ('vnodlocal', 'operstate', 'pseudowirehandle') |
| 57 | |
| 58 | |
| 59 | admin.site.register(VnodLocalSystem, VnodLocalSystemAdmin) |
| 60 | admin.site.register(VnodLocalService, VnodLocalServiceAdmin) |
| 61 | admin.site.register(VnodLocalPseudowireConnectorService, VnodLocalPseudowireConnectorServiceAdmin) |
| 62 | |
| 63 | |