From efd6030833b056507ac3b10462008338b21ce0d5 Mon Sep 17 00:00:00 2001 From: Houssem Dafdouf Date: Mon, 11 May 2026 14:29:50 +0200 Subject: [PATCH] ci: cram: pwhm: update pwhm test with FEAT-389 requirements FEAT-389 requires that link removal or addition must not trigger interface reconfiguration. This test update verifies that no interface reconfiguration occurs by checking the ifindex value from the iw output. References: FEAT-389,PPM-3772 Signed-off-by: Houssem Dafdouf --- .gitlab/tests/cram/scripts/wifi.sh | 56 +++++++ .../tests/cram/wnc-freedom/100-pwhm_step_1.t | 146 +++++++++++++++-- .../tests/cram/wnc-freedom/100-pwhm_step_2.t | 152 ++++++++++++++++-- 3 files changed, 333 insertions(+), 21 deletions(-) diff --git a/.gitlab/tests/cram/scripts/wifi.sh b/.gitlab/tests/cram/scripts/wifi.sh index 66ec6e82d6..04b7029c4a 100644 --- a/.gitlab/tests/cram/scripts/wifi.sh +++ b/.gitlab/tests/cram/scripts/wifi.sh @@ -399,6 +399,62 @@ get_main_link_itf () { fi } +# print ifindex of a specific AP +# In : AP index +# Out : ifindex +get_ifindex () { + local ap_index=$1 + ifname=$(wifi_dm "AccessPoint.${ap_index}.SSIDReference+.Name?" | cut -d'"' -f2) + R logger -t cram "get_ifindex: AccessPoint ${1} / interface $ifname" + R "iw dev ${ifname} info" | grep ifindex | sed 's/^[ \t]*//' | cut -d ' ' -f2 +} + +# Print sorted list of hostapd sockets inodes and pathes +# In : no input +# Out : list of hostapd sockets inodes and paths +read_hostapd_inodes(){ + ilist=$(R "ls -li /var/run/hostapd/wlan* 2>/dev/null" | awk '{print $1, $NF}' | sort) + echo "$ilist" +} + +# print lines difference (diff command equivalent) +# In : old string, new string +# Out : lines differences with A:/R: prefix (Added/Removed) +compare_list() { + awk -v l1="$1" -v l2="$2" ' + function trim(s) { gsub(/^[ \t\r]+|[ \t\r]+$/, "", s); return s } + BEGIN { + n1 = split(l1, a, "\n") + n2 = split(l2, b, "\n") + + for (i=1; i<=n1; i++) if ((a[i]=trim(a[i])) != "") s1[a[i]] + for (i=1; i<=n2; i++) if ((b[i]=trim(b[i])) != "") s2[b[i]] + + for (i=1; i<=n1; i++) if (a[i] != "" && !(a[i] in s2)) print "R: " a[i] + for (i=1; i<=n2; i++) if (b[i] != "" && !(b[i] in s1)) print "A: " b[i] + }' +} + +# compare ifindex of specific AP +# In : AP index, old ifindex list +# Out : OK / error message +check_ifindexes () { + while [ "$#" -ge 2 ]; do + ap_index=$1 + tgt_ifindex=$2 + + current_ifindex=$(get_ifindex "${ap_index}") + + if [ "${current_ifindex}" = "${tgt_ifindex}" ]; then + echo "OK" + else + echo "AP${ap_index}: NOK (got ${current_ifindex}, expected ${tgt_ifindex})" + fi + + shift 2 + done +} + # print link number from iw output # In : APMLD index (ie MLDID) # Out : link number from iw output diff --git a/.gitlab/tests/cram/wnc-freedom/100-pwhm_step_1.t b/.gitlab/tests/cram/wnc-freedom/100-pwhm_step_1.t index f523d377db..3c60bd0a4e 100644 --- a/.gitlab/tests/cram/wnc-freedom/100-pwhm_step_1.t +++ b/.gitlab/tests/cram/wnc-freedom/100-pwhm_step_1.t @@ -59,7 +59,9 @@ Check that no hostapd instance is running: $ R "pgrep -f 'hostapd'" [1] -Test activation of access point 1: +##################################### +# Test activation of access point 1 # +##################################### $ R logger -t cram "Test AccessPoint 1 activation "$(get_ssid_ref 1)"" @@ -91,7 +93,24 @@ Save hostap pid: $ hostap_pid=$(R pgrep -f 'hostapd') $ R logger -t cram "hostap PID : $hostap_pid" -Test activation of access point 2: +Save all the current ifindexes and verify inodes (FEAT-389): + + $ ilist_old= + $ ilist_new=$(read_hostapd_inodes) + $ ifindexes=$(R "iw dev" | grep ifindex -B 1 | sed 's/^[[:space:]]*//') + + +This is a new MLD so two new sockets should be created: + + $ compare_list "$ilist_old" "$ilist_new" + A: .* /var/run/hostapd/wlan2.1 (re) + A: .* /var/run/hostapd/wlan2.1_link0 (re) + + $ ilist_old=$ilist_new + +##################################### +# Test activation of access point 2 # +##################################### $ R logger -t cram "Test AccessPoint 2 activation "$(get_ssid_ref 2)"" @@ -120,7 +139,21 @@ Check wpacltrl socket file: wlan2.2 wlan2.2_link0 -Test activation of access point 3: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +This is a new MLD so two new sockets should be created: + + $ compare_list "$ilist_old" "$ilist_new" + A: .* /var/run/hostapd/wlan2.2 (re) + A: .* /var/run/hostapd/wlan2.2_link0 (re) + + $ ilist_old=$ilist_new + +##################################### +# Test activation of access point 3 # +##################################### $ R logger -t cram "Test AccessPoint 3 activation "$(get_ssid_ref 3)"" @@ -150,7 +183,20 @@ Check wpacltrl socket file: wlan2.2 wlan2.2_link0 -Test activation of access point 4: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +This is a new link so one new socket should be created: + + $ compare_list "$ilist_old" "$ilist_new" + A: .* /var/run/hostapd/wlan2.1_link1 (re) + + $ ilist_old=$ilist_new + +##################################### +# Test activation of access point 4 # +##################################### $ R logger -t cram "Test AccessPoint 4 activation "$(get_ssid_ref 4)"" @@ -181,7 +227,20 @@ Check wpacltrl socket file: wlan2.2_link0 wlan2.2_link1 -Test activation of access point 5: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +This is a new link so one new socket should be created: + + $ compare_list "$ilist_old" "$ilist_new" + A: .* /var/run/hostapd/wlan2.2_link1 (re) + + $ ilist_old=$ilist_new + +##################################### +# Test activation of access point 5 # +##################################### $ R logger -t cram "Test AccessPoint 5 activation "$(get_ssid_ref 5)"" @@ -213,7 +272,20 @@ Check wpacltrl socket file: wlan2.2_link0 wlan2.2_link1 -Test activation of access point 6: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +This is a new link so one new socket should be created: + + $ compare_list "$ilist_old" "$ilist_new" + A: .* /var/run/hostapd/wlan2.1_link2 (re) + + $ ilist_old=$ilist_new + +##################################### +# Test activation of access point 6 # +##################################### $ R logger -t cram "Test AccessPoint 6 activation "$(get_ssid_ref 6)"" @@ -246,7 +318,20 @@ Check wpacltrl socket file: wlan2.2_link1 wlan2.2_link2 -Test activation of access point 7: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +This is a new link so one new socket should be created: + + $ compare_list "$ilist_old" "$ilist_new" + A: .* /var/run/hostapd/wlan2.2_link2 (re) + + $ ilist_old=$ilist_new + +##################################### +# Test activation of access point 7 # +##################################### $ R logger -t cram "Test AccessPoint 7 activation "$(get_ssid_ref 7)"" @@ -281,8 +366,21 @@ Check wpacltrl socket file: wlan2.3 wlan2.3_link0 +Check and save inodes (FEAT-389): -Test activation of access point 8: + $ ilist_new=$(read_hostapd_inodes) + +This is a new MLD so two new sockets should be created: + + $ compare_list "$ilist_old" "$ilist_new" + A: .* /var/run/hostapd/wlan2.3 (re) + A: .* /var/run/hostapd/wlan2.3_link0 (re) + + $ ilist_old=$ilist_new + +##################################### +# Test activation of access point 8 # +##################################### $ R logger -t cram "Test AccessPoint 8 activation "$(get_ssid_ref 8)"" @@ -318,7 +416,20 @@ Check wpacltrl socket file: wlan2.3_link0 wlan2.3_link1 -Test activation of access point 9: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +This is a new link so one new socket should be created: + + $ compare_list "$ilist_old" "$ilist_new" + A: .* /var/run/hostapd/wlan2.3_link1 (re) + + $ ilist_old=$ilist_new + +##################################### +# Test activation of access point 9 # +##################################### $ R logger -t cram "Test AccessPoint 9 activation "$(get_ssid_ref 9)"" @@ -355,9 +466,26 @@ Check wpacltrl socket file: wlan2.3_link1 wlan2.3_link2 +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +This is a new link so one new socket should be created: + + $ compare_list "$ilist_old" "$ilist_new" + A: .* /var/run/hostapd/wlan2.3_link2 (re) + + $ ilist_old=$ilist_new + +Check is any ifindex changed. grep only removed (ie changed) ifindexes (FEAT-389): + + $ ifidx_cur=$(R "iw dev" | grep ifindex -B 1 | sed 's/^[[:space:]]*//') + $ compare_list "$ifindexes" "$ifidx_cur" | grep 'R:' || true + $ sleep 5 Check if hostap pid has changed or not: $ if [ "$(R pgrep -f 'hostapd')" = "$hostap_pid" ]; then echo "true"; else echo "hostap restarted during the test !"; fi true + diff --git a/.gitlab/tests/cram/wnc-freedom/100-pwhm_step_2.t b/.gitlab/tests/cram/wnc-freedom/100-pwhm_step_2.t index e5a6c5b7b0..44ccdb9820 100644 --- a/.gitlab/tests/cram/wnc-freedom/100-pwhm_step_2.t +++ b/.gitlab/tests/cram/wnc-freedom/100-pwhm_step_2.t @@ -5,11 +5,16 @@ Create R alias: $ R "logger -t cram 'Starting PWHM test (step 2) ...'" -Save hostap pid: +Save hostap pid, it's needed as part of script split (PCF-2222): $ hostap_pid=$(R pgrep -f 'hostapd') $ R logger -t cram "hostap PID : $hostap_pid" +Save inodes (FEAT-389), it's needed as part of script split (PCF-2222) + + $ ilist_old=$(read_hostapd_inodes) + $ ifindexes=$(R "iw dev" | grep ifindex -B 1 | sed 's/^[[:space:]]*//') + Check that hostapd is operating as expected: $ R logger -t cram "Check that hostapd is operating" @@ -62,7 +67,9 @@ Check that the tree interfaces are present in the main link interface: link 2: channel.* (re) -Test deactivation of access point 9: +####################################### +# Test deactivation of access point 9 # +####################################### $ enable_ap_sync 9 0 AccessPoint.9.Enable=0 @@ -96,7 +103,20 @@ Check wpacltrl socket file: wlan2.3_link0 wlan2.3_link1 -Test deactivation of access point 8: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +One link was removed, so there should be one less socket: + + $ compare_list "$ilist_old" "$ilist_new" + R: .* /var/run/hostapd/wlan2.3_link2 (re) + + $ ilist_old=$ilist_new + +####################################### +# Test deactivation of access point 8 # +####################################### $ R logger -t cram "Test AccessPoint 8 deactivation "$(get_ssid_ref 8)"" @@ -131,7 +151,20 @@ Check wpacltrl socket file: wlan2.3 wlan2.3_link0 -Test deactivation of access point 7: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +One link was removed, so there should be one less socket: + + $ compare_list "$ilist_old" "$ilist_new" + R: .* /var/run/hostapd/wlan2.3_link1 (re) + + $ ilist_old=$ilist_new + +####################################### +# Test deactivation of access point 7 # +####################################### $ R logger -t cram "Test AccessPoint 7 deactivation "$(get_ssid_ref 7)"" @@ -164,7 +197,21 @@ Check wpacltrl socket file: wlan2.2_link1 wlan2.2_link2 -Test deactivation of access point 6: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +The MLD was disabled, so there should be two less socket: + + $ compare_list "$ilist_old" "$ilist_new" + R: .* /var/run/hostapd/wlan2.3 (re) + R: .* /var/run/hostapd/wlan2.3_link0 (re) + + $ ilist_old=$ilist_new + +####################################### +# Test deactivation of access point 6 # +####################################### $ enable_ap_sync 6 0 AccessPoint.6.Enable=0 @@ -194,7 +241,20 @@ Check wpacltrl socket file: wlan2.2_link0 wlan2.2_link1 -Test deactivation of access point 5: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +One link was removed, so there should be one less socket: + + $ compare_list "$ilist_old" "$ilist_new" + R: .* /var/run/hostapd/wlan2.2_link2 (re) + + $ ilist_old=$ilist_new + +####################################### +# Test deactivation of access point 5 # +####################################### $ R logger -t cram "Test AccessPoint 5 deactivation "$(get_ssid_ref 5)"" @@ -225,7 +285,20 @@ Check wpacltrl socket file: wlan2.2_link0 wlan2.2_link1 -Test deactivation of access point 4: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +One link was removed, so there should be one less socket: + + $ compare_list "$ilist_old" "$ilist_new" + R: .* /var/run/hostapd/wlan2.1_link2 (re) + + $ ilist_old=$ilist_new + +####################################### +# Test deactivation of access point 4 # +####################################### $ R logger -t cram "Test AccessPoint 4 deactivation "$(get_ssid_ref 4)"" @@ -255,7 +328,20 @@ Check wpacltrl socket file: wlan2.2 wlan2.2_link0 -Test deactivation of access point 3: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +One link was removed, so there should be one less socket: + + $ compare_list "$ilist_old" "$ilist_new" + R: .* /var/run/hostapd/wlan2.2_link1 (re) + + $ ilist_old=$ilist_new + +####################################### +# Test deactivation of access point 3 # +####################################### $ R logger -t cram "Test AccessPoint 3 deactivation "$(get_ssid_ref 3)"" @@ -284,7 +370,20 @@ Check wpacltrl socket file: wlan2.2 wlan2.2_link0 -Test deactivation of access point 2: +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +One link was removed, so there should be one less socket: + + $ compare_list "$ilist_old" "$ilist_new" + R: .* /var/run/hostapd/wlan2.1_link1 (re) + + $ ilist_old=$ilist_new + +####################################### +# Test deactivation of access point 2 # +####################################### $ enable_ap_sync 2 0 AccessPoint.2.Enable=0 @@ -309,12 +408,26 @@ Check wpacltrl socket file: wlan2.1 wlan2.1_link0 +Check and save inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +The MLD was disabled, so there should be two less socket: + + $ compare_list "$ilist_old" "$ilist_new" + R: .* /var/run/hostapd/wlan2.2 (re) + R: .* /var/run/hostapd/wlan2.2_link0 (re) + + $ ilist_old=$ilist_new + Before deactivating last AP (ie stopping hostpad), check if hostap pid has changed or not: $ if [ "$(R pgrep -f 'hostapd')" = "$hostap_pid" ]; then echo "true"; else echo "hostap restarted during the test !"; fi true -Test deactivation of access point 1: +####################################### +# Test deactivation of access point 1 # +####################################### $ R logger -t cram "Test AccessPoint 1 deactivation "$(get_ssid_ref 1)"" @@ -340,6 +453,21 @@ Check wpacltrl socket file: $ ls_hapd_sockets ls: /var/run/hostapd/: No such file or directory +Check inodes (FEAT-389): + + $ ilist_new=$(read_hostapd_inodes) + +The MLD was disabled, so there should be two less socket so all sockets are now closed: + + $ compare_list "$ilist_old" "$ilist_new" + R: .* /var/run/hostapd/wlan2.1 (re) + R: .* /var/run/hostapd/wlan2.1_link0 (re) + +Check is any ifindex changed (FEAT-389): + + $ ifidx_cur=$(R "iw dev" | grep ifindex -B 1 | sed 's/^[[:space:]]*//') + $ compare_list "$ifindexes" "$ifidx_cur" + Check if hostapd process is stopped: $ R "pgrep -f 'hostapd'" @@ -347,8 +475,8 @@ Check if hostapd process is stopped: Resume prplMesh: - $ R "ba-cli -l X_PRPLWARE-COM_ProcessManager.PrplMesh.Enable=1" | tr -d '\n' - 1 (no-eol) +$ R "ba-cli -l X_PRPLWARE-COM_ProcessManager.PrplMesh.Enable=1" | tr -d '\n' +1 (no-eol) $ R logger -t cram "Stopping PWHM test .."