Inherit Config Context Data in Device Role Hierarchy #11066

Closed
opened 2025-12-29 21:39:48 +01:00 by adam · 1 comment
Owner

Originally created by @pheus on GitHub (Apr 22, 2025).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v4.3.0-beta1

Feature type

New functionality

Proposed functionality

The new Device Role hierarchy in NetBox Beta is fantastic! To make it even more powerful, I’d love the ability for child roles to automatically inherit - and optionally override - Config Context data defined on their parent roles.

  • When you assign Config Context data to a parent Device Role, all of its descendants automatically receive those settings.
  • Child roles can extend or override individual keys without redefining the entire context.

Example:

Device Role: Switch - Config Context: { "ntp": "10.0.0.1" }
└─ Device Role: Access Switch - Config Context: { "ntp": "10.0.1.1", "syslog": "10.100.1.1" }
(inherits all other keys from “Switch”)

Final Merged Config Context for “Access Switch”:

{
  "ntp": "10.0.1.1",
  "syslog": "10.100.1.1"
}

Use case

  • Define global NTP and DNS settings once at a high-level role (e.g. “Switch”)
  • Create specialized child roles (“Access Switch”, “Distribution Switch”, etc.) that tweak only what’s different
  • Avoid duplication and ensure consistency across large device fleets

Benefits

  • DRY configuration: Don’t repeat the same context in every role
  • Clear hierarchy: Easily see which values are inherited vs. overridden
  • Faster onboarding: New roles automatically pick up baseline settings

Database changes

  • No new database tables required - leverage the existing Config Context model

External dependencies

None.

Originally created by @pheus on GitHub (Apr 22, 2025). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v4.3.0-beta1 ### Feature type New functionality ### Proposed functionality The new Device Role hierarchy in NetBox Beta is fantastic! To make it even more powerful, I’d love the ability for child roles to automatically inherit - and optionally override - Config Context data defined on their parent roles. - When you assign Config Context data to a parent Device Role, all of its descendants automatically receive those settings. - Child roles can extend or override individual keys without redefining the entire context. **Example**: Device Role: Switch - Config Context: `{ "ntp": "10.0.0.1" }` └─ Device Role: Access Switch - Config Context: `{ "ntp": "10.0.1.1", "syslog": "10.100.1.1" }` *(inherits all other keys from “Switch”)* **Final Merged Config Context for “Access Switch”:** ```json { "ntp": "10.0.1.1", "syslog": "10.100.1.1" } ``` ### Use case - Define global NTP and DNS settings once at a high-level role (e.g. “Switch”) - Create specialized child roles (“Access Switch”, “Distribution Switch”, etc.) that tweak only what’s different - Avoid duplication and ensure consistency across large device fleets **Benefits** - **DRY configuration**: Don’t repeat the same context in every role - **Clear hierarchy**: Easily see which values are inherited vs. overridden - **Faster onboarding**: New roles automatically pick up baseline settings ### Database changes - No new database tables required - leverage the existing Config Context model ### External dependencies None.
adam added the status: acceptedtype: featurecomplexity: mediumbeta labels 2025-12-29 21:39:48 +01:00
adam closed this issue 2025-12-29 21:39:49 +01:00
Author
Owner

@jeremystretch commented on GitHub (Apr 24, 2025):

I'll mark this as open for work with the presumption that we can replicate existing patterns for regions and site groups. However, if anything more complex is uncovered we may have to bump it.

@jeremystretch commented on GitHub (Apr 24, 2025): I'll mark this as open for work with the presumption that we can replicate existing patterns for regions and site groups. However, if anything more complex is uncovered we may have to bump it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11066