]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: MBO ANQP
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 10 Mar 2017 16:59:12 +0000 (18:59 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 10 Mar 2017 16:59:12 +0000 (18:59 +0200)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/test_mbo.py

index b31054a676f980cbe3645fe22dd779b161c72a72..6fcc3c210af738b24b7c409579df29e14e801afb 100644 (file)
@@ -468,3 +468,42 @@ def test_mbo_without_pmf(dev, apdev):
             pass
         else:
             raise
+
+def check_mbo_anqp(dev, bssid, cell_data_conn_pref):
+    if "OK" not in dev.request("ANQP_GET " + bssid + " 272,mbo:2"):
+        raise Exception("ANQP_GET command failed")
+
+    ev = dev.wait_event(["GAS-QUERY-START"], timeout=5)
+    if ev is None:
+        raise Exception("GAS query start timed out")
+
+    ev = dev.wait_event(["GAS-QUERY-DONE"], timeout=10)
+    if ev is None:
+        raise Exception("GAS query timed out")
+
+    if cell_data_conn_pref is not None:
+        ev = dev.wait_event(["RX-MBO-ANQP"], timeout=1)
+        if ev is None or "cell_conn_pref" not in ev:
+            raise Exception("Did not receive MBO Cellular Data Connection Preference")
+        if cell_data_conn_pref != int(ev.split('=')[1]):
+            raise Exception("Unexpected cell_conn_pref value: " + ev)
+
+    dev.dump_monitor()
+
+def test_mbo_anqp(dev, apdev):
+    """MBO ANQP"""
+    params = { 'ssid': "test-wnm-mbo",
+               'mbo': '1',
+               'interworking': '1',
+               'mbo_cell_data_conn_pref': '1' }
+    hapd = hostapd.add_ap(apdev[0], params)
+    bssid = hapd.own_addr()
+
+    dev[0].scan_for_bss(bssid, freq="2412", force_scan=True)
+    check_mbo_anqp(dev[0], bssid, 1)
+
+    hapd.set('mbo_cell_data_conn_pref', '255')
+    check_mbo_anqp(dev[0], bssid, 255)
+
+    hapd.set('mbo_cell_data_conn_pref', '-1')
+    check_mbo_anqp(dev[0], bssid, None)