AddrFormatError when setting invalid interface MAC address via the API #2014

Closed
opened 2025-12-29 17:21:30 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Sep 18, 2018).

Environment

  • Python version: 3.5.2
  • NetBox version: 2.4.4

Steps to Reproduce

  1. Attempt to set an invalid MAC address on an interface using the following API request:
curl -X PATCH \
-H "Authorization: Token <TOKEN>" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
http://localhost:8000/api/dcim/interfaces/<PK>/ \
--data '{"mac_address": "01234567890123456789"}'

Expected Behavior

The API should return a validation error, as 01234567890123456789 is too long to be a valid EUI-48 address.

Observed Behavior

An unhandled AddrFormatError exception is raised.

Originally created by @jeremystretch on GitHub (Sep 18, 2018). ### Environment * Python version: 3.5.2 * NetBox version: 2.4.4 ### Steps to Reproduce 1. Attempt to set an invalid MAC address on an interface using the following API request: ``` curl -X PATCH \ -H "Authorization: Token <TOKEN>" \ -H "Content-Type: application/json" \ -H "Accept: application/json; indent=4" \ http://localhost:8000/api/dcim/interfaces/<PK>/ \ --data '{"mac_address": "01234567890123456789"}' ``` ### Expected Behavior The API should return a validation error, as `01234567890123456789` is too long to be a valid EUI-48 address. ### Observed Behavior An unhandled `AddrFormatError` exception is raised.
adam added the type: bugstatus: accepted labels 2025-12-29 17:21:30 +01:00
adam closed this issue 2025-12-29 17:21:30 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2014