MCPcopy
hub / github.com/ktbyers/netmiko / _test_channel_read

Method _test_channel_read

netmiko/keymile/keymile_nos_ssh.py:17–29  ·  view source on GitHub ↗

Since Keymile NOS always returns True on paramiko.connect() we check the output for substring Login incorrect after connecting.

(self, count: int = 40, pattern: str = "")

Source from the content-addressed store, hash-verified

15 self.clear_buffer()
16
17 def _test_channel_read(self, count: int = 40, pattern: str = "") -> str:
18 """Since Keymile NOS always returns True on paramiko.connect() we
19 check the output for substring Login incorrect after connecting."""
20 output = super()._test_channel_read(count=count, pattern=pattern)
21 pattern = r"Login incorrect"
22 if re.search(pattern, output):
23 self.paramiko_cleanup()
24 msg = "Authentication failure: unable to connect"
25 msg += f"{self.device_type} {self.host}:{self.port}"
26 msg += self.RESPONSE_RETURN + "Login incorrect"
27 raise NetmikoAuthenticationException(msg)
28 else:
29 return output
30
31 def special_login_handler(self, delay_factor: float = 1.0) -> None:
32 """Since Keymile NOS always returns True on paramiko.connect() we

Callers 15

special_login_handlerMethod · 0.95
session_preparationMethod · 0.45
session_preparationMethod · 0.45
session_preparationMethod · 0.45
session_preparationMethod · 0.45
session_preparationMethod · 0.45
session_preparationMethod · 0.45
session_preparationMethod · 0.45
session_preparationMethod · 0.45
session_preparationMethod · 0.45
session_preparationMethod · 0.45
session_preparationMethod · 0.45

Calls 2

paramiko_cleanupMethod · 0.80

Tested by

no test coverage detected