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

Junos Terminal Output Discrepancy Between Device and Netmiko #3466

Open
jvdspeare opened this issue Jul 23, 2024 · 2 comments
Open

Junos Terminal Output Discrepancy Between Device and Netmiko #3466

jvdspeare opened this issue Jul 23, 2024 · 2 comments

Comments

@jvdspeare
Copy link

jvdspeare commented Jul 23, 2024

Description of Issue/Question

netmiko.exceptions.ReadTimeout: Pattern not detected, while configuring a Juniper EX2300. From the logs, it would appear netmiko is having an issue reading the terminal, or there's an issue with the logging. Please observe the discrepancy between:
Jul 23 16:55:40 lab_jun_ex2300_0 mgd[7099]: UI_CMDLINE_READ_LINE: User 'x', command 'set interfaces ge-0/0/2 unit 0 description provisioning-vlan '
&
{master:0}[edit]
x@lab_jun_ex2300_0# set interfaces ge-0/0/2
x@lab_jun_ex2300_0# set interfaces ge-0/0/2 ���unit 0 description provisioning-vlan

Device perspective:
Jul 23 16:55:40 lab_jun_ex2300_0 mgd[7099]: UI_CMDLINE_READ_LINE: User 'x', command 'configure exclusive '
Jul 23 16:55:40 lab_jun_ex2300_0 mgd[7099]: UI_DBASE_LOGIN_EVENT: User 'x' entering configuration mode
Jul 23 16:55:40 lab_jun_ex2300_0 mgd[7099]: UI_CMDLINE_READ_LINE: User 'x', command 'delete interfaces ge-0/0/2 disable '
Jul 23 16:55:40 lab_jun_ex2300_0 mgd[7099]: UI_CMDLINE_READ_LINE: User 'x', command 'set interfaces ge-0/0/2 unit 0 description provisioning-vlan '

Netmiko session log:
{master:0}
x@lab_jun_ex2300_0>
{master:0}
x@lab_jun_ex2300_0>
{master:0}
x@lab_jun_ex2300_0> configure exclusive
warning: uncommitted changes will be discarded on exit
Entering configuration mode
{master:0}[edit]
x@lab_jun_ex2300_0#
{master:0}[edit]
x@lab_jun_ex2300_0#
{master:0}[edit]
x@lab_jun_ex2300_0# delete interfaces ge-0/0/2 disable
{master:0}[edit]
x@lab_jun_ex2300_0# set interfaces ge-0/0/2
x@lab_jun_ex2300_0# set interfaces ge-0/0/2 ���unit 0 description provisioning-vlan

Exception:
netmiko.exceptions.ReadTimeout:
Pattern not detected: 'set\ interfaces\ ge\-0/0/2\ unit\ 0\ description\ provisioning\-vlan' in output.
Things you might try to fix this:

  1. Adjust the regex pattern to better identify the terminating string. Note, in
    many situations the pattern is automatically based on the network device's prompt.
  2. Increase the read_timeout to a larger value.
    You can also look at the Netmiko session_log or debug log for more information.

Netmiko version

4.4.0

Netmiko device_type (if relevant to the issue)

juniper_junos

Relevant Python code

ssh_configuration = ['delete interfaces ge-0/0/2 disable', 'set interfaces ge-0/0/2 unit 0 description provisioning-vlan']

net_connect.send_config_set(ssh_configuration,
                                                                             exit_config_mode=False,
                                                                             read_timeout=120)})
@jvdspeare
Copy link
Author

jvdspeare commented Jul 23, 2024

cmd_verify=False resolves however I feel it's worth raising as it may be a bug. I tried different delays (global and delay_factor) without success. I can only replicate when configuring certain interfaces, which makes the behaviour even stranger.

@ktbyers
Copy link
Owner

ktbyers commented Jul 24, 2024

@jvdspeare It looks like the Juniper device does something odd here from a user-interface perspective with the "?" mark characters.

x@lab_jun_ex2300_0# set interfaces ge-0/0/2 ���unit 0 description provisioning-vlan

You can probably see if you can actually capture the characters that get echoed back (i.e. what Juniper outputs here). You might need to look at them using "repr".

You could also very that the Netmiko command (earlier in the session) that sets the terminal width is being properly accepted ("set cli screen-width 511").

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

No branches or pull requests

2 participants