From 831cb7af961b5dc6ab2a44eb86b9f54d04170df7 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 9 Oct 2014 01:23:21 +0300 Subject: [PATCH] tests: Extend DFS testing to include channel switch Simulate a radar detection event to verify that hostapd switches channels properly and the station follows the AP to the new channel. Signed-off-by: Jouni Malinen --- tests/hwsim/test_dfs.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/hwsim/test_dfs.py b/tests/hwsim/test_dfs.py index f929d4545..7bb2872a5 100644 --- a/tests/hwsim/test_dfs.py +++ b/tests/hwsim/test_dfs.py @@ -83,6 +83,27 @@ def test_dfs(dev, apdev): raise Exception("Unexpected frequency") dev[0].connect("dfs", key_mgmt="NONE") + hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) + + hapd.request("RADAR DETECTED freq=5260 ht_enabled=1 chan_width=1") + ev = hapd.wait_event(["DFS-RADAR-DETECTED"], timeout=10) + if ev is None: + raise Exception("DFS-RADAR-DETECTED event not reported") + if "freq=5260" not in ev: + raise Exception("Incorrect frequency in radar detected event: " + ev); + ev = hapd.wait_event(["DFS-NEW-CHANNEL"], timeout=70) + if ev is None: + raise Exception("DFS-NEW-CHANNEL event not reported") + if "freq=5260" in ev: + raise Exception("Channel did not change after radar was detected"); + + ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=70) + if ev is None: + raise Exception("AP-CSA-FINISHED event not reported") + if "freq=5260" in ev: + raise Exception("Channel did not change after radar was detected(2)"); + time.sleep(1) + hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) finally: subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])