Pass delay factors to nornir_napalm plugin

Hello,

I am trying to run nornir_napalm getters - “interfaces_countes” against Cisco Nexus switches. For the switches which have huge number of ports, task is failing with the following error.

Traceback (most recent call last):
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir/core/task.py”, line 98, in start
r = self.task(self, **self.params)
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir_napalm/plugins/tasks/napalm_get.py”, line 44, in napalm_get
result[g] = method(**options)
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/napalm/nxos_ssh/nxos_ssh.py”, line 1702, in get_interfaces_counters
command, “TABLE_interface”, “ROW_interface”
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/napalm/nxos/nxos.py”, line 637, in _get_command_table
json_output = self._send_command(command)
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/napalm/nxos_ssh/nxos_ssh.py”, line 458, in _send_command
return self.device.send_command(command, cmd_verify=cmd_verify)
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/netmiko/utilities.py”, line 429, in wrapper_decorator
return func(self, *args, **kwargs)
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/netmiko/base_connection.py”, line 1525, in send_command
search_pattern
OSError: Search pattern never detected in send_command: swiacc-003#

When I tried to run the ‘show interface’ command against these switches it took almost 1.5 minutes for completion which could be causing the issue.

Also, I tried to provide a delay factor for Nornir_Napalm but I get the following error. Not sure if I am passing it correctly. Don’t has issues to pass delay factors for Nornir_Netmiko plugin.

Inventory file : (groups file)

cisco_nxos:
platform: ‘cisco_nxos’
connection_options:
napalm:
platform: ‘nxos_ssh’
extras:
global_delay_factor: 5
netmiko:
extras:
global_delay_factor: 5
delay_factor: 5

Error :

Traceback (most recent call last):
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir/core/task.py”, line 98, in start
r = self.task(self, **self.params)
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir_napalm/plugins/tasks/napalm_get.py”, line 32, in napalm_get
device = task.host.get_connection(CONNECTION_NAME, task.nornir.config)
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir/core/inventory.py”, line 448, in get_connection
extras=conn.extras,
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir/core/inventory.py”, line 499, in open_connection
configuration=configuration,
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir_napalm/plugins/connections/init.py”, line 56, in open
connection = network_driver(**parameters)
TypeError: init() got an unexpected keyword argument ‘global_delay_factor’

Traceback (most recent call last):
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir/core/task.py”, line 98, in start
r = self.task(self, **self.params)
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir_napalm/plugins/tasks/napalm_get.py”, line 32, in napalm_get
device = task.host.get_connection(CONNECTION_NAME, task.nornir.config)
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir/core/inventory.py”, line 448, in get_connection
extras=conn.extras,
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir/core/inventory.py”, line 499, in open_connection
configuration=configuration,
File “/home/x1shaiku/VENVS/nornir/nornir/lib64/python3.6/site-packages/nornir_napalm/plugins/connections/init.py”, line 56, in open
connection = network_driver(**parameters)
TypeError: init() got an unexpected keyword argument ‘global_delay_factor’

Please guide me on how can I handle this situation.
Also, other getters like “facts” don’t have issues to run on these switches.
Thanks in advance…

1 Like

Answered by @Kirk Byers.

Extras for NAPALM needs to have an extra optional_args layer (as that is the NAPALM argument it takes arguments in). So:
cisco_nxos:
platform: ‘cisco_nxos’
connection_options:
napalm:
platform: ‘nxos_ssh’
extras:
optional_args:
global_delay_factor: 5
netmiko:
extras:
global_delay_factor: 5
8:18
Also your extra delay_factor argument in the Netmiko extras section won’t work, you only need global_delay_factor there.

1 Like

Reformated so it is somewhat readable:

Extras for NAPALM needs to have an extra optional_args layer (as that is the NAPALM argument it takes arguments in). So:

cisco_nxos:
  platform: cisco_nxos
  connection_options:
    napalm:
      platform: nxos_ssh
      extras:
        optional_args:
          global_delay_factor: 5
    netmiko:
      extras:
        global_delay_factor: 5
1 Like