[PATCH 1/2] tests: Active beacon req for primary/center channel

Baligh Gasmi gasmibal at gmail.com
Mon Feb 28 12:55:23 PST 2022


Add tests for active beacon request to scan a specific VHT
channel, either using primary channel or a center freq channel
numbers.

Signed-off-by: Baligh Gasmi <gasmibal at gmail.com>
---
 tests/hwsim/test_rrm.py | 82 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/tests/hwsim/test_rrm.py b/tests/hwsim/test_rrm.py
index 5a65a506e..e62565984 100644
--- a/tests/hwsim/test_rrm.py
+++ b/tests/hwsim/test_rrm.py
@@ -1795,6 +1795,88 @@ def test_rrm_beacon_req_passive_scan_vht160(dev, apdev):
     finally:
         clear_regdom(hapd, dev)
 
+def test_rrm_beacon_req_active_scan_pri_channel(dev, apdev):
+    """Beacon request - primary channel active scan mode - VHT80"""
+    clear_scan_cache(apdev[0])
+    try:
+        hapd = None
+        params = {"ssid": "rrm-vht",
+                  "country_code": "FR",
+                  'ieee80211d': '0',
+                  "hw_mode": "a",
+                  "channel": "36",
+                  "ht_capab": "[HT40+]",
+                  "ieee80211n": "1",
+                  "ieee80211ac": "1",
+                  "vht_oper_chwidth": "1",
+                  "vht_oper_centr_freq_seg0_idx": "42",
+                  "rrm_beacon_report": "1"}
+
+        hapd = hostapd.add_ap(apdev[0], params)
+
+        dev[0].scan_for_bss(apdev[0]['bssid'], freq=5180)
+        dev[0].connect("rrm-vht", key_mgmt="NONE", scan_freq="5180")
+        dev[0].request("LEVEL debug")
+        dev[0].request("LOG_LEVEL MSGDUMP")
+
+        sig = dev[0].request("SIGNAL_POLL").splitlines()
+        addr = dev[0].own_addr()
+        token = run_req_beacon(hapd, addr, "80240000040001ffffffffffff")
+        ev = hapd.wait_event(["BEACON-RESP-RX"], timeout=10)
+        if ev is None:
+            raise Exception("Beacon report response not received")
+        fields = ev.split(' ')
+        if not fields[4]:
+            raise Exception("Beacon report is empty")
+        report = BeaconReport(binascii.unhexlify(fields[4]))
+        logger.info("Received beacon report: " + str(report))
+        if report.opclass != 128:
+            raise Exception("Incorrect opclass for AP")
+    except Exception as e:
+        raise
+    finally:
+        clear_regdom(hapd, dev)
+
+def test_rrm_beacon_req_active_scan_center_freq_channel(dev, apdev):
+    """Beacon request - center channel active scan mode - VHT80"""
+    clear_scan_cache(apdev[0])
+    try:
+        hapd = None
+        params = {"ssid": "rrm-vht",
+                  "country_code": "FR",
+                  'ieee80211d': '0',
+                  "hw_mode": "a",
+                  "channel": "36",
+                  "ht_capab": "[HT40+]",
+                  "ieee80211n": "1",
+                  "ieee80211ac": "1",
+                  "vht_oper_chwidth": "1",
+                  "vht_oper_centr_freq_seg0_idx": "42",
+                  "rrm_beacon_report": "1"}
+
+        hapd = hostapd.add_ap(apdev[0], params)
+
+        dev[0].scan_for_bss(apdev[0]['bssid'], freq=5180)
+        dev[0].connect("rrm-vht", key_mgmt="NONE", scan_freq="5180")
+        sig = dev[0].request("SIGNAL_POLL").splitlines()
+        addr = dev[0].own_addr()
+        token = run_req_beacon(hapd, addr, "802a0000040001ffffffffffff")
+        ev = hapd.wait_event(["BEACON-RESP-RX"], timeout=10)
+        if ev is None:
+            raise Exception("Beacon report response not received")
+        fields = ev.split(' ')
+        if not fields[4]:
+            raise Exception("Empty beacon report")
+        report = BeaconReport(binascii.unhexlify(fields[4]))
+        logger.info("Received beacon report: " + str(report))
+        if report.opclass != 128:
+            raise Exception("Incorrect opclass for AP")
+    except Exception as e:
+        raise
+    finally:
+        clear_regdom(hapd, dev)
+
+
 def test_rrm_beacon_req_ap_errors(dev, apdev):
     """Beacon request - AP error cases"""
     try:
-- 
2.35.1




More information about the Hostap mailing list