netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Public demo: https://demo.netbox.dev
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.34k stars 2.49k forks source link

Device Roles in Device Types #16718

Open LHBL2003 opened 1 week ago

LHBL2003 commented 1 week ago

NetBox version

v4.0.3

Feature type

Data model extension

Proposed functionality

Add the Device Roles field as optional in Device Types

image

and enable the enumeration in the Device Roles properties under "Related Objects". image

The number should then also be listed in the Device Roles area. image

Use case

In Netbox, we maintain the device roles for the devices and VMs. These are often designations such as firewall, printer, fax, access point, etc. Most roles are hardware-specific. We would also like to reuse the device roles in the Device Types area. At the moment, we have solved this by using a TAG with the same name or by creating a customer field. However, after clicking on the link under "Related Objects" in the Customer Field, the Device Types area is not displayed, which is not so nice.

We would therefore prefer a proper integration of the Device Role field. Or the adjustment that the Device Types are also listed under Related Objects.

Database changes

No response

External dependencies

No response

jeremystretch commented 1 week ago

Add the Device Roles field as optional in Device Types

This would not make sense as there is no consistent correlation between a device type and role: A single device type may function in one of several different roles depending on how it is deployed. For example, a single model of switch might be used as either a core, distribution, or access switch; a particular router might be used in the backbone or at the edge.

and enable the enumeration in the Device Roles properties under "Related Objects".

It might be feasible to include statistics about the number of roles in which each device type has been deployed without altering the current model. Is this what you're after?

sleepinggenius2 commented 1 week ago

I just added this as a multi-object custom field on Device Types within our environment, so that it can be used within a custom validator and for filtering. To @jeremystretch's point, a single model can generally have multiple roles, which is why we implemented it as a multi-object field. It would be nice to integrate that functionality into the core, but so far the custom configuration seems to be working in our environment.

LHBL2003 commented 6 days ago

This would not make sense as there is no consistent correlation between a device type and role: A single device type may function in one of several different roles depending on how it is deployed. For example, a single model of switch might be used as either a core, distribution, or access switch; a particular router might be used in the backbone or at the edge.

At first I didn't understand why you didn't think it made sense. Until I understood your point of view. :D In a nutshell: The device role on the device type is primarily used to group the device types, as the device roles are 90% identical to those of the device instances. Of course, it would also be nice if the stored device role were proposed as a template when a device instance is created, as it can be changed when it is created if necessary. But I hadn't thought that far ahead, as the device role should primarily be used to group the device types.

image

As with the VMs, you could also create a checkbox for the device roles so that the device role is displayed or not displayed for the device types. image

So if I want to filter how many models of managed switches we have, I have to create a TAG parallel to the device role or implement the device role as a customer field.

Disadvantage A: No coloring as with device instances and VMs image

and enable the enumeration in the Device Roles properties under "Related Objects".

Disadvantage B: After clicking on the link "Switch l LAN Managed (SW)", the device type is not listed. This is nice for the devices because you can filter quickly by clicking on the number. Provided that you have not filtered before and would like to do so using this method. image