Skip to content

Add timeout parameter #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--------------------------------------------------------------------------------
Fix
--------------------------------------------------------------------------------
* yang.connector
* Modified netconf.py:
* Add custom timeout parameter to Netconf.connect
8 changes: 8 additions & 0 deletions connector/src/yang/connector/netconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def connect(self):
port: 830
username: admin
password: admin
timeout: 120

Code Example::

Expand Down Expand Up @@ -335,6 +336,7 @@ def connect(self):
'hostkey_verify': False,
'look_for_keys': False,
'ssh_config': None,
'timeout': 60
}
defaults.update(self.connection_info)

Expand Down Expand Up @@ -364,6 +366,12 @@ def connect(self):
except Exception:
pass

# check timeout
try:
defaults['timeout'] = int(self.connection_info['timeout'])
Copy link
Contributor

@tahigash tahigash Apr 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/CiscoTestAutomation/yang/blob/master/connector/src/yang/connector/netconf.py#L266

self.timeout already exist via __init__. you might want to use this instead to be simple.

and please be aware of that the timeout is already used here. https://github.com/CiscoTestAutomation/yang/blob/master/connector/src/yang/connector/netconf.py#L284

so the timeout value will be shared between this and your code.

except (KeyError, ValueError):
pass

# support sshtunnel
if 'sshtunnel' in defaults:
from unicon.sshutils import sshtunnel
Expand Down