Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Client Configuration timeout seems ignored by prompt:REGEXP usage #421

Open
hpe-ykoehler opened this issue Sep 23, 2022 · 0 comments
Open

Comments

@hpe-ykoehler
Copy link

I have a CLI application for which commands can take close to 30 seconds. I used the "Read Until Prompt" to determine when the command has terminated and set the timeout using "Set Client Configuration timeout=60 seconds". This works if I specify the prompt using "Set Client Configuration prompt=MyPrompt#" but fails if I do "Set Client Configuration prompt=REGEXP:[$.*#]".

The failure seems to indicate that the "Set Client Configuration timeout=60 seconds" didn't go into effect as the output captured is only partial and the test fails before the expected 60 seconds for a timeout condition (seems to actually fail after 3 seconds which is the Default value of timeout).

I am using robot-framework 5.0.1 and SSHLibrary > 3.2.0 over Ubuntu 22.04 LTS.

Btw, it would be a good idea to add a delay parameter to the Read Until Prompt (and any Read command) as it is available to Read.

*** Settings ***

Documentation          Robot Framework test script
Library                SSHLibrary

*** Variables ***
${controller}                192.168.2.10
${controller_username}            admin
${controller_password}            admin
${firmware}            /tftpboot/ArubaOS_90xx_8.11.1.0
${host}                192.168.2.1
${host_username}       ykoehler
${host_password}       mypassword
${partition}           1
 
*** Keywords ***
Connect To SSH 
    [Arguments]  ${host}  ${username}  ${password}
    Open Connection  ${host}
    Login            ${username}  ${password}  delay=1

Connect To AOS SSH
    [Arguments]  ${host}  ${username}  ${password}
    Connect To SSH   ${host}  ${username}  ${password}
#    Set Client Configuration  prompt=(YK_A9004) *[mynode] #
    Set Client Configuration  prompt=REGEXP:[$\(.+\)\s+.*\\\[.+\\\]\s+#]

Upgrade Firmware
    [Arguments]  ${host}  ${username}  ${password}  ${firmware}  ${partition}
    Write              copy scp: ${host} ${username} ${firmware} system: partition ${partition}
    ${pw_output}=      Read  delay=10
    Should Contain     ${pw_output}  Password:
    Write              ${password}
    ${output}=         Read Until Prompt 
    Should Contain     ${output}  copied to partition ${partition} successfully.

*** Test Cases ***
Test SSH Connection
    Connect To AOS SSH     ${controller}  ${controller_username}  ${controller_password}
    Set Client Configuration  timeout=60

    # This validates that the 'Read Until Prompt' is working
    Write              show image version
    Read Until Prompt

    # This runs a command that can take 30-40 seconds.
    Upgrade Firmware  ${host}  ${host_username}  ${host_password}  ${firmware}  ${partition}

    Close All Connections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant