[PATCH 4/5] hwsim tests: Add test cases for AP channel switch announcement

Ilan Peer ilan.peer
Wed Jan 1 05:32:12 PST 2014


From: Luciano Coelho <luciano.coelho at intel.com>

Signed-hostap: Luciano Coelho <luciano.coelho at intel.com>
---
 tests/hwsim/test_ap_csa.py |   85 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 tests/hwsim/test_ap_csa.py

diff --git a/tests/hwsim/test_ap_csa.py b/tests/hwsim/test_ap_csa.py
new file mode 100644
index 0000000..9b2feb0
--- /dev/null
+++ b/tests/hwsim/test_ap_csa.py
@@ -0,0 +1,85 @@
+#!/usr/bin/python
+#
+# AP CSA  tests
+# Copyright (c) 2013, Luciano Coelho <luciano.coelho at intel.com>
+#
+# This software may be distributed under the terms of the BSD license.
+# See README for more details.
+
+import time
+import subprocess
+import logging
+logger = logging.getLogger()
+
+import hwsim_utils
+import hostapd
+
+def connect(dev, apdev):
+    params = { "ssid": "ap-csa",
+               "channel": "1" }
+    ap = hostapd.add_ap(apdev[0]['ifname'], params)
+    dev.connect("ap-csa", key_mgmt="NONE")
+    return ap
+
+def switch_channel(ap, count, freq):
+    ap.request("CHAN_SWITCH " + str(count) + " " + str(freq))
+    ev = ap.wait_event(["AP-CSA-FINISHED"], timeout=10)
+    if ev is None:
+        raise Exception("CSA finished event timed out")
+    if "freq=" + str(freq) not in ev:
+        raise Exception("Unexpected channel in CSA finished event")
+    time.sleep(0.1)
+
+def test_ap_csa_1_switch(dev, apdev):
+    """AP Channel Switch, one switch"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 10, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_2_switches(dev, apdev):
+    """AP Channel Switch, two switches"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 10, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 10, 2412)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_1_switch_count_0(dev, apdev):
+    """AP Channel Switch, one switch with count 0"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 0, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_2_switches_count_0(dev, apdev):
+    """AP Channel Switch, two switches with count 0"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 0, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 0, 2412)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_1_switch_count_1(dev, apdev):
+    """AP Channel Switch, one switch with count 1"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 1, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_2_switches_count_1(dev, apdev):
+    """AP Channel Switch, two switches with count 1"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 1, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 1, 2412)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
-- 
1.7.10.4




More information about the Hostap mailing list