Timeout with telnet transport
See original GitHub issueDescribe the bug Unable to open a telnet session using nornir-scrapli, getting socket.timeout: timed out
To Reproduce Steps to reproduce the behavior:
-
Configure scrapli transport parameters as follows:
host.connection_options["scrapli"] = ConnectionOptions( extras={ "auth_secondary": "XXXX", "port": 23, "transport": "telnet", } )
Execute a nornir tasks to connect and it immediately thows socket.timeout (from telnetlib library?) -
What you’re connecting to (vendor, platform, version)
Cisco switch, WS-C3750G-24T, (old code: 12.2(35)SE5)
- Anything else relevant
Simple script using telnetlib also throwing timeout using example script
`import telnetlib
HOST = “hostname” timeout=5
tn = telnetlib.Telnet(HOST, timeout=time_out) tn.set_debuglevel(100)
tn.read_until(b"Username:")
tn.close()`
Expected behavior Should establish telnet connection
Stack Trace
Traceback (most recent call last): File "/redacted/.venv/lib/python3.8/site-packages/nornir/core/task.py", line 99, in start r = self.task(self, **self.params) File "/redacted/.venv/lib/python3.8/site-packages/nornir_scrapli/tasks/core/send_configs_from_file.py", line 58, in send_configs_from_file scrapli_conn = task.host.get_connection("scrapli", task.nornir.config) File "/redacted/.venv/lib/python3.8/site-packages/nornir/core/inventory.py", line 494, in get_connection self.open_connection( File "/redacted/.venv/lib/python3.8/site-packages/nornir/core/inventory.py", line 546, in open_connection conn_obj.open( File "/redacted/.venv/lib/python3.8/site-packages/nornir_scrapli/connection.py", line 105, in open connection.open() File "/redacted/.venv/lib/python3.8/site-packages/scrapli/driver/base/sync_driver.py", line 84, in open self.transport.open() File "/redacted/.venv/lib/python3.8/site-packages/scrapli/transport/plugins/telnet/transport.py", line 152, in open self._handle_control_chars() File "/redacted/.venv/lib/python3.8/site-packages/scrapli/transport/plugins/telnet/transport.py", line 127, in _handle_control_chars c = self._read(1) File "/redacted/.venv/lib/python3.8/site-packages/scrapli/transport/plugins/telnet/transport.py", line 192, in _read return self.socket.sock.recv(n) socket.timeout: timed out
Screenshots n/a
OS (please complete the following information):
- OS: Ubuntu 20.4
- scrapli version: 2022.7.30
- Python 3.8.10
Additional context
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Going to close this and handle all the follow up in #253! thanks a bunch @egreenspan2 for reporting and for the work @haccht !
Carl
Hi! I also had a same issue, and created PR to fix this problem. #253 Is it possible to be reviewed or get an advice about this please?