scripts: More gui automation fixes and improvements.

This commit is contained in:
Ben Greear
2020-04-16 16:34:35 -07:00
parent 496f5acd62
commit 0497c25adf
7 changed files with 381 additions and 12 deletions

View File

@@ -20,26 +20,33 @@ test_rig: TR-398 test bed
Save this text to a file for later use: AP-Auto-ap-auto-32-64-dual.txt
You can also use the ../lf_testmod.pl script to do this:
# The head and tail stuff trims leading and trailing lines, respectively.
../lf_testmod.pl --mgr 192.168.100.156 --action show --test_name AP-Auto-ap-auto-32-64-dual|tail -n +2 | head -n -2 > test_configs/mytest.txt
# Save this text using the ../lf_testmod.pl script:
../lf_testmod.pl --mgr 192.168.100.156 --action show --test_name AP-Auto-ap-auto-32-64-dual > test_configs/mytest.txt
To load a test file:
lf_testmod.pl --mgr 192.168.100.156 --action set --test_name AP-Auto-ben --file test_configs/mytest.txt
# To load a test file into the LANforge server configuration:
../lf_testmod.pl --mgr 192.168.100.156 --action set --test_name AP-Auto-ben --file test_configs/mytest.txt
# Save print and scenario:
../lf_testmod.pl --mgr 192.168.100.156 --action show --test_name simpleThput --test_type Network-Connectivity > test_configs/myscenario.txt
# Load a scenario into the LANforge server configuration
../lf_testmod.pl --mgr 192.168.100.156 --action set --test_type Network-Connectivity --test_name 64sta --file test_configs/myscenario.txt
###
Once test cases have been loaded, you can tell the GUI to run tests for you, potentially modifying the
Once test cases have been loaded into the server, you can tell the GUI to run tests for you, potentially modifying the
test configuration through the GUI.
First, tell the GUI to read the latest test config from the server.
# Tell the GUI to read the latest test config from the server.
../lf_gui_cmd.pl --manager localhost --port 3990 --cmd "cli show_text_blob"
# Tell the Chamber-View GUI widget to load and build the specified scenario.
../lf_gui_cmd.pl --manager localhost --port 3990 --load 64sta
Now, tell the GUI to run a test with the new config.
# Now, tell the GUI to run a test with the new config.
# Note that the --tconfig option does not have the "AP-Auto-" prepended to it, that is automatically
# done by the GUI in order to make sure each test has its own namespace.
../lf_gui_cmd.pl --manager localhost --port 3990 --ttype "AP-Auto" --tname ap-auto-ben --tconfig ben --rpt_dest /tmp/lf_reports/

View File

