From 70d29ec946b9a811be98b1c66a8f824f40cacc3b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 12 Dec 2014 21:09:32 +0200 Subject: [PATCH] tests: Extend RRM neighbor request testing This uses a new testing mode in hostapd to allow RRM neighbor request transmittion to be tested. For the second part of the test case to be executed, mac80211_hwsim needs to be modified to claim support for the required RRM capabilities (that change is not yet in Linux kernel). Signed-off-by: Jouni Malinen --- tests/hwsim/test_wpas_ctrl.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py index 6a6bcd968..a70a3fe08 100644 --- a/tests/hwsim/test_wpas_ctrl.py +++ b/tests/hwsim/test_wpas_ctrl.py @@ -1099,11 +1099,41 @@ def test_wpas_ctrl_neighbor_rep_req(dev, apdev): """wpa_supplicant ctrl_iface NEIGHBOR_REP_REQUEST""" params = { "ssid": "test" } hostapd.add_ap(apdev[0]['ifname'], params) + params = { "ssid": "test2", "radio_measurements": "1" } + hostapd.add_ap(apdev[1]['ifname'], params) + dev[0].connect("test", key_mgmt="NONE", scan_freq="2412") if "FAIL" not in dev[0].request("NEIGHBOR_REP_REQUEST"): raise Exception("Request succeeded unexpectedly") if "FAIL" not in dev[0].request("NEIGHBOR_REP_REQUEST ssid=abcdef"): raise Exception("Request succeeded unexpectedly") + dev[0].request("DISCONNECT") + + rrm = int(dev[0].get_driver_status_field("capa.rrm_flags"), 16) + if rrm & 0x5 != 0x5: + logger.info("Driver does not support required RRM capabilities - skip rest of the test case") + return + + dev[0].connect("test2", key_mgmt="NONE", scan_freq="2412") + + # These requests are expected to get sent properly, but since hostapd does + # not yet support processing of the request, these are expected to fail. + + if "OK" not in dev[0].request("NEIGHBOR_REP_REQUEST"): + raise Exception("Request failed") + ev = dev[0].wait_event([ "RRM-NEIGHBOR-REP-RECEIVED", + "RRM-NEIGHBOR-REP-REQUEST-FAILED" ], timeout=10) + if ev is None: + raise Exception("RRM report result not indicated") + logger.info("RRM result: " + ev) + + if "OK" not in dev[0].request("NEIGHBOR_REP_REQUEST ssid=abcdef"): + raise Exception("Request failed") + ev = dev[0].wait_event([ "RRM-NEIGHBOR-REP-RECEIVED", + "RRM-NEIGHBOR-REP-REQUEST-FAILED" ], timeout=10) + if ev is None: + raise Exception("RRM report result not indicated") + logger.info("RRM result: " + ev) def test_wpas_ctrl_rsp(dev, apdev): """wpa_supplicant ctrl_iface CTRL-RSP-"""