使用ROBOT SSH库传递多个命令选项

时间:2017-11-21 07:43:11

标签: robotframework

I am new to RF and trying to autmoate user account on test machine.
Once the main command nmc@myhost:/$ "create appliance user john" is executed
it will ask for multiple inputs one by one with enter key press in each level. 
I tried with write and read keywords of SSH as below and not able to get success.

手动测试执行输出。     ============================     nmc @ myhost:/ $创建设备用户john     主文件夹:JOHN / Test     说明:测试     默认组:员工     密码:xxxxxxxxxxxxx     确认密码:xxxxxxxxxxxxx     NMC @为myhost:/ $

    enter code here



*** Settings ***
Suite Setup       Open Connection And Log In
Suite Teardown    Close All Connections
Library           SSHLibrary

*** Variables ***
${HOST}           192.168.221.129
${USERNAME}       admin
${PASSWORD}       nexenta

*** Test Cases ***
User_Create
    ${written}=    Write    nmc -c "create appliance user john"
    Set Client Configuration    prompt=:    timeout=60s
    ${output}=    Read Until prompt
    ${written}=    Write    John/Test
    ${output}=    Read Until prompt
    ${written}=    Write    Test
    ${output}=    Read Until prompt
    ${written}=    Write    staff
    ${output}=    Read Until prompt
    ${written}=    Write    afghg@12345
    ${output}=    Read Until prompt
    ${written}=    Write    afghg@12345
    ${output}=    Read Until    $

*** Keywords ***
Open Connection And Log In
    Set Log Level    DEBUG
    Open Connection    ${HOST}    timeout=1 hour
    Login    ${USERNAME}    ${PASSWORD}

0 个答案:

没有答案