Add iperf3 testing functionality to runtest.sh and update CSV output format; include local and remote TCP/UDP metrics
This commit is contained in:
parent
da0763806b
commit
4891f0bdfe
3 changed files with 40 additions and 5 deletions
|
@ -433,9 +433,6 @@ def analyze_pcap(pcapng_path, start_ts, end_ts, ap_bssid, ap_channel):
|
||||||
'CiscoMaxClients': max(cisco_reported_clients) if cisco_reported_clients else 0
|
'CiscoMaxClients': max(cisco_reported_clients) if cisco_reported_clients else 0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
cap.close()
|
cap.close()
|
||||||
|
|
||||||
|
|
38
runtest.sh
38
runtest.sh
|
@ -56,7 +56,7 @@ FAILED_START=$(get_tx_failed)
|
||||||
|
|
||||||
# Create CSV header if needed
|
# Create CSV header if needed
|
||||||
if [ ! -f "$TEST_FILE" ]; then
|
if [ ! -f "$TEST_FILE" ]; then
|
||||||
echo "StartTimestamp,EndTimestamp,Link,Level,Noise,BSSID,TX Bitrate,RX Bitrate,$(speedtest --csv-header),TX Failures,Channel,Frequency,Packet Loss,Jitter" > "$TEST_FILE"
|
echo "StartTimestamp,EndTimestamp,Link,Level,Noise,BSSID,TX Bitrate,RX Bitrate,$(speedtest --csv-header),TX Failures,Channel,Frequency,Packet Loss,Jitter,LocalTCPUp,LocalTCPDown,LocalUDPUp,LocalUDPDown,RemoteTCPUp,RemoteTCPDown,RemoteUDPUp,RemoteUDPDown" > "$TEST_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ "$COUNTER" -lt "$NUM_TESTS" ]; do
|
while [ "$COUNTER" -lt "$NUM_TESTS" ]; do
|
||||||
|
@ -107,10 +107,44 @@ while [ "$COUNTER" -lt "$NUM_TESTS" ]; do
|
||||||
packet_loss=$(ping -c $PING_COUNT -q $PING_TARGET | grep -oP '\d+(?=% packet loss)')
|
packet_loss=$(ping -c $PING_COUNT -q $PING_TARGET | grep -oP '\d+(?=% packet loss)')
|
||||||
jitter=$(ping -c $PING_COUNT $PING_TARGET | grep "time=" | awk '{print $(NF-1)}' | sed 's/time=//g' | awk '{sum+=$1; sumsq+=$1*$1} END {if (NR>1) print sqrt(sumsq/NR - (sum/NR)**2); else print 0}')
|
jitter=$(ping -c $PING_COUNT $PING_TARGET | grep "time=" | awk '{print $(NF-1)}' | sed 's/time=//g' | awk '{sum+=$1; sumsq+=$1*$1} END {if (NR>1) print sqrt(sumsq/NR - (sum/NR)**2); else print 0}')
|
||||||
|
|
||||||
|
# iperf3 function
|
||||||
|
run_iperf() {
|
||||||
|
local target=$1
|
||||||
|
local mode=$2 # tcp or udp
|
||||||
|
local direction=$3 # up or down
|
||||||
|
|
||||||
|
local args="-c $target -J -t $IPERF_DURATION"
|
||||||
|
[ "$mode" = "udp" ] && args="$args -u -b 10M"
|
||||||
|
|
||||||
|
[ "$direction" = "down" ] && args="$args -R"
|
||||||
|
|
||||||
|
iperf3 $args 2>/dev/null | jq -r '
|
||||||
|
if .error then "0" else
|
||||||
|
if .end then
|
||||||
|
if .end.sum_received then .end.sum_received.bits_per_second
|
||||||
|
elif .end.sum then .end.sum.bits_per_second
|
||||||
|
else "0" end
|
||||||
|
else "0" end
|
||||||
|
end'
|
||||||
|
}
|
||||||
|
|
||||||
|
echo " Running iperf3 tests..."
|
||||||
|
|
||||||
|
# Run them all. These are in bits per second, convert as needed later.
|
||||||
|
LocalTCPUp=$(run_iperf "$IPERF_LOCAL_TARGET" tcp up)
|
||||||
|
LocalTCPDown=$(run_iperf "$IPERF_LOCAL_TARGET" tcp down)
|
||||||
|
LocalUDPUp=$(run_iperf "$IPERF_LOCAL_TARGET" udp up)
|
||||||
|
LocalUDPDown=$(run_iperf "$IPERF_LOCAL_TARGET" udp down)
|
||||||
|
|
||||||
|
RemoteTCPUp=$(run_iperf "$IPERF_REMOTE_TARGET" tcp up)
|
||||||
|
RemoteTCPDown=$(run_iperf "$IPERF_REMOTE_TARGET" tcp down)
|
||||||
|
RemoteUDPUp=$(run_iperf "$IPERF_REMOTE_TARGET" udp up)
|
||||||
|
RemoteUDPDown=$(run_iperf "$IPERF_REMOTE_TARGET" udp down)
|
||||||
|
|
||||||
END_TIME=$(date -Iseconds)
|
END_TIME=$(date -Iseconds)
|
||||||
|
|
||||||
# Log everything
|
# Log everything
|
||||||
echo "$START_TIME,$END_TIME,$link_level_noise,$bssid_and_bitrate,$speed_results,$FAILED_DELTA,$channel,$freq,$packet_loss,$jitter" >> "$TEST_FILE"
|
echo "$START_TIME,$END_TIME,$link_level_noise,$bssid_and_bitrate,$speed_results,$FAILED_DELTA,$channel,$freq,$packet_loss,$jitter,$LocalTCPUp,$LocalTCPDown,$LocalUDPUp,$LocalUDPDown,$RemoteTCPUp,$RemoteTCPDown,$RemoteUDPUp,$RemoteUDPDown" >> "$TEST_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$COUNTER" -lt "$NUM_TESTS" ]; then
|
if [ "$COUNTER" -lt "$NUM_TESTS" ]; then
|
||||||
|
|
|
@ -17,4 +17,8 @@ PING_TARGET=1.1.1.1
|
||||||
MAX_RETRIES=5
|
MAX_RETRIES=5
|
||||||
RETRY_DELAY=10 # seconds
|
RETRY_DELAY=10 # seconds
|
||||||
|
|
||||||
|
IPERF_LOCAL_TARGET=
|
||||||
|
IPERF_REMOTE_TARGET=
|
||||||
|
IPERF_DURATION=10
|
||||||
|
|
||||||
RECIPIENT=
|
RECIPIENT=
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue