Closed timber-schroeder closed 1 year ago
All the code for this has been centralized here: https://github.com/nautobot/nautobot-plugin-golden-config/blob/44430319795273bcc6572075209eb31174db806b/nautobot_golden_config/utilities/utils.py#L8-L12
I think I would prefer a generic function, similar to the pattern here: https://github.com/nautobot/nautobot-plugin-golden-config/blob/develop/docs/navigating-compliance-custom.md#configuration
This way one could do arbitrary mappings, such as using a custom field.
A custom function handler for this case would be great, and I would likely do exactly what you mentioned and put a custom field on platforms (nornir_driver
or something like that).
Think this actually is solved in 1.6 of nautobot with the platform mapping functionality.
In 2.0 we will move to a network_driver based solution.
Environment
Proposed Functionality
The Platform structure in Nautobot already contains a field called
napalm_driver
, which is designed to map to an individual OS automation driver, while the name of the platform model is not. For example, all of the platforms I use are simply the version numbers of the NOS in question, with themanufacturer
andnapalm_driver
fields taking care of the NOS vendor and automation driver settings respectively. This is also how the model was originally documented to be used under Netbox.In the immediate term this can be worked around by manually maintaining a large mapping list under
platform_slug_map
, however that isn't really ideal as you then have to update the Nautobot configuration every time you add a new platform.Ideally, I would like to have a
platform_napalm_driver_slug_map
, which could optionally be used as an alternative toplatform_slug_map
, which would map thenapalm_driver
field instead of the Platform slug. Pulling arguments from something similar to thenapalm_args
field would also be nice however that would require a Platform model update to better support alternative drivers.Use Case
Create two platforms,
Junos 18.1R1
andJunos 18.1R2
. Set bothnapalm_driver
fields to 'junos'. Add"platform_napalm_driver_slug_map": {"junos": "juniper_junos"}
to this plugin's configuration. The destination is arbitrary and continues to map tonetwork_os
entries as the existingplatform_slug_map
does.