[PR #18759] [MERGED] Fixes #15924: Fix API interface patch tagged all mode #15435

Closed
opened 2025-12-30 00:21:54 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/18759
Author: @jeremystretch
Created: 2/27/2025
Status: Merged
Merged: 2/28/2025
Merged by: @jeremystretch

Base: mainHead: 15924-fix-api-interface-patch-tagged-all-mode


📝 Commits (10+)

  • 5c9a145 Fixes: #15924 - Prevent API payload from allowing tagged_vlans while interface mode is set to taged-all
  • 282836c Prevent cleanup of tagged_vlans when no tagged_vlans set on interface
  • 4ea0047 Fix test errors
  • d4c8e88 Remove accidental debug statements
  • bab5a5b Update validation to model clean method instead of serializer
  • 4f830ce Remove clearing of tagged vlans from save()
  • d159547 Make changes to validation to account for M2M not being available under model in addition to not being able to check incoming vlans under same model.
  • 9a13caa Optimize untagged vlan check
  • 07444e6 Re-ordering statements in validators
  • 5776db6 Forgot to call super().clean()

📊 Changes

5 files changed (+292 additions, -15 deletions)

View changed files

📝 netbox/dcim/api/serializers_/device_components.py (+50 -1)
📝 netbox/dcim/forms/common.py (+6 -12)
📝 netbox/dcim/models/device_components.py (+2 -0)
📝 netbox/dcim/tests/test_api.py (+70 -0)
📝 netbox/dcim/tests/test_forms.py (+164 -2)

📄 Description

Fixes: #15924

  • Prevent API (or any API write function) which includes untagged_vlan with interface 802.1q mode is not set
  • Prevent API (or any API write function) which includes tagged_vlans with interface mode set to tagged-all

Note: These changes were initially merged into feature as it was understood to effect a breaking change, however after some discussion we decided that was not warranted, so we're merging these into main now for NetBox v4.2.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/18759 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 2/27/2025 **Status:** ✅ Merged **Merged:** 2/28/2025 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `main` ← **Head:** `15924-fix-api-interface-patch-tagged-all-mode` --- ### 📝 Commits (10+) - [`5c9a145`](https://github.com/netbox-community/netbox/commit/5c9a14525573ab580f6ec26f2ac6f5620a2979fd) Fixes: #15924 - Prevent API payload from allowing tagged_vlans while interface mode is set to taged-all - [`282836c`](https://github.com/netbox-community/netbox/commit/282836c9a003e8ccd5608e323384a92f7b501c33) Prevent cleanup of tagged_vlans when no tagged_vlans set on interface - [`4ea0047`](https://github.com/netbox-community/netbox/commit/4ea00474aa555388187c2ca40fd316ab8ed7f572) Fix test errors - [`d4c8e88`](https://github.com/netbox-community/netbox/commit/d4c8e88fd771b516ab372be27d81578e4060f3b9) Remove accidental debug statements - [`bab5a5b`](https://github.com/netbox-community/netbox/commit/bab5a5b273be34853047b1caa34c835d29ed23df) Update validation to model clean method instead of serializer - [`4f830ce`](https://github.com/netbox-community/netbox/commit/4f830ce3cc63db0f08c896055e80e5bcb38735d6) Remove clearing of tagged vlans from `save()` - [`d159547`](https://github.com/netbox-community/netbox/commit/d15954775875f19ac8c9f26ba6248b24341e16ac) Make changes to validation to account for M2M not being available under model in addition to not being able to check incoming vlans under same model. - [`9a13caa`](https://github.com/netbox-community/netbox/commit/9a13caae7a942675a4802c89f867b3c91a49897b) Optimize untagged vlan check - [`07444e6`](https://github.com/netbox-community/netbox/commit/07444e6f1abf5fb2fcc212c81bffafd9ca055bd1) Re-ordering statements in validators - [`5776db6`](https://github.com/netbox-community/netbox/commit/5776db645079d2a07cfcead6a903fff027e20fd2) Forgot to call super().clean() ### 📊 Changes **5 files changed** (+292 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/api/serializers_/device_components.py` (+50 -1) 📝 `netbox/dcim/forms/common.py` (+6 -12) 📝 `netbox/dcim/models/device_components.py` (+2 -0) 📝 `netbox/dcim/tests/test_api.py` (+70 -0) 📝 `netbox/dcim/tests/test_forms.py` (+164 -2) </details> ### 📄 Description ### Fixes: #15924 * Prevent API (or any API write function) which includes `untagged_vlan` with interface 802.1q mode is not set * Prevent API (or any API write function) which includes `tagged_vlans` with interface mode set to tagged-all Note: These changes were initially merged into `feature` as it was understood to effect a breaking change, however after some discussion we decided that was not warranted, so we're merging these into `main` now for NetBox v4.2. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:21:54 +01:00
adam closed this issue 2025-12-30 00:21:54 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15435