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

Function ConnectHandler

netmiko/ssh_dispatcher.py:504–516  ·  view source on GitHub ↗

Factory function selects the proper class and creates object based on device_type.

(*args: Any, **kwargs: Any)

Source from the content-addressed store, hash-verified

502
503
504def ConnectHandler(*args: Any, **kwargs: Any) -> "BaseConnection":
505 """Factory function selects the proper class and creates object based on device_type."""
506 device_type = kwargs["device_type"]
507 if device_type not in platforms:
508 if device_type is None:
509 msg_str = platforms_str
510 else:
511 msg_str = telnet_platforms_str if "_telnet" in device_type else platforms_str
512 raise ValueError(
513 "Unsupported 'device_type' currently supported platforms are: {}".format(msg_str)
514 )
515 ConnectionClass = ssh_dispatcher(device_type)
516 return ConnectionClass(*args, **kwargs)
517
518
519def TelnetFallback(*args: Any, **kwargs: Any) -> "BaseConnection":

Callers 15

test_session_log_appendFunction · 0.90
test_session_log_secretsFunction · 0.90
test_unicodeFunction · 0.90
test_session_log_bytesioFunction · 0.90
test_session_log_no_logFunction · 0.90
test_failed_keyFunction · 0.90
test_valid_connFunction · 0.90
test_invalid_portFunction · 0.90
test_conn_timeoutFunction · 0.90

Calls 1

ssh_dispatcherFunction · 0.85

Tested by 15

test_session_log_appendFunction · 0.72
test_session_log_secretsFunction · 0.72
test_unicodeFunction · 0.72
test_session_log_bytesioFunction · 0.72
test_session_log_no_logFunction · 0.72
test_failed_keyFunction · 0.72
test_valid_connFunction · 0.72
test_invalid_portFunction · 0.72
test_conn_timeoutFunction · 0.72