[VOL-4267] Added openonu-adapter restart scenario with continuous ping running in background for DT
Change-Id: I05e6bc4d085ec7f5921862e08496874a6ea90257
diff --git a/libraries/utils.robot b/libraries/utils.robot
index 64b4c84..c08d1ac 100755
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -1328,6 +1328,33 @@
${object}= Evaluate json.loads(r'''${output}''') json
[Return] ${object}
+Run Ping In Background
+ [Arguments] ${output_file} ${dst_ip} ${iface} ${ip} ${user} ${pass}=${None}
+ ... ${container_type}=${None} ${container_name}=${None}
+ [Documentation] Runs the 'ping' on remote system in background and stores the result in a file
+ ${result}= Login And Run Command On Remote System
+ ... ping -I ${iface} ${dst_ip} > ${output_file} &
+ ... ${ip} ${user} ${pass} ${container_type} ${container_name}
+ Log ${result}
+
+Stop Ping Running In Background
+ [Arguments] ${ip} ${user} ${pass}=${None}
+ ... ${container_type}=${None} ${container_name}=${None}
+ [Documentation] Stops the 'ping' running in background on remote system
+ ${result}= Login And Run Command On Remote System
+ ... sudo kill -SIGINT `pgrep ping`
+ ... ${ip} ${user} ${pass} ${container_type} ${container_name}
+ Log ${result}
+
+Retrieve Remote File Contents
+ [Documentation] Retrieves the contents of the file on remote system
+ [Arguments] ${file} ${ip} ${user} ${pass}=${None}
+ ... ${container_type}=${None} ${container_name}=${None} ${prompt}=~$
+ ${output}= Login And Run Command On Remote System
+ ... cat ${file}
+ ... ${ip} ${user} ${pass} ${container_type} ${container_name} ${prompt}
+ [Return] ${output}
+
RestoreONUs
[Documentation] Restore all connected ONUs
[Arguments] ${num_all_onus}