diff mbox series

[2/2] tests: multi AP extend tests

Message ID 20201013101627.17868-2-janusz.dziedzic@gmail.com
State Accepted
Headers show
Series [1/2] tests: multi_ap pass params_backhaul | expand

Commit Message

Janusz Dziedzic Oct. 13, 2020, 10:16 a.m. UTC
Add option to:
 - add new AP on the same phy that bhaul-sta using
 - run CSA from the parent

Adding new AP (bhaul/fhaul) on the same
phy we have for bhaul-sta is closer to
the real repeater implementation.

Add test case for that and run CSA.

This is common problem when we have on the same phy:
 - connected bhaul STA
 - we started fhaul/bhaul AP
 - we receive (from parent) CSA on sta interface

This is multi_ap_wps_shared_apdev_csa test case,
which fail today - even with hwsim.

This also fail with ath9k.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
---
 tests/hwsim/test_multi_ap.py | 56 ++++++++++++++++++++++++++++++++++--
 1 file changed, 54 insertions(+), 2 deletions(-)

Comments

Jouni Malinen Feb. 6, 2021, 4:07 p.m. UTC | #1
On Tue, Oct 13, 2020 at 12:16:27PM +0200, Janusz Dziedzic wrote:
> Add option to:
>  - add new AP on the same phy that bhaul-sta using
>  - run CSA from the parent
> 
> Adding new AP (bhaul/fhaul) on the same
> phy we have for bhaul-sta is closer to
> the real repeater implementation.
> 
> Add test case for that and run CSA.
> 
> This is common problem when we have on the same phy:
>  - connected bhaul STA
>  - we started fhaul/bhaul AP
>  - we receive (from parent) CSA on sta interface
> 
> This is multi_ap_wps_shared_apdev_csa test case,
> which fail today - even with hwsim.

Thanks, both patches applied. However, I do not want to add test cases
that are known to fail always, so I modified
multi_ap_wps_shared_apdev_csa to ignore the error for now until the
issue has been addressed.
diff mbox series

Patch

diff --git a/tests/hwsim/test_multi_ap.py b/tests/hwsim/test_multi_ap.py
index 4e32b8cfd..73a60af39 100644
--- a/tests/hwsim/test_multi_ap.py
+++ b/tests/hwsim/test_multi_ap.py
@@ -63,8 +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):
-    """Helper for running Multi-AP WPS tests
+def run_multi_ap_wps(dev, apdev, params, params_backhaul=None, add_apdev=False, run_csa=False):
+    """Help/er for running Multi-AP WPS tests
 
     dev[0] does multi_ap WPS, dev[1] does normal WPS. apdev[0] is the fronthaul
     BSS. If there is a separate backhaul BSS, it must have been set up by the
@@ -72,6 +72,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 +136,36 @@  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"], timeout=5)
+            if not ev:
+                raise Exception("sta - no chanswitch 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 +176,26 @@  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})
+    run_multi_ap_wps(dev, apdev, params, add_apdev=True, run_csa=True)
+
 def test_multi_ap_wps_shared_psk(dev, apdev):
     """WPS on shared fronthaul/backhaul AP using PSK"""
     ssid = "multi-ap-wps"