Enable Device Uniqueness by Device Role #3196

Closed
opened 2025-12-29 18:26:33 +01:00 by adam · 1 comment
Owner

Originally created by @darcynz on GitHub (Jan 21, 2020).

Environment

  • Python version: 3.7
  • NetBox version: 2.71

Proposed Functionality

Enable a toggle per device role that allows a device (physical/vm) to be checked for uniqueness upon creation of a new item.

Use Case

As per the implementation of #2669 in 2.71, device names were made non unique.

This enables generic device types (patch panels, cables), however it allows the possibility of introducing a conflict in the database for a unique device (eg logical router).

Whilst this can be addressed re-actively by validation (reports) for users that use Netbox as their network source of truth this problem can be magnified by automation that is in place and increase the difficulty of cross system API calls that use the Device name as an identifier.

Database Changes

None

External Dependencies

None

Originally created by @darcynz on GitHub (Jan 21, 2020). ### Environment * Python version: 3.7 * NetBox version: 2.71 ### Proposed Functionality Enable a toggle per device role that allows a device (physical/vm) to be checked for uniqueness upon creation of a new item. ### Use Case As per the implementation of #2669 in 2.71, device names were made non unique. This enables generic device types (patch panels, cables), however it allows the possibility of introducing a conflict in the database for a unique device (eg logical router). Whilst this can be addressed re-actively by validation (reports) for users that use Netbox as their network source of truth this problem can be magnified by automation that is in place and increase the difficulty of cross system API calls that use the Device name as an identifier. ### Database Changes None ### External Dependencies None
adam closed this issue 2025-12-29 18:26:33 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 21, 2020):

however it allows the possibility of introducing a conflict in the database for a unique device (eg logical router).

This is not a conflict, but a violation of your particular organization's naming/provisioning policy. If you need to restrict certain device roles to have no more than n instances, it will need to be done using a custom script or other custom mechanism. NetBox does not support conditional uniqueness enforcement for any models and we have no plans to introduce it at this time.

@jeremystretch commented on GitHub (Jan 21, 2020): > however it allows the possibility of introducing a conflict in the database for a unique device (eg logical router). This is not a conflict, but a violation of your particular organization's naming/provisioning policy. If you need to restrict certain device roles to have no more than _n_ instances, it will need to be done using a custom script or other custom mechanism. NetBox does not support conditional uniqueness enforcement for any models and we have no plans to introduce it at this time.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3196