Skip to content

Commit

Permalink
Install net-tools if not already installed
Browse files Browse the repository at this point in the history
To check if the device is up, we use netstat, which is not pre-installed
in newer versions of Ubuntu.

Change-Id: Iab6c5773c441fe0f110f804fd2f66b37624b2828
Signed-off-by: lubos-cicut <[email protected]>
  • Loading branch information
lubos-cicut committed Aug 21, 2024
1 parent eb3c8aa commit cb38e3f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions csit/libraries/SSHKeywords.robot
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,23 @@ Assure_Library_Counter
Count_Port_Occurences
[Documentation] Run 'netstat' on the remote machine and count occurences of given port in the given state connected to process with the given name.
[Arguments] ${port} ${state} ${name}
BuiltIn.Run Keyword And Ignore Error Check_And_Install_Netstat
${output} = SSHLibrary.Execute_Command
... ${NETSTAT_COMMAND} 2> /dev/null | grep -E ":${port} .+ ${state} .+${name}" | wc -l
RETURN ${output}

Check_And_Install_Netstat
[Documentation] Check if netstat is installed and install it if not.
${netstat_installed} = SSHLibrary.Execute_Command netstat --version
IF '${netstat_installed}' is not string and '${netstat_installed}' != '0'
Install_Netstat
END

Install_Netstat
[Documentation] Install netstat if it is not already installed.
SSHLibrary.Execute_Command sudo apt-get update
SSHLibrary.Execute_Command sudo apt-get install -y net-tools

Virtual_Env_Set_Path
[Documentation] Set \${SSHKeywords__current_venv_path} variable to ${venv_path}. Path should be absolute.
[Arguments] ${venv_path}
Expand Down

0 comments on commit cb38e3f

Please sign in to comment.