From be7686f7f07b2d23acb4d969b6b71594da602fa5 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Wed, 19 Jun 2024 21:03:03 -0700 Subject: [PATCH 1/2] Pass ctrl-q char to unlock it from telnet hung state --- netmiko/cisco_base_connection.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netmiko/cisco_base_connection.py b/netmiko/cisco_base_connection.py index 483f4c0f..fbee3dae 100644 --- a/netmiko/cisco_base_connection.py +++ b/netmiko/cisco_base_connection.py @@ -123,6 +123,9 @@ def find_prompt_special_case(self, delay_factor: float = 1.0, if cxr_pattern in prompt.lower(): time.sleep((delay_factor * 0.1) + 3) prompt = self.read_channel() + if count == 5 and not prompt: + self.log.info("Probably in telnet hung state. Passing ctrl-q . Potential DDTS: CSCwh67759 and CSCvy64395") + self.write_channel('\x11') count += 1 # If multiple lines in the output take the last line From ed1dbd5e8ec74ef7f1d9c67d00a03a35d19d4d0f Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Tue, 25 Jun 2024 10:47:37 -0700 Subject: [PATCH 2/2] passing ctrl-q after count=3 --- netmiko/cisco_base_connection.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/netmiko/cisco_base_connection.py b/netmiko/cisco_base_connection.py index fbee3dae..cf7c00ef 100644 --- a/netmiko/cisco_base_connection.py +++ b/netmiko/cisco_base_connection.py @@ -123,9 +123,14 @@ def find_prompt_special_case(self, delay_factor: float = 1.0, if cxr_pattern in prompt.lower(): time.sleep((delay_factor * 0.1) + 3) prompt = self.read_channel() - if count == 5 and not prompt: + if count == 3 and not prompt: self.log.info("Probably in telnet hung state. Passing ctrl-q . Potential DDTS: CSCwh67759 and CSCvy64395") self.write_channel('\x11') + time.sleep(15) + prompt = self.read_channel().strip() + if prompt: + self.log.info(f"Prompt found after passing ctrl-q. Prompt is {prompt}") + break count += 1 # If multiple lines in the output take the last line