Skip to content
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

Added support to telnetlib #1358

Merged
merged 2 commits into from
Feb 20, 2025
Merged

Conversation

dineshbaburam91
Copy link
Collaborator

@dineshbaburam91 dineshbaburam91 commented Jan 27, 2025

Used the telnetlib.py from python source code to fix telnetlib dependency in junos-eznc.

It is temporary fix till it support exscript or telnetlib3 in junos-eznc.

(pyez_vir)  % python3.13 tel_ex.py
INFO:jnpr.junos.tty:TTY: connecting to TTY:x.x.x.x:23 ...
INFO:jnpr.junos.tty:TTY: logging in......
INFO:jnpr.junos.tty:TTY: OK.....starting NETCONF
INFO:jnpr.junos.console:facts: retrieving device facts...
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><get-route-engine-information/></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><file-list><path>~</path></file-list></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><get-chassis-inventory/></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><file-show><filename>/usr/share/cevo/cevo_version</filename></file-show></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><get-interface-information><routing-instance>__juniper_private1__</routing-instance><terse/></get-interface-information></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><file-show><filename>/etc/hosts.junos</filename></file-show></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><get-configuration database="committed" inherit="inherit" commit-scripts="apply"><configuration>\n            <system>\n                <domain-name/>\n             </system>\n        </configuration></get-configuration></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><command>show version invoke-on all-routing-engines</command></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><get-virtual-chassis-information/></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><get-chassis-cluster-status/></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><get-ethernet-switching-table-information><summary/></get-ethernet-switching-table-information></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><command>show bridge mac-table count</command></rpc>'
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><request-shell-execute><command>sysctl -n hw.re.vmhost_mode</command></request-shell-execute></rpc>'
{'2RE': True, 'HOME': '/var/home/regress', 'RE0': {'mastership_state': 'master', 'status': 'OK', 'model': 'RE-S-1800x4', 'last_reboot_reason': 'Router rebooted after a normal shutdown.', 'up_time': '3 hours, 2 minutes, 49 seconds'}, 'RE1': {'mastership_state': 'Present', 'status': None, 'model': None, 'last_reboot_reason': None, 'up_time': None}, 'RE_hw_mi': False, 'current_re': ['re0', 'master', 'node', 'fwdd', 'member', 'pfem'], 'domain': 'juniper.net', 'fqdn': 'sandalwood.englab.juniper.net', 'hostname': 'x.x.x.x', 'hostname_info': {'re0': 'x.x.x.x'}, 'ifd_style': 'CLASSIC', 'junos_info': {'re0': {'text': '25.2, 'object': junos.version_info(major=(25, 2), type=I, minor=2025, build=None)}}, 'master': 'RE0', 'model': 'MX480', 'model_info': {'re0': 'MX480'}, 'personality': 'MX', 're_info': {'default': {'0': {'mastership_state': 'master', 'status': 'OK', 'model': 'RE-S-1800x4', 'last_reboot_reason': 'Router rebooted after a normal shutdown.'}, '1': {'mastership_state': 'Present', 'status': None, 'model': None, 'last_reboot_reason': None}, 'default': {'mastership_state': 'master', 'status': 'OK', 'model': 'RE-S-1800x4', 'last_reboot_reason': 'Router rebooted after a normal shutdown.'}}}, 're_master': {'default': '0'}, 'serialnumber': 'JN123', 'srx_cluster': None, 'srx_cluster_id': None, 'srx_cluster_redundancy_group': None, 'switch_style': 'BRIDGE_DOMAIN', 'vc_capable': False, 'vc_fabric': None, 'vc_master': None, 'vc_mode': None, 'version': '25.2I', 'version_RE0': '25.2', 'version_RE1': None, 'version_info': junos.version_info(major=(25, 2), type=I, minor=20250127_, build=None), 'virtual': False, 'vmhost': False}
INFO:jnpr.junos.tty:logout: logging out.....
INFO:jnpr.junos.tty_netconf:Calling rpc: b'<rpc><close-session/></rpc>'

Used the telnetlib.py from python source code to fix telnetlib
dependency in junos-eznc.

It is temporary fix till it support exscript or telnetlib3 in
junos-eznc.
Copy link
Collaborator

@chidanandpujar chidanandpujar left a comment

Choose a reason for hiding this comment

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

approved

@chidanandpujar chidanandpujar merged commit 0348d41 into Juniper:master Feb 20, 2025
7 checks passed
@ktbyers
Copy link

ktbyers commented Feb 20, 2025

Thanks for fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants