cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
1031
Views
0
Helpful
1
Replies
uheil
Beginner

pyATS: force output after login through terminalserver?

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
Beginner

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
Beginner

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

Create
Recognize Your Peers
Content for Community-Ad