Allow assigning multiple devices roles #6993

Closed
opened 2025-12-29 19:47:33 +01:00 by adam · 5 comments
Owner

Originally created by @dreng on GitHub (Sep 16, 2022).

NetBox version

v3.3.2

Feature type

Change to existing functionality

Proposed functionality

In the current situation you are able to assign exactly one device role to a device. I'd propose the possibility to assign multiple device roles to a device.

Use case

In the real world it is a common scenario to have more than one role for a device. E.g. a switch could be a switch (obviously) and a DHCP-Relay or a Firewall could be an Intrusion Protection System and a VPN connector. A virtual machine could be a domain controller, a DNS-Server and a DHCP-Server (which is a very common scenario for SMEs).

Database changes

class Device: device_role needs to be a ManyToManyField.
Change would break API queries on device role.

External dependencies

none

Originally created by @dreng on GitHub (Sep 16, 2022). ### NetBox version v3.3.2 ### Feature type Change to existing functionality ### Proposed functionality In the current situation you are able to assign exactly one device role to a device. I'd propose the possibility to assign multiple device roles to a device. ### Use case In the real world it is a common scenario to have more than one role for a device. E.g. a switch could be a switch (obviously) and a DHCP-Relay or a Firewall could be an Intrusion Protection System and a VPN connector. A virtual machine could be a domain controller, a DNS-Server and a DHCP-Server (which is a very common scenario for SMEs). ### Database changes class Device: device_role needs to be a ManyToManyField. Change would break API queries on device role. ### External dependencies none
adam added the type: feature label 2025-12-29 19:47:33 +01:00
adam closed this issue 2025-12-29 19:47:33 +01:00
Author
Owner

@jsenecal commented on GitHub (Sep 22, 2022):

Why not using tags for this ?

@jsenecal commented on GitHub (Sep 22, 2022): Why not using tags for this ?
Author
Owner

@jeremystretch commented on GitHub (Sep 26, 2022):

In the real world it is a common scenario to have more than one role for a device.

I disagree. In my experience, every infrastructure device is easily classified by its primary function, and the device role model works very well for this. From your examples above, it seems you're more interested in tracking a matrix of specific features or configurations, which is a supplementary information to a node's role.

@jeremystretch commented on GitHub (Sep 26, 2022): > In the real world it is a common scenario to have more than one role for a device. I disagree. In my experience, every infrastructure device is easily classified by its primary function, and the device role model works very well for this. From your examples above, it seems you're more interested in tracking a matrix of specific features or configurations, which is a supplementary information to a node's role.
Author
Owner

@dreng commented on GitHub (Sep 27, 2022):

@jeremystretch Thank you for your comment. I agree that every device can be classified by its primary function. The Idea is to have every role (primary or not) documented and be able to search/filter for it. What would you suggest how the situation should be mapped in NetBox? @jsenecal suggested to use tags. What I don't like about that proposal is that you can use tags for virtually anything. But it is not the purpose of a database to use one field for everything you can imagine.

@dreng commented on GitHub (Sep 27, 2022): @jeremystretch Thank you for your comment. I agree that every device can be classified by its primary function. The Idea is to have every role (primary or not) documented and be able to search/filter for it. What would you suggest how the situation should be mapped in NetBox? @jsenecal suggested to use tags. What I don't like about that proposal is that you can use tags for virtually anything. But it is not the purpose of a database to use one field for everything you can imagine.
Author
Owner

@jeremystretch commented on GitHub (Sep 27, 2022):

You can use tags, custom fields, or a custom plugin to achieve what you want to do. There are pros and cons to each approach. However, the function of the device role is well established, and changing it would be both unnecessary and disruptive for many, many users. For this reason I'm going to decline this proposal. Thanks for your consideration.

@jeremystretch commented on GitHub (Sep 27, 2022): You can use tags, custom fields, or a custom plugin to achieve what you want to do. There are pros and cons to each approach. However, the function of the device role is well established, and changing it would be both unnecessary and disruptive for many, many users. For this reason I'm going to decline this proposal. Thanks for your consideration.
Author
Owner

@DanSheps commented on GitHub (Sep 29, 2022):

Personally, I would make a custom plugin that adds "features" to a device/device-type.

@DanSheps commented on GitHub (Sep 29, 2022): Personally, I would make a custom plugin that adds "features" to a device/device-type.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6993