cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1550
Views
0
Helpful
1
Replies

pyATS: force output after login through terminalserver?

uheil
Level 1
Level 1

Hi!

 

I'm trying to login into a switch which is connected through a terminal server vis ssh.

When i login nothing happens and after a while i get

TypeError: device is not connected, output must be provided.

When i try with ssh "ssh -p 4002 username@10.10.10.2" login works but i need to press enter at least once before the switch prompt gets displayed.

 

My testbed file looks like:

testbed:
  credentials:
    default:
      username: '%ASK{}'
      password: '%ASK{}'
devices:
  SW1:
    connections:
      console:
        protocol: ssh
        ip: 10.10.10.2
        port: 4002
    os: 'ios'
    type: switch
    platform: '2960'

What can i do to trigger the switch so that it prints a login prompt after supplying the password?

I read about 'execute' and 'command' but i have no clue how to extend my testbed file.

 

1 Accepted Solution

Accepted Solutions

uheil
Level 1
Level 1

Somehow i figured it out!

testbed:
  credentials:
    default:
      username: '%ASK{}'
      password: '%ASK{}'
devices:
  SW1:
    connections:
      console:
        protocol: ssh
        ip: 10.10.10.2
        port: 4002
        arguments:
          connection_timeout : 2
          prompt_recovery : true
    os: 'ios'
    type: switch
    platform: '2960'

Using arguments: and prompt_recovery.

With those settings in the testbed.yaml it tries to recover the prompt after 2 seconds (default is 60).

 

Would be nice if someone knows how to set the connection_timeout only for login and reset it afterwards.

View solution in original post

1 Reply 1

uheil
Level 1
Level 1

Somehow i figured it out!

testbed:
  credentials:
    default:
      username: '%ASK{}'
      password: '%ASK{}'
devices:
  SW1:
    connections:
      console:
        protocol: ssh
        ip: 10.10.10.2
        port: 4002
        arguments:
          connection_timeout : 2
          prompt_recovery : true
    os: 'ios'
    type: switch
    platform: '2960'

Using arguments: and prompt_recovery.

With those settings in the testbed.yaml it tries to recover the prompt after 2 seconds (default is 60).

 

Would be nice if someone knows how to set the connection_timeout only for login and reset it afterwards.