与机器人框架的多个并发 ssh 连接 [英] Multiple concurrent ssh connections with robot framework

查看:117
本文介绍了与机器人框架的多个并发 ssh 连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Robot Framework 运行多个 ssh 进程?所有到集群上的不同节点.我曾尝试使用 for 循环,或使用进程库中的 start process 关键字为我需要的每个节点启动一个.我需要检查每个节点上的 OpenSSH_ 版本.

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

推荐答案

SSHLibrary 机器人框架库支持到不同主机的多个连接.理想情况下,您最终会得到这样的结果:

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

这篇关于与机器人框架的多个并发 ssh 连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