Simplify setting/updating primary MAC through interface model. #10854

Open
opened 2025-12-29 21:36:45 +01:00 by adam · 5 comments
Owner

Originally created by @Andres1357 on GitHub (Mar 5, 2025).

NetBox version

v4.2.4

Feature type

Change to existing functionality

Proposed functionality

Hello! I'd like to see the ability to set & update the primary MAC address in one step through actions on the interface (or VM interface) model directly. See related discussion #18807. This proposal relates to both GUI & API.

GUI

Change the interface creation & update request processing to create/update/delete MAC address models in the background once we hit submit on the form. Something like this:

  1. Create/update interface
  2. Create/update MAC assigned to new/updated interface
  3. Update interface to set the MAC as primary.

I think the "quick add" MAC address mini form could remain (minus the interface selection) but the related request wouldn't happen until after hitting submit on the main form.

API

Add a similar behind-the-scenes workflow when handling a request on dcim.interface or virtualization.vminterface that basically does the same as above.

Use case

The majority of interfaces have only one MAC so I think ease of use for that use case is important. Unfortunately, the new MAC address model additions make it a little harder to manage this.

The current GUI workflow for managing interfaces & primary MACs is not smooth when creating new interfaces. The MAC "quick add" function does not allow assigning the new MAC to the new interface you are creating (because the MAC is created before the interface exists). The "quick add" works fine when updating existing interfaces to add a primary MAC.

The fastest existing process is:

  1. Create new interface without a MAC
  2. Edit the interface
    a. "Quick add" a primary MAC (now defaults to assigning it to this interface)
    b. Save interface with new MAC

When using the API, the fastest existing process is:

  1. Create interface object without a MAC.
  2. Create MAC address object w/ assigned interface ID.
  3. Update interface to set the MAC address as primary.

I'm essentially suggesting that these steps be put under the hood to allow for a single-request experience as it was before v4.2.

Thanks for any consideration or ideas.

Database changes

No response

External dependencies

No response

Originally created by @Andres1357 on GitHub (Mar 5, 2025). ### NetBox version v4.2.4 ### Feature type Change to existing functionality ### Proposed functionality Hello! I'd like to see the ability to set & update the primary MAC address in one step through actions on the interface (or VM interface) model directly. See related discussion #18807. This proposal relates to both GUI & API. ### GUI Change the interface creation & update request processing to create/update/delete MAC address models in the background once we hit submit on the form. Something like this: 1. Create/update interface 2. Create/update MAC assigned to new/updated interface 3. Update interface to set the MAC as primary. I think the "quick add" MAC address mini form could remain (minus the interface selection) but the related request wouldn't happen until after hitting submit on the main form. ### API Add a similar behind-the-scenes workflow when handling a request on `dcim.interface` or `virtualization.vminterface` that basically does the same as above. ### Use case The majority of interfaces have only one MAC so I think ease of use for that use case is important. Unfortunately, the new MAC address model additions make it a little harder to manage this. The current GUI workflow for managing interfaces & primary MACs is not smooth when creating new interfaces. The MAC "quick add" function does not allow assigning the new MAC to the new interface you are creating (because the MAC is created before the interface exists). The "quick add" works fine when updating existing interfaces to add a primary MAC. The fastest existing process is: 1. Create new interface without a MAC 2. Edit the interface a. "Quick add" a primary MAC (now defaults to assigning it to this interface) b. Save interface with new MAC When using the API, the fastest existing process is: 1. Create interface object without a MAC. 2. Create MAC address object w/ assigned interface ID. 3. Update interface to set the MAC address as primary. I'm essentially suggesting that these steps be put under the hood to allow for a single-request experience as it was before `v4.2`. Thanks for any consideration or ideas. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurestatus: needs ownercomplexity: mediumnetbox labels 2025-12-29 21:36:45 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (Jul 24, 2025):

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] commented on GitHub (Jul 24, 2025): 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](https://github.com/netbox-community/netbox/blob/main/CONTRIBUTING.md).
Author
Owner

@bitcollector1 commented on GitHub (Sep 5, 2025):

It's not easy to update the mac address via API. It seems to me that there is no way to set the "is_primary" from mac_addresses, when creating a new mac.

After creating the mac address, I had to make a call to the interface and set the mac and make it primary.

I can do it all in 1 step from the bulk import, so something seems off.

@bitcollector1 commented on GitHub (Sep 5, 2025): It's not easy to update the mac address via API. It seems to me that there is no way to set the "is_primary" from mac_addresses, when creating a new mac. After creating the mac address, I had to make a call to the interface and set the mac and make it primary. I can do it all in 1 step from the bulk import, so something seems off.
Author
Owner

@jeremystretch commented on GitHub (Sep 8, 2025):

@bitcollector1 would you like to volunteer to own this issue?

@jeremystretch commented on GitHub (Sep 8, 2025): @bitcollector1 would you like to volunteer to own this issue?
Author
Owner

@bitcollector1 commented on GitHub (Sep 8, 2025):

@bitcollector1 would you like to volunteer to own this issue?

I don't think I'd be the best person to handle something like this, but I will make an effort to follow the fix/solution to try and learn.

@bitcollector1 commented on GitHub (Sep 8, 2025): > [@bitcollector1](https://github.com/bitcollector1) would you like to volunteer to own this issue? I don't think I'd be the best person to handle something like this, but I will make an effort to follow the fix/solution to try and learn.
Author
Owner

@ifoughal commented on GitHub (Oct 30, 2025):

Actually this could be done in 2 steps:

  • create the interface object.
  • create the mac address object & set is_primary: true
@ifoughal commented on GitHub (Oct 30, 2025): Actually this could be done in 2 steps: - create the interface object. - create the mac address object & set `is_primary: true`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10854