Description
NetBox version
v4.2.8
Feature type
Change to existing functionality
Proposed functionality
This is a FR related to #19414 to fulfil the request by arthanson .
The proposed functionality would allow for the definition of multiple naming conventions using {module}
such that the same module type can be used with devices with in different levels of module bay configurations.
The implementation of this could be managed in different ways with the desired outcome to be the creation of values like
1 level: port-1
2 levels: port-1-1
3 levels: port-1-1-1
Possible Implementations
List all possible combinations
port-{module},port-{module}-{module},port-{module}-{module}-{module}
Assume stop once all modules values are consumed
port-{module}-{module}-{module}
Regex optional repeat
port-{module}(-{module}){0,2}
Use case
The current functionality of module bays and module types correctly allows for nested designs
eg: device -> module bays -> module type -> module bays -> module type -> interface
A practical example of this would be a Server with a OCP bay (device -> module bay) which is filled with a dual port SFP nic (module type -> module bays), each port is then filled with a SFP module (module type -> interface).
For this to work in Netbox the SFP module needs to have the interface name set with 2 {module}
variables
eg: port-{module}-{module}
However the same SFP module can not be used in another device which doesn't have this nested structure.
eg: device -> module bays -> module type -> interface
A practical example of this would be a Switch with SFP ports (module type -> module bays), each port is then filled with a SFP module (module type -> interface).
For this to work in Netbox the SFP module needs to have the interface name set with 1 {module}
variable
eg: port-{module}
The Server and the Switch require different variables for the SFP Module which currently isn't possible.
The error message seen when trying to add a module type with the incorrect number of {module}
vars for a given device configuration is
Cannot install module with placeholder values in a module bay tree <x> in tree but <y> placeholders given.
Workarounds
Duplicate Module Types
A work around to this would be to have multiple SFP Modules of the same type with different nesting vars for each one.
eg:
SFP Module (nest 1) = port-{module}
SFP Module (nest 2) = port-{module}-{module}
SFP Module (nest 3) = port-{module}-{module}-{module}
This can end up messy as you end up with multiple modules that are identical except for how they are used and requires the user to understand this specific problem/workaround.
Untick Replicate Components
When adding the module to a bay that has unsupported nesting untick the Replicate Components
option and then manually create the interfaces and link them back to the correct bays.
This is additional work that isn't required when the {module}
count matches with the potential for human error.
Alter the Module Type each time it is used in a different nesting format
Each time you get the error message Cannot install module with placeholder values in a module bay tree <x> in tree but <y> placeholders given.
go to the Module Type and alter the {module}
format to suit the current device.
This is additional work that isn't required when the {module}
count matches but would need to be done each time the module is used on a device with nesting that is different from the last time it was used.
Reproducible test case
Types
- Create a Device Type
Server with a OCP bay
with 1 Module Bay namedOCP
- Create a Device Type
24 port Switch
with 2 Module Bays namedSFP 1
andSFP 2
using positions 1 and 2 - Create a Module Type of
Dual port SFP nic
with 2 Module Bays namedSFP 1
andSFP 2
using positions 1 and 2 - Create a Module Type of
SFP module
with a single interface nameport-{module}
Server
- Create a Device with a Device Type of
Server with a OCP bay
- Add a Module Type of
Dual port SFP nic
to the availableOCP
Module Bay - Add a Module Type of
SFP module
to theSFP 1
Module BaySFP 1
, you will get error message
Cannot install module with placeholder values in a module bay tree <x> in tree but <y> placeholders given.
- Change the Module Type of
SFP module
with a single interface name ofport-{module}
to have a interface name ofport-{module}-{module}
- Add a Module Type of
SFP module
to theSFP 1
Module BaySFP 1
, it will work and create a interface linked to the module calledport-1-1
Switch
- Create a Device with a Device Type of
24 port Switch
- Add a Module Type of
SFP module
to theSFP 1
Module BaySFP 1
, you will get error message
Cannot install module with placeholder values in a module bay tree <x> in tree but <y> placeholders given.
- Change the Module Type of
SFP module
with a single interface name ofport-{module}-{module}
to have a interface name ofport-{module}
- Add a Module Type of
SFP module
to theSFP 1
Module BaySFP 1
, it will work and create a interface linked to the module calledport-1
Database changes
No response
External dependencies
No response