timing issue with find_prompt on Palo Alto - netmiko 1.0.0
See original GitHub issue[Summary: in netmiko v1.0.0 need to set delay_factor in paloalto_panos_ssh.py to 7 from the current value of 3 to get it to work with Palo Altos as it did with netmiko v0.5.6]
All was fine connecting to my Palo Alto 5060 with 0.5.6, but with 1.0.0 I get:
Traceback (most recent call last):
File "/home/fav/get_arp_tables.py", line 241, in <module>
net_connect = ConnectHandler(**dev)
File "/home/fav/anaconda3/lib/python3.5/site-packages/netmiko/ssh_dispatcher.py", line 94, in ConnectHandler
return ConnectionClass(*args, **kwargs)
File "/home/fav/anaconda3/lib/python3.5/site-packages/netmiko/base_connection.py", line 89, in __init__
self.session_preparation()
File "/home/fav/anaconda3/lib/python3.5/site-packages/netmiko/paloalto/paloalto_panos_ssh.py", line 21, in session_preparation
self.set_base_prompt(delay_factor=3)
File "/home/fav/anaconda3/lib/python3.5/site-packages/netmiko/base_connection.py", line 478, in set_base_prompt
raise ValueError("Router prompt not found: {0}".format(prompt))
ValueError: Router prompt not found: Welcome root.
The Palo Alto returns the following on login:
Last login: Thu Oct 6 11:58:08 2016 from x.y.z
Welcome root.
root@fw(active)>
Turning on debugging in find_prompt() in base_connection.py (extra debugging prompt4 and “end of prompt” added by me - prompt4 is the result after processing multi-line response) I get:
prompt1:
^^^^^ end of prompt1 ^^^^^
prompt2a: 'Welcome root.'
^^^^^ end of prompt2a ^^^^^
prompt2b: Welcome root.
^^^^^ end of prompt2b ^^^^^
prompt3: Welcome root.
^^^^^ end of prompt3 ^^^^^
prompt4: Welcome root.
^^^^^ end of prompt4 ^^^^^
Traceback (most recent call last):
File "test_netmiko.py", line 7, in <module>
net_connect = ConnectHandler(**dev)
File "/home/fav/anaconda3/lib/python3.5/site-packages/netmiko/ssh_dispatcher.py", line 94, in ConnectHandler
return ConnectionClass(*args, **kwargs)
File "/home/fav/anaconda3/lib/python3.5/site-packages/netmiko/base_connection.py", line 89, in __init__
self.session_preparation()
File "/home/fav/anaconda3/lib/python3.5/site-packages/netmiko/paloalto/paloalto_panos_ssh.py", line 23, in session_preparation
self.set_base_prompt(delay_factor=3)
File "/home/fav/anaconda3/lib/python3.5/site-packages/netmiko/base_connection.py", line 478, in set_base_prompt
raise ValueError("Router prompt not found: {0}".format(prompt))
ValueError: Router prompt not found: Welcome root.
So despite sending a newline in find_prompt(), it doesn’t get past seeing “Welcome root” as the response.
If I change the value of delay_factor in paloalto_panos_ssh.py from 3 to 4 it works, but only by sending multiple newlines in find_prompt:
prompt1:
^^^^^ end of prompt1 ^^^^^
prompt2a: 'Welcome root.\r\n\r\nroot@fw(active)> \r\nroot@fw(active)> \r\nroot@fw(active)>'
^^^^^ end of prompt2a ^^^^^
prompt2b: Welcome root.
root@fw(active)>
root@fw(active)>
root@fw(active)>
^^^^^ end of prompt2b ^^^^^
prompt3: Welcome root.
root@fw(active)>
root@fw(active)>
root@fw(active)>
^^^^^ end of prompt3 ^^^^^
prompt4: root@fw(active)>
^^^^^ end of prompt4 ^^^^^
If I increase delay_factor to 7, then it works as expected (and as similar debugging shows it does with netmiko v0.5.6), getting all of the initial prompt lines without having to send more than one newline in find_prompt():
prompt1: Welcome root.
root@fw(active)>
root@fw(active)>
^^^^^ end of prompt1 ^^^^^
prompt3: Welcome root.
root@fw(active)>
root@fw(active)>
^^^^^ end of prompt3 ^^^^^
prompt4: root@fw(active)>
^^^^^ end of prompt4 ^^^^^
Hope this helps, and many thanks for the module,
Mark
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (6 by maintainers)
Top GitHub Comments
Okay, made this change in dev_1_1 branch:
https://github.com/ktbyers/netmiko/commit/891fc42f1d7f1ca51d8790a617bdd80dd71b0a56
That results in a 2 second delay which isn’t that long.
Can either of you test the dev_1_1 branch and see if this fixes it? @mcfone @GGabriele
Okay, I am going to close this issue.
If you see problems in the future, just open a new issue.