cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
788
Views
0
Helpful
8
Replies

Pyats does not see hostname while connect

Dombre
Level 1
Level 1

Dombre_0-1739812940915.png

Hostname: DUT1(Master:1)

Hi team. I've run into a problem, as you can see above - when trying to connect with this hostname, I get an error because the hostname doesn't match the prompt. Is there any way to change the prompt, or another way to solve this problem? (Changing the hostname is not possible, because when the switches are stacked, this suffix appears and i can`t remove it on my system).  

8 Replies 8

mfr-6
Spotlight
Spotlight

Hi @Dombre 

Could you please share with us your testbed file? What's the platform/hardware name for destination device you want to connect to?

Mateusz Frak NetDevOps | DevNet | Automation DevNet Expert #20240068
Please mark this post as helpful if it solves your issue, to make this visible for other users, thank you!

Jesus Illescas
Cisco Employee
Cisco Employee

Without looking at your testbed could be a hostname mismatch between what you have on your testbed and the hostname of your device. 

From https://xrdocs.io/programmability/tutorials/pyats-series-tips-and-tricks/#mismatch-between-the-hostname-and-the-keys-in-the-testbed


The name of the device in your testbed, and the hostname MUST match. It’s case sensitive. In case it doesn’t match, you will have a similar error.

unicon.core.errors.TimeoutError: Prompt timeout occured, please check the hostname 

You can also specify in your Python script that you do not care if they don’t match by setting the learn_hostname argument to True in your device connect() method.

device.connect(learn_hostname=True)

As always full tracebacks are good to check erros, and better if they are text based so is easier to parse them.

 

IMG_5026.jpeg

@Jesus Illescas 

@mfr-6 

my hostname is DUT1, but in CLI when the switch is stacked its «DUT1(Master:1)»  so connect function can’t see the hostname.

I tried changing hostname in testbed, but it is useless because the connect function cant even read the hostname from the CLI, its in the buffer

mfr-6
Spotlight
Spotlight

@Dombre 

What's the platform/hardware of the stacked switch you want to connect to?

Mateusz Frak NetDevOps | DevNet | Automation DevNet Expert #20240068
Please mark this post as helpful if it solves your issue, to make this visible for other users, thank you!

Dombre
Level 1
Level 1

@mfr-6  its my own iosxe-like os

mfr-6
Spotlight
Spotlight

@Dombre - the prompt i see coming from your device looks like HP/Aruba-like device, or something similar. I'm afraid it's not supported by Unicon, the framework that deals with creating connections to devices, used by pyATS.

Please see the list of supported devices here: https://pubhub.devnetcloud.com/media/unicon/docs/user_guide/supported_platforms.html#

Mateusz Frak NetDevOps | DevNet | Automation DevNet Expert #20240068
Please mark this post as helpful if it solves your issue, to make this visible for other users, thank you!

Dombre
Level 1
Level 1

@mfr-6  i can connect to devices, everything works except this device that is stacked (it connects but then the command are not sent)

mfr-6
Spotlight
Spotlight

@Dombre yes, I see your struggle and the problem is that your device is not fully supported under certain conditions (in your case - once device is stacked) and that's because your device requires special prompt handling, but since unicon doesn't support that, it doesn't know how to handle prompt that includes "(Master:1)".

The reason why it works with a switches not being stacked is because CLI interface is pretty much the same as iosxe one and as long as there are no discrepancies, all works good as all patterns of ios-xe are matched.

I see this is important for you, so what about addressing your issue directly to the team who is responsible for pyATS? Drop them an email and include a link to this conversation, so they'll better understand what's the issue about.
Here's the contact info to pyATS team: pyats-support-ext@cisco.com

pyATS is available for everyone for free, but it's closed-source, meaning that community cannot make adjustments to the code to add support for new device types - that's why issues like this need to be addressed to the team who's in charge of pyATS.

Mateusz Frak NetDevOps | DevNet | Automation DevNet Expert #20240068
Please mark this post as helpful if it solves your issue, to make this visible for other users, thank you!