[PR #804] [MERGED] Enforce Global Unique on Prefixes #12118

Closed
opened 2025-12-29 22:19:43 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/804
Author: @zachmoody
Created: 1/16/2017
Status: Merged
Merged: 1/17/2017
Merged by: @jeremystretch

Base: developHead: prefix-unique


📝 Commits (4)

  • cfaf8b9 added duplicates() method to IPAddress and Prefix model managers.
  • eedec19 Added model tests for duplicate prefix and IPs.
  • 485a21f cleaned up IPAddress clean() to be more like Prefix's
  • edf29e7 moved duplicates() method to model instead of manager.

📊 Changes

3 files changed (+101 additions, -13 deletions)

View changed files

📝 netbox/ipam/models.py (+29 -13)
netbox/ipam/tests/__init__.py (+0 -0)
netbox/ipam/tests/test_models.py (+72 -0)

📄 Description

Should fix #802 - the language in the docs made it seem like ENFORCE_GLOBAL_UNIQUE should work on prefixes as well as IPAddress objects in the GRT, but I didn't find the logic for Prefixes. Refactored each model's clean() method a little. Also added some tests for the behavior in both models.


🔄 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/804 **Author:** [@zachmoody](https://github.com/zachmoody) **Created:** 1/16/2017 **Status:** ✅ Merged **Merged:** 1/17/2017 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `prefix-unique` --- ### 📝 Commits (4) - [`cfaf8b9`](https://github.com/netbox-community/netbox/commit/cfaf8b9157db535a5289a656188628842c781ddb) added duplicates() method to IPAddress and Prefix model managers. - [`eedec19`](https://github.com/netbox-community/netbox/commit/eedec192ba0a21c09f1108b61cd590a0bb679820) Added model tests for duplicate prefix and IPs. - [`485a21f`](https://github.com/netbox-community/netbox/commit/485a21f13ee73c25ccd99a029a4f3616eee35bc2) cleaned up IPAddress clean() to be more like Prefix's - [`edf29e7`](https://github.com/netbox-community/netbox/commit/edf29e7b9b38821650dbba6a762b188a44948558) moved duplicates() method to model instead of manager. ### 📊 Changes **3 files changed** (+101 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `netbox/ipam/models.py` (+29 -13) ➕ `netbox/ipam/tests/__init__.py` (+0 -0) ➕ `netbox/ipam/tests/test_models.py` (+72 -0) </details> ### 📄 Description Should fix #802 - the language in the docs made it seem like `ENFORCE_GLOBAL_UNIQUE` should work on prefixes as well as IPAddress objects in the GRT, but I didn't find the logic for Prefixes. Refactored each model's `clean()` method a little. Also added some tests for the behavior in both models. --- <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-29 22:19:43 +01:00
adam closed this issue 2025-12-29 22:19:43 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12118