[PATCH RFC 3/3] tests: Add MLO case for AP VLAN tests
Muna Sinada
quic_msinada at quicinc.com
Mon Dec 23 16:49:49 PST 2024
Add test case for MLO + AP VLAN which brings up an EHT MLD AP with
Dynamic VLAN configurations and successfully create VLANs for the
connected non-AP MLD and a non-ML STA.
Signed-off-by: Muna Sinada <quic_msinada at quicinc.com>
---
tests/hwsim/hostapd.py | 6 +++-
tests/hwsim/test_ap_vlan.py | 57 +++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index 1ffc96e7d4de..e1b36ac8a083 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -990,7 +990,7 @@ def send_file(apdev, src, dst):
hapd_global = HostapdGlobal(apdev)
return hapd_global.send_file(src, dst)
-def acl_file(dev, apdev, conf):
+def acl_file(dev, apdev, conf, mld_addr1=None):
fd, filename = tempfile.mkstemp(dir='/tmp', prefix=conf + '-')
f = os.fdopen(fd, 'w')
@@ -1008,6 +1008,10 @@ def acl_file(dev, apdev, conf):
mac1 = dev[1].get_status_field("address")
f.write(mac0 + " 1\n")
f.write(mac1 + " 2\n")
+
+ if mld_addr1:
+ mac2 = mld_addr1
+ f.write(mac2 + " 3\n")
elif conf == 'hostapd.accept2':
mac0 = dev[0].get_status_field("address")
mac1 = dev[1].get_status_field("address")
diff --git a/tests/hwsim/test_ap_vlan.py b/tests/hwsim/test_ap_vlan.py
index 76c3ce93b9b3..312936e11efb 100644
--- a/tests/hwsim/test_ap_vlan.py
+++ b/tests/hwsim/test_ap_vlan.py
@@ -23,6 +23,9 @@ import hostapd
from utils import *
import os
from tshark import run_tshark
+from hwsim import HWSimRadio
+from wpasupplicant import WpaSupplicant
+from test_eht import eht_mld_enable_ap, eht_verify_status, eht_verify_wifi_version, eht_mld_ap_wpa2_params, traffic_test
def test_ap_vlan_open(dev, apdev):
"""AP VLAN with open network"""
@@ -873,3 +876,57 @@ def test_ap_vlan_sae_group_rekey(dev, apdev, params):
time.sleep(1)
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
+
+def test_mld_ap_vlan_acl_file(dev, apdev):
+ """MLD AP VLAN Test"""
+ with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+ HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+
+ wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+ wpas.interface_add(wpas_iface)
+
+ sta_mld_mac = wpas.get_addr()
+ filename = hostapd.acl_file(dev, apdev, 'hostapd.accept', sta_mld_mac)
+ hostapd.send_file(apdev[0], filename, filename)
+
+ ssid = "test-mlo-vlan"
+ passphrase = '12345678'
+
+ params = eht_mld_ap_wpa2_params(ssid, passphrase,
+ key_mgmt="SAE", mfp="2", pwe='1')
+
+ params['dynamic_vlan'] = "1"
+ params['accept_mac_file'] = filename
+
+ hapd0 = eht_mld_enable_ap(hapd_iface, 0, params)
+
+ params['channel'] = '6'
+ hapd1 = eht_mld_enable_ap(hapd_iface, 1, params)
+
+ wpas.set("sae_pwe", "1")
+ wpas.connect(ssid, sae_password=passphrase, scan_freq="2412 2437",
+ key_mgmt="SAE", ieee80211w="2")
+
+ dev[0].set("sae_pwe", "1")
+ dev[0].connect(ssid, sae_password=passphrase, scan_freq="2412",
+ key_mgmt="SAE", ieee80211w="2")
+ hapd0.wait_sta()
+ hapd0.wait_sta()
+ eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True,
+ valid_links=3, active_links=3)
+ eht_verify_wifi_version(wpas)
+
+ traffic_test(wpas, hapd0, ifname2="brvlan3")
+ traffic_test(wpas, hapd1, ifname2="brvlan3")
+ hwsim_utils.test_connectivity_iface(dev[0], hapd0, "brvlan1")
+
+ sta = hapd0.get_sta(wpas.own_addr())
+ if not (sta and "vlan_id" in sta):
+ raise Exception("VLAN information not in non-AP MLD output")
+
+ sta = hapd0.get_sta(dev[0].own_addr())
+ if not (sta and "vlan_id" in sta):
+ raise Exception("VLAN information not in non-ML STA output")
+
+ if filename.startswith('/tmp/'):
+ os.unlink(filename)
--
2.34.1
More information about the Hostap
mailing list