<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: pyATS connection refused in Tools</title>
    <link>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521962#M642</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1267241"&gt;@vsfomin&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thanks for the feedback.&lt;/P&gt;&lt;P&gt;I suspect there is an issue with the YAML file, but the issue is not obvious because I copied and pasted the information you provided into a file, launched a Python shell, and imported the testbed file without an issue -- no errors similar to what you show above.&lt;/P&gt;&lt;P&gt;The shell did ask for "enable passwords" for two of the devices, but did NOT generate errors, even when I attempted to connect to one of the devices.&lt;/P&gt;&lt;P&gt;Here's the output showing the Python session:&lt;/P&gt;&lt;PRE&gt;(tvenv) [fjm@myServer .tmp]$ python
Python 3.8.0 (default, Apr 28 2020, 13:27:51) 
[GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; 
&amp;gt;&amp;gt;&amp;gt; from pyats.topology import loader
&amp;gt;&amp;gt;&amp;gt; tb_file = "testbed1.yml"
Enter enable password for device SW-PD-01: 
Enter enable password for device SW-PD-02: 
&amp;gt;&amp;gt;&amp;gt; dev = tb.devices["SW-PD-01"]
&amp;gt;&amp;gt;&amp;gt; dev.connect()

2021-12-21 01:03:51,334: %UNICON-INFO: +++ SW-PD-01 logfile /tmp/SW-PD-01-cli-20211221T010351333.log +++

2021-12-21 01:03:51,335: %UNICON-INFO: +++ Unicon plugin iosxe +++
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to 10.0.240.171 [10.0.240.171] port 22.


2021-12-21 01:03:51,349: %UNICON-INFO: +++ connection to spawn: ssh -l admin -v 10.0.240.171 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null, id: 139941292532256 +++

2021-12-21 01:03:51,349: %UNICON-INFO: connection to SW-PD-01&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This line in your output tells us that the YAML file wasn't loaded properly:&lt;/P&gt;&lt;PRE&gt;pyats.utils.yaml.exceptions.LoadError: Content of 'testbed1.yml' failed to load into a dict.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After loading the YAML file successfully, you should be able to "ask" Python to display the dictionary that is built from the data:&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;tb.__dict__&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Here's the dictionary that was built when I loaded your YAML file:&lt;/P&gt;&lt;PRE&gt;&amp;gt;&amp;gt;&amp;gt; tb.__dict__
{'name': 'testbed1', 'alias': 'testbed1', 'servers': AttrDict({}), 'custom': AttrDict({}), 'credentials': Credentials(NestedAttrDict({})), 'devices': TopologyDict({'SW-PD-01': &amp;lt;Device SW-PD-01 at 0x7f46a24794f0&amp;gt;, 'SW-PD-02': &amp;lt;Device SW-PD-02 at 0x7f46a2479400&amp;gt;, 'SW-PD-03': &amp;lt;Device SW-PD-03 at 0x7f46a2479700&amp;gt;}), 'tacacs': AttrDict({'login_prompt': 'login:', 'password_prompt': 'Password:', 'username': 'vsuri001'}), 'passwords': AttrDict({'tacacs': 'lab', 'enable': 'lab', 'line': 'lab', 'linux': 'lab'}), 'clean': AttrDict({}), 'testbed_file': 'testbed1.yml', 'ipv4_cache': &amp;lt;genie.conf.base.utils.IPv4InterfaceCache object at 0x7f46a2bce2e0&amp;gt;, 'ipv6_cache': &amp;lt;genie.conf.base.utils.IPv6InterfaceCache object at 0x7f46a2bb0790&amp;gt;, 'mac_cache': &amp;lt;genie.conf.base.utils.MACCache object at 0x7f46a2bce7c0&amp;gt;, 'raw_config': {'devices': {'SW-PD-01': {'connections': {'cli': {'ip': '10.0.240.171', 'command': 'ssh -v 10.0.240.171 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null'}}, 'credentials': {'default': {'password': 'secretpassword', 'username': 'admin'}, 'enable': {'password': '%ASK{}'}}, 'os': 'iosxe', 'type': 'iosxe'}, 'SW-PD-02': {'connections': {'cli': {'ip': '10.0.240.172', 'command': 'ssh -v 10.0.240.172 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null'}}, 'credentials': {'default': {'password': 'secretpassword', 'username': 'admin'}, 'enable': {'password': '%ASK{}'}}, 'os': 'iosxe', 'type': 'iosxe'}, 'SW-PD-03': {'connections': {'cli': {'ip': '10.0.240.173', 'command': 'ssh -v 10.0.240.173 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null'}}, 'credentials': {'default': {'password': 'secretpassword', 'username': 'admin'}, 'enable': {'password': 'cisco'}}, 'os': 'iosxe', 'type': 'iosxe'}}, 'testbed': {'testbed_file': 'testbed1.yml', 'name': 'testbed1'}, 'topology': {}}}
&amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt;&lt;P&gt;You won't be able to attach to any devices until you can successfully load the YAML file.&lt;/P&gt;&lt;P&gt;What version of pyATS are you using?&amp;nbsp; Would you please provide the output from this command?&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;pyats version check&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I'm running an older version of pyATS -- 21.6, so perhaps there's an issue w/ the version that you're using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a Webex Space where you can get help directly from the development team.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Here's the &lt;A title="Webex pyATS Community - General" href="https://eurl.io/#r18UzrQVr" target="_blank" rel="noopener"&gt;URL&lt;/A&gt; to join the Webex space and raise your question.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Dec 2021 07:34:22 GMT</pubDate>
    <dc:creator>fracjackmac</dc:creator>
    <dc:date>2021-12-21T07:34:22Z</dc:date>
    <item>
      <title>pyATS connection refused</title>
      <link>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521679#M638</link>
      <description>&lt;P&gt;I'm trying to get pyATS to work, but it won't connect to the devices in any way.&lt;BR /&gt;There are several vIOSs deployed in the EVE-NG&amp;nbsp;lab and connection refused occurs when pyATS try to connect to my devices.&lt;BR /&gt;The hostname matches the hostname in the testbed.yaml file. Also I try to create new environment, but have the same result.&lt;BR /&gt;If you try to connect manually via ssh client it works, python/nornir scripts also work. But pyATS show me&amp;nbsp;"ssh: connect to host&amp;nbsp; port 22: Connection refused" for all atempts for all devices.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 16:30:14 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521679#M638</guid>
      <dc:creator>vsfomin</dc:creator>
      <dc:date>2021-12-20T16:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS connection refused</title>
      <link>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521762#M639</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1267241"&gt;@vsfomin&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's something you can try to get more information about why SSH is failing...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Go to&amp;nbsp;your YAML testbed file, select a device, and modify it as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp; Replace&lt;/P&gt;&lt;PRE&gt;protocol: ssh&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; with&lt;/P&gt;&lt;PRE&gt;command:&amp;nbsp;"ssh -v &lt;FONT color="#0000FF"&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;lt;device-ip-addr&amp;gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt; -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null"&lt;/PRE&gt;&lt;P&gt;Replace&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;lt;device-ip-addr&amp;gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&amp;nbsp;with the IP address of the&amp;nbsp;device that was modified in the YAML testbed file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Save your YAML testbed file changes, then bring up a Python interactive shell session and enter the following:&lt;/P&gt;&lt;PRE&gt;from pyats.topology import loader
tb_file = &lt;FONT color="#0000FF"&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;lt;testbed-file-name&amp;gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;
tb = loader.load(tb_file)
dev = tb.devices["&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;lt;device-name&amp;gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;"]
dev.connect()&lt;/PRE&gt;&lt;P&gt;Replace&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;lt;testbed-file-name&amp;gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt; with the name of your YAML testbed file.&lt;/P&gt;&lt;P&gt;Replace&amp;nbsp;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;lt;device-name&amp;gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt; with the name of the device that you modified.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output from the&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;dev.connect()&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;command should provide you with verbose output from the &lt;EM&gt;SSH -v&lt;/EM&gt;&amp;nbsp;command and provide a clue regarding why the connection request is being refused.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please post the output from your "dev.connect()" attempt here if you require additional assistance working through this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fjm&lt;/P&gt;&lt;P&gt;@ittybittypacket&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 20:06:55 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521762#M639</guid>
      <dc:creator>fracjackmac</dc:creator>
      <dc:date>2021-12-20T20:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS connection refused</title>
      <link>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521770#M640</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1267241"&gt;@vsfomin&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;One additional thought occurred to me after replying -- are there access lists on the devices that are preventing you from logging in from the host that you're running Python on?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fjm&lt;/P&gt;&lt;P&gt;@ittybittypacket&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 20:04:44 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521770#M640</guid>
      <dc:creator>fracjackmac</dc:creator>
      <dc:date>2021-12-20T20:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS connection refused</title>
      <link>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521926#M641</link>
      <description>&lt;P&gt;This is output what I have.&amp;nbsp;I get this result whether I change protocol: ssh to command: ssh -v... or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Traceback (most recent call last):
  File "/home/vsfomin/python-scripts/pyats/test.py", line 3, in &amp;lt;module&amp;gt;
    tb = loader.load(tb_file)
  File "/home/vsfomin/.local/lib/python3.6/site-packages/pyats/topology/loader/__init__.py", line 44, in load
    return TestbedFileLoader(**init_kwargs).load(loadable, **kwargs)
  File "src/pyats/utils/yaml/loader.py", line 116, in pyats.utils.yaml.loader.Loader.load
  File "src/pyats/topology/loader/base.py", line 170, in pyats.topology.loader.base.TestbedFileLoader.load_arbitrary
  File "src/pyats/utils/yaml/loader.py", line 247, in pyats.utils.yaml.loader.Loader.load_arbitrary
pyats.utils.yaml.exceptions.LoadError: Content of 'testbed1.yml' failed to load into a dict.
Got: testbed1.yml&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;My testbed file is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;devices:
  SW-PD-01:
    connections:
      cli:
        ip: 10.0.240.171
        command: "ssh -v 10.0.240.171 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null"
    credentials:
      default:
        password: secretpassword
        username: admin
      enable:
        password: '%ASK{}'
    os: iosxe
    type: iosxe
  SW-PD-02:
    connections:
      cli:
        ip: 10.0.240.172
        command: "ssh -v 10.0.240.172 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null"
    credentials:
      default:
        password: secretpassword
        username: admin
      enable:
        password: '%ASK{}'
    os: iosxe
    type: iosxe
  SW-PD-03:
    connections:
      cli:
        ip: 10.0.240.173
        command: "ssh -v 10.0.240.173 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null"
    credentials:
      default:
        password: secretpassword
        username: admin
      enable:
        password: cisco
    os: iosxe
    type: iosxe  &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my script test.py which I start to test if it works or not:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;from pyats.topology import loader
tb_file = "testbed1.yml"
tb = loader.load(tb_file)
dev = tb.devices["SW-PD-01"]
dev.connect()&lt;/PRE&gt;&lt;P&gt;No any access-list on these devices.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 06:41:12 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521926#M641</guid>
      <dc:creator>vsfomin</dc:creator>
      <dc:date>2021-12-21T06:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS connection refused</title>
      <link>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521962#M642</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1267241"&gt;@vsfomin&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thanks for the feedback.&lt;/P&gt;&lt;P&gt;I suspect there is an issue with the YAML file, but the issue is not obvious because I copied and pasted the information you provided into a file, launched a Python shell, and imported the testbed file without an issue -- no errors similar to what you show above.&lt;/P&gt;&lt;P&gt;The shell did ask for "enable passwords" for two of the devices, but did NOT generate errors, even when I attempted to connect to one of the devices.&lt;/P&gt;&lt;P&gt;Here's the output showing the Python session:&lt;/P&gt;&lt;PRE&gt;(tvenv) [fjm@myServer .tmp]$ python
Python 3.8.0 (default, Apr 28 2020, 13:27:51) 
[GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; 
&amp;gt;&amp;gt;&amp;gt; from pyats.topology import loader
&amp;gt;&amp;gt;&amp;gt; tb_file = "testbed1.yml"
Enter enable password for device SW-PD-01: 
Enter enable password for device SW-PD-02: 
&amp;gt;&amp;gt;&amp;gt; dev = tb.devices["SW-PD-01"]
&amp;gt;&amp;gt;&amp;gt; dev.connect()

2021-12-21 01:03:51,334: %UNICON-INFO: +++ SW-PD-01 logfile /tmp/SW-PD-01-cli-20211221T010351333.log +++

2021-12-21 01:03:51,335: %UNICON-INFO: +++ Unicon plugin iosxe +++
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to 10.0.240.171 [10.0.240.171] port 22.


2021-12-21 01:03:51,349: %UNICON-INFO: +++ connection to spawn: ssh -l admin -v 10.0.240.171 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null, id: 139941292532256 +++

2021-12-21 01:03:51,349: %UNICON-INFO: connection to SW-PD-01&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This line in your output tells us that the YAML file wasn't loaded properly:&lt;/P&gt;&lt;PRE&gt;pyats.utils.yaml.exceptions.LoadError: Content of 'testbed1.yml' failed to load into a dict.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After loading the YAML file successfully, you should be able to "ask" Python to display the dictionary that is built from the data:&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;tb.__dict__&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Here's the dictionary that was built when I loaded your YAML file:&lt;/P&gt;&lt;PRE&gt;&amp;gt;&amp;gt;&amp;gt; tb.__dict__
{'name': 'testbed1', 'alias': 'testbed1', 'servers': AttrDict({}), 'custom': AttrDict({}), 'credentials': Credentials(NestedAttrDict({})), 'devices': TopologyDict({'SW-PD-01': &amp;lt;Device SW-PD-01 at 0x7f46a24794f0&amp;gt;, 'SW-PD-02': &amp;lt;Device SW-PD-02 at 0x7f46a2479400&amp;gt;, 'SW-PD-03': &amp;lt;Device SW-PD-03 at 0x7f46a2479700&amp;gt;}), 'tacacs': AttrDict({'login_prompt': 'login:', 'password_prompt': 'Password:', 'username': 'vsuri001'}), 'passwords': AttrDict({'tacacs': 'lab', 'enable': 'lab', 'line': 'lab', 'linux': 'lab'}), 'clean': AttrDict({}), 'testbed_file': 'testbed1.yml', 'ipv4_cache': &amp;lt;genie.conf.base.utils.IPv4InterfaceCache object at 0x7f46a2bce2e0&amp;gt;, 'ipv6_cache': &amp;lt;genie.conf.base.utils.IPv6InterfaceCache object at 0x7f46a2bb0790&amp;gt;, 'mac_cache': &amp;lt;genie.conf.base.utils.MACCache object at 0x7f46a2bce7c0&amp;gt;, 'raw_config': {'devices': {'SW-PD-01': {'connections': {'cli': {'ip': '10.0.240.171', 'command': 'ssh -v 10.0.240.171 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null'}}, 'credentials': {'default': {'password': 'secretpassword', 'username': 'admin'}, 'enable': {'password': '%ASK{}'}}, 'os': 'iosxe', 'type': 'iosxe'}, 'SW-PD-02': {'connections': {'cli': {'ip': '10.0.240.172', 'command': 'ssh -v 10.0.240.172 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null'}}, 'credentials': {'default': {'password': 'secretpassword', 'username': 'admin'}, 'enable': {'password': '%ASK{}'}}, 'os': 'iosxe', 'type': 'iosxe'}, 'SW-PD-03': {'connections': {'cli': {'ip': '10.0.240.173', 'command': 'ssh -v 10.0.240.173 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null'}}, 'credentials': {'default': {'password': 'secretpassword', 'username': 'admin'}, 'enable': {'password': 'cisco'}}, 'os': 'iosxe', 'type': 'iosxe'}}, 'testbed': {'testbed_file': 'testbed1.yml', 'name': 'testbed1'}, 'topology': {}}}
&amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt;&lt;P&gt;You won't be able to attach to any devices until you can successfully load the YAML file.&lt;/P&gt;&lt;P&gt;What version of pyATS are you using?&amp;nbsp; Would you please provide the output from this command?&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;pyats version check&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I'm running an older version of pyATS -- 21.6, so perhaps there's an issue w/ the version that you're using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a Webex Space where you can get help directly from the development team.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Here's the &lt;A title="Webex pyATS Community - General" href="https://eurl.io/#r18UzrQVr" target="_blank" rel="noopener"&gt;URL&lt;/A&gt; to join the Webex space and raise your question.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 07:34:22 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521962#M642</guid>
      <dc:creator>fracjackmac</dc:creator>
      <dc:date>2021-12-21T07:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS connection refused</title>
      <link>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521997#M643</link>
      <description>&lt;P&gt;$ pyats version check&lt;BR /&gt;You are currently running pyATS version: 21.8.1&lt;BR /&gt;Python: 3.6.8 [64bit]&lt;/P&gt;&lt;P&gt;Package Version&lt;BR /&gt;---------------------------- -------&lt;BR /&gt;genie 21.8.2&lt;BR /&gt;genie.libs.clean 21.8&lt;BR /&gt;genie.libs.conf 21.8&lt;BR /&gt;genie.libs.filetransferutils 21.8&lt;BR /&gt;genie.libs.health 21.8.1&lt;BR /&gt;genie.libs.ops 21.8&lt;BR /&gt;genie.libs.parser 21.8&lt;BR /&gt;genie.libs.robot 21.8&lt;BR /&gt;genie.libs.sdk 21.8&lt;BR /&gt;genie.telemetry 21.8&lt;BR /&gt;genie.trafficgen 21.8.1&lt;BR /&gt;pyats 21.8.1&lt;BR /&gt;pyats.aereport 21.8.1&lt;BR /&gt;pyats.aetest 21.8.1&lt;BR /&gt;pyats.async 21.8.1&lt;BR /&gt;pyats.connections 21.8.1&lt;BR /&gt;pyats.contrib 21.8&lt;BR /&gt;pyats.datastructures 21.8.1&lt;BR /&gt;pyats.easypy 21.8.1&lt;BR /&gt;pyats.kleenex 21.8.1&lt;BR /&gt;pyats.log 21.8.1&lt;BR /&gt;pyats.reporter 21.8.1&lt;BR /&gt;pyats.results 21.8.1&lt;BR /&gt;pyats.robot 21.8.1&lt;BR /&gt;pyats.tcl 21.8.1&lt;BR /&gt;pyats.topology 21.8.1&lt;BR /&gt;pyats.utils 21.8.1&lt;BR /&gt;unicon 21.8&lt;BR /&gt;unicon.plugins 21.8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've try to create new env and install pyats 21.6, copied testbed file and test.py script to new directory&lt;/P&gt;&lt;LI-CODE lang="python"&gt;2021-12-21 03:00:16,974: %UNICON-INFO: connection to SW-PD-01
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: configuration requests final Match pass
debug1: re-parsing configuration
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf
debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config
debug1: Connecting to 10.0.240.171 [10.0.240.171] port 22.
debug1: connect to address 10.0.240.171 port 22: Connection refused
ssh: connect to host 10.0.240.171 port 22: Connection refused
Traceback (most recent call last):
  File "src/unicon/statemachine/statemachine.py", line 727, in unicon.statemachine.statemachine.StateMachine.go_to
  File "src/unicon/statemachine/statetransition.py", line 478, in unicon.statemachine.statetransition.AnyStateTransition.do_transitions
  File "src/unicon/eal/dialogs.py", line 459, in unicon.eal.dialogs.Dialog.process
  File "src/unicon/eal/dialog_processor.py", line 321, in unicon.eal.dialog_processor.SimpleDialogProcessor.process
  File "src/unicon/eal/dialog_processor.py", line 235, in unicon.eal.dialog_processor.SimpleDialogProcessor.expect_eval_statements
  File "/home/vsfomin/.local/lib/python3.6/site-packages/unicon/plugins/iosxe/cat9k/statements.py", line 29, in wrapper
    return func(spawn)
  File "/home/vsfomin/.local/lib/python3.6/site-packages/unicon/plugins/generic/statements.py", line 41, in connection_refused_handler
    raise Exception('Connection refused to device %s' % (str(spawn)))
Exception: Connection refused to device spawn: ssh -l admin -v 10.0.240.171 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null, id: 140179752518880

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "src/unicon/bases/connection.py", line 757, in unicon.bases.connection.Connection.connect
  File "src/unicon/bases/routers/connection_provider.py", line 190, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.connect
  File "src/unicon/bases/routers/connection_provider.py", line 217, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.establish_connection
  File "src/unicon/statemachine/statemachine.py", line 730, in unicon.statemachine.statemachine.StateMachine.go_to
unicon.core.errors.StateMachineError: Failed while bringing device to "any" state

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/vsfomin/python-scripts/pyats-21.6/test.py", line 5, in &amp;lt;module&amp;gt;
    dev.connect()
  File "src/pyats/connections/manager.py", line 453, in pyats.connections.manager.ConnectionManager.connect
  File "src/unicon/bases/connection.py", line 763, in unicon.bases.connection.Connection.connect
unicon.core.errors.ConnectionError: failed to connect to SW-PD-01
Failed while bringing device to "any" state&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 08:08:23 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4521997#M643</guid>
      <dc:creator>vsfomin</dc:creator>
      <dc:date>2021-12-21T08:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: pyATS connection refused</title>
      <link>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4522167#M644</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cisco.com/t5/user/viewprofilepage/user-id/1267241"&gt;@vsfomin&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I'm glad to see that the older environment (21.6) loaded the testbed file and now produces the same result that you originally saw.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked w/ the folks in the Webex&amp;nbsp;pyATS Community space regarding the failure to properly load the YAML file into the 21.8.1 environment, and the suggestion came back that you may have kicked off the Python session from a directory that did not include the YAML file.&lt;/P&gt;&lt;P&gt;To avoid an issue like this, I always call out the full pathname to the testbed file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Back to the login failure...&lt;/P&gt;&lt;P&gt;Time to figure out why the device is not allowing you in.&lt;/P&gt;&lt;P&gt;Please turn on debugging for AAA Authentication and SSH at the device to determine why the device is not accepting the login.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;debug aaa authentication&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;debug ip ssh detail&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;terminal monitor&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what I received on a &lt;STRONG&gt;successful login&lt;/STRONG&gt; to an IOS-based device with the two debug commands on plus &lt;EM&gt;&lt;STRONG&gt;terminal monitor&lt;/STRONG&gt;&lt;/EM&gt;:&lt;/P&gt;&lt;P&gt;Dec 21 08:52:32.368 EST: SSH1: starting SSH control process&lt;BR /&gt;Dec 21 08:52:32.368 EST: SSH1: sent protocol version id SSH-2.0-Cisco-1.25&lt;BR /&gt;Dec 21 08:52:32.368 EST: SSH1: protocol version id is - SSH-2.0-Sun_SSH_1.1.8&lt;BR /&gt;Dec 21 08:52:32.368 EST: SSH2 1: Server certificate trustpoint not found. Skipping hostkey algo = x509v3-ssh-rsa&lt;BR /&gt;Dec 21 08:52:32.368 EST: SSH2 1: kexinit sent: hostkey algo = ssh-rsa&lt;BR /&gt;Dec 21 08:52:32.368 EST: SSH2 1: kexinit sent: encryption algo = aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc&lt;BR /&gt;Dec 21 08:52:32.368 EST: SSH2 1: kexinit sent: mac algo = hmac-sha1,hmac-sha1-96&lt;BR /&gt;Dec 21 08:52:32.368 EST: SSH2 1: SSH2_MSG_KEXINIT sent&lt;BR /&gt;Dec 21 08:52:32.376 EST: SSH2 1: SSH2_MSG_KEXINIT received&lt;BR /&gt;Dec 21 08:52:32.376 EST: SSH2 1: kex: client-&amp;gt;server enc:aes256-ctr mac:hmac-sha1&lt;BR /&gt;Dec 21 08:52:32.376 EST: SSH2 1: kex: server-&amp;gt;client enc:aes256-ctr mac:hmac-sha1&lt;BR /&gt;Dec 21 08:52:32.376 EST: SSH2 1: Using hostkey algo = ssh-rsa&lt;BR /&gt;Dec 21 08:52:32.376 EST: SSH2 1: Using kex_algo = diffie-hellman-group-exchange-sha1&lt;BR /&gt;Dec 21 08:52:32.576 EST: SSH2 1: SSH2_MSG_KEX_DH_GEX_REQUEST received&lt;BR /&gt;Dec 21 08:52:32.576 EST: SSH2 1: Range sent by client is - 1024 &amp;lt; 4096 &amp;lt; 8192&lt;BR /&gt;Dec 21 08:52:32.576 EST: SSH2 1: Modulus size established : 4096 bits&lt;BR /&gt;Dec 21 08:52:32.952 EST: SSH2 1: expecting SSH2_MSG_KEX_DH_GEX_INIT&lt;BR /&gt;Dec 21 08:52:32.952 EST: SSH2 1: SSH2_MSG_KEXDH_INIT received&lt;BR /&gt;Dec 21 08:52:33.412 EST: SSH2: kex_derive_keys complete&lt;BR /&gt;Dec 21 08:52:33.412 EST: SSH2 1: SSH2_MSG_NEWKEYS sent&lt;BR /&gt;Dec 21 08:52:33.412 EST: SSH2 1: waiting for SSH2_MSG_NEWKEYS&lt;BR /&gt;Dec 21 08:52:33.420 EST: SSH2 1: SSH2_MSG_NEWKEYS received&lt;BR /&gt;Dec 21 08:52:33.620 EST: SSH2 1: Authentications that can continue = publickey,keyboard-interactive,password&lt;BR /&gt;Dec 21 08:52:33.620 EST: SSH2 1: Using method = none&lt;BR /&gt;Dec 21 08:52:33.620 EST: SSH2 1: Authentications that can continue = publickey,keyboard-interactive,password&lt;BR /&gt;Dec 21 08:52:33.784 EST: SSH2 1: Using method = keyboard-interactive&lt;BR /&gt;Dec 21 08:52:33.784 EST: AAA/BIND(0000002C): Bind i/f&lt;BR /&gt;Dec 21 08:52:33.784 EST: AAA/AUTHEN/LOGIN (0000002C): Pick method list 'default'&lt;BR /&gt;Dec 21 08:52:45.717 EST: SSH2 1: authentication successful for vsuri001&lt;BR /&gt;Dec 21 08:52:45.717 EST: SSH2 1: channel open request&lt;BR /&gt;Dec 21 08:52:45.717 EST: SSH2 1: pty-req request&lt;BR /&gt;Dec 21 08:52:45.717 EST: SSH2 1: setting TTY - requested: height 45, width 142; set: height 45, width 142&lt;BR /&gt;Dec 21 08:52:45.717 EST: SSH2 1: shell request&lt;BR /&gt;Dec 21 08:52:45.717 EST: SSH2 1: shell message received&lt;BR /&gt;Dec 21 08:52:45.717 EST: SSH2 1: starting shell for vty&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;router01-lab-03#&lt;STRONG&gt;show debug&lt;/STRONG&gt;&lt;BR /&gt;General OS:&lt;BR /&gt;AAA Authentication debugging is on&lt;/P&gt;&lt;P&gt;SSH:&lt;BR /&gt;ssh detail messages debugging is on&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully something obvious will pop up to tell you why you're being rejected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fjm&lt;/P&gt;&lt;P&gt;@ittybittypacket&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 14:16:42 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-connection-refused/m-p/4522167#M644</guid>
      <dc:creator>fracjackmac</dc:creator>
      <dc:date>2021-12-21T14:16:42Z</dc:date>
    </item>
  </channel>
</rss>

