From patchwork Sat Dec 14 19:43:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Coelho X-Patchwork-Id: 301292 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 79CA32C007B for ; Sun, 15 Dec 2013 12:40:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 6C7B99D2BB; Sat, 14 Dec 2013 14:43:37 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jNWTyKB4Xwtj; Sat, 14 Dec 2013 14:43:37 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 386299D29E; Sat, 14 Dec 2013 14:43:32 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 282429D29E for ; Sat, 14 Dec 2013 14:43:31 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mWXoIJ8Z1BUD for ; Sat, 14 Dec 2013 14:43:25 -0500 (EST) Received: from emh06.mail.saunalahti.fi (emh06.mail.saunalahti.fi [62.142.5.116]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "emh06.mail.saunalahti.fi", Issuer "emh06.mail.saunalahti.fi" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 5DE0E9D29D for ; Sat, 14 Dec 2013 14:43:25 -0500 (EST) Received: from porter.coelho.fi (a88-113-229-85.elisa-laajakaista.fi [88.113.229.85]) by emh06.mail.saunalahti.fi (Postfix) with ESMTP id A5EC869980 for ; Sat, 14 Dec 2013 21:43:19 +0200 (EET) From: Luciano Coelho To: hostap@lists.shmoo.com Subject: [PATCH v2] hwsim tests: Add test cases for AP channel switch announcement Date: Sat, 14 Dec 2013 21:43:17 +0200 Message-Id: <1387050197-3183-1-git-send-email-luca@coelho.fi> X-Mailer: git-send-email 1.8.5.1 X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Luciano Coelho Signed-hostap: Luciano Coelho --- In v2: * fixed copy and paste bug in the description of the testcases with count 1 (thanks Ilan). 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 +# +# 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'])