06-19-2020 12:57 PM
I'm experimenting with the Genie / pyATS scripts to remotely gather configurations so they can be compared. When I try to connect the SSH session is hanging indefinitely.
Upon further review I realized that due to our custom tacacs+ implementation we're not sending a Password: prompt, but a custom message on what is expected. I'm trying to find where in the genie or pyATS code to modify it so that I can add this particular string of text as an alternative to Password:
Anyone run into this or know where to adjust?
06-19-2020 10:53 PM
Hi Jeff,
I haven't run into this one before when I've used pyATS but then again my implimentation of AAA hasn't required any changes to the password field before.
Are you able to post a picture of what the CLI spits out? I'm curious to see if you can indeed right a simple function that parses that particular output so the SSH connection continues on instead of just hanging.
06-20-2020 01:44 AM
Hi
Please have a look at Login and Password Prompts section in the docs -
It can be done by setting regular expression to LOGIN_PROMPT and PASSWORD_PROMPT attributes of device settings.
Example:
# Unicon standalone mode
dev = Connection(hostname='R2', start=['telnet x.x.x.x'],\
credentials={{'default': {'username': 'admin', 'password': 'Cisc0123'}})
dev.settings.LOGIN_PROMPT = r'USERNAME:\s?$'
dev.settings.PASSWORD_PROMPT = r'PASSWORD:\s$'
In pyATS testbed yaml file, this can be set in the following way:
devices:
R2
credentials:
default:
username: admin
password: Cisc0123
connections:
defaults: {class: 'unicon.Unicon'}
a:
protocol: telnet
ip: x.x.x.x
port: 2042
prompts:
login: r'USERNAME:\s?$'
password: r'PASSWORD:\s$'
Hope this helps ..
please hit the helpful button for any helpful posts..
09-04-2024 06:49 AM - edited 09-04-2024 06:49 AM
Hi,
I have the same issue on a ios device. Setting
dev.settings.PASSWORD_PROMPT = r'PASSWORD:\s$'
works fine but if I try to set the value in the testbed file, pattern list is not updated. Indeed the documentation states
These settings attributes are supported on below plugins:
generic
iosxr
junos
linux
aireos
Is there any way to make pyats working with custom ssh password prompts and ios/iosxe switches?
Regards
M
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide