+
+Start Packet Capture On Node
+ [Arguments] ${node_ip} ${file_Name}=${dump_default_name} ${network_Adapter}=eth0 ${user}=${DEFAULT_USER} ${password}=${EMPTY} ${prompt}=${DEFAULT_LINUX_PROMPT}
+ ... ${prompt_timeout}=${DEFAULT_TIMEOUT} ${filter}=${EMPTY}
+ [Documentation] Connects to the remote machine and starts tcpdump
+ ${current_ssh_connection}= SSHLibrary.Get Connection
+ ${conn_id}= SSHLibrary.Open Connection ${node_ip} prompt=${prompt} timeout=${prompt_timeout}
+ SSHKeywords.Flexible SSH Login ${user} ${password}
+ ${cmd} = Set Variable sudo /usr/sbin/tcpdump -vvv -ni ${networkAdapter} ${filter} -w /tmp/${file_Name}.pcap
+ ${stdout} ${stderr} = SSHLibrary.Start Command ${cmd}
+ Log ${stderr}
+ Log ${stdout}
+ [Teardown] SSHKeywords.Restore_Current_SSH_Connection_From_Index ${current_ssh_connection.index}
+ [Return] ${conn_id}
+
+Stop Packet Capture on Node
+ [Arguments] ${conn_id}
+ [Documentation] This keyword will list the running processes looking for tcpdump and then kill the process with the name tcpdump
+ SSHLibrary.Switch Connection ${conn_id}
+ ${stdout} = SSHLibrary.Execute Command sudo ps -elf | grep tcpdump
+ Log ${stdout}
+ ${stdout} ${stderr} = SSHLibrary.Execute Command sudo pkill -f tcpdump return_stderr=True
+ Log ${stderr}
+ Log ${stdout}
+ ${stdout} = SSHLibrary.Execute Command sudo xz -9ekvv /tmp/*.pcap
+ Log ${stdout}
+ ${stdout} = SSHLibrary.Execute Command sudo ls -ls /tmp
+ Log ${stdout}
+
+Start Packet Capture on Nodes
+ [Arguments] ${tag}=${EMPTY} ${filter}=${EMPTY} ${ips}=@{EMPTY}
+ [Documentation] Start packet captures on the given list of node ips.
+ ... The captures will be named with the tag and ip.
+ @{conn_ids} = BuiltIn.Create List @{EMPTY}
+ FOR ${ip} IN @{ips}
+ ${fname} = BuiltIn.Catenate SEPARATOR=__ ${tag} ${ip}
+ ${conn_id} = Tcpdump.Start Packet Capture on Node ${ip} file_Name=${fname} filter=${filter}
+ Collections.Append To List ${conn_ids} ${conn_id}
+ END
+ [Return] @{conn_ids}
+
+Stop Packet Capture on Nodes
+ [Arguments] ${conn_ids}=@{EMPTY}
+ [Documentation] Stop the packet captures on the given list of node connection ids
+ FOR ${conn_id} IN @{conn_ids}
+ Stop Packet Capture on Node ${conn_id}
+ END