Quickadd MAC address created when adding an interface can not be saves/set as primary
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.
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
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.
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.
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.
Step 2:
Step 3 'Primary MAC Address' is automatically filled:
This behavior is with both edge and firefox with all auto fill options off and clearing autofill form data.
Step 4:
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.
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.
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.
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 would you like to volunteer to implement this feature request?