class IPAddressFilterForm(BootstrapMixin, CustomFieldFilterForm): model = IPAddress q = forms.CharField(required=False, label='Search') parent = forms.CharField(required=False, label='Parent Prefix', widget=forms.TextInput(attrs={ 'placeholder': 'Prefix', })) family = forms.ChoiceField(required=False, choices=IP_FAMILY_CHOICES, label='Address family') mask_length = forms.ChoiceField(required=False, choices=IPADDRESS_MASK_LENGTH_CHOICES, label='Mask length') vrf = FilterChoiceField( queryset=VRF.objects.annotate(filter_count=Count('ip_addresses')), to_field_name='rd', label='VRF', null_label='-- Global --') tenant = FilterChoiceField( queryset=Tenant.objects.annotate(filter_count=Count('ip_addresses')), to_field_name='slug', null_label='-- None --') status = AnnotatedMultipleChoiceField(choices=IPADDRESS_STATUS_CHOICES, annotate=IPAddress.objects.all(), annotate_field='status', required=False) role = AnnotatedMultipleChoiceField(choices=IPADDRESS_ROLE_CHOICES, annotate=IPAddress.objects.all(), annotate_field='role', required=False)
class VirtualMachineFilterForm(BootstrapMixin, CustomFieldFilterForm): model = VirtualMachine q = forms.CharField(required=False, label='Search') cluster_group = FilterChoiceField(queryset=ClusterGroup.objects.all(), to_field_name='slug', null_label='-- None --') cluster_type = FilterChoiceField(queryset=ClusterType.objects.all(), to_field_name='slug', null_label='-- None --') cluster_id = FilterChoiceField(queryset=Cluster.objects.annotate( filter_count=Count('virtual_machines')), label='Cluster') site = FilterChoiceField(queryset=Site.objects.annotate( filter_count=Count('clusters__virtual_machines')), to_field_name='slug', null_label='-- None --') role = FilterChoiceField(queryset=DeviceRole.objects.filter( vm_role=True).annotate(filter_count=Count('virtual_machines')), to_field_name='slug', null_label='-- None --') status = AnnotatedMultipleChoiceField( choices=VM_STATUS_CHOICES, annotate=VirtualMachine.objects.all(), annotate_field='status', required=False) tenant = FilterChoiceField(queryset=Tenant.objects.annotate( filter_count=Count('virtual_machines')), to_field_name='slug', null_label='-- None --') platform = FilterChoiceField(queryset=Platform.objects.annotate( filter_count=Count('virtual_machines')), to_field_name='slug', null_label='-- None --')
class VLANFilterForm(BootstrapMixin, CustomFieldFilterForm): model = VLAN q = forms.CharField(required=False, label='Search') site = FilterChoiceField( queryset=Site.objects.annotate(filter_count=Count('vlans')), to_field_name='slug', null_label='-- Global --' ) group_id = FilterChoiceField( queryset=VLANGroup.objects.annotate(filter_count=Count('vlans')), label='VLAN group', null_label='-- None --' ) tenant = FilterChoiceField( queryset=Tenant.objects.annotate(filter_count=Count('vlans')), to_field_name='slug', null_label='-- None --' ) status = AnnotatedMultipleChoiceField( choices=VLAN_STATUS_CHOICES, annotate=VLAN.objects.all(), annotate_field='status', required=False ) role = FilterChoiceField( queryset=Role.objects.annotate(filter_count=Count('vlans')), to_field_name='slug', null_label='-- None --' )
class CircuitFilterForm(BootstrapMixin, CustomFieldFilterForm): model = Circuit q = forms.CharField(required=False, label='Search') type = FilterChoiceField( queryset=CircuitType.objects.annotate(filter_count=Count('circuits')), to_field_name='slug' ) provider = FilterChoiceField( queryset=Provider.objects.annotate(filter_count=Count('circuits')), to_field_name='slug' ) status = AnnotatedMultipleChoiceField( choices=CIRCUIT_STATUS_CHOICES, annotate=Circuit.objects.all(), annotate_field='status', required=False ) tenant = FilterChoiceField( queryset=Tenant.objects.annotate(filter_count=Count('circuits')), to_field_name='slug', null_label='-- None --' ) site = FilterChoiceField( queryset=Site.objects.annotate(filter_count=Count('circuit_terminations')), to_field_name='slug' ) commit_rate = forms.IntegerField(required=False, min_value=0, label='Commit rate (Kbps)')
class PrefixFilterForm(BootstrapMixin, CustomFieldFilterForm): model = Prefix q = forms.CharField(required=False, label='Search') within_include = forms.CharField(required=False, label='Search within', widget=forms.TextInput(attrs={ 'placeholder': 'Prefix', })) family = forms.ChoiceField( required=False, choices=IP_FAMILY_CHOICES, label='Address family') mask_length = forms.ChoiceField( required=False, choices=PREFIX_MASK_LENGTH_CHOICES, label='Mask length') vrf = FilterChoiceField( queryset=VRF.objects.annotate(filter_count=Count('prefixes')), to_field_name='rd', label='VRF', null_label='-- Global --' ) tenant = FilterChoiceField( queryset=Tenant.objects.annotate(filter_count=Count('prefixes')), to_field_name='slug', null_label='-- None --' ) status = AnnotatedMultipleChoiceField( choices=PREFIX_STATUS_CHOICES, annotate=Prefix.objects.all(), annotate_field='status', required=False ) site = FilterChoiceField( queryset=Site.objects.annotate(filter_count=Count('prefixes')), to_field_name='slug', null_label='-- None --' ) role = FilterChoiceField( queryset=Role.objects.annotate(filter_count=Count('prefixes')), to_field_name='slug', null_label='-- None --' ) expand = forms.BooleanField( required=False, label='Expand prefix hierarchy')