nornir-nautobot icon indicating copy to clipboard operation
nornir-nautobot copied to clipboard

Non-standard platform slug not fully supported

Open JostLuebbe opened this issue 1 year ago • 0 comments

Hello,

I wasn't sure under which Github repository to leave this issue so if I should open it under the nornir_netmiko library instead let me know.

Issue

The nornir_nautobot library allows us to map non-standard platform slugs to the correct [Nornir Dispatcher class].(https://docs.nautobot.com/projects/plugin-nornir/en/latest/user/app_feature_dispatcher/#configuring-the-dispatcher)

This is very convenient, and I was attempting to take advantage of this but noticed my Nautobot Golden Config backup jobs were still failing. Here is the code trace I've done and what I believe is the root cause of the failure:

  1. nornir_nautobot selects the correct dispatched based on the extra configurations we make, and eventually ends up in the get_config method of the NetmikoNautobotNornirDriver class: https://github.com/nautobot/nornir-nautobot/blob/develop/nornir_nautobot/plugins/tasks/dispatcher/default.py
  2. This method calls the netmiko_send_command task.
  3. This then attempts to establish a Netmiko connection object: https://github.com/ktbyers/nornir_netmiko/blob/develop/nornir_netmiko/tasks/netmiko_send_command.py https://github.com/ktbyers/nornir_netmiko/blob/develop/nornir_netmiko/connections/netmiko.py
  4. This connection object attempts to use the platform string to map to the correct Netmiko device_type:
napalm_to_netmiko_map = {
    "ios": "cisco_ios",
    "nxos": "cisco_nxos",
    "nxos_ssh": "cisco_nxos",
    "eos": "arista_eos",
    "junos": "juniper_junos",
    "iosxr": "cisco_xr",
}

However, because we are using a non-standard platform string this mapping fails and throws an exception.

The Ask

Would it be possible to allow us to either also configure the napalm_to_netmiko_map to include our non-standard platform strings, or have some way of passing an overriding platform value when calling the netmiko_send_command task and establishing the Netmiko connection.

Another possibility may be to use the Napalm driver instead, but I also believe there modifications would be necessary to pass a configured platform slug.

I am of course open to any other suggestions or ideas you may have for working around this issue and please let me know if you'd like more information.

JostLuebbe avatar Jun 12 '23 15:06 JostLuebbe