* feat(dcim): Add VLAN mode filter to CommonInterface
Introduces a new FilterSet for VLAN mode in CommonInterfaceFilterSet.
This allows filtering interfaces based on their VLAN mode using defined
choices.
* feat(dcim): Add VLAN mode filter to Interface FilterForm
Add a field to InterfaceFilterSet to filter interfaces by 802.1Q VLAN
mode.
* feat(virtualization): Add VLAN mode filter to VMInterface
Add a field to VMInterfaceFilterSet to filter interfaces by 802.1Q VLAN
mode.
* fix(dcim): Correct mode filter parameter type in tests
Updates the `mode` filter parameter to accept a list instead of a single
value in `test_filtersets.py`. Ensures proper count assertion for
accurate test behavior.
* feat(virtualization): Add tests for VLAN mode filtering
Introduces tests to validate filtering by `mode` for VMInterface.
Ensures correct filtering for 802.1Q VLAN mode.
* refactor(virtualization): Reorganize FieldSets in FilterSets
Splits the 'Attributes' FieldSet into two distinct FieldSets for better
clarity: 'Attributes' and 'Addressing'. This improves form organization
and makes it more intuitive for users.
* feat(dcim): Add filter by location slug for Device
Introduces a TreeNodeMultipleChoiceFilter for filtering locations by
slug. Enhances filtering flexibility in the Device model by supporting
both ID and slug lookups.
Fixes#19056
* feat(dcim): Add Device filtering by location slug in tests
Extend test cases to include filtering by location slug. Ensures the
FilterSet works correctly with slug-based queries for locations.
Fixes#19056
* Move Module & ModuleType models to a separate file
* Add ModuleTypeProfile & related fields
* Initial work on JSON schema validation
* Add attributes property on ModuleType
* Introduce MultipleOfValidator
* Introduce JSONSchemaProperty
* Enable dynamic form field rendering
* Misc cleanup
* Fix migration conflict
* Ensure deterministic ordering of attriubte fields
* Support choices & default values
* Include module type attributes on module view
* Enable modifying individual attributes via REST API
* Enable filtering by attribute values
* Add documentation & tests
* Schema should be optional
* Include attributes column for profiles
* Profile is nullable
* Include some initial profiles to be installed via migration
* Fix migrations conflict
* Fix filterset test
* Misc cleanup
* Fixes#19023: get_field_value() should respect null values in bound forms (#19024)
* Skip filters which do not specify a JSON-serializable value
* Fix handling of array item types
* Fix initial data in schema field during bulk edit
* Implement sanity checking for JSON schema definitions
* Fall back to filtering by string value
Made DeviceRoles hierarchical, had to also change the filtersets for Device, ConfigContext and VirtualMachine to use the TreeNodeMultipleChoiceFilter.
Note: The model was changed to use NestedGroupModel, a side-effect of this is it also adds comments field, but I thought that was better then doing a one-off just for DeviceRole and having to define the fields, validators, etc.. - keeps everything DRY / consistent.
* 18981 Make Device Roles Hierarchical
* 18981 forms, serializer
* 18981 fix tests
* 18981 fix tests
* 18981 fix tests
* 18981 fix tests
* 18981 fix tests
* 18981 fix migration merge
* 18981 fix tests
* 18981 fix filtersets
* 18981 fix tests
* 18981 comments
* 18981 review changes
- [x] 1. Add the field to the model class
- [x] 2. Generate and run database migrations
- [NA] 3. Add validation logic to clean()
- [NA] 4. Update relevant querysets
- [x] 5. Update API serializer
- [x] 6. Add fields to forms
- [x] dcim.forms.model_forms.LocationForm, create/edit (e.g. model_forms.py)
- [x] dcim.forms.buld_edit.LocationBulkEditForm, bulk edit
- [x] dcim.dorms.bulk_import.LocationImportForm, CSV import
- [x] filter (UI and API)
- [NA] UI
- Note: could not find any comments related things in filtersets
- [x] API
- [x] 7. Extend object filter set
- [x] 8. Add column to object table
- [x] 9. Update the SearchIndex
- [x] 10. Update the UI templates
- [x] 11. Create/extend test cases
- [NA] models
- [x] views
- [NA] forms
- [x] filtersets
- [x] api
- [NA] 12. Update the model's documentation
* Create MACAddress model and migrations to convert existing .mac_address fields to standalone objects
* Add migrations
* All views/filtering working and documentation done; no unit tests yet
* Redo migrations following VLAN Translation
* Remove mac_address filter fields and add table columns for device/vm
* Remove unnecessary "bulk rename"
* Fix filterset tests for Device
* Fix filterset tests for Interface
* Fix tests on single-object forms
* Fix serializer tests
* Fix filterset tests for VMInterface
* Fix filterset tests for Device and VirtualMachine
* Move new field check into lookup_map iteration
* Fix general MACAddress filter tests
* Add GraphQL types/filters/schema
* Fix bulk edit/create tests (bulk editing Interfaces will be unsupported because of inheritance from ComponentBulkEditForm)
* Make mac_address read_only on InterfaceSerializer/VMInterfaceSerializer
* Undo unrelated work
* Cleanup unused IPAddress derived stuff
* API endpoints
* Add serializer objects to interface serializers
* Clean up unnecessary bulk create forms/views/routes
* Add SearchIndex and adjust indexable fields for Interface and VMInterface
* Reorganize MACAddress classes out of association with DeviceComponents
* Move MACAddressSerializer
* Enforce saving only a single is_primary MACAddress per interface/vminterface
* Perform is_primary validation on MACAddress model and just check if one already exists for the interface
* Remove form-level validation
* Fix check for current is_primary setting when reassigning
* Model cleanup
* Documentation notes and cleanup
* Simplify serializer and add ip_addresses
* Add to VMInterfaceSerializer too
* Style cleanup
* Standardize "MAC Address" instead of "MAC"
* Remove unused views
* Add is_primary field for bulk edit
* HTML cleanup and add copy-to-clipboard button
* Remove mac_address from Interface and VMInterface bulk-edit forms
* Add device and VM filtering
* Use combined assigned_object_parent in table to match structure of IPAddressTable
* Add GFK fields to MACAddressSerializer
* Reorganize "Addressing" sections to remove from proximity to "Device Components" and related groupings
* Clean up migrations
* Misc cleanup
* Add filterset test
* Remove mac_address field from interface forms
* Designate primary MAC address via a ForeignKey on the interface models
* Add serializer fields for primary_mac_address
* Update docs
---------
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
* VLANTranslationPolicy and VLANTranslationRule models and all associated UI classes
* Change VLANTranslationPolicy to a PrimaryModel and make name unique
* Add serializer classes to InterfaceSerializer
* Remake migrations
* Add GraphQL typing
* Skip tagged models in test
* Missing migration
* Remove get_absolute_url methods
* Remove package-lock.json
* Rebuild migration and add constraints and field options
* Rebuild migrations
* Use DynamicModelChoiceField for policy field
* Make vlan_translation_policy fields on filtersets more consistent with existing __name convention
* Add vlan_translation_table to VMInterface detail page
* Add vlan_translation_policy to VMInterfaceSerializer
* Move vlan_translation_policy fields to model and filterset mixins
* Protect in-use policies against deletion
* Add vlan_translation_policy to fields in VMInterfaceSerializer
* Cleanup indentation
* Remove unnecessary ordering column
* Rebuild migrations
* Search methods and registration
* Ensure 'id' column is present by default
* Add graphql types/filters/schema for VLANTranslationRule
* Filterset tests
* View tests
* API and viewset tests (incomplete)
* Add tags to VLANTranslationRuleForm
* Complete viewset tests for VLANTranslationRule
* Make VLANTranslationRule.policy nullable (but still required)
* Revert "Make VLANTranslationRule.policy nullable (but still required)"
This reverts commit 4c1bb437ef.
* Revert nullability
* Explicitly prefetch policy in graphql
* Documentation of new and affected models
* Add note about select_related in graphql
* Rework policy/rule documentation
* Move vlan_translation_policy into 802.1Q Switching fieldset
* Remove redundant InterfaceVLANTranslationTable
* Conditionally include vlan_translation_table in interface.html and vminterface.html
* Add description field to VLANTranslationRule
* Define vlan_translation_table conditionally
* Add policy (name) filter to VLANTranslationRuleFilterSet
* Revert changes to adding-models.md (moved to another PR)
* Dynamic table for linked rules in vlantranslationpolicy.html
* Misc cleanup
---------
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
* 17195 Add color to PowerOutlet
* 17195 Add color to PowerOutlet
* Reorder serializer fields
* Misc cleanup
---------
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
* Add device_status as filtering option (and configurable column) for InventoryItemTable
* Add device_status to common superclasses for Device Components, and refactor ChoiceFieldColumn to support a "color" callable allowing get_FOO_color behavior to be overridden
* Remove unnecessary 'device_status' in fields
* Add unit tests for device_status
* Fixes 16536 - Fix filtering of device component by device role
Rename role and role_id fields to device_role and device_role_id in
DeviceComponentFilterSet
* Update tests for DeviceComponentFilterSet
* Use device_role filter name for DeviceComponentFilterSetTests
* Add test_device_role test in InventoryItemTestCase
* 12826 add RackType
* 12826 add forms, filters, tables
* 12826 add to menu
* 12826 remove role
* 12826 add api/serializers
* 12826 add tests and fixes
* 12826 fix tests
* 12826 fix tests
* 12826 fix tests
* 12826 fix tests
* 12826 add device_type to device and instantiation
* 12826 test device creation
* 12826 add slug
* 12826 fix tests
* 12826 fix slug field
* 12826 prevent modification of rack fields if rack_type set
* 12826 update rack fields on rack_type edit
* Misc cleanup
* Update model docs
* Add manufacturer field to RackType
* Add test for mounting_depth
* Rename 'type' to 'form_factor'
* Create base classes for Rack & RackType models, serializers
* Hide RackType-defined fields on RackForm when a rack type is set
* Establish a base filter form for Rack & RackType
* Clean up RackType attr inheritance
* Clean up templates
---------
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
* Fixes 16536 - Fix filtering of device component by device role
Rename role and role_id fields to device_role and device_role_id in
DeviceComponentFilterSet
* Update tests for DeviceComponentFilterSet
* Use device_role filter name for DeviceComponentFilterSetTests
* Add test_device_role test in InventoryItemTestCase