[PR #20611] [MERGED] Fixes #20610: Correct VLAN ID range calculation logic #15978

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

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20611
Author: @pheus
Created: 10/17/2025
Status: Merged
Merged: 10/28/2025
Merged by: @jeremystretch

Base: mainHead: 20610-vlangroup-total-vlan-ids-off-by-one


📝 Commits (1)

  • 05fd14a fix(ipam): Correct VLAN ID range calculation logic

📊 Changes

3 files changed (+33 additions, -1 deletions)

View changed files

netbox/ipam/migrations/0083_vlangroup_populate_total_vlan_ids.py (+27 -0)
📝 netbox/ipam/models/vlans.py (+2 -1)
📝 netbox/ipam/tests/test_models.py (+4 -0)

📄 Description

Fixes: #20610

Correct an off‑by‑one in VLANGroup._total_vlan_ids by computing lengths with half‑open [lo, hi) semantics during save(). Removes the +1, adds a test and includes a data migration to backfill existing _total_vlan_ids.

No schema changes.


🔄 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/20611 **Author:** [@pheus](https://github.com/pheus) **Created:** 10/17/2025 **Status:** ✅ Merged **Merged:** 10/28/2025 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `main` ← **Head:** `20610-vlangroup-total-vlan-ids-off-by-one` --- ### 📝 Commits (1) - [`05fd14a`](https://github.com/netbox-community/netbox/commit/05fd14a59af4adc96b75c8096a43fad146c67eb9) fix(ipam): Correct VLAN ID range calculation logic ### 📊 Changes **3 files changed** (+33 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `netbox/ipam/migrations/0083_vlangroup_populate_total_vlan_ids.py` (+27 -0) 📝 `netbox/ipam/models/vlans.py` (+2 -1) 📝 `netbox/ipam/tests/test_models.py` (+4 -0) </details> ### 📄 Description <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #20610 <!-- Please include a summary of the proposed changes below. --> Correct an off‑by‑one in `VLANGroup._total_vlan_ids` by computing lengths with half‑open `[lo, hi)` semantics during `save()`. Removes the `+1`, adds a test and includes a data migration to backfill existing `_total_vlan_ids`. No schema changes. --- <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:25:07 +01:00
adam closed this issue 2025-12-30 00:25:08 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15978