X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FTcpdump.robot;h=977c12bd7cd31236389dd899580b316bb8cffc39;hb=a6c5d6d6208d696496f01ae01987270bb21218e0;hp=6fd11c8f26d26dda381934f462bb16bd64f03048;hpb=57ffdb8b0bb58c5392d0d7989a9d8e9bf794fdd9;p=integration%2Ftest.git diff --git a/csit/libraries/Tcpdump.robot b/csit/libraries/Tcpdump.robot index 6fd11c8f26..977c12bd7c 100644 --- a/csit/libraries/Tcpdump.robot +++ b/csit/libraries/Tcpdump.robot @@ -1,6 +1,7 @@ *** Settings *** Documentation Library to catch traffic/packets using linux tcpdump command Library SSHLibrary +Resource SSHKeywords.robot Resource Utils.robot Resource RemoteBash.robot Variables ../variables/Variables.py @@ -19,7 +20,7 @@ Start Tcpdumping [Documentation] Connects to the remote machine via ssh and starts tcpdump linux command ${currentcon}= SSHLibrary.Get Connection index=True SSHLibrary.Open Connection ${system} prompt=${prompt} timeout=${timeout} alias=${dumpalias} - Utils.Flexible SSH Login ${user} password=${password} delay=${timeout} + SSHKeywords.Flexible SSH Login ${user} password=${password} delay=${timeout} SSHLibrary.Write ${dumpcmd} -i ${eth} ${more_params} Run Keyword If ${currentcon}==${None} Return From Keyword SSHLibrary.Switch Connection ${currentcon} @@ -41,12 +42,12 @@ Stop Tcpdumping And Download 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} + ... ${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} - Flexible SSH Login ${user} ${password} - ${cmd} = Set Variable sudo /usr/sbin/tcpdump -vvv -ni ${networkAdapter} -w /tmp/${file_Name}.pcap + 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} @@ -67,3 +68,20 @@ Stop Packet Capture on Node ${stdout} = SSHLibrary.Execute Command sudo ls -ls /tmp Log ${stdout} SSHLibrary. Close Connection + +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} + [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}