| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- from django.utils.translation import gettext as _
- from dcim.choices import LinkStatusChoices
- from dcim.models import Interface
- from ipam.models import VLAN
- from netbox.forms import NetBoxModelCSVForm
- from tenancy.models import Tenant
- from utilities.forms import CSVChoiceField, CSVModelChoiceField, SlugField
- from wireless.choices import *
- from wireless.models import *
- __all__ = (
- 'WirelessLANCSVForm',
- 'WirelessLANGroupCSVForm',
- 'WirelessLinkCSVForm',
- )
- class WirelessLANGroupCSVForm(NetBoxModelCSVForm):
- parent = CSVModelChoiceField(
- queryset=WirelessLANGroup.objects.all(),
- required=False,
- to_field_name='name',
- help_text=_('Parent group')
- )
- slug = SlugField()
- class Meta:
- model = WirelessLANGroup
- fields = ('name', 'slug', 'parent', 'description', 'tags')
- class WirelessLANCSVForm(NetBoxModelCSVForm):
- group = CSVModelChoiceField(
- queryset=WirelessLANGroup.objects.all(),
- required=False,
- to_field_name='name',
- help_text=_('Assigned group')
- )
- status = CSVChoiceField(
- choices=WirelessLANStatusChoices,
- help_text='Operational status'
- )
- vlan = CSVModelChoiceField(
- queryset=VLAN.objects.all(),
- required=False,
- to_field_name='name',
- help_text=_('Bridged VLAN')
- )
- tenant = CSVModelChoiceField(
- queryset=Tenant.objects.all(),
- required=False,
- to_field_name='name',
- help_text=_('Assigned tenant')
- )
- auth_type = CSVChoiceField(
- choices=WirelessAuthTypeChoices,
- required=False,
- help_text=_('Authentication type')
- )
- auth_cipher = CSVChoiceField(
- choices=WirelessAuthCipherChoices,
- required=False,
- help_text=_('Authentication cipher')
- )
- class Meta:
- model = WirelessLAN
- fields = (
- 'ssid', 'group', 'status', 'vlan', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description',
- 'comments', 'tags',
- )
- class WirelessLinkCSVForm(NetBoxModelCSVForm):
- status = CSVChoiceField(
- choices=LinkStatusChoices,
- help_text=_('Connection status')
- )
- interface_a = CSVModelChoiceField(
- queryset=Interface.objects.all()
- )
- interface_b = CSVModelChoiceField(
- queryset=Interface.objects.all()
- )
- tenant = CSVModelChoiceField(
- queryset=Tenant.objects.all(),
- required=False,
- to_field_name='name',
- help_text=_('Assigned tenant')
- )
- auth_type = CSVChoiceField(
- choices=WirelessAuthTypeChoices,
- required=False,
- help_text=_('Authentication type')
- )
- auth_cipher = CSVChoiceField(
- choices=WirelessAuthCipherChoices,
- required=False,
- help_text=_('Authentication cipher')
- )
- class Meta:
- model = WirelessLink
- fields = (
- 'interface_a', 'interface_b', 'ssid', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description',
- 'comments', 'tags',
- )
|