VOL-2054 Improve cleanup for tech profile tests
Change-Id: Iad932d27b9e3d8948f3ab0e2ff5e7d702a1d64c1
diff --git a/libraries/utils.robot b/libraries/utils.robot
index 688b9a2..e72b93c 100644
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -472,18 +472,22 @@
FOR ${I} IN RANGE 0 ${num_onus}
${src}= Set Variable ${hosts.src[${I}]}
${dst}= Set Variable ${hosts.dst[${I}]}
- Run Keyword And Ignore Error Kill Linux Process [w]pa_supplicant ${src['ip']}
+ Execute Remote Command pkill wpa_supplicant ${src['ip']}
... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
- Run Keyword And Ignore Error Kill Linux Process [d]hclient ${src['ip']}
+ Execute Remote Command pkill dhclient ${src['ip']}
... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
- Run Keyword If '${dst['ip']}' != '${None}' Run Keyword And Ignore Error
- ... Kill Linux Process [d]hcpd ${dst['ip']} ${dst['user']}
- ... ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
+ Execute Remote Command sudo pkill mausezahn ${src['ip']}
+ ... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
+ Run Keyword If '${dst['ip']}' != '${None}' Execute Remote Command pkill dhcpd
+ ... ${dst['ip']} ${dst['user']} ${dst['pass']} ${dst['container_type']} ${dst['container_name']}
Delete IP Addresses from Interface on Remote Host ${src['dp_iface_name']} ${src['ip']}
... ${src['user']} ${src['pass']} ${src['container_type']} ${src['container_name']}
Run Keyword If '${dst['ip']}' != '${None}' Delete Interface on Remote Host
... ${dst['dp_iface_name']}.${src['s_tag']} ${dst['ip']} ${dst['user']} ${dst['pass']}
... ${dst['container_type']} ${dst['container_name']}
+ Run Keyword If '${dst['noroot_ip']}' != '${None}' Execute Remote Command
+ ... sudo pkill mausezahn ${dst['noroot_ip']} ${dst['noroot_user']} ${dst['noroot_pass']}
+ ... ${dst['container_type']} ${dst['container_name']}
END
Clean WPA Process
@@ -554,7 +558,7 @@
[Documentation] SSH into a remote host and execute a command on the bare host or in a container.
... This replaces and simplifies the Login And Run Command On Remote System keyword in CORDRobot.
[Arguments] ${cmd} ${ip} ${user} ${pass}=${None}
- ... ${container_type}=${None} ${container_name}=${None}
+ ... ${container_type}=${None} ${container_name}=${None} ${timeout}=${None}
${conn_id}= SSHLibrary.Open Connection ${ip}
Run Keyword If '${pass}' != '${None}'
... SSHLibrary.Login ${user} ${pass}
@@ -564,12 +568,12 @@
... kubectl get pods --all-namespaces | grep ${container_name} | awk '{print $1}'
${stdout} ${stderr} ${rc}= Run Keyword If '${container_type}' == 'LXC'
... SSHLibrary.Execute Command lxc exec ${container_name} -- ${cmd}
- ... return_stderr=True return_rc=True
+ ... return_stderr=True return_rc=True timeout=${timeout}
... ELSE IF '${container_type}' == 'K8S'
... SSHLibrary.Execute Command kubectl -n ${namespace} exec ${container_name} -- ${cmd}
- ... return_stderr=True return_rc=True
+ ... return_stderr=True return_rc=True timeout=${timeout}
... ELSE
- ... SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True
+ ... SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True timeout=${timeout}
Log ${stdout}
Log ${stderr}
@@ -646,17 +650,18 @@
... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
FOR ${pbit} IN RANGE 8
- Execute Remote Command sudo pkill -2 mausezahn
+ Execute Remote Command sudo pkill mausezahn
... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
- ${var1}= Set Variable sudo mausezahn ${src_iface} -B ${target_ip} -c ${packet_count}
+ ${var1}= Set Variable sudo mausezahn ${src_iface} -B ${target_ip} -c ${packet_count} -d 100m
${var2}= Set Variable -t ${packet_type} "dp=${target_port}" -p 1472 -Q ${pbit}:${vlan}
${cmd}= Set Variable ${var1} ${var2}
Start Remote Command ${cmd} ${src_ip} ${src_user} ${src_pass}
... ${src_container_type} ${src_container_name}
${output} ${stderr} ${rc}= Execute Remote Command
- ... timeout 30 sudo tcpdump -l -U -c 30 -i ${target_iface} -e ${tcpdump_filter}
+ ... sudo tcpdump -l -U -c 30 -i ${target_iface} -e ${tcpdump_filter}
... ${dst_ip} ${dst_user} ${dst_pass} ${dst_container_type} ${dst_container_name}
- Execute Remote Command sudo pkill -2 mausezahn
+ ... timeout=30 seconds
+ Execute Remote Command sudo pkill mausezahn
... ${src_ip} ${src_user} ${src_pass} ${src_container_type} ${src_container_name}
# VOL-3262: I'm seeing untagged downstream traffic at RG for pbit 0. According to Girish this is
# incorrect behavior. Simplify the following check when VOL-3262 is resolved.