Virtual machine interfaces API endpoint does not allow filtering by multiple MAC addresses #3129

Closed
opened 2025-12-29 18:25:57 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Jan 7, 2020).

Environment

  • Python version: 3.6.8
  • NetBox version: 2.6.11

Steps to Reproduce

  1. Create two interfaces on virtual machines with the MAC addresses 00:00:00:00:00:01 and 00:00:00:00:00:02
  2. Make a request for GET /api/virtualization/interfaces/?mac_address=00:00:00:00:00:01&mac_address=00:00:00:00:00:02

Expected Behavior

Both interfaces should be returned. This works as expected on the DCIM interfaces endpoint (/api/dcim/interfaces/).

Observed Behavior

Only the second interface (with MAC address 00:00:00:00:00:02) is returned.

This happens because the mac_address filter on the virtualization InterfaceFilter is not a MultiValueMACAddressFilter:

class InterfaceFilter(django_filters.FilterSet):
    ...
    mac_address = django_filters.CharFilter(
        method='_mac_address',
        label='MAC address',
    )
Originally created by @jeremystretch on GitHub (Jan 7, 2020). ### Environment * Python version: 3.6.8 * NetBox version: 2.6.11 ### Steps to Reproduce 1. Create two interfaces on virtual machines with the MAC addresses `00:00:00:00:00:01` and `00:00:00:00:00:02` 2. Make a request for `GET /api/virtualization/interfaces/?mac_address=00:00:00:00:00:01&mac_address=00:00:00:00:00:02` ### Expected Behavior Both interfaces should be returned. This works as expected on the DCIM interfaces endpoint (`/api/dcim/interfaces/`). ### Observed Behavior Only the second interface (with MAC address `00:00:00:00:00:02`) is returned. This happens because the `mac_address` filter on the virtualization InterfaceFilter is not a MultiValueMACAddressFilter: ``` class InterfaceFilter(django_filters.FilterSet): ... mac_address = django_filters.CharFilter( method='_mac_address', label='MAC address', ) ```
adam added the type: bugstatus: accepted labels 2025-12-29 18:25:57 +01:00
adam closed this issue 2025-12-29 18:25:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3129