Updated Test Connectivity to retry ping and capture ping output 71/9771/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 25 Sep 2020 09:39:31 +0000 (09:39 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 1 Oct 2020 11:01:17 +0000 (11:01 +0000)
Change-Id: Idf6b873db0066ea8783f5ae917ad94bcff2f6d43
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
robot-systest/lib/connectivity_lib.robot

index 7b86593..3db20b8 100644 (file)
 #   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}