Windows 7 如何使用robot框架从已登录的设备ssh远程设备?
我有以下测试拓扑:Windows 7 如何使用robot框架从已登录的设备ssh远程设备?,windows-7,robotframework,Windows 7,Robotframework,我有以下测试拓扑: Windows Computer ----- Router1 ----- Router2 我需要从“Windows计算机”到“路由器2”执行SSH。通过直接SSH是不可能的,因为它位于不同的网络中(拒绝访问) 所以,我需要SSH“Router1”,然后再次从“Router1”通过SSH连接Router2 有谁能告诉我,如何在机器人框架中做到这一点 到目前为止,我能够使用以下“关键字”从“Windows计算机”SSH到“路由器1”: 提前谢谢。像这样的怎么样? 这需要路由器
Windows Computer ----- Router1 ----- Router2
我需要从“Windows计算机”到“路由器2”执行SSH。通过直接SSH是不可能的,因为它位于不同的网络中(拒绝访问)
所以,我需要SSH“Router1”,然后再次从“Router1”通过SSH连接Router2
有谁能告诉我,如何在机器人框架中做到这一点
到目前为止,我能够使用以下“关键字”从“Windows计算机”SSH到“路由器1”:
提前谢谢。像这样的怎么样?
这需要路由器1上的sshpass。还有一种更复杂的方法是使用密码来避免使用密码。这都是假设您不需要在其上运行Robotframework,并且乐于在其上运行终端命令
***Keywords***
Remote Bash
[Arguments] ${command}
[Documentation] Runs a given terminal command on remote server and returns terminal output.
${test} = SSHLibrary.Execute Command ${command}
Return From Keyword ${test}
***Test Cases***
RemoteSSH
Open Connection ${ROUTER1_IP}
Login ${ROUTER1_USER} ${ROUTER1_PW}
Remote Bash sshpass -p ${ROUTER2_PW} ${ROUTER2_USER}@${ROUTER2_IP}
Remote Bash echo 'Hello World!'
***Keywords***
Remote Bash
[Arguments] ${command}
[Documentation] Runs a given terminal command on remote server and returns terminal output.
${test} = SSHLibrary.Execute Command ${command}
Return From Keyword ${test}
***Test Cases***
RemoteSSH
Open Connection ${ROUTER1_IP}
Login ${ROUTER1_USER} ${ROUTER1_PW}
Remote Bash sshpass -p ${ROUTER2_PW} ${ROUTER2_USER}@${ROUTER2_IP}
Remote Bash echo 'Hello World!'