Kepler
Kepler

Reputation: 15

Multiple concurrent ssh connections with robot framework

How do I use Robot Framework to have multiple ssh processes running? All to different nodes on a cluster. I have though of using a for loop, or using start process keyword in process library to start one for each of the nodes I need. I need to check the OpenSSH_ version on each of these nodes.

I'm very new to robot framework.

@{nodes}   Create List     1  2  3  4   5   6   7   8
    :FOR    ${node}   IN   @{nodes}
    \  Open Connection    ${node}
    \  Enable SSH Logging    ${output}
    \  Run Keyword And Ignore Error     Login  user    pass
    \  Log     all output:${output}
    \  File Should not be empty     ${output}
    \  ${version}=     Grep File      ${output}   OpenSSH_
    \  Should contain  ${version}  OpenSSH_6.9
    \  Close Connection

Upvotes: 0

Views: 2972

Answers (2)

Bahubali Patil
Bahubali Patil

Reputation: 1135

Switch between the different SSH session with the below keyword :

Switch Connection    index_or_alias

Upvotes: 1

ILostMySpoon
ILostMySpoon

Reputation: 2409

The SSHLibrary library for Robot Framework supports multiple connections to different hosts. Ideally, you will end up with something like this:

:FOR    ${host}    IN    @{hosts}
    Open Connection    ${host}
    Comment    Do something with current ${host}
    Close Connection

Upvotes: 0

Related Questions