From 0f8994b11d3bdf104a54cb08b5a61484b9e36057 Mon Sep 17 00:00:00 2001 From: Janusz Dziedzic Date: Tue, 13 Oct 2020 12:16:27 +0200 Subject: [PATCH] tests: Extend Multi AP tests Add option to: - add a new AP on the same phy that the backhaul-sta uses - run CSA from the parent Adding a new AP (backhaul/fronthaul) on the same phy we have for backhaul-sta is closer to the real repeater implementation. Add a test case for that and run CSA. This is a common problem when we have on the same phy: - connected backhaul STA - we started fronthaul/backhaul AP - we receive (from parent) CSA on the STA interface This is multi_ap_wps_shared_apdev_csa test case, which fails today with both mac80211_hwsim and ath9k. To avoid always failing test cases, ignore this failure for now. Full validation can be enabled once the issue behind this is fixed. Signed-off-by: Janusz Dziedzic --- tests/hwsim/test_multi_ap.py | 65 +++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_multi_ap.py b/tests/hwsim/test_multi_ap.py index 4e32b8cfd..4965d87de 100644 --- a/tests/hwsim/test_multi_ap.py +++ b/tests/hwsim/test_multi_ap.py @@ -63,7 +63,8 @@ def test_multi_ap_fronthaul_on_ap(dev, apdev): if "CTRL-EVENT-DISCONNECTED" not in ev: raise Exception("Unexpected connection result") -def run_multi_ap_wps(dev, apdev, params, params_backhaul=None): +def run_multi_ap_wps(dev, apdev, params, params_backhaul=None, add_apdev=False, + run_csa=False, allow_csa_fail=False): """Helper for running Multi-AP WPS tests dev[0] does multi_ap WPS, dev[1] does normal WPS. apdev[0] is the fronthaul @@ -72,6 +73,8 @@ def run_multi_ap_wps(dev, apdev, params, params_backhaul=None): the WPS parameters. multi_ap_bssid must be given if it is not equal to the fronthaul BSSID.""" + wpas_apdev = None + if params_backhaul: hapd_backhaul = hostapd.add_ap(apdev[1], params_backhaul) multi_ap_bssid = hapd_backhaul.own_addr() @@ -134,6 +137,42 @@ def run_multi_ap_wps(dev, apdev, params, params_backhaul=None): if len(dev[1].list_networks()) != 1: raise Exception("Unexpected number of network blocks") + try: + # Add apdev to the same phy that dev[0] + if add_apdev: + wpas_apdev = {} + wpas_apdev['ifname'] = dev[0].ifname + "_ap" + status, buf = dev[0].cmd_execute(['iw', dev[0].ifname, + 'interface', 'add', + wpas_apdev['ifname'], + 'type', 'managed']) + if status != 0: + raise Exception("iw interface add failed") + wpas_hapd = hostapd.add_ap(wpas_apdev, params) + + if run_csa: + if 'OK' not in hapd.request("CHAN_SWITCH 5 2462 ht"): + raise Exception("chan switch request failed") + + ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=5) + if not ev: + raise Exception("chan switch failed") + + # now check station + ev = dev[0].wait_event(["CTRL-EVENT-CHANNEL-SWITCH", + "CTRL-EVENT-DISCONNECTED"], timeout=5) + if not ev: + raise Exception("sta - no chanswitch event") + if "CTRL-EVENT-CHANNEL-SWITCH" not in ev and not allow_csa_fail: + raise Exception("Received disconnection event instead of channel switch event") + + if add_apdev: + dev[0].cmd_execute(['iw', wpas_apdev['ifname'], 'del']) + except: + if wpas_apdev: + dev[0].cmd_execute(['iw', wpas_apdev['ifname'], 'del']) + raise + def test_multi_ap_wps_shared(dev, apdev): """WPS on shared fronthaul/backhaul AP""" ssid = "multi-ap-wps" @@ -144,6 +183,30 @@ def test_multi_ap_wps_shared(dev, apdev): "multi_ap_backhaul_wpa_passphrase": passphrase}) run_multi_ap_wps(dev, apdev, params) +def test_multi_ap_wps_shared_csa(dev, apdev): + """WPS on shared fronthaul/backhaul AP, run CSA""" + ssid = "multi-ap-wps-csa" + passphrase = "12345678" + params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase) + params.update({"multi_ap": "3", + "multi_ap_backhaul_ssid": '"%s"' % ssid, + "multi_ap_backhaul_wpa_passphrase": passphrase}) + run_multi_ap_wps(dev, apdev, params, run_csa=True) + +def test_multi_ap_wps_shared_apdev_csa(dev, apdev): + """WPS on shared fronthaul/backhaul AP add apdev on same phy and run CSA""" + ssid = "multi-ap-wps-apdev-csa" + passphrase = "12345678" + params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase) + params.update({"multi_ap": "3", + "multi_ap_backhaul_ssid": '"%s"' % ssid, + "multi_ap_backhaul_wpa_passphrase": passphrase}) + # This case is currently failing toc omplete CSA on the station interface. + # For the time being, ignore that to avoid always failing tests. Full + # validation can be enabled once the issue behind this is fixed. + run_multi_ap_wps(dev, apdev, params, add_apdev=True, run_csa=True, + allow_csa_fail=True) + def test_multi_ap_wps_shared_psk(dev, apdev): """WPS on shared fronthaul/backhaul AP using PSK""" ssid = "multi-ap-wps"