MarketSquare / MarketSquare/SSHLibrary
Set Client Configuration timeout seems ignored by prompt:REGEXP usage
- Dominant language
- Python
- Stars
- 167
- Forks
- 145
- PR merge metrics
- No merged PRs in 30d
Description
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
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the supplied Robot Framework example with SSHLibrary, comparing Read Until Prompt with a literal prompt and with the REGEXP prompt after timeout=60. Trace the Set Client Configuration and Read Until Prompt entry points to verify which timeout is used, then confirm that the configured timeout is honored for both prompt forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100