@@ -12,6 +12,8 @@
#
AP_AUTO_CFG_FILE=${AP_AUTO_CFG_FILE:-test_configs/AP-Auto-ap-auto-32-64-dual.txt}
WCT_CFG_FILE=${WCT_CFG_FILE:-test_configs/WCT-64sta.txt}
SCENARIO_CFG_FILE=${SCENARIO_CFG_FILE:-test_configs/64_sta_scenario.txt}
# LANforge target machine
LFMANAGER=${LFMANAGER:-localhost}
@@ -23,9 +25,13 @@ MY_TMPDIR=${MY_TMPDIR:-/tmp}
# Test configuration (10 minutes by default, in interest of time)
STABILITY_DURATION=${STABILITY_DURATION:-600}
TEST_RIG_ID=${TEST_RIG_ID:-Unspecified}
# Tests to run
DEFAULT_ENABLE=${DEFAULT_ENABLE:-1}
DO_WCT_DL=${DO_WCT_DL:-$DEFAULT_ENABLE}
DO_WCT_UL=${DO_WCT_UL:-$DEFAULT_ENABLE}
DO_WCT_BI=${DO_WCT_BI:-$DEFAULT_ENABLE}
DO_SHORT_AP_BASIC_CX=${DO_SHORT_AP_BASIC_CX:-$DEFAULT_ENABLE}
DO_SHORT_AP_TPUT=${DO_SHORT_AP_TPUT:-$DEFAULT_ENABLE}
DO_SHORT_AP_STABILITY_RESET=${DO_SHORT_AP_STABILITY_RESET:-$DEFAULT_ENABLE}
@@ -38,20 +44,78 @@ RSLTS_DIR=${RSLTS_DIR:-basic_regression_results_$DATESTR}
# Probably no config below here
AP_AUTO_CFG=ben
WCT_CFG=ben
SCENARIO=64sta
RPT_TMPDIR=${MY_TMPDIR}/lf_reports
mkdir -p $RSLTS_DIR
set -x
# Load scenario file
../lf_testmod.pl --mgr $LFMANAGER --action set --test_type Network-Connectivity --test_name $SCENARIO --file $SCENARIO_CFG_FILE
# Load AP-Auto config file
../lf_testmod.pl --mgr $LFMANAGER --action set --test_name AP-Auto-$AP_AUTO_CFG --file $AP_AUTO_CFG_FILE
# Load Wifi Capacity config file
../lf_testmod.pl --mgr $LFMANAGER --action set --test_name Wifi-Capacity-$WCT_CFG --file $WCT_CFG_FILE
# Make sure GUI is synced up with the server
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --cmd "cli show_text_blob"
# Pause to let GUI finish getting data from the server
sleep 10
# Tell GUI to load and build the scenario
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --scenario $SCENARIO
# Clean out temp report directory
if [ -d $RPT_TMPDIR ]
then
rm -fr $RPT_TMPDIR/*
fi
# Do capacity test
echo "Checking if we should run WCT Download test."
if [ "_$DO_WCT_DL" == "_1" ]
then
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --ttype "WiFi Capacity" --tname wct-ben --tconfig $WCT_CFG \
--modifier_key "Test Rig ID:" --modifier_val "$TEST_RIG_ID" \
--modifier_key "RATE_DL" --modifier_val "1Gbps" \
--modifier_key "RATE_UL" --modifier_val "0" \
--rpt_dest $RPT_TMPDIR > $MY_TMPDIR/basic_regression_log.txt 2>&1
mv $RPT_TMPDIR/* $RSLTS_DIR/wifi_capacity_dl
mv $MY_TMPDIR/basic_regression_log.txt $RSLTS_DIR/wifi_capacity_dl/test_automation.txt
fi
echo "Checking if we should run WCT Upload test."
if [ "_$DO_WCT_UL" == "_1" ]
then
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --ttype "WiFi Capacity" --tname wct-ben --tconfig $WCT_CFG \
--modifier_key "Test Rig ID:" --modifier_val "$TEST_RIG_ID" \
--modifier_key "RATE_UL" --modifier_val "1Gbps" \
--modifier_key "RATE_DL" --modifier_val "0" \
--rpt_dest $RPT_TMPDIR > $MY_TMPDIR/basic_regression_log.txt 2>&1
mv $RPT_TMPDIR/* $RSLTS_DIR/wifi_capacity_ul
mv $MY_TMPDIR/basic_regression_log.txt $RSLTS_DIR/wifi_capacity_ul/test_automation.txt
fi
echo "Checking if we should run WCT Bi-Direction test."
if [ "_$DO_WCT_BI" == "_1" ]
then
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --ttype "WiFi Capacity" --tname wct-ben --tconfig $WCT_CFG \
--modifier_key "Test Rig ID:" --modifier_val "$TEST_RIG_ID" \
--modifier_key "RATE_UL" --modifier_val "1Gbps" \
--modifier_key "RATE_DL" --modifier_val "1Gbps" \
--modifier_key "Protocol:" --modifier_val "TCP-IPv4" \
--rpt_dest $RPT_TMPDIR > $MY_TMPDIR/basic_regression_log.txt 2>&1
mv $RPT_TMPDIR/* $RSLTS_DIR/wifi_capacity_bi
mv $MY_TMPDIR/basic_regression_log.txt $RSLTS_DIR/wifi_capacity_bi/test_automation.txt
fi
# Run basic-cx test
echo "Checking if we should run Short-AP Basic CX test."
if [ "_$DO_SHORT_AP_BASIC_CX" == "_1" ]
then
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --ttype "AP-Auto" --tname ap-auto-ben --tconfig $AP_AUTO_CFG \
@@ -62,6 +126,7 @@ fi
# Run Throughput, Dual-Band, Capacity test in a row, the Capacity will use results from earlier
# tests.
echo "Checking if we should run Short-AP Throughput test."
if [ "_$DO_SHORT_AP_TPUT" == "_1" ]
then
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --ttype "AP-Auto" --tname ap-auto-ben --tconfig $AP_AUTO_CFG \
@@ -75,6 +140,7 @@ then
fi
# Run Stability test (single port resets, voip, tcp, udp)
echo "Checking if we should run Short-AP Stability Reset test."
if [ "_$DO_SHORT_AP_STABILITY_RESET" == "_1" ]
then
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --ttype "AP-Auto" --tname ap-auto-ben --tconfig $AP_AUTO_CFG \
@@ -87,6 +153,7 @@ then
fi
# Run Stability test (radio resets, voip, tcp, udp)
echo "Checking if we should run Short-AP Stability Radio Reset test."
if [ "_$DO_SHORT_AP_STABILITY_RADIO_RESET" == "_1" ]
then
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --ttype "AP-Auto" --tname ap-auto-ben --tconfig $AP_AUTO_CFG \
@@ -100,6 +167,7 @@ then
fi
# Run Stability test (no resets, no voip, tcp, udp)
echo "Checking if we should run Short-AP Stability No-Reset test."
if [ "_$DO_SHORT_AP_STABILITY_NO_RESET" == "_1" ]
then
../lf_gui_cmd.pl --manager $GMANAGER --port $GMPORT --ttype "AP-Auto" --tname ap-auto-ben --tconfig $AP_AUTO_CFG \
@@ -112,3 +180,5 @@ then
mv $RPT_TMPDIR/* $RSLTS_DIR/ap_auto_stability_no_reset
mv $MY_TMPDIR/basic_regression_log.txt $RSLTS_DIR/ap_auto_stability_no_reset/test_automation.txt
fi
echo "Done with regression test."

View File

@@ -0,0 +1,12 @@
profile_link 1.1 STA-AC 64 'DUT: TR398-DUT Radio-1' NA wiphy0,AUTO -1
profile_link 1.1 upstream 1 'DUT: TR398-DUT LAN' NA eth1,AUTO -1
chamber TR-398 495 239 NA 10.0
chamber MobileStations 305 240 NA 10.0
dut Lexus 0 0
dut SurfacePro 110 152
dut iphone 0 0
dut Comcast 565 309
dut NetgearAP 987 177
resource 1.2 0 0

View File

@@ -0,0 +1,126 @@
[BLANK]
sel_port-0: 1.1.eth1
sel_port-1: 1.1.sta00000
sel_port-2: 1.1.sta00001
sel_port-3: 1.1.sta00002
sel_port-4: 1.1.sta00003
sel_port-5: 1.1.sta00004
sel_port-6: 1.1.sta00005
sel_port-7: 1.1.sta00006
sel_port-8: 1.1.sta00007
sel_port-9: 1.1.sta00008
sel_port-10: 1.1.sta00009
sel_port-11: 1.1.sta00010
sel_port-12: 1.1.sta00011
sel_port-13: 1.1.sta00012
sel_port-14: 1.1.sta00013
sel_port-15: 1.1.sta00014
sel_port-16: 1.1.sta00015
sel_port-17: 1.1.sta00016
sel_port-18: 1.1.sta00017
sel_port-19: 1.1.sta00018
sel_port-20: 1.1.sta00019
sel_port-21: 1.1.sta00020
sel_port-22: 1.1.sta00021
sel_port-23: 1.1.sta00022
sel_port-24: 1.1.sta00023
sel_port-25: 1.1.sta00024
sel_port-26: 1.1.sta00025
sel_port-27: 1.1.sta00026
sel_port-28: 1.1.sta00027
sel_port-29: 1.1.sta00028
sel_port-30: 1.1.sta00029
sel_port-31: 1.1.sta00030
sel_port-32: 1.1.sta00031
sel_port-33: 1.1.sta00032
sel_port-34: 1.1.sta00033
sel_port-35: 1.1.sta00034
sel_port-36: 1.1.sta00035
sel_port-37: 1.1.sta00036
sel_port-38: 1.1.sta00037
sel_port-39: 1.1.sta00038
sel_port-40: 1.1.sta00039
sel_port-41: 1.1.sta00040
sel_port-42: 1.1.sta00041
sel_port-43: 1.1.sta00042
sel_port-44: 1.1.sta00043
sel_port-45: 1.1.sta00044
sel_port-46: 1.1.sta00045
sel_port-47: 1.1.sta00046
sel_port-48: 1.1.sta00047
sel_port-49: 1.1.sta00048
sel_port-50: 1.1.sta00049
sel_port-51: 1.1.sta00050
sel_port-52: 1.1.sta00051
sel_port-53: 1.1.sta00052
sel_port-54: 1.1.sta00053
sel_port-55: 1.1.sta00054
sel_port-56: 1.1.sta00055
sel_port-57: 1.1.sta00056
sel_port-58: 1.1.sta00057
sel_port-59: 1.1.sta00058
sel_port-60: 1.1.sta00059
sel_port-61: 1.1.sta00060
sel_port-62: 1.1.sta00061
sel_port-63: 1.1.sta00062
sel_port-64: 1.1.sta00063
show_events: 1
show_log: 0
port_sorting: 0
bg: 0xE0ECF8
test_rig:
show_scan: 1
auto_helper: 1
skip_2: 0
skip_5: 0
batch_size: 1,2,5,10,20,40,64
loop_iter: 1
duration: 20000
test_groups: 0
test_groups_subset: 0
protocol: UDP-IPv4
dl_rate_sel: Total Download Rate:
dl_rate: 1000000000
ul_rate_sel: Total Upload Rate:
ul_rate: 0
prcnt_tcp: 100000
l4_endp:
pdu_sz: -1
mss_sel: 1
sock_buffer: 0
ip_tos: 0
multi_conn: -1
min_speed: -1
ps_interval: 60-second Running Average
fairness: 0
naptime: 0
before_clear: 5000
rpt_timer: 1000
try_lower: 0
rnd_rate: 1
leave_ports_up: 0
down_quiesce: 0
udp_nat: 1
record_other_ssids: 0
clear_reset_counters: 1
do_pf: 0
pf_min_period_dl: 1544000
pf_min_period_ul: 0
pf_max_reconnects: 0
use_mix_pdu: 0
pdu_prcnt_pps: 1
pdu_prcnt_bps: 0
pdu_mix_ln-0:
show_scan: 1
show_golden_3p: 0
save_csv: 0
show_realtime: 1
show_pie: 1
show_per_loop_totals: 1
show_cx_time: 1
show_dhcp: 1
show_anqp: 1
show_4way: 1
show_latency: 1

View File

@@ -28,6 +28,7 @@ my $port = "";
my $cmd = "";
my $ttype = ""; # Test type
my $tname = "lfgui-test";
my $scenario = "";
my $tconfig = ""; # test config
my $rpt_dest = "";
my $show_help = 0;
@@ -43,6 +44,8 @@ my $usage = qq($0 [--manager { hostname or address of LANforge GUI machine } ]
# careful, your cli-socket might be 3390!
[--ttype {test instance type} ]
# likely types: "cv", "WiFi Capacity", "Port Bringup", "Port Reset"
[--scenario {scenario name} ]
# Apply and build the scenario.
[--tname {test instance name} ]
[--tconfig {test configuration name, use defaults if not specified} ]
[--rpt_dest {Copy report to destination once it is complete} ]
@@ -52,6 +55,7 @@ my $usage = qq($0 [--manager { hostname or address of LANforge GUI machine } ]
Example:
lf_gui_cmd.pl --manager localhost --port 3990 --ttype TR-398 --tname mytest --tconfig comxim --rpt_dest /var/www/html/lf_reports
lf_gui_cmd.pl --manager localhost --port 3990 --cmd \"help\"
lf_gui_cmd.pl --manager localhost --port 3990 --scenario 64sta
);
if (@ARGV < 2) {
@@ -66,6 +70,7 @@ GetOptions (
'modifier_val=s' => \@modifiers_val,
'ttype=s' => \$ttype,
'tname=s' => \$tname,
'scenario=s' => \$scenario,
'tconfig=s' => \$tconfig,
'rpt_dest=s' => \$rpt_dest,
'port=s' => \$port,
@@ -102,6 +107,23 @@ if ($cmd ne "") {
print doCmd("$cmd");
}
if ($scenario ne "") {
print doCmd("cv apply '$scenario'");
print doCmd("cv build");
sleep(3);
while (1) {
my $rslt = doCmd("cv is_built");
print "Result-built -:$rslt:-\n";
if ($rslt =~ /NO/) {
sleep(3);
}
else {
last;
}
}
}
if ($ttype ne "") {
print doCmd("cv create '$ttype' '$tname'");
if ($tconfig ne "") {
@@ -164,6 +186,7 @@ if ($ttype ne "") {
sleep(3);
}
else {
print("Chamber-View is (re)built, exiting.\n");
last;
}
}

View File

@@ -134,9 +134,27 @@ $::utils->connect($lfmgr_host, $lfmgr_port);
if ($::action eq "show") {
$cmd = "show_text_blob $test_type $test_name";
my $r = $::utils->doCmd($cmd);
print $r;
print "\n\n";
my $txt = $::utils->doCmd($cmd);
my @r = split(/\n/, $txt);
my $first = $r[0];
chomp($first);
if ($first =~ /.*::(.*)/) {
print "$1\n";
}
my $i;
for ($i = 1; $i<@r; $i++) {
my $ln = $r[$i];
chomp($ln);
if ($ln =~ /\s*>>RSLT.*/) {
# ignore
}
elsif ($ln =~ /\s*default\@btbits.*/) {
# ignore
}
else {
print "$ln\n";
}
}
}
elsif ($::action eq "set") {
if ($file_name eq "") {

113
tos_plus_auto.py Executable file
View File

@@ -0,0 +1,113 @@
#!/usr/bin/python3
'''
make sure pexpect is installed:
$ sudo yum install python3-pexpect
You might need to install pexpect-serial using pip:
$ pip3 install pexpect-serial
./tos_plus_auto.py
'''
import sys
if sys.version_info[0] != 3:
print("This script requires Python 3")
exit()
import os
import re
import logging
import time
from time import sleep
import pprint
import telnetlib
import argparse
import pexpect
ptype="QCA"
def usage():
print("$0 used connect to automated a test case using cisco controller and LANforge tos-plus script:")
print("-p|--ptype: AP Hardware type")
print("-h|--help")
def main():
global ptype
parser = argparse.ArgumentParser(description="TOS Plus automation script")
parser.add_argument("-p", "--ptype", type=str, help="AP Hardware type")
args = None
try:
args = parser.parse_args()
if (args.ptype != None):
ptype = args.ptype
except Exception as e:
logging.exception(e);
usage()
exit(2);
# Set up cisco controller. For now, variables are hard-coded.
dest = 172.19.27.95
port = 2013
ap = AxelMain
user = cisco
passwd = Cisco123
subprocess.run("python3 cisco_wifi_ctl.py -d %s -o %s -s telnet -l stdout -a %s -u %s -p %s -w wlan_open -i 6 --action wlan"%(dest, port, ap, user, passwd))
subprocess.run("python3 cisco_wifi_ctl.py -d %s -o %s -s telnet -l stdout -a %s -u %s -p %s -w wlan_open -i 6 --action wlan_qos --value platinum"%(dest, port, ap, user, passwd))
subprocess.run("python3 cisco_wifi_ctl.py -d %s -o %s -s telnet -l stdout -a %s -u %s -p %s --action show --value \"wlan summary\""%(dest, port, ap, user, passwd))
subprocess.run("python3 cisco_wifi_ctl.py -d %s -o %s -s telnet -l stdout -a %s -u %s -p %s -b b --action disable"%(dest, port, ap, user, passwd))
subprocess.run("python3 cisco_wifi_ctl.py -d %s -o %s -s telnet -l stdout -a %s -u %s -p %s -b a --action disable"%(dest, port, ap, user, passwd))
subprocess.run("python3 cisco_wifi_ctl.py -d %s -o %s -s telnet -l stdout -a %s -u %s -p %s -b a --action channel --value 149"%(dest, port, ap, user, passwd))
subprocess.run("python3 cisco_wifi_ctl.py -d %s -o %s -s telnet -l stdout -a %s -u %s -p %s -b a --action bandwidth --value 80"%(dest, port, ap, user, passwd))
subprocess.run("python3 cisco_wifi_ctl.py -d %s -o %s -s telnet -l stdout -a %s -u %s -p %s -b a --action enable"%(dest, port, ap, user, passwd))
# Run the tos plus script to generate traffic and grab capture files.
# You may edit this command as needed for different behaviour.
subprocess.run("./lf_tos_plus_test.py --dur 1 --lfmgr localhost --ssid 11ax-open --radio \"1.wiphy0 2 0\" --txpkts 10000 --wait_sniffer 1 --cx \"1.wiphy0 1.wlan0 anAX 1.eth2 udp 1024 10000 50000000 184\" --sniffer_radios \"1.wiphy2\"")
file1 = open('TOS_PLUS.sh', 'r')
lines = file1.readlines()
csv_file = ""
capture_dir = ""
# Strips the newline character
for line in lines:
tok_val = line.split("=", 1)
if tok_val[0] == "CAPTURE_DIR":
capture_dir = tok_val[1]
else if tok_val[0] == "CSV_FILE":
capture_dir = tok_val[1]
# Remove third-party tool's tmp file tmp file
os.unlink("stormbreaker.log")
# Run third-party tool to process the capture files.
subprocess.run("python3 sb -p %s -subdir %s"%(ptype, capture_dir))
# Print out one-way latency reported by LANforge
file2 = open(csv_file, 'r')
lines = file2.readlines()
# Strips the newline character
for line in lines:
cols = line.split("\t")
# Print out endp-name and avg latency
print("%s\t%s"%(cols[1], cols[15]))
subprocess.run("python3 cisco_wifi_ctl.py -d %s -o %s -s telnet -l stdout -a %s -u %s -p %s -w wlan_open -i 6 --action delete_wlan"%(dest, port, ap, user, passwd))
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
if __name__ == '__main__':
main()
####
####
####