-
Notifications
You must be signed in to change notification settings - Fork 346
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
Issues with error handling for HelloHandler when using tty_netconf transport #1254
Comments
Hi @monnierj Thanks |
Hi, Here is a simple reproduction script, junos-eznc is in the latest tagged version, which matches what can be found in the documentation: from jnpr.junos import Device
CS_HOSTNAME = "ts_hostname"
CS_USERNAME = "ts_user"
CS_PASSWORD = "xxx"
DEVICE_USERNAME = "noc"
DEVICE_PASSWORD = "xxx"
with Device(
host=CS_HOSTNAME, cs_user=CS_USERNAME, cs_passwd=CS_PASSWORD,
user=DEVICE_USERNAME, passwd=DEVICE_PASSWORD, timeout=6
) as dev:
print("Connected!")
print(dev.facts) The issue has been reproduced both on macOS+Python 3.10 and Debian Linux 11+Python 3.9. The target device is an SRX300 running JUNOS 21.4R3-S3.4, and the console server is an Avocent ACS8000. Thanks! |
Hi @monnierj Thanks |
Fixed and merged. Hence closing this issue. |
I've missed your previous message, but thanks for the merge! |
Hi,
I've found something off in the
open
function from lib/jnpr/junos/transport/tty_netconf.py.The data read upon opening connection is fed into
HelloHandler.parse
can be of two types:bytes
sequence, if the data was XML-compliantIf the case of an unrecoverable error,
_parse_buffer
returns an XML element, on which we call decode(). It obviously raises an exception:The related PR fixes the issue by checking whether we have a bytes sequence or a XML element, and conditionally calling decode on it.
I can provide a reproduction script, even if it's not really useful (just a connection to an SRX300 through a terminal server).
The text was updated successfully, but these errors were encountered: