<?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 Genie connect() function can't ssh to ASR9K with interactive login. in Tools</title>
    <link>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070108#M533</link>
    <description>&lt;P&gt;Thanks for shinning some light here omz.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I tried your suggestion I realized that the "interactive login" happens before Genie calls the connect() function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output when I enter a password at the CLI prompt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;vkoulermou$ genie parse "show version" --testbed-file testbed.yaml -vvv
loading yaml file /Users/vkoulermou/Automate-ACL/testbed.yaml
Deriving testbed name ...
Enter default password for device access-r.lim:       &lt;STRONG&gt;# Did not enter password here&lt;/STRONG&gt;Enter enable password for device access-r.lim:        &lt;STRONG&gt;# Did not enter password here&lt;/STRONG&gt;
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.
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-04-21 00:09:21,041] +++ access-r.lim logfile /tmp/access-r_lim-cli-20200421T000921040.log +++
[2020-04-21 00:09:21,041] +++ Unicon plugin iosxr +++

C
***********************************************************************
* MOTD here                                                           *
***********************************************************************
[2020-04-21 00:09:22,269] +++ connection to spawn: ssh -l vkoulermou 10.20.0.10, id: 4608966176 +++
[2020-04-21 00:09:22,270] connection to access-r.lim
***********************************************************************
* MOTD continutes here                                                *
***********************************************************************

You are connected to: 

****** access-r.lim ******


Password: Using a default key as pyATS configuration under [secrets] string.key was not specified.

&lt;STRONG&gt;Password: 111111     # Password entered here and returned my input at the console after exception&lt;/STRONG&gt;
Traceback (most recent call last):
  File "src/unicon/statemachine/statemachine.py", line 719, in unicon.statemachine.statemachine.StateMachine.go_to
  File "src/unicon/statemachine/statetransition.py", line 486, in unicon.statemachine.statetransition.AnyStateTransition.do_transitions
  File "src/unicon/eal/dialogs.py", line 440, in unicon.eal.dialogs.Dialog.process
  File "src/unicon/eal/dialog_processor.py", line 301, in unicon.eal.dialog_processor.SimpleDialogProcessor.process
  File "src/unicon/eal/dialog_processor.py", line 238, in unicon.eal.dialog_processor.SimpleDialogProcessor.expect_eval_statements
  File "/Users/vkoulermou/Automate-ACL/lib/python3.8/site-packages/unicon/plugins/generic/statements.py", line 209, in password_handler
    credential = get_current_credential(context=context, session=session)
  File "/Users/vkoulermou/Automate-ACL/lib/python3.8/site-packages/unicon/plugins/utils.py", line 79, in get_current_credential
    raise CredentialsExhaustedError(
unicon.core.errors.CredentialsExhaustedError: The following credentials have been tried without success : ['default']

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "src/unicon/bases/connection.py", line 623, in unicon.bases.connection.Connection.connect
  File "src/unicon/bases/routers/connection_provider.py", line 141, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.connect
  File "src/unicon/bases/routers/connection_provider.py", line 163, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.establish_connection
  File "src/unicon/statemachine/statemachine.py", line 722, 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 "src/pyats/cli/base.py", line 202, in pyats.cli.base.Command.main
  File "src/genie/cli/commands/parser.py", line 174, in genie.cli.commands.parser.ParserCommand.run
  File "src/genie/conf/base/device.py", line 597, in genie.conf.base.device.Device.connect
  File "src/pyats/connections/manager.py", line 334, in pyats.connections.manager.ConnectionManager.connect
  File "src/unicon/bases/connection.py", line 629, in unicon.bases.connection.Connection.connect
unicon.core.errors.ConnectionError: failed to connect to access-r.lim
Failed while bringing device to "any" state


failed to connect to access-r.lim
Failed while bringing device to "any" state

&lt;STRONG&gt;vkoulermou$ 111111
-bash: 111111: command not found
vkoulermou$&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Genie works when I enter the password at&amp;nbsp; the &lt;STRONG&gt;"Enter default password for device access-r.lim:"&lt;/STRONG&gt; prompt:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;vkoulermou$ genie parse "show version" --testbed-file testbed.yaml -vvv
loading yaml file /Users/vkoulermou/Automate-ACL/testbed.yaml
Deriving testbed name ...
Enter default password for device access-r.lim: &lt;STRONG&gt;# Password entered here &lt;BR /&gt;&lt;/STRONG&gt;Enter enable password for device access-r.lim: &lt;STRONG&gt;# Password entered here &lt;/STRONG&gt;
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.
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-04-21 00:07:05,342] +++ access-r.lim logfile /tmp/access-r_lim-cli-20200421T000705341.log +++
[2020-04-21 00:07:05,342] +++ Unicon plugin iosxr +++

C
***********************************************************************
* MOTD here                                                           *
*                                                                     *
* MOTD here                                                           *
***********************************************************************
[2020-04-21 00:07:06,618] +++ connection to spawn: ssh -l vkoulermou 10.20.0.10, id: 4549537312 +++
[2020-04-21 00:07:06,620] connection to access-r.lim
***********************************************************************
* MOTD continues here                                                 *
*                                                                     *
* MOTD continues here                                                 *
***********************************************************************

You are connected to: 

****** access-r.lim ******


Password: Using a default key as pyATS configuration under [secrets] string.key was not specified.



RP/0/RSP0/CPU0:access-r.lim#
[2020-04-21 00:07:08,066] +++ initializing handle +++
[2020-04-21 00:07:08,067] +++ access-r.lim: executing command 'terminal length 0' +++
terminal length 0
Mon Apr 20 21:07:08.088 UTC
RP/0/RSP0/CPU0:access-r.lim#
[2020-04-21 00:07:08,495] +++ access-r.lim: executing command 'terminal width 0' +++
terminal width 0
Mon Apr 20 21:07:08.520 UTC
RP/0/RSP0/CPU0:access-r.lim#
  0%|                                                                                                                                                         | 0/1 [00:00&amp;lt;?, ?it/s]TclHistory is enabled.
TclHistory is enabled.
TclHistory is enabled.
TclHistory is enabled.
TclHistory is enabled.
[2020-04-21 00:07:09,410] +++ access-r.lim: executing command 'show version' +++
show version
Mon Apr 20 21:07:09.435 UTC

Cisco IOS XR Software, Version 6.4.2
Copyright (c) 2013-2017 by Cisco Systems, Inc.

Build Information:
 Built By     : radharan
 Built On     : Fri Jul 27 02:55:47 PDT 2018
 Build Host   : iox-ucs-003
 Workspace    : /auto/srcarchive17/prod/6.4.2/asr9k-x64/ws
 Version      : 6.4.2
 Location     : /opt/cisco/XR/packages/

cisco ASR9K () processor 
System uptime is 46 weeks, 11 hours, 33 minutes

RP/0/RSP0/CPU0:access-r.lim#
{
  "device_family": "ASR9K",
  "operating_system": "IOSXR",
  "software_version": "6.4.2",
  "uptime": "46 weeks, 11 hours, 33 minutes"
}
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00&amp;lt;00:00,  1.03it/s]

vkoulermou$&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it seems I cannot debug connections via console, since my commands may be have a time difference between the time I &lt;STRONG&gt;load()&lt;/STRONG&gt; the .yaml and the time I &lt;STRONG&gt;connect()&lt;/STRONG&gt;, during which the authenticator will change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;&amp;gt;&amp;gt;&amp;gt;tb = load('testbed.yaml')&lt;/STRONG&gt;Warning: Password input may be echoed.
Enter default password for device access-r.lim: &amp;gt;?   &lt;STRONG&gt;# Did not enter password here&lt;/STRONG&gt;
Warning: Password input may be echoed.
Enter enable password for device access-r.lim: &amp;gt;?    &lt;STRONG&gt;# Did not enter password here&lt;/STRONG&gt;
&lt;STRONG&gt;&amp;gt;&amp;gt;&amp;gt;access_r_lim = tb.devices['access-r.lim']&lt;BR /&gt;# I did not enter a password&lt;BR /&gt;# since authenticator will change&lt;BR /&gt;# until I execute connect() function&lt;BR /&gt;#&lt;/STRONG&gt;
&lt;STRONG&gt;&amp;gt;&amp;gt;&amp;gt;access_r_lim.connect()&lt;/STRONG&gt;
[2020-04-21 00:37:52,268] +++ access-r.lim logfile /tmp/access-r_lim-cli-20200421T003752262.log +++
[2020-04-21 00:37:52,268] +++ Unicon plugin iosxr +++
C
***********************************************************************
* MOTD here                                                           *
*                                                                     *
* MOTD here                                                           *
***********************************************************************
***********************************************************************
* MOTD here                                                           *
*                                                                     *
* MOTD here                                                           *
***********************************************************************
[2020-04-21 00:37:53,588] +++ connection to spawn: ssh -l vkoulermou 10.20.0.10, id: 4658969376 +++
[2020-04-21 00:37:53,589] connection to access-r.lim
***********************************************************************
* MOTD continues here                                                 *
*                                                                     *
* MOTD continues here                                                 *
***********************************************************************
You are connected to: 
****** access-r.lim ******
Password: 
Password: Traceback (most recent call last): &lt;STRONG&gt;# Password entered here but returned my input at the console after exception&lt;/STRONG&gt;  File "src/unicon/statemachine/statemachine.py", line 719, in unicon.statemachine.statemachine.StateMachine.go_to
  File "src/unicon/statemachine/statetransition.py", line 486, in unicon.statemachine.statetransition.AnyStateTransition.do_transitions
  File "src/unicon/eal/dialogs.py", line 440, in unicon.eal.dialogs.Dialog.process
  File "src/unicon/eal/dialog_processor.py", line 301, in unicon.eal.dialog_processor.SimpleDialogProcessor.process
  File "src/unicon/eal/dialog_processor.py", line 238, in unicon.eal.dialog_processor.SimpleDialogProcessor.expect_eval_statements
  File "/Users/vkoulermou/Automate-ACL/lib/python3.8/site-packages/unicon/plugins/generic/statements.py", line 209, in password_handler
    credential = get_current_credential(context=context, session=session)
  File "/Users/vkoulermou/Automate-ACL/lib/python3.8/site-packages/unicon/plugins/utils.py", line 79, in get_current_credential
    raise CredentialsExhaustedError(
unicon.core.errors.CredentialsExhaustedError: The following credentials have been tried without success : ['default']
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "src/unicon/bases/connection.py", line 623, in unicon.bases.connection.Connection.connect
  File "src/unicon/bases/routers/connection_provider.py", line 141, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.connect
  File "src/unicon/bases/routers/connection_provider.py", line 163, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.establish_connection
  File "src/unicon/statemachine/statemachine.py", line 722, 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 "&amp;lt;input&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "src/genie/conf/base/device.py", line 597, in genie.conf.base.device.Device.connect
  File "src/pyats/connections/manager.py", line 334, in pyats.connections.manager.ConnectionManager.connect
  File "src/unicon/bases/connection.py", line 629, in unicon.bases.connection.Connection.connect
unicon.core.errors.ConnectionError: failed to connect to access-r.lim
Failed while bringing device to "any" state

&lt;STRONG&gt;&amp;gt;&amp;gt;&amp;gt; 222222   # Returned password&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question now is there a way to make connect() function interactive during login?&lt;/P&gt;</description>
    <pubDate>Mon, 20 Apr 2020 22:09:21 GMT</pubDate>
    <dc:creator>vkoul</dc:creator>
    <dc:date>2020-04-20T22:09:21Z</dc:date>
    <item>
      <title>PyATS Genie connect() function can't ssh to ASR9K with interactive login.</title>
      <link>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070060#M530</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hey everyone I have an issue getting genie to connect to a production ASR9K. I setup my testbed.yaml using 'genie create testbed '. The rationale was to get a prompt whenever I attempt to login since we are using an authenticator. The yaml file ended up as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;devices:
&amp;nbsp;access-r.lim:
&amp;nbsp;&amp;nbsp;&amp;nbsp;connections:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cli:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ip: 10.20.0.10
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;protocol: ssh
&amp;nbsp;&amp;nbsp;&amp;nbsp;credentials:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;password: '%ASK{}'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;username: vkoulermou
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;enable:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;password: '%ASK{}'
&amp;nbsp;&amp;nbsp;&amp;nbsp;os: iosxr
&amp;nbsp;&amp;nbsp;&amp;nbsp;type: iosxr&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="toolbar"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;I get the MOTD and then the '&lt;STRONG&gt;Password:&lt;/STRONG&gt;' (&lt;STRONG&gt;twice&lt;/STRONG&gt;) returned in the console and finally an exception which ends up with 'Failed while bringing device to "any" state'. Even if i try to paste the password when prompted the PyCharm console returns a notification saying "Previous command is still running.....". Native bash console returns what I tried to paste back to the python console prompt&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;P.S. I can connect to the ASR9K via SSH.&lt;BR /&gt;Syslog returns:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;RP/0/RSP0/CPU0:Apr 20 19:19:54.&lt;STRONG&gt;383&lt;/STRONG&gt; UTC: SSHD_[66063]: %SECURITY-SSHD-4-INFO_FAILURE : Failed authentication attempt by user 'vkoulermou' from '172.16.20.10' on 'vty1' &lt;STRONG&gt;&amp;lt;-Genie&lt;/STRONG&gt;
RP/0/RSP0/CPU0:Apr 20 19:19:54.&lt;STRONG&gt;550&lt;/STRONG&gt; UTC: SSHD_[66063]: %SECURITY-SSHD-3-ERR_GENERAL : Failed to receive User authentication request &lt;STRONG&gt;&amp;lt;-Genie&lt;/STRONG&gt;
RP/0/RSP0/CPU0:Apr 20 19:43:44.006 UTC: SSHD_[67113]: %SECURITY-SSHD-6-INFO_SUCCESS : Successfully authenticated user 'vkoulermou' from '172.16.20.10' on 'vty0'(cipher 'aes128-ctr', mac 'hmac-sha2-256') &lt;STRONG&gt;&amp;lt;- Me&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 20:35:29 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070060#M530</guid>
      <dc:creator>vkoul</dc:creator>
      <dc:date>2020-04-20T20:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: PyATS Genie connect() function can't ssh to ASR9K with interactive login.</title>
      <link>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070083#M531</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Can you test with genie cli?&lt;/P&gt;&lt;P&gt;genie parse "show version" --testbed-file nexus_testbed.yaml &lt;STRONG&gt;-vvv&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;to see if you get more info..&amp;nbsp;&lt;/P&gt;&lt;P&gt;validate your testbed file with -&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;pyats validate testbed &amp;lt;test file name&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Apr 2020 21:34:25 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070083#M531</guid>
      <dc:creator>omz</dc:creator>
      <dc:date>2020-04-20T21:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: PyATS Genie connect() function can't ssh to ASR9K with interactive login.</title>
      <link>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070092#M532</link>
      <description>&lt;P&gt;tested your testbed file with sandbox&lt;/P&gt;&lt;P&gt;cant see any issues with genie or pyats login ..&amp;nbsp;&lt;/P&gt;&lt;P&gt;test with adding &lt;STRONG&gt;alias&lt;/STRONG&gt;&amp;nbsp;and then target that device&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-04-20 at 22.28.13.png" style="width: 860px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/72322iB2AB48E8D3915F00/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-04-20 at 22.28.13.png" alt="Screenshot 2020-04-20 at 22.28.13.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-04-20 at 22.32.08.png" style="width: 860px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/72323i825CC717F154CE51/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-04-20 at 22.32.08.png" alt="Screenshot 2020-04-20 at 22.32.08.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;test with adding &lt;STRONG&gt;alias&lt;/STRONG&gt;&amp;nbsp;and then target that device&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 21:40:03 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070092#M532</guid>
      <dc:creator>omz</dc:creator>
      <dc:date>2020-04-20T21:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: PyATS Genie connect() function can't ssh to ASR9K with interactive login.</title>
      <link>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070108#M533</link>
      <description>&lt;P&gt;Thanks for shinning some light here omz.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I tried your suggestion I realized that the "interactive login" happens before Genie calls the connect() function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output when I enter a password at the CLI prompt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;vkoulermou$ genie parse "show version" --testbed-file testbed.yaml -vvv
loading yaml file /Users/vkoulermou/Automate-ACL/testbed.yaml
Deriving testbed name ...
Enter default password for device access-r.lim:       &lt;STRONG&gt;# Did not enter password here&lt;/STRONG&gt;Enter enable password for device access-r.lim:        &lt;STRONG&gt;# Did not enter password here&lt;/STRONG&gt;
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.
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-04-21 00:09:21,041] +++ access-r.lim logfile /tmp/access-r_lim-cli-20200421T000921040.log +++
[2020-04-21 00:09:21,041] +++ Unicon plugin iosxr +++

C
***********************************************************************
* MOTD here                                                           *
***********************************************************************
[2020-04-21 00:09:22,269] +++ connection to spawn: ssh -l vkoulermou 10.20.0.10, id: 4608966176 +++
[2020-04-21 00:09:22,270] connection to access-r.lim
***********************************************************************
* MOTD continutes here                                                *
***********************************************************************

You are connected to: 

****** access-r.lim ******


Password: Using a default key as pyATS configuration under [secrets] string.key was not specified.

&lt;STRONG&gt;Password: 111111     # Password entered here and returned my input at the console after exception&lt;/STRONG&gt;
Traceback (most recent call last):
  File "src/unicon/statemachine/statemachine.py", line 719, in unicon.statemachine.statemachine.StateMachine.go_to
  File "src/unicon/statemachine/statetransition.py", line 486, in unicon.statemachine.statetransition.AnyStateTransition.do_transitions
  File "src/unicon/eal/dialogs.py", line 440, in unicon.eal.dialogs.Dialog.process
  File "src/unicon/eal/dialog_processor.py", line 301, in unicon.eal.dialog_processor.SimpleDialogProcessor.process
  File "src/unicon/eal/dialog_processor.py", line 238, in unicon.eal.dialog_processor.SimpleDialogProcessor.expect_eval_statements
  File "/Users/vkoulermou/Automate-ACL/lib/python3.8/site-packages/unicon/plugins/generic/statements.py", line 209, in password_handler
    credential = get_current_credential(context=context, session=session)
  File "/Users/vkoulermou/Automate-ACL/lib/python3.8/site-packages/unicon/plugins/utils.py", line 79, in get_current_credential
    raise CredentialsExhaustedError(
unicon.core.errors.CredentialsExhaustedError: The following credentials have been tried without success : ['default']

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "src/unicon/bases/connection.py", line 623, in unicon.bases.connection.Connection.connect
  File "src/unicon/bases/routers/connection_provider.py", line 141, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.connect
  File "src/unicon/bases/routers/connection_provider.py", line 163, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.establish_connection
  File "src/unicon/statemachine/statemachine.py", line 722, 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 "src/pyats/cli/base.py", line 202, in pyats.cli.base.Command.main
  File "src/genie/cli/commands/parser.py", line 174, in genie.cli.commands.parser.ParserCommand.run
  File "src/genie/conf/base/device.py", line 597, in genie.conf.base.device.Device.connect
  File "src/pyats/connections/manager.py", line 334, in pyats.connections.manager.ConnectionManager.connect
  File "src/unicon/bases/connection.py", line 629, in unicon.bases.connection.Connection.connect
unicon.core.errors.ConnectionError: failed to connect to access-r.lim
Failed while bringing device to "any" state


failed to connect to access-r.lim
Failed while bringing device to "any" state

&lt;STRONG&gt;vkoulermou$ 111111
-bash: 111111: command not found
vkoulermou$&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Genie works when I enter the password at&amp;nbsp; the &lt;STRONG&gt;"Enter default password for device access-r.lim:"&lt;/STRONG&gt; prompt:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;vkoulermou$ genie parse "show version" --testbed-file testbed.yaml -vvv
loading yaml file /Users/vkoulermou/Automate-ACL/testbed.yaml
Deriving testbed name ...
Enter default password for device access-r.lim: &lt;STRONG&gt;# Password entered here &lt;BR /&gt;&lt;/STRONG&gt;Enter enable password for device access-r.lim: &lt;STRONG&gt;# Password entered here &lt;/STRONG&gt;
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.
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-04-21 00:07:05,342] +++ access-r.lim logfile /tmp/access-r_lim-cli-20200421T000705341.log +++
[2020-04-21 00:07:05,342] +++ Unicon plugin iosxr +++

C
***********************************************************************
* MOTD here                                                           *
*                                                                     *
* MOTD here                                                           *
***********************************************************************
[2020-04-21 00:07:06,618] +++ connection to spawn: ssh -l vkoulermou 10.20.0.10, id: 4549537312 +++
[2020-04-21 00:07:06,620] connection to access-r.lim
***********************************************************************
* MOTD continues here                                                 *
*                                                                     *
* MOTD continues here                                                 *
***********************************************************************

You are connected to: 

****** access-r.lim ******


Password: Using a default key as pyATS configuration under [secrets] string.key was not specified.



RP/0/RSP0/CPU0:access-r.lim#
[2020-04-21 00:07:08,066] +++ initializing handle +++
[2020-04-21 00:07:08,067] +++ access-r.lim: executing command 'terminal length 0' +++
terminal length 0
Mon Apr 20 21:07:08.088 UTC
RP/0/RSP0/CPU0:access-r.lim#
[2020-04-21 00:07:08,495] +++ access-r.lim: executing command 'terminal width 0' +++
terminal width 0
Mon Apr 20 21:07:08.520 UTC
RP/0/RSP0/CPU0:access-r.lim#
  0%|                                                                                                                                                         | 0/1 [00:00&amp;lt;?, ?it/s]TclHistory is enabled.
TclHistory is enabled.
TclHistory is enabled.
TclHistory is enabled.
TclHistory is enabled.
[2020-04-21 00:07:09,410] +++ access-r.lim: executing command 'show version' +++
show version
Mon Apr 20 21:07:09.435 UTC

Cisco IOS XR Software, Version 6.4.2
Copyright (c) 2013-2017 by Cisco Systems, Inc.

Build Information:
 Built By     : radharan
 Built On     : Fri Jul 27 02:55:47 PDT 2018
 Build Host   : iox-ucs-003
 Workspace    : /auto/srcarchive17/prod/6.4.2/asr9k-x64/ws
 Version      : 6.4.2
 Location     : /opt/cisco/XR/packages/

cisco ASR9K () processor 
System uptime is 46 weeks, 11 hours, 33 minutes

RP/0/RSP0/CPU0:access-r.lim#
{
  "device_family": "ASR9K",
  "operating_system": "IOSXR",
  "software_version": "6.4.2",
  "uptime": "46 weeks, 11 hours, 33 minutes"
}
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00&amp;lt;00:00,  1.03it/s]

vkoulermou$&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it seems I cannot debug connections via console, since my commands may be have a time difference between the time I &lt;STRONG&gt;load()&lt;/STRONG&gt; the .yaml and the time I &lt;STRONG&gt;connect()&lt;/STRONG&gt;, during which the authenticator will change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;&amp;gt;&amp;gt;&amp;gt;tb = load('testbed.yaml')&lt;/STRONG&gt;Warning: Password input may be echoed.
Enter default password for device access-r.lim: &amp;gt;?   &lt;STRONG&gt;# Did not enter password here&lt;/STRONG&gt;
Warning: Password input may be echoed.
Enter enable password for device access-r.lim: &amp;gt;?    &lt;STRONG&gt;# Did not enter password here&lt;/STRONG&gt;
&lt;STRONG&gt;&amp;gt;&amp;gt;&amp;gt;access_r_lim = tb.devices['access-r.lim']&lt;BR /&gt;# I did not enter a password&lt;BR /&gt;# since authenticator will change&lt;BR /&gt;# until I execute connect() function&lt;BR /&gt;#&lt;/STRONG&gt;
&lt;STRONG&gt;&amp;gt;&amp;gt;&amp;gt;access_r_lim.connect()&lt;/STRONG&gt;
[2020-04-21 00:37:52,268] +++ access-r.lim logfile /tmp/access-r_lim-cli-20200421T003752262.log +++
[2020-04-21 00:37:52,268] +++ Unicon plugin iosxr +++
C
***********************************************************************
* MOTD here                                                           *
*                                                                     *
* MOTD here                                                           *
***********************************************************************
***********************************************************************
* MOTD here                                                           *
*                                                                     *
* MOTD here                                                           *
***********************************************************************
[2020-04-21 00:37:53,588] +++ connection to spawn: ssh -l vkoulermou 10.20.0.10, id: 4658969376 +++
[2020-04-21 00:37:53,589] connection to access-r.lim
***********************************************************************
* MOTD continues here                                                 *
*                                                                     *
* MOTD continues here                                                 *
***********************************************************************
You are connected to: 
****** access-r.lim ******
Password: 
Password: Traceback (most recent call last): &lt;STRONG&gt;# Password entered here but returned my input at the console after exception&lt;/STRONG&gt;  File "src/unicon/statemachine/statemachine.py", line 719, in unicon.statemachine.statemachine.StateMachine.go_to
  File "src/unicon/statemachine/statetransition.py", line 486, in unicon.statemachine.statetransition.AnyStateTransition.do_transitions
  File "src/unicon/eal/dialogs.py", line 440, in unicon.eal.dialogs.Dialog.process
  File "src/unicon/eal/dialog_processor.py", line 301, in unicon.eal.dialog_processor.SimpleDialogProcessor.process
  File "src/unicon/eal/dialog_processor.py", line 238, in unicon.eal.dialog_processor.SimpleDialogProcessor.expect_eval_statements
  File "/Users/vkoulermou/Automate-ACL/lib/python3.8/site-packages/unicon/plugins/generic/statements.py", line 209, in password_handler
    credential = get_current_credential(context=context, session=session)
  File "/Users/vkoulermou/Automate-ACL/lib/python3.8/site-packages/unicon/plugins/utils.py", line 79, in get_current_credential
    raise CredentialsExhaustedError(
unicon.core.errors.CredentialsExhaustedError: The following credentials have been tried without success : ['default']
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "src/unicon/bases/connection.py", line 623, in unicon.bases.connection.Connection.connect
  File "src/unicon/bases/routers/connection_provider.py", line 141, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.connect
  File "src/unicon/bases/routers/connection_provider.py", line 163, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.establish_connection
  File "src/unicon/statemachine/statemachine.py", line 722, 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 "&amp;lt;input&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "src/genie/conf/base/device.py", line 597, in genie.conf.base.device.Device.connect
  File "src/pyats/connections/manager.py", line 334, in pyats.connections.manager.ConnectionManager.connect
  File "src/unicon/bases/connection.py", line 629, in unicon.bases.connection.Connection.connect
unicon.core.errors.ConnectionError: failed to connect to access-r.lim
Failed while bringing device to "any" state

&lt;STRONG&gt;&amp;gt;&amp;gt;&amp;gt; 222222   # Returned password&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question now is there a way to make connect() function interactive during login?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 22:09:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070108#M533</guid>
      <dc:creator>vkoul</dc:creator>
      <dc:date>2020-04-20T22:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: PyATS Genie connect() function can't ssh to ASR9K with interactive login.</title>
      <link>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070120#M534</link>
      <description>&lt;P&gt;are you looking to get an interactive device prompt? I'm not sure if you can get that ..&lt;/P&gt;&lt;P&gt;there is pyats interactive shell&amp;nbsp; -&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;bash$ pyats shell --testbed-file our-testbed-file.yaml&lt;/PRE&gt;&lt;P&gt;&lt;A href="https://developer.cisco.com/docs/pyats/#!connection-to-devices/device-connections" target="_blank"&gt;https://developer.cisco.com/docs/pyats/#!connection-to-devices/device-connections&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 22:23:04 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070120#M534</guid>
      <dc:creator>omz</dc:creator>
      <dc:date>2020-04-20T22:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: PyATS Genie connect() function can't ssh to ASR9K with interactive login.</title>
      <link>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070142#M535</link>
      <description>&lt;P&gt;Thanks for the info omz.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I am looking for a way to perform the interactive login when I call the &lt;STRONG&gt;connect()&lt;/STRONG&gt; function and &lt;STRONG&gt;not the load()&lt;/STRONG&gt; function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason is that while coding I may have different devices in a testbed.yaml (or even multiple .yaml files) loaded to different variables. So everytime I want to connect to a device to execute a command to test/parse something I have to call one function then input the authenticator code and then another two functions &lt;STRONG&gt;and do it fast before the authenticator code expires&lt;/STRONG&gt;. Which seems to be quite the hassle.&lt;/P&gt;&lt;PRE&gt;&amp;gt;&amp;gt;&amp;gt;tb = load('testbed.yaml')&lt;BR /&gt;Warning: Password input may be echoed.&lt;BR /&gt;Enter default password for device access-r.lim: 333333&lt;BR /&gt;Warning: Password input may be echoed.&lt;BR /&gt;Enter enable password for device access-r.lim: 333333&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;access_r_lim = tb.devices['access-r.lim']&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;access_r_lim.connect()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks anyway!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 23:27:42 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4070142#M535</guid>
      <dc:creator>vkoul</dc:creator>
      <dc:date>2020-04-20T23:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: PyATS Genie connect() function can't ssh to ASR9K with interactive login.</title>
      <link>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4128362#M556</link>
      <description>&lt;P&gt;I just had the same issue and been struggling for 2 days now and finally got it right &lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So just a brief background what I am using:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Latest Ubuntu 20.04LTS&lt;/LI&gt;&lt;LI&gt;Latest Windows 10 version 2004&lt;/LI&gt;&lt;LI&gt;Python 3.8.2&lt;/LI&gt;&lt;LI&gt;WSL2&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;My goal is to learn and play with pyATS/Genie for network automation. I created a virtual environment and installed &lt;STRONG&gt;pyATS&lt;/STRONG&gt; and &lt;STRONG&gt;Genie&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked if any packages were outdated:&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;pyats version check --outdated&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Then updated the versions:&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#0000FF"&gt;pyats version update&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After this I got the sample testbed file and added my devices accordingly. I first tested with telnet devices and it work immediately. When I tested the devices with SSH enabled, that is when it all started. I started doubting my testbed file and my commands and everything. It just did not work and changed my testbed file like 12 times. I got the exact same message as you did and &lt;STRONG&gt;WHAT WAS THE ISSUE??🤷‍&lt;span class="lia-unicode-emoji" title=":male_sign:"&gt;♂️&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;My pyATS were outdated --&amp;gt; SOLUTION:&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;I upgraded my pyATS: &lt;FONT color="#0000FF"&gt;&lt;EM&gt;pip install pyats[full] --upgrade&lt;/EM&gt;&lt;/FONT&gt; and restarted and it got further by showing the progress bar but it failed again. 🤦‍&lt;span class="lia-unicode-emoji" title=":male_sign:"&gt;♂️&lt;/span&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;Then I checked another testbed file and changed it again and it worked. 🤪&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;PRE&gt;testbed:
    name: IOS_Testbed
    credentials:
        default:
            username: admin
            password: '%ASK{}'
        enable:
            password: '%ASK{}'

devices:
    &amp;lt;Hostname&amp;gt;:
        os: ios
        type: ios
        connections:
            a:
                protocol: telnet
                ip: 10.0.0.1
                port: 23
            vty:
                protocol: ssh
                ip: 10.0.0.1&lt;/PRE&gt;&lt;P&gt;&lt;FONT size="6"&gt;So what did I learn?&lt;/FONT&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Do the proper complete install/upgrade of pyATS.&amp;nbsp;&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Get the right testbed file for the type of version your running.&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;If the device has telnet and ssh enabled, then you need to specify both ssh and telnet details of the device in the testbed file or it will not connect.&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Some links:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="https://pubhub.devnetcloud.com/media/pyats/docs/getting_started/index.html" target="_self"&gt;pyATS getting started&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;A href="https://gratuitous-arp.net/getting-started-with-pyats-and-genie/" target="_self"&gt;Getting started with pyATS and Genie&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 21:03:05 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4128362#M556</guid>
      <dc:creator>Olloff</dc:creator>
      <dc:date>2020-07-30T21:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: PyATS Genie connect() function can't ssh to ASR9K with interactive</title>
      <link>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4679430#M676</link>
      <description>&lt;P&gt;wow, nice. &amp;nbsp;you taught a lot, saved lot of time.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 20:35:58 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/4679430#M676</guid>
      <dc:creator>tperiasa</dc:creator>
      <dc:date>2022-08-31T20:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: PyATS Genie connect() function can't ssh to ASR9K with interactive</title>
      <link>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/5138500#M3550</link>
      <description>&lt;P&gt;In my case WSL&amp;nbsp;restart solved problem&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 13:48:32 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/pyats-genie-connect-function-can-t-ssh-to-asr9k-with-interactive/m-p/5138500#M3550</guid>
      <dc:creator>gdjundev</dc:creator>
      <dc:date>2024-07-01T13:48:32Z</dc:date>
    </item>
  </channel>
</rss>

