From 5d9fa5ead26b1eba431f56cbf29aaa77201ec60f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 10 Mar 2017 18:59:12 +0200 Subject: [PATCH] tests: MBO ANQP Signed-off-by: Jouni Malinen --- tests/hwsim/test_mbo.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/hwsim/test_mbo.py b/tests/hwsim/test_mbo.py index b31054a67..6fcc3c210 100644 --- a/tests/hwsim/test_mbo.py +++ b/tests/hwsim/test_mbo.py @@ -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)