Device-specific configuration context #1970

Closed
opened 2025-12-29 17:21:01 +01:00 by adam · 5 comments
Owner

Originally created by @ngrundler on GitHub (Aug 24, 2018).

Environment

  • Python version: 3.5.4
  • NetBox version: 2.4.4

Proposed Functionality

Configuration contexts are an incredibly useful feature, but as with any standards that we try and apply with a broad brush, there are always exceptions. Our environment is very diverse, and in order to meet the needs of a particular tenant or user group, we are forced to adjust a template or standard to accommodate a request that often impacts only a single device. Extending configuration contexts to a specific device or set of devices would allow us to keep track of these snowflakes. Tagging can solve some of these requests, but often the changes are complex enough that having a configuration context would be more desirable.

Use Case

Some examples I've run into include a user, ssh-key, and permission settings on a single device, a unique login banner, or even enabling a particular protocol required to interoperate with a downstream device. This could also be useful for device-specific hardware settings, e.g. setting the pic-mode for various Juniper devices. Being able to encode this kind of information in an single, external source of authority is very important for us as we try to automate our environment. Right now we're keeping this device-specific information in a separate git repo, but it would be really nice to be able to put all of this in Netbox.

Database Changes

Unknown

External Dependencies

None that I can think of

Originally created by @ngrundler on GitHub (Aug 24, 2018). <!-- NOTE: This form is only for proposing specific new features or enhancements. If you have a general idea or question, please post to our mailing list instead of opening an issue: https://groups.google.com/forum/#!forum/netbox-discuss NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.5.4 * NetBox version: 2.4.4 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality Configuration contexts are an incredibly useful feature, but as with any standards that we try and apply with a broad brush, there are always exceptions. Our environment is very diverse, and in order to meet the needs of a particular tenant or user group, we are forced to adjust a template or standard to accommodate a request that often impacts only a single device. Extending configuration contexts to a specific device or set of devices would allow us to keep track of these snowflakes. Tagging can solve some of these requests, but often the changes are complex enough that having a configuration context would be more desirable. <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case Some examples I've run into include a user, ssh-key, and permission settings on a single device, a unique login banner, or even enabling a particular protocol required to interoperate with a downstream device. This could also be useful for device-specific hardware settings, e.g. setting the `pic-mode` for various Juniper devices. Being able to encode this kind of information in an single, external source of authority is very important for us as we try to automate our environment. Right now we're keeping this device-specific information in a separate git repo, but it would be really nice to be able to put all of this in Netbox. <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes Unknown <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies None that I can think of
adam added the status: accepted label 2025-12-29 17:21:01 +01:00
adam closed this issue 2025-12-29 17:21:01 +01:00
Author
Owner

@lampwins commented on GitHub (Aug 25, 2018):

This is feasible and has been brought up by a few others already in the mailing list and the NTC slack. I am labeling it as a minor feature because we will need to think carefully through the implications to the data model and avoid scope creep.

My initial impression is that we will allow a single ConfigContext object to be assigned to a Device instance. This particular ConfigContext object will automatically be weighted such that is takes precedence over any other rendered ConfigContexts for the device. Thoughts on this?

@lampwins commented on GitHub (Aug 25, 2018): This is feasible and has been brought up by a few others already in the mailing list and the NTC slack. I am labeling it as a minor feature because we will need to think carefully through the implications to the data model and avoid scope creep. My initial impression is that we will allow a single ConfigContext object to be assigned to a Device instance. This particular ConfigContext object will automatically be weighted such that is takes precedence over any other rendered ConfigContexts for the device. Thoughts on this?
Author
Owner

@ngrundler commented on GitHub (Aug 27, 2018):

+1

Just to confirm, other config contexts would still be inherited based on site/tenant etc, but any overlapping values in the device instance context would automatically "win"? That is basically exactly what we're looking for on my end.

@ngrundler commented on GitHub (Aug 27, 2018): +1 Just to confirm, other config contexts would still be inherited based on site/tenant etc, but any overlapping values in the device instance context would automatically "win"? That is basically exactly what we're looking for on my end.
Author
Owner

@lampwins commented on GitHub (Aug 28, 2018):

@ngrundler correct, that is the basic idea.

@lampwins commented on GitHub (Aug 28, 2018): @ngrundler correct, that is the basic idea.
Author
Owner

@sdktr commented on GitHub (Aug 28, 2018):

Why the difference in the 'weighting' for this specific mapping? In general I propose that the priority for conflicting objects from multiple ConfigContext should be:

  • weights (higher value wins)
  • order according to this (or another fixed) list as tiebreaker (lower in the list wins)
    -- TenantGroup
    -- Tenant
    -- Region
    -- Site
    -- Roles
    -- Platform
    -- Device
@sdktr commented on GitHub (Aug 28, 2018): Why the difference in the 'weighting' for this specific mapping? In general I propose that the priority for conflicting objects from multiple ConfigContext should be: - weights (higher value wins) - order according to this (or another fixed) list as tiebreaker (lower in the list wins) -- TenantGroup -- Tenant -- Region -- Site -- Roles -- Platform -- Device
Author
Owner

@ebusto commented on GitHub (Aug 28, 2018):

Similarly, it would be helpful to have device type configuration contexts.

This would allow administrators to store BIOS, iLO/DRAC, and other configuration data that makes sense to handle on a per-model basis.

@ebusto commented on GitHub (Aug 28, 2018): Similarly, it would be helpful to have device type configuration contexts. This would allow administrators to store BIOS, iLO/DRAC, and other configuration data that makes sense to handle on a per-model basis.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1970