question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Timeout with telnet transport

See original GitHub issue

Describe the bug Unable to open a telnet session using nornir-scrapli, getting socket.timeout: timed out

To Reproduce Steps to reproduce the behavior:

  1. 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?)

  2. What you’re connecting to (vendor, platform, version)

Cisco switch, WS-C3750G-24T, (old code: 12.2(35)SE5)

  1. 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:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
carlmontanaricommented, Aug 27, 2022

Going to close this and handle all the follow up in #253! thanks a bunch @egreenspan2 for reporting and for the work @haccht !

Carl

1reaction
hacchtcommented, Aug 26, 2022

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

telnet command with custom timeout duration
This waits 2 seconds before killing the backgrounded telnet. Share.
Read more >
telnet timeout
An idle Telnet session is a session that is still sending TCP ACKs in response to keep alive messages from the device, but...
Read more >
Changing the Login Timeout Period for Telnet Sessions
To change the login timeout period, enter the telnet login-timeout command followed by the number of minutes as shown.
Read more >
Adjusting Telnet and SSH connection and prompt timeout for ...
This article outlines where to adjust Telnet and SSH Connection and Prompt timeouts in Orion Web Console.
Read more >
Telnet Session Timeouts - Ospf Network - Cisco Certified Expert
The timeout for an inactive Telnet session (10 minutes by default) provides an additional security measure. If the console is left unattended in ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found