diff --git a/connector/docs/changelog/undistributed/changelog_GerriorL_add_timeout_to_netconf_20220718.rst b/connector/docs/changelog/undistributed/changelog_GerriorL_add_timeout_to_netconf_20220718.rst new file mode 100644 index 00000000..6c76f268 --- /dev/null +++ b/connector/docs/changelog/undistributed/changelog_GerriorL_add_timeout_to_netconf_20220718.rst @@ -0,0 +1,6 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* yang.connector + * Modified netconf.py: + * Add custom timeout parameter to Netconf.connect \ No newline at end of file diff --git a/connector/src/yang/connector/netconf.py b/connector/src/yang/connector/netconf.py index 705d62e1..4b2389a8 100644 --- a/connector/src/yang/connector/netconf.py +++ b/connector/src/yang/connector/netconf.py @@ -295,6 +295,7 @@ def connect(self): port: 830 username: admin password: admin + timeout: 120 Code Example:: @@ -335,6 +336,7 @@ def connect(self): 'hostkey_verify': False, 'look_for_keys': False, 'ssh_config': None, + 'timeout': 60 } defaults.update(self.connection_info) @@ -364,6 +366,12 @@ def connect(self): except Exception: pass + # check timeout + try: + defaults['timeout'] = int(self.connection_info['timeout']) + except (KeyError, ValueError): + pass + # support sshtunnel if 'sshtunnel' in defaults: from unicon.sshutils import sshtunnel