cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1827
Views
5
Helpful
2
Replies

PYATS failed to connect (even though it does)

MK9796
Level 1
Level 1

I have a project coming up to do some DHCP helper updates enterprise wide. I was hoping to use pyATS to confirm the changes. I started with this simple yaml file in my lab. I get a failed to connect even though the log shows it connecting. I think I'm missing something simple. I can't really come up with a simpler test. The yaml file is attached.

 

Test device is a Catalyst 3560. I can successfully login with the credentials and have priv 15 access. 

 

Command:

 

genie learn all -v -v -v --testbed-file example.yaml


loading yaml file example.yaml

 

Learning '['acl', 'arp', 'bgp', 'dot1x', 'eigrp', 'fdb', 'hsrp', 'igmp', 'interface', 'lag', 'lisp', 'lldp', 'mcast', 'mld', 'msdp', 'nd', 'ntp', 'ospf', 'pim', 'platform', 'prefix_list', 'rip', 'route_policy', 'routing', 'static_routing', 'stp', 'vlan', 'vrf', 'vxlan', 'config']' on devices '['sw1']'

 

failed to connect to sw1

 

Log:

 

[2019-07-01 10:50:25,016] +++ sw1 logfile ./connection_sw1.txt +++
[2019-07-01 10:50:25,016] +++ Unicon plugin ios +++
Trying 192.168.1.157...

[2019-07-01 10:50:25,023] +++ connection to spawn: telnet 192.168.1.157, id: 140148915360768 +++
[2019-07-01 10:50:25,023] connection to sw1
Connected to 192.168.1.157.
Escape character is '^]'.


User Access Verification

Username: cisco
Password:
SW1#

2 Replies 2

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

I've not had a chance to test pyATS yet, but I'm going to take a wild guess...

 

The device name (or maybe the alias) probably has to match the hostname shown on the CLI prompt. This is probably a fail safe to verify you have connected to the device you think it is. I'd suggest changing your yaml file to:

testbed:
  name: genie
  tacacs:
      username: "cisco"
  passwords:
      tacacs: "cisco"
      enable: "cisco"
      line: "cisco"
devices:
  SW1:
    alias: SW1
....<etc>....

cheers,

Seb.

I had the same problem but thanks to @Seb Rupik hint the connection to devices is now working without a problem

 

Thank you again @Seb Rupik 

 

 

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: