Skip to content

Commit

Permalink
Fix WLC conn_timeout issue (#1897)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers authored Aug 25, 2020
1 parent a61b70b commit dc26c2c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions netmiko/base_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,16 @@ def establish_connection(self, width=511, height=1000):

msg = msg.lstrip()
raise NetmikoTimeoutException(msg)
except paramiko.ssh_exception.SSHException as no_session_err:
self.paramiko_cleanup()
if "No existing session" in str(no_session_err):
msg = (
"Paramiko: 'No existing session' error: "
"try increasing 'conn_timeout' to 10 seconds or larger."
)
raise NetmikoTimeoutException(msg)
else:
raise
except paramiko.ssh_exception.AuthenticationException as auth_err:
self.paramiko_cleanup()
msg = "Authentication failure: unable to connect {device_type} {ip}:{port}".format(
Expand Down
6 changes: 6 additions & 0 deletions netmiko/cisco/cisco_wlc_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
class CiscoWlcSSH(BaseConnection):
"""Netmiko Cisco WLC support."""

def __init__(self, *args, **kwargs):
# WLC/AireOS has an issue where you can get "No Existing Session" with
# the default conn_timeout (so increase conn_timeout to 10-seconds).
kwargs.setdefault("conn_timeout", 10)
return super().__init__(*args, **kwargs)

def special_login_handler(self, delay_factor=1):
"""WLC presents with the following on login (in certain OS versions)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def commands(request):

# Nokia SR-OS driver is overloaded with both classical-CLI and MD-CLI
# Swap out the commands to be the MD-CLI commands
if device_under_test == 'sros1_md':
if device_under_test == "sros1_md":
test_platform = "nokia_sros_md"

return commands_yml[test_platform]
Expand Down

0 comments on commit dc26c2c

Please sign in to comment.