10-08-2020 02:27 AM
Hi,
Just started to play around with pyATS and genie.
But I cannot connect to the switch via ssh.
My testbed.yml file looks like this:
devices: as-test2: connections: vty: ip: 172.21.31.6 protocol: ssh credentials: default: password: '%ASK{}' username: chris os: iosxe type: iosxe series: cat9k platform: cat9k
Then I try to parse "show version" and the connect fails:
./bin/genie -vvv parse "show version" --testbed-file testbed.yml loading yaml file /Users/cb/networking/genie/testbed.yml Deriving testbed name ... Enter default password for device as-test2: Using a default key as pyATS configuration under [secrets] string.key was not specified. Using a default key as pyATS configuration under [secrets] string.key was not specified. Credential credentials not found, trying default ... Credential credentials not found, trying default ... 2020-10-08 11:04:33,535: %UNICON-INFO: +++ as-test2 logfile /tmp/as-test2-cli-20201008T110433535.log +++ 2020-10-08 11:04:33,536: %UNICON-INFO: +++ Unicon plugin iosxe/cat9k +++ Connection closed by 172.21.31.6 port 22 2020-10-08 11:04:42,574: %UNICON-INFO: +++ connection to spawn: ssh -l chris 172.21.31.6, id: 4682891904 +++ 2020-10-08 11:04:42,574: %UNICON-INFO: connection to as-test2 0%| | 0/1 [00:00<?, ?it/s]Issue with the parser show version Traceback (most recent call last): File "src/genie/cli/commands/parser.py", line 339, in genie.cli.commands.parser.ParserCommand.parse File "src/genie/conf/base/device.py", line 551, in genie.conf.base.device.Device.parse File "src/genie/conf/base/device.py", line 582, in genie.conf.base.device.Device._get_parser_output TypeError: device is not connected, output must be provided. 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 2.30it/s]
ssh access in general is working via terminal, and also username and password are correct.
In syslog it generates messages:
%SEC_LOGIN-4-LOGIN_FAILED: Login failed [user: Invalid-Credentials] [Source: 172.23.8.241] [localport: 22] [Reason: Login Authentication Failed]
Has someone an idea what could be the reason.
Kind regards, Christian
Solved! Go to Solution.
10-08-2020 08:39 AM
Yes..you are right. Are you in a position to spin up a new virtual environment or use the pyATS Docker image and try? It looks like your testbed file is good and if you can ssh from that same system I would try to determine if maybe I had an issue with my environment.
10-08-2020 06:03 AM
HI @boesch
Can you try replacing vty with your cli in your testbed file?
Also, what version of pyATS are you using.
Here is an Intro Repo that may be of help:
https://github.com/cldeluna/interop2020_pyats_intro
10-08-2020 07:03 AM
Hi Claudia,
I've already tried changing vty to cli with no effect.
I have pyats version 20.9.
10-08-2020 07:42 AM
good..thx for the info.
Is the hostname as-test2 the actual hostname of the device? Those should match exactly
here is what I get when the hostname does not match:
(interop2020_pyats_intro) claudia@Claudias-iMac interop2020_pyats_intro % pyats parse "show version" --testbed-file test_tb.yml --output TEST Enter default password for device as-test2: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 2.64it/s] +==============================================================================+ | Genie Parse Summary for as-test2 | +==============================================================================+ | Failed to connect to as-test2 | | - Log: TEST/connection_as-test2.txt | |------------------------------------------------------------------------------| | Could not parse 'show version' | | - Exception: TEST/as-test2_show-version_exception.txt | | - Device Console: TEST/as-test2_show-version_console.txt | |------------------------------------------------------------------------------|
Here is what I get when it does:
(interop2020_pyats_intro) claudia@Claudias-iMac interop2020_pyats_intro % pyats parse "show version" --testbed-file test_tb.yml --output TEST Enter default password for device celebes-sw05: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.30it/s] +==============================================================================+ | Genie Parse Summary for celebes-sw05 | +==============================================================================+ | Connected to celebes-sw05 | | - Log: TEST/connection_celebes-sw05.txt | |------------------------------------------------------------------------------| | Parsed command 'show version' | | - Parsed structure: TEST/celebes-sw05_show-version_parsed.txt | | - Device Console: TEST/celebes-sw05_show-version_console.txt | |------------------------------------------------------------------------------| (interop2020_pyats_intro) claudia@Claudias-iMac interop2020_pyats_intro %
Here is the testbed file I used the second time (that worked):
--- devices: celebes-sw05: connections: vty: ip: 10.1.10.216 protocol: ssh credentials: default: password: '%ASK{}' username: cisco os: iosxe type: iosxe series: cat9k platform: cat9k
So you are on the right track!
10-08-2020 08:21 AM
Yes the hostname is exactly the same:
as-test2#sh run | in hostname hostname as-test2
In your unsuccessful example you can at least connect.
My problem is that the connection cannot be established:
Traceback (most recent call last): File "src/genie/cli/commands/parser.py", line 339, in genie.cli.commands.parser.ParserCommand.parse File "src/genie/conf/base/device.py", line 551, in genie.conf.base.device.Device.parse File "src/genie/conf/base/device.py", line 582, in genie.conf.base.device.Device._get_parser_output TypeError: device is not connected, output must be provided.
10-08-2020 08:39 AM
Yes..you are right. Are you in a position to spin up a new virtual environment or use the pyATS Docker image and try? It looks like your testbed file is good and if you can ssh from that same system I would try to determine if maybe I had an issue with my environment.
09-09-2021 12:51 AM - edited 09-09-2021 01:04 AM
If you have done the DEVNET Associate 1.0 course then follow this:-
1. See the steps in LAB-7.0.3---- PART-2, STEP-4
2. Do those steps again before pushing the command "genie parse "show ip interface brief" --testbed-file yaml/testbed.yml --devices CSR1kv"
3. It shows an error because whenever you start CSR1kv it changes the RSA fingerprint in the backend and when you try to connect with the tesbed.yml credentials it refuses the connection due to RSA mismatch.
4. Follow my point no-1 and delete the existing RSA Fingerprint and update with the new one and again push the command "show ip interface brief" --testbed-file yaml/testbed.yml --devices CSR1kv" it will work for sure.
5. You can see the screenshots for further reference.
Regards,
Satya Prakash Dhal
12-26-2021 06:49 AM
I had the same issue and following the steps from SPDCool solved it, thank you!
05-12-2023 07:03 AM
your screenshots definitely helped!! thank you
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