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

Banner and Cisco IOS fail when cmd_verify=True #1531

Closed
chriseizus opened this issue Jan 27, 2020 · 9 comments
Closed

Banner and Cisco IOS fail when cmd_verify=True #1531

chriseizus opened this issue Jan 27, 2020 · 9 comments
Labels

Comments

@chriseizus
Copy link

I'm having following code to push cisco ios banner to the device.
After upgrade to 3.0, it no longer works. It works fine when switch back to 2.4.2

Exception: <class 'netmiko.ssh_exception.NetmikoTimeoutException'>: Timed-out reading channel, data not available.

I guess it is due to the new expect mechanism in send_config_set since when configuring multi line banner, the device_name# won't be returned yet until the last line of the banner applied.

Here is the code, please advise any solution.

ios_device = {
'device_type': 'cisco_ios',
'ip': "192.168.0.1",
'username': "admin",
'password': "cisco",
'secret': "cisco"
}

net_connect = None

net_connect = ConnectHandler(**ios_device)

banner = [
"banner login ^",
"This is login banner",
"^"
]

net_connect.enable() # I'm using priviledge level 15 so enable is not really an issue
net_connect.send_config_set(banner)

@ktbyers
Copy link
Owner

ktbyers commented Jan 27, 2020

You can ignore my earlier comment, it was incorrect and I deleted it.

Let me re-test it.

@ktbyers
Copy link
Owner

ktbyers commented Jan 27, 2020

Okay, I reproduced the issue.

You can disable the cmd_verify behavior by doing:

net_connect.send_config_set(banner, cmd_verify=False)

I will need to figure out what to do here...

@chriseizus
Copy link
Author

Nice for the prompt test. Will stay tuned for the resolving. Thanks

@ktbyers
Copy link
Owner

ktbyers commented Jan 27, 2020

I wouldn't stay tuned as it might take me a while to fix. I.E. use the fix stated above.

Leave this issue open, however, so I can track the issue you referenced.

@chriseizus
Copy link
Author

Ok, any caveat of using cmd verify false? Still a reliable push? Or I should be only dealing with banner using this?

@ktbyers
Copy link
Owner

ktbyers commented Jan 27, 2020

It basically just falls back to the Netmiko send_config_set mode that existed prior to Netmiko 3.X.X.

@ktbyers ktbyers added the bug label Apr 14, 2021
@ktbyers ktbyers changed the title Banner push failed in 3.0 but successful in 2.4.2 Banner and Cisco IOS fail when cmd_verify=True Apr 14, 2021
@mkorn2021
Copy link

mkorn2021 commented Apr 23, 2021

The most evident you are having a low-speed connection between you and your device. Consider setting a pause between commands that you send to device

@chriseizus
Copy link
Author

The most evident you are having a low-speed connection between you and your device. Consider setting a pause between commands that you send to device

This has been validated by ktbyers as a bug.
Just so you know, it's nothing to do with connection speed. I'm testing in my lab. the swtich is beside me.

@ktbyers
Copy link
Owner

ktbyers commented Nov 2, 2021

Should be fixed here:

#2558

Netmiko will auto disable cmd_verify for banner configuration commands.

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

No branches or pull requests

3 participants