TimeoutError('Timed out reading from transport') for Junos
See original GitHub issueScrapli works well for cases when configuration is error free, but if there is a typo - it will hang for a while untill Timeout is reached, but the session would be still connected
Here is a basic configuration that I used:
from scrapli.driver.core import JunosDriver my_device = { “host”: “192.168.226.139”, “auth_username”: “test”, “auth_password”: “~!QAZXSW@”, “auth_strict_key”: False } conn = JunosDriver(**my_device) conn.open() print(conn.send_command(“configure exclusive”).result) commands = [“set system services ssh”,“set system services nestconf ssh”] for command in commands: print("sending line - "+command) response = conn.send_config(command, strip_prompt=False) print(response.result) conn.close()
To Reproduce Steps to reproduce the behavior:
- run the script with several commands and one of them should contain typo
- Junos vMX with VCP/VFP v 17.2R1.13
Expected behavior I would expect to have it like “set system services nestconfssh” as Junos parser would not recognize command and get an error from parser, but I don’t see that command was ever entered (by using - “show log interactive-commands” on vMX)
Stack Trace
/home/python/PycharmProjects/config_deploy/venv/bin/python /home/python/PycharmProjects/config_deploy/scrapli_test.py
warning: uncommitted changes will be discarded on exit
Entering configuration mode
[edit]
sending line - set system services ssh
[edit]
test@LAB-ROUTER#
sending line - set system services nestconf ssh
Traceback (most recent call last):
File "/home/python/PycharmProjects/config_deploy/scrapli_test.py", line 16, in <module>
response = conn.send_config(command, strip_prompt=False)
File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/driver/network_driver.py", line 392, in send_config
multi_response = self.send_configs(
File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/driver/network_driver.py", line 445, in send_configs
response = super().send_command(
File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/driver/generic_driver.py", line 75, in send_command
raw_response, processed_response = self.channel.send_input(
File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/channel/channel.py", line 165, in send_input
raw_result, processed_result = self._send_input(
File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/decorators.py", line 77, in timeout_wrapper
return future.result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/channel/channel.py", line 192, in _send_input
self._read_until_input(channel_input=bytes_channel_input)
File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/channel/channel.py", line 82, in _read_until_input
output += self._read_chunk()
File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/channel/channel.py", line 47, in _read_chunk
new_output = self.transport.read()
File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/decorators.py", line 104, in requires_open_session_wrapper
return wrapped_func(*args, **kwargs)
File "/home/python/PycharmProjects/config_deploy/venv/lib/python3.8/site-packages/scrapli/decorators.py", line 76, in timeout_wrapper
raise TimeoutError(message)
TimeoutError: Timed out reading from transport
OS:
- OS: Ubuntu 20.04
- scrapli version 2020.7.12
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (8 by maintainers)
Top GitHub Comments
updated develop branch with the fix. still doing some testing locally but I think it should be good to try!
Hopefully I’ll merge/release next weekend – I’ve got a few other things I’m working on I’d like to include in the next release!