netbox icon indicating copy to clipboard operation
netbox copied to clipboard

Quickadd MAC address created when adding an interface can not be saves/set as primary

Open Domoninic opened this issue 1 year ago • 10 comments

Deployment Type

Self-hosted

NetBox Version

V4.2.5

Python Version

3.12

Steps to Reproduce

1: Add Interface to existing Device 2: Use quickadd widget to create new primary mac address ~3: set new mac address a primary~ 4 Save new interface

Expected Behavior

Save should work and newly create MAC should be assigned to new interface and set as primary.

Observed Behavior

Saving the new interface fails with error on field Primary MAC address "MAC address XX:XX:XX:XX:XX:XX is not assigned to this interface". While creating the MAC address it is not possible to assign it to the new interface as that does not yet exist. One must first save the interface then edit it and use the quick add to create the MAC as assigned to the interface and then save it. Seems to be a chicken and egg problem.

Domoninic avatar Mar 12 '25 12:03 Domoninic

This topic is also covered in other reports and discussions: https://github.com/netbox-community/netbox/issues/18787 https://github.com/netbox-community/netbox/discussions/18807 https://github.com/netbox-community/netbox/issues/18821

tomasz-c avatar Mar 12 '25 14:03 tomasz-c

3: set new mac address a primary

How are you doing this? There is no option to designate the MAC address as primary on the form.

Further the MAC address can't be assigned to the interface until the interface has been created.

jeremystretch avatar Apr 09 '25 19:04 jeremystretch

3: set new mac address a primary

How are you doing this? There is no option to designate the MAC address as primary on the form.

Further the MAC address can't be assigned to the interface until the interface has been created.

After clicking create in the "Quick Add MAC Address" the new MAC address is automatically filled in.

Domoninic avatar Apr 10 '25 08:04 Domoninic

I'm not sure what you're looking at. NetBox itself does not automatically populate any of the fields. Maybe your browser is auto filling the form.

But my question stands: How are you marking the MAC as primary before it is created? There is currently no option for this.

Please review your reproduction steps.

jeremystretch avatar Apr 10 '25 11:04 jeremystretch

Step 2:

Image

Image

Step 3 'Primary MAC Address' is automatically filled:

Image

This behavior is with both edge and firefox with all auto fill options off and clearing autofill form data.

Step 4:

Image

Domoninic avatar Apr 10 '25 11:04 Domoninic

Ok, so #3 in your instructions isn't a separate step, hence my confusion.

I don't see how this was ever intended to work for creating a new interface. It's a chicken-and-egg problem: The MAC address can't be assigned to the interface as the interface has not yet been created, and the interface can't be created with a primary MAC that isn't assigned to it.

jeremystretch avatar Apr 10 '25 12:04 jeremystretch

I've noticed this issue as well. I understand it was caused by introduction of multiple mac address feature. In my opinion there should be a way to add a device with single MAC address(which is likely majority of devices) as it used to be all along. Having to go through the same edit dialog second time just to add the MAC address wastes a lot of time. Can't understate how confusing it is (given that it is a recent change) and every member of my team went through it scratching their head.

How about disabling validation on the 'Primary MAC address' field, letting the user enter any mac, and if it doesn't exist then create the MAC address and assign it automatically? Or perhaps you could put a 'Add new MAC address' in the /add/ form what would open a MAC text field.

tokkyuuressha avatar Apr 30 '25 13:04 tokkyuuressha

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

github-actions[bot] avatar Jul 30 '25 04:07 github-actions[bot]

Bulk updating/adding MAC addresses was a feature from issue #2733 that was previously implemented.

Currently (v4.3.6) when creating a new interface on an existing device there is an option to add a Primary MAC (which fails with the above error). I would think it's possible to take ownership of the unassigned MAC and create MAC address objects to assign to the remaining ports if interfaces are being bulk created. The bulk edit should also be able to do something similar.

jlundstrom avatar Aug 21 '25 15:08 jlundstrom

@jlundstrom would you like to volunteer to implement this feature request?

jeremystretch avatar Aug 21 '25 16:08 jeremystretch