SLICING-01 - Basic Network Slicing robot test
[osm/devops.git] / robot-systest / lib / ssh_lib.robot
index 3d2d708..23e5ae4 100644 (file)
@@ -40,6 +40,20 @@ Get Remote File Content
     Close All Connections
     [Return]   ${output}
 
+Ping Many
+    [Arguments]  ${host}  ${username}  ${password}  ${privatekey}   @{ip_list}
+
+    Open Connection     ${host}
+    Run Keyword If   '${password}'!='${EMPTY}'  Login  ${username}  ${password}
+    ...   ELSE   Login With Public Key  ${username}  ${privatekey}
+    FOR   ${ip}   IN   @{ip_list}
+        ${result}=   Execute Command   ping -c 5 -W 1 ${ip} > /dev/null && echo OK  shell=True
+        Log     ${result}
+        Should Contain  ${result}  OK
+    END
+    Close All Connections
+
+
 Execute Remote Command Check Rc Return Output
     [Arguments]   ${host}   ${username}   ${password}   ${privatekey}   ${command}
 
@@ -51,4 +65,5 @@ Execute Remote Command Check Rc Return Output
     log   ${stdout}
     Close All Connections
     Should Be Equal As Integers   ${rc}   0
-    [Return]   ${stdout}
\ No newline at end of file
+    [Return]   ${stdout}
+