mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-03 04:07:52 +00:00
instruct people to use update_deps.py
This commit is contained in:
committed by
Jed Reynolds
parent
be7e94916f
commit
2550204f3e
@@ -10,6 +10,8 @@ Follow our [getting started cookbook](http://www.candelatech.com/cookbook.php?vo
|
||||
to learn more about how to operate your LANforge client.
|
||||
|
||||
## Getting Started ##
|
||||
The first step is to run update_deps.py which is located in py-scripts. This command will install all dependencies necessary for lanforge-scripts on your system.
|
||||
|
||||
New automation tests and JSON client scripts should go in `../py-scripts`. This directory
|
||||
is intended for utility and library scripts. To use this module, make sure your include path
|
||||
captures this module by adding it to your `sys.path`. We recommend your scripts in `../py-scripts`
|
||||
@@ -172,4 +174,3 @@ This directory defines the LANforge module holding the following classes:
|
||||
|
||||
Have fun coding!
|
||||
support@candelatech.com
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
This directory contains python scripts useful for unit-tests. It uses libraries in ../py-json. Please place new tests in this directory. Unless they are libraries, please avoid adding python scripts to ../py-json. Please read https://www.candelatech.com/cookbook/cli/json-python to learn about how to use the LANforge client JSON directly. Review http://www.candelatech.com/scripting_cookbook.php to understand more about scripts in general.
|
||||
|
||||
# Getting Started
|
||||
|
||||
The first step is to make sure all dependencies are installed in your system by running update_deps.py in this folder.
|
||||
|
||||
Please consider using the `LFCliBase` class as your script superclass. It will help you with a consistent set of JSON handling methods and pass and fail methods for recording test results. Below is a sample snippet that includes LFCliBase:
|
||||
|
||||
if 'py-json' not in sys.path:
|
||||
@@ -263,6 +266,3 @@ Test will exit on failure of not receiving traffic for one minute on any station
|
||||
* class `VapStations`
|
||||
* function `run`:
|
||||
* function `main`:
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,23 +14,26 @@ CURR_TEST_NUM=0
|
||||
CURR_TEST_NAME="BLANK"
|
||||
STOP_NUM=9
|
||||
|
||||
DATA_DIR="/home/lanforge/report-data"
|
||||
DATA_DIR="${TEST_DIR}"
|
||||
REPORT_DIR="/home/lanforge/html-reports"
|
||||
|
||||
#set -vex
|
||||
|
||||
#Test array
|
||||
testCommands=("./example_security_connection.py --num_stations $NUM_STA --ssid jedway-r8000-36 --passwd jedway-r8000-36 --radio $RADIO_USED --security wpa "
|
||||
testCommands=(
|
||||
"./example_security_connection.py --num_stations $NUM_STA --ssid jedway-r8000-36 --passwd jedway-r8000-36 --radio $RADIO_USED --security wpa"
|
||||
"./example_security_connection.py --num_stations $NUM_STA --ssid $SSID_USED --passwd $SSID_USED --radio $RADIO_USED --security wpa2"
|
||||
"./example_security_connection.py --num_stations $NUM_STA --ssid jedway-wep-48 --passwd jedway-wep-48 --radio $RADIO_USED --security wep"
|
||||
"./example_security_connection.py --num_stations $NUM_STA --ssid jedway-wpa3-1 --passwd jedway-wpa3-1 --radio $RADIO_USED --security wpa3"
|
||||
"./test_ipv4_connection.py --radio wiphy2 --num_stations $NUM_STA --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY"
|
||||
"./test_generic.py --mgr localhost --radio $RADIO_USED --ssid $SSID_USED --passwd $PASSWD_USED --num_stations $NUM_STA --type lfping --dest 10.40.0.1 --security $SECURITY"
|
||||
"./test_generic.py --mgr localhost --radio $RADIO_USED --ssid $SSID_USED --passwd $PASSWD_USED --num_stations $NUM_STA --type speedtest --speedtest_min_up 20 --speedtest_min_dl 20 --speedtest_max_ping 150 --security $SECURITY"
|
||||
"./test_ipv4_l4_urls_per_ten.py --radio $RADIO_USED --num_stations $NUM_STA --security $SECURITY --ssid $SSID_USED --passwd $PASSWD_USED --num_tests 1 --requests_per_ten 600 --target_per_ten 600"
|
||||
"./test_ipv4_l4_wifi.py --radio wiphy0 --num_stations $NUM_STA --security $SECURITY --ssid $SSID_USED --passwd $PASSWD_USED --test_duration 2m"
|
||||
"./test_ipv4_l4.py --radio wiphy3 --num_stations 4 --security $SECURITY --ssid $SSID_USED --passwd $PASSWD_USED --url \"dl http://10.40.0.1 /dev/null\" --test_duration 2m"
|
||||
"./test_generic.py --radio $RADIO_USED --ssid $SSID_USED --passwd $PASSWD_USED --num_stations $NUM_STA --type lfping --dest 10.40.0.1 --security $SECURITY"
|
||||
"./test_generic.py --radio $RADIO_USED --ssid $SSID_USED --passwd $PASSWD_USED --num_stations $NUM_STA --type speedtest --speedtest_min_up 20 --speedtest_min_dl 20 --speedtest_max_ping 150 --security $SECURITY"
|
||||
"./test_ipv4_l4_urls_per_ten.py --radio $RADIO_USED --num_stations $NUM_STA --security $SECURITY --ssid $SSID_USED --passwd $PASSWD_USED --num_tests 1 --requests_per_ten 600 --target_per_ten 600"
|
||||
"./test_ipv4_l4_wifi.py --radio wiphy0 --num_stations $NUM_STA --security $SECURITY --ssid $SSID_USED --passwd $PASSWD_USED --test_duration 2m"
|
||||
"./test_ipv4_l4.py --radio wiphy3 --num_stations 4 --security $SECURITY --ssid $SSID_USED --passwd $PASSWD_USED --url \"dl http://10.40.0.1 /dev/null\" --test_duration 2m"
|
||||
"./test_ipv4_variable_time.py --radio wiphy1 --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY --test_duration 30s --output_format excel"
|
||||
"./test_ipv4_variable_time.py --radio wiphy1 --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY --test_duration 30s --output_format csv"
|
||||
"./create_bridge.py --radio wiphy1 --upstream_port eth1 --target_device sta0000"
|
||||
#"./create_bridge.py --radio wiphy1 --upstream_port eth1 --target_device sta0000"
|
||||
#"./create_l3.py --radio wiphy1 --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY"
|
||||
#"./create_l4.py --radio wiphy1 --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY"
|
||||
#"./create_macvlan.py --radio wiphy1"
|
||||
@@ -63,6 +66,11 @@ function echo_print() {
|
||||
echo "Beginning $CURR_TEST_NAME test..." >>~/test_all_output_file.txt
|
||||
}
|
||||
results=()
|
||||
detailedresults=()
|
||||
NOW=$(date +"%Y-%m-%d-%H-%M")
|
||||
NOW="${NOW/:/-}"
|
||||
TEST_DIR="/home/lanforge/report-data/${NOW}"
|
||||
mkdir "$TEST_DIR"
|
||||
function run_test() {
|
||||
for i in "${testCommands[@]}"; do
|
||||
CURR_TEST_NAME=${i%%.py*}
|
||||
@@ -78,10 +86,14 @@ function run_test() {
|
||||
if (( $CURR_TEST_NUM > $START_NUM )) || (( $CURR_TEST_NUM == $START_NUM )); then
|
||||
echo_print
|
||||
echo "$i"
|
||||
if $i; then
|
||||
results+=("<tr><td>${CURR_TEST_NAME}</td><td>Success</td></tr>")
|
||||
$i > "${TEST_DIR}/${i}.txt" 2> "${TEST_DIR}/${i}_stderr.txt"
|
||||
retval=$?
|
||||
grep -i fail "${TEST_DIR}/${i}.txt" && retval=1
|
||||
chmod 664 "${TEST_DIR}/${i}.txt"
|
||||
if (( $retval == 0 )); then
|
||||
results+=("<tr><td>${CURR_TEST_NAME}</td><td class='scriptdetails'>${i}</td><td class='success'>Success</td><td><button onclick=\"toggle_visibility('${i}');\">Show/Hide</button></td></tr>")
|
||||
else
|
||||
results+=("<tr><td>${CURR_TEST_NAME}</td><td>Failure</td></tr>")
|
||||
results+=("<tr><td>${CURR_TEST_NAME}</td><td class='scriptdetails'>${i}</td><td class='failure'>Failure</td><td><button onclick=\"toggle_visibility('${i}');\">Show/Hide</button></td></tr>")
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -98,46 +110,64 @@ function check_args() {
|
||||
function html_generator() {
|
||||
NOW=$(date +"%Y-%m-%d-%T")
|
||||
header="<html>
|
||||
<head>
|
||||
<title>Test All Scripts Results $NOW</title>
|
||||
<style>
|
||||
.success {
|
||||
background-color:green;
|
||||
}
|
||||
.failure {
|
||||
background-color:red;
|
||||
}
|
||||
table {
|
||||
border: 1px solid gray;
|
||||
}
|
||||
td {
|
||||
margin: 0;
|
||||
padding: 2px;
|
||||
font-family: 'Courier New',courier,sans-serif;
|
||||
}
|
||||
h1, h2, h3, h4 {
|
||||
font-family: 'Century Gothic',Arial,sans,sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test All Scripts Results</h1>
|
||||
<h4> $NOW</h4>
|
||||
<table border ='1'>
|
||||
"
|
||||
tail="</table>
|
||||
</body>
|
||||
</html>"
|
||||
<head>
|
||||
<title>Test All Scripts Results $NOW</title>
|
||||
<style>
|
||||
.success {
|
||||
background-color:green;
|
||||
}
|
||||
.failure {
|
||||
background-color:red;
|
||||
}
|
||||
table {
|
||||
border: 1px solid gray;
|
||||
}
|
||||
td {
|
||||
margin: 0;
|
||||
padding: 2px;
|
||||
font-family: 'Courier New',courier,sans-serif;
|
||||
}
|
||||
h1, h2, h3, h4 {
|
||||
font-family: 'Century Gothic',Arial,sans,sans-serif;
|
||||
}
|
||||
.scriptdetails {
|
||||
font-size: 10px;
|
||||
}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
function toggle_visibility(id) {
|
||||
var e = document.getElementById(id);
|
||||
if(e.style.display == 'block')
|
||||
e.style.display = 'none';
|
||||
else
|
||||
e.style.display = 'block';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test All Scripts Results</h1>
|
||||
<h4>$NOW</h4>
|
||||
<table border ='1'>
|
||||
"
|
||||
tail="</body>
|
||||
</html>"
|
||||
|
||||
fname="/home/lanforge/html-reports/test_all_output_file-${NOW}.html"
|
||||
echo $fname >> $fname
|
||||
echo "$header" >> $fname
|
||||
echo "${results[@]}" >> $fname
|
||||
echo "</table>" >> $fname
|
||||
for item in "${testCommands[@]}"; do
|
||||
CURR_TEST_NAME=${item%%.py*}
|
||||
CURR_TEST_NAME=${CURR_TEST_NAME#./*}
|
||||
echo "<div id=${item} style=\"display:none;\"><iframe src=\"${TEST_DIR}/${item}.txt\"></iframe></div>" >> $fname
|
||||
done;
|
||||
echo "$tail" >> $fname
|
||||
}
|
||||
|
||||
#true >~/test_all_output_file.txt
|
||||
check_args $1 $2
|
||||
run_test
|
||||
echo "${detailedresults}"
|
||||
html_generator
|
||||
#test generic and fileio are for macvlans
|
||||
|
||||
Reference in New Issue
Block a user