-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Labels
complexity: mediumRequires a substantial but not unusual amount of effort to implementRequires a substantial but not unusual amount of effort to implementnetboxstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application
Milestone
Description
NetBox version
v4.4.0
Feature type
Change to existing functionality
Proposed functionality
Currently the MAC Address view only allows filtering on:
- MAC Address
- Assigned Device
- Assigned VM
This makes searching and filtering through (possibles tens of) thousands of MAC addresses quite a lot.
Additional filtering would be very helpful for searching and using export templates.
I do not believe any model changes are needed, but changes would need to be made to the list view and MACAddressFilterSet
class MACAddressFilterSet(NetBoxModelFilterSet):
mac_address = MultiValueMACAddressFilter()
device = MultiValueCharFilter(
method='filter_device',
field_name='name',
label=_('Device (name)'),
)
device_id = MultiValueNumberFilter(
method='filter_device',
field_name='pk',
label=_('Device (ID)'),
)
virtual_machine = MultiValueCharFilter(
method='filter_virtual_machine',
field_name='name',
label=_('Virtual machine (name)'),
)
virtual_machine_id = MultiValueNumberFilter(
method='filter_virtual_machine',
field_name='pk',
label=_('Virtual machine (ID)'),
)
interface = django_filters.ModelMultipleChoiceFilter(
field_name='interface__name',
queryset=Interface.objects.all(),
to_field_name='name',
label=_('Interface (name)'),
)
interface_id = django_filters.ModelMultipleChoiceFilter(
field_name='interface',
queryset=Interface.objects.all(),
label=_('Interface (ID)'),
)
vminterface = django_filters.ModelMultipleChoiceFilter(
field_name='vminterface__name',
queryset=VMInterface.objects.all(),
to_field_name='name',
label=_('VM interface (name)'),
)
vminterface_id = django_filters.ModelMultipleChoiceFilter(
field_name='vminterface',
queryset=VMInterface.objects.all(),
label=_('VM interface (ID)'),
)
Use case
| Filter | Use Case |
|---|---|
Assigned: true/false |
Filtering for only (un)assigned MACs |
Is Primary: true/false |
Show only/do not show primary MAC addresses |
| Parent Device Role | Filter on MAC for switches, firewalls, cameras, etc |
Parent interface connected/Cable: true/false |
Show/don't show MACs assigned to connected/cabled interfaces |
| Parent device tenant or site/location | Show only MACs for a given tenant, site, or location |
Database changes
No response
External dependencies
No response
ifoughal
Metadata
Metadata
Assignees
Labels
complexity: mediumRequires a substantial but not unusual amount of effort to implementRequires a substantial but not unusual amount of effort to implementnetboxstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application