ktbyers / nornir_netmiko

Netmiko Plugins for Nornir
Apache License 2.0
80 stars 24 forks source link

netmiko.ssh_exception.NetmikoTimeoutException: Timed-out reading channel, pattern not found in output: #43

Closed neyamt closed 1 year ago

neyamt commented 1 year ago

hello everyone,

I am trying to do some repetitive works on 135 devices which are Cisco routers and switches. When i run run(task=netmiko_send_command, command_string="show version | in uptime") commands there is no any issue but when i run run(task=netmiko_send_config, name="Base Commands", config_commands="do wr") or run(task=netmiko_send_command, command_string="wr") its giving error with some devices which are old (when we write the config on old device its taking some more seconds to finish the write configuration) and its giving the below error:

vvvv Base Commands changed : False vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ERROR Traceback (most recent call last): File "/home/itadmin/Net-Automate/.venv/lib/python3.7/site-packages/nornir/core/task.py", line 99, in start r = self.task(self, self.params) File "/home/itadmin/Net-Automate/.venv/lib/python3.7/site-packages/nornir_netmiko/tasks/netmiko_send_config.py", line 38, in netmiko_send_config result = net_connect.send_config_set(config_commands=config_commands, *kwargs) File "/home/itadmin/Net-Automate/.venv/lib/python3.7/site-packages/netmiko/base_connection.py", line 1921, in send_config_set new_output = self.read_until_pattern(pattern=pattern) File "/home/itadmin/Net-Automate/.venv/lib/python3.7/site-packages/netmiko/base_connection.py", line 655, in read_until_pattern return self._read_channel_expect(args, **kwargs) File "/home/itadmin/Net-Automate/.venv/lib/python3.7/site-packages/netmiko/base_connection.py", line 596, in _read_channel_expect f"Timed-out reading channel, pattern not found in output: {pattern}" netmiko.ssh_exception.NetmikoTimeoutException: Timed-out reading channel, pattern not found in output: (?:MAIN-OFF-RTR|#)

^^^^ END Base Commands ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

its not overall with all devices, only with few old devices which are taking more seconds to write the configuration. how to increase timeout second on configurations ?

thanks, Neyamt

neyamt commented 1 year ago

its resolved by add the below parameter in defaults.yaml file:


connection_options: netmiko: extras: {"fast_cli": False}