Browse Source

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 <j@w1.fi>
Jouni Malinen 10 years ago
parent
commit
70d29ec946
1 changed files with 30 additions and 0 deletions
  1. 30 0
      tests/hwsim/test_wpas_ctrl.py

+ 30 - 0
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-"""