Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4867 multiple mac addresses #17902

Open
wants to merge 54 commits into
base: feature
Choose a base branch
from
Open

Conversation

bctiemann
Copy link
Contributor

@bctiemann bctiemann commented Oct 30, 2024

Closes: #17902

This PR changes the mac_address of an Interface or VMInterface from a simple model field to a many-to-one relationship with a new MACAddress model. This allows many MAC addresses to be associated with a single Interface or VMInterface (with one optionally designated is_primary).

The "MAC Addresses" pageset is grouped under Devices -> Device Components.

Interfaces and VMInterfaces now show an inline table for creation of associated MACAddress objects:

Screenshot 2024-11-05 at 1 43 19 PM

There is a data migration which converts existing mac_address values to concrete MACAddress objects. There is also now a mac_address property on both Interface and VMInterface which reflects the value of the primary (or only) MACAddress associated with the interface, preserving backward compatibility for querying and display.

Filtering by mac_address works as before, acting on the related object's mac_address field.

Note: bulk create of Interfaces and VMInterfaces via POST will create associated MACAddress objects; but bulk edit of those same objects with mac_address specified in the payload is not supported. This is consistent with preexisting unit test coverage of bulk create and edit operations in test_views.py modules; however this is an area for potential future refinement.

@bctiemann bctiemann self-assigned this Oct 30, 2024
@bctiemann bctiemann marked this pull request as draft October 30, 2024 20:03
@jeremystretch jeremystretch added this to the v4.2 milestone Oct 30, 2024
@bctiemann bctiemann marked this pull request as ready for review November 1, 2024 15:26
@jeremystretch jeremystretch self-requested a review November 7, 2024 16:43
docs/models/dcim/interface.md Outdated Show resolved Hide resolved
docs/models/virtualization/vminterface.md Outdated Show resolved Hide resolved
netbox/dcim/models/devices.py Outdated Show resolved Hide resolved
netbox/dcim/models/devices.py Outdated Show resolved Hide resolved
netbox/dcim/models/devices.py Outdated Show resolved Hide resolved
netbox/templates/dcim/interface.html Outdated Show resolved Hide resolved
netbox/templates/dcim/macaddress.html Show resolved Hide resolved
netbox/templates/dcim/macaddress.html Outdated Show resolved Hide resolved
netbox/templates/dcim/macaddress_bulk_add.html Outdated Show resolved Hide resolved
netbox/dcim/forms/model_forms.py Outdated Show resolved Hide resolved
netbox/dcim/api/serializers_/device_components.py Outdated Show resolved Hide resolved
netbox/dcim/migrations/0199_macaddress.py Outdated Show resolved Hide resolved
netbox/dcim/migrations/0199_macaddress.py Outdated Show resolved Hide resolved
netbox/dcim/migrations/0199_macaddress.py Outdated Show resolved Hide resolved
netbox/dcim/filtersets.py Outdated Show resolved Hide resolved
netbox/dcim/graphql/types.py Show resolved Hide resolved
netbox/dcim/models/device_components.py Outdated Show resolved Hide resolved
netbox/virtualization/api/serializers_/virtualmachines.py Outdated Show resolved Hide resolved
netbox/dcim/tests/test_filtersets.py Outdated Show resolved Hide resolved
netbox/dcim/forms/model_forms.py Outdated Show resolved Hide resolved
@jeremystretch jeremystretch self-assigned this Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants