diff --git a/netmiko/base_connection.py b/netmiko/base_connection.py index 9f46e281b..d3312987f 100644 --- a/netmiko/base_connection.py +++ b/netmiko/base_connection.py @@ -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( diff --git a/netmiko/cisco/cisco_wlc_ssh.py b/netmiko/cisco/cisco_wlc_ssh.py index b669d43cb..77126791a 100644 --- a/netmiko/cisco/cisco_wlc_ssh.py +++ b/netmiko/cisco/cisco_wlc_ssh.py @@ -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) diff --git a/tests/conftest.py b/tests/conftest.py index 57c239ca8..8f900e50f 100755 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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]