Allow configurable separator for {module_path} placeholder #152

Closed
opened 2026-04-05 16:22:19 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @mrmrcoleman on 3/13/2026

NetBox version

v4.5.2

Feature type

Change to existing functionality

Proposed functionality

The {module_path} placeholder (introduced in #21436) currently joins module bay positions with a hardcoded / separator (MODULE_TOKEN_SEPARATOR in dcim/constants.py). This works well for the common <unit>/<slot>/<port> naming convention used by most modern switches and routers, but some hardware uses different separators:

  • : for channelized interfaces (e.g. 1/2:3)
  • - for certain legacy platforms
  • . for sub-interface style naming

It would be useful to allow the separator to be configurable, either:

  1. Per-template: A separator field on component templates that use {module_path}, or
  2. Per-ModuleType: A separator property on the ModuleType itself, or
  3. Globally: A configurable setting (though this is the least flexible option)

Justification

This was raised during review of #21436 by @sleepinggenius2 and @arthanson. The current constant-based approach was chosen deliberately to keep the initial {module_path} implementation simple, with the expectation that configurability could be added as a follow-up.

*Originally created by @mrmrcoleman on 3/13/2026* ### NetBox version v4.5.2 ### Feature type Change to existing functionality ### Proposed functionality The `{module_path}` placeholder (introduced in [#21436](<https://github.com/netbox-community/netbox/issues/21436>)) currently joins module bay positions with a hardcoded `/` separator (`MODULE_TOKEN_SEPARATOR` in `dcim/constants.py`). This works well for the common `<unit>/<slot>/<port>` naming convention used by most modern switches and routers, but some hardware uses different separators: * `:` for channelized interfaces (e.g. `1/2:3`) * `-` for certain legacy platforms * `.` for sub-interface style naming It would be useful to allow the separator to be configurable, either: 1. **Per-template:** A separator field on component templates that use `{module_path}`, or 2. **Per-ModuleType:** A separator property on the ModuleType itself, or 3. **Globally:** A configurable setting (though this is the least flexible option) ### Justification This was raised during review of [#21436](<https://github.com/netbox-community/netbox/issues/21436>) by @sleepinggenius2 and @arthanson. The current constant-based approach was chosen deliberately to keep the initial `{module_path}` implementation simple, with the expectation that configurability could be added as a follow-up. ### Related * [#21436](<https://github.com/netbox-community/netbox/issues/21436>) (PR introducing `{module_path}`) * [NB-1871](https://linear.app/netboxlabs/issue/NB-1871/cannot-install-module-with-placeholder-values-in-a-module-bay-tree-2), [NB-1486](https://linear.app/netboxlabs/issue/NB-1486/extend-the-behaviour-of-the-module-variable-in-components-of-module) (original issues motivating `{module_path}`)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#152