[PATCH 2/2] tests: hwsim: add dfs_chan_switch_precac
Janusz Dziedzic
janusz.dziedzic at gmail.com
Sat Oct 3 08:00:13 EDT 2020
Add test case that will check preCAC,
which is available for EU regulatory
domain.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic at gmail.com>
---
tests/hwsim/test_dfs.py | 49 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/tests/hwsim/test_dfs.py b/tests/hwsim/test_dfs.py
index 3efe6bb2d..8708125d1 100644
--- a/tests/hwsim/test_dfs.py
+++ b/tests/hwsim/test_dfs.py
@@ -652,3 +652,52 @@ def test_dfs_chan_switch(dev, apdev):
hwsim_utils.test_connectivity(dev[0], hapd)
finally:
clear_regdom(hapd, dev)
+
+ at long_duration_test
+def test_dfs_chan_switch_precac(dev, apdev):
+ """DFS channel switch pre CAC"""
+ try:
+ hapd = None
+
+ # Toggle regulatory - clean all preCAC
+ hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', "US"])
+
+ hapd = start_dfs_ap(apdev[0], country="PL")
+
+ ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70)
+ if "success=1" not in ev:
+ raise Exception("CAC failed")
+ if "freq=5260" not in ev:
+ raise Exception("Unexpected DFS freq result")
+ ev = hapd.wait_event(["AP-ENABLED"], timeout=5)
+ if not ev:
+ raise Exception("AP setup timed out")
+ freq = hapd.get_status_field("freq")
+ if freq != "5260":
+ raise Exception("Unexpected frequency")
+
+ # TODO add/connect station here
+ # Today skip this step while dev[0].connect()
+ # for some reason toggle regulatory to US
+ # and clean preCAC
+
+ # Back to non DFS channel
+ if "OK" not in hapd.request("CHAN_SWITCH 5 5180 ht"):
+ raise Exception("CHAN_SWITCH 5180 failed")
+
+ ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=5)
+ if not ev:
+ raise Exception("No CSA finished event - 5180")
+ freq = hapd.get_status_field("freq")
+ if freq != "5180":
+ raise Exception("Unexpected frequency")
+
+ # Back again to DFS channel (CAC passed)
+ if "OK" not in hapd.request("CHAN_SWITCH 5 5260 ht"):
+ raise Exception("CHAN_SWITCH 5260 failed")
+
+ ev = wait_dfs_event(hapd, "AP-CSA-FINISHED", 5)
+ if not ev:
+ raise Exception("No CSA finished event - 5260")
+ finally:
+ clear_regdom(hapd, dev)
--
2.17.1
More information about the Hostap
mailing list