From 36b0312c543c3166e72d46af3879258f4ef71650 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 25 Sep 2020 09:39:31 +0000 Subject: [PATCH] Updated Test Connectivity to retry ping and capture ping output Change-Id: Idf6b873db0066ea8783f5ae917ad94bcff2f6d43 Signed-off-by: garciadeblas --- robot-systest/lib/connectivity_lib.robot | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/robot-systest/lib/connectivity_lib.robot b/robot-systest/lib/connectivity_lib.robot index 7b86593..3db20b8 100644 --- a/robot-systest/lib/connectivity_lib.robot +++ b/robot-systest/lib/connectivity_lib.robot @@ -10,10 +10,26 @@ # See the License for the specific language governing permissions and # limitations under the License. +*** Variables *** +${success_return_code} 0 +${connectivity_pol_time} 5sec +${connectivity_max_wait_time} 30sec + *** Keywords *** +Test Ping Host + [Documentation] Run Ping + ... Parameters: + ... host: IP or name of the host + ... Execution example: + ... Ping Test \${host} + + [Arguments] ${host} + + ${rc} ${stdout}= Run and Return RC and Output ping -c 2 -W 1 ${host} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + Test Connectivity [Arguments] ${host} - ${result} Run Process ping -c 5 -W 1 ${host} > /dev/null && echo OK shell=True - Log all output: ${result.stdout} - Should Contain ${result.stdout} OK + WAIT UNTIL KEYWORD SUCCEEDS ${connectivity_max_wait_time} ${connectivity_pol_time} Test Ping Host ${host} -- 2.17.1