【发布时间】:2019-09-27 10:06:53
【问题描述】:
我正在尝试获取Telnet.Execute Command 的输出,我的 telnet 连接在 SSH 连接内。
如果我尝试${saida}= SSHLibrary.Execute Command ls,我可以获得ls 命令的输出,但如果我尝试${saida}= SSHLibrary.Execute Command Telnet.Execute Command dir,我期待dir [在Telnet.Execute Command] 命令的输出被传递给SSHLibrary.Execute Command 但不是。
如何获得Telnet.Execute Command 的输出?
Library SSHLibrary
Library Telnet
Suite Setup Open Connection And Log In
Suite Teardown SSHLibrary.Close All Connections
*** Variables ***
${HOST} OMITTED.70
${Other-Host} OMITTED.1
${OTHER-USERNAME} OMITTED
${OTHER-PASSWORD} OMITTED
${USERNAME} OMITTED
${PASSWORD} OMITTED
*** Test Cases ***
Acessando OLT para testes
SSHLibrary.Execute Command Telnet.Open Connection ${Other-Host}
SSHLibrary.Execute Command Telnet.Login ${OTHER-USERNAME} ${OTHER-PASSWORD} password_prompt=password
Verificando a saída do terminal
${saida}= SSHLibrary.Execute Command Telnet.Execute Command dir
BuiltIn.Log to console ${saida}
*** Keywords ***
Open Connection And Log In
SSHLibrary.Open Connection ${HOST}
SSHLibrary.Login ${USERNAME} ${PASSWORD}
【问题讨论】:
-
我不确定我是否理解你的意图,你能详细说明你想要完成什么吗?您想将
Telnet.Open Connection的输出作为Execute Command的参数吗?或者你想在 ssh 会话中运行 telnet? -
@TodorMinakov 我实现了在 ssh 连接中使用 telnet,但我想使用 Telnet 库
-
是的,我想打开一个 telnet 连接并使用 ssh 和 telnet 的机器人库在 SSH 连接中获得反馈。 telnet 连接有效,但我没有从 Execute Command 得到反馈
标签: python ssh robotframework telnet