netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.27k stars 2.59k forks source link

Device-specific configuration context #2392

Closed ngrundler closed 6 years ago

ngrundler commented 6 years ago

Environment

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

lampwins commented 6 years ago

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?

ngrundler commented 6 years ago

+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.

lampwins commented 6 years ago

@ngrundler correct, that is the basic idea.

sdktr commented 6 years ago

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:

ebusto commented 6 years ago

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.