From patchwork Wed Mar 30 08:55:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz.Dziedzic@tieto.com X-Patchwork-Id: 603267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qZhNS6sCJz9snm for ; Wed, 30 Mar 2016 19:57:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=tieto.com header.i=@tieto.com header.b=vXUo+uDn; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1alBvv-0006yR-9e; Wed, 30 Mar 2016 08:56:59 +0000 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1alBvk-0006KK-PZ for hostap@lists.infradead.org; Wed, 30 Mar 2016 08:56:53 +0000 Received: by mail-lf0-x22e.google.com with SMTP id k79so30817856lfb.2 for ; Wed, 30 Mar 2016 01:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L/OSVtZGZxE72cvJuijHZYAY9w4IaySN/AuQEZZfws8=; b=vXUo+uDn1l40DeXzhYSq4yxnxhJg1DcB8Q3iwS6NCF1vK44ErY4FeMCMf2reKUgnOS VH2VqjK2P41tmzowdlwFDmvRmb3Q4xthr9ngtH2lwtayz6IzV0aBi2HKIKCraPJRjLTu Be0EavbTQywWhufwohOr/rz80Wb0iBcvukQ4c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L/OSVtZGZxE72cvJuijHZYAY9w4IaySN/AuQEZZfws8=; b=CbphEdHpkkqZOCe13W/B6Z+eQwwhBYf8SK4tT97ECfe1hSjyX9s2U9+b+7O3VonXt5 jvuEq/TCcgXixi5ZDwNFYotwfOvGfK8ifplyXHBbzlpzMKeW0S6HTWOQIlzggqrgjgJK gbgcxpXNKo+YFDMwvmj/j2WEJKoNIgzc3tLSvvu9blJxHeap28nfQDffr/+JDzYuXnnE QRLhQc1kMNT8LsRoR4evaovZ/wzbI666XCTUyPvMoPb8Oe8AWESiZtjOqHIsX2T/KgwA 7kZeI+BmFXFLt7ERs14YFlWt2TQWQGL8kgw9QoKHTzVmlJ58CvAdtLOcL8mjcTA7YzDY 5vCA== X-Gm-Message-State: AD7BkJJuplYWqqk+nHgI1vq6xKQ9r6bcVlc0wU9m9iKWGyh0nYohIdCGzHYwjIWLyG6Sq6yROKKj/qiwca/rBEsIvJWA4FKjtTLHZKqVnHL3wqOeVKtHffrKwR2Ac7bl2DpXkC4dhiv7RHwDvg6iHvAq8ZfJRM9fbp3ZUzgAC3RUZ9zxMhQbrxEdRlx9DiZ4s3iM X-Received: by 10.25.151.149 with SMTP id z143mr2829637lfd.72.1459328185728; Wed, 30 Mar 2016 01:56:25 -0700 (PDT) Received: from dell6430.wifi.local ([91.198.246.8]) by smtp.gmail.com with ESMTPSA id t2sm422839lbr.45.2016.03.30.01.56.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Mar 2016 01:56:25 -0700 (PDT) From: Janusz Dziedzic To: hostap@lists.infradead.org Subject: [PATCH 4/6] tests: pass apdev to HostapdGlobal() Date: Wed, 30 Mar 2016 10:55:59 +0200 Message-Id: <1459328161-4298-5-git-send-email-janusz.dziedzic@tieto.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459328161-4298-1-git-send-email-janusz.dziedzic@tieto.com> References: <1459328161-4298-1-git-send-email-janusz.dziedzic@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160330_015649_128256_B025B686 X-CRM114-Status: UNSURE ( 8.29 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:4010:c07:0:0:0:22e listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: j@w1.fi, Janusz Dziedzic MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Pass apdev to HostapdGlobal() and handle apdev['hostname'] for case of remote hosts usage. Signed-off-by: Janusz Dziedzic --- tests/hwsim/hostapd.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py index a4af629..db37d20 100644 --- a/tests/hwsim/hostapd.py +++ b/tests/hwsim/hostapd.py @@ -20,7 +20,13 @@ def mac2tuple(mac): return struct.unpack('6B', binascii.unhexlify(mac.replace(':',''))) class HostapdGlobal: - def __init__(self, hostname=None, port=8878): + def __init__(self, apdev=None): + try: + hostname = apdev['hostname'] + port = apdev['port'] + except: + hostname = None + port = 8878 self.host = remotehost.Host(hostname) self.hostname = hostname self.port = port @@ -349,7 +355,7 @@ def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30): logger.info("Starting AP " + ifname) hostname = None port = 8878 - hapd_global = HostapdGlobal(hostname=hostname, port=port) + hapd_global = HostapdGlobal(apdev) hapd_global.remove(ifname) hapd_global.add(ifname) port = hapd_global.get_ctrl_iface_port(ifname) @@ -393,7 +399,7 @@ def add_bss(phy, apdev, confname, ignore_error=False): logger.info("Starting BSS phy=" + phy + " ifname=" + ifname) hostname = None port = 8878 - hapd_global = HostapdGlobal(hostname=hostname, port=port) + hapd_global = HostapdGlobal(apdev) hapd_global.add_bss(phy, confname, ignore_error) port = hapd_global.get_ctrl_iface_port(ifname) hapd = Hostapd(ifname, hostname=hostname, port=port) @@ -410,7 +416,7 @@ def add_iface(apdev, confname): logger.info("Starting interface " + ifname) hostname = None port = 8878 - hapd_global = HostapdGlobal(hostname=hostname, port=port) + hapd_global = HostapdGlobal(apdev) hapd_global.add_iface(ifname, confname) port = hapd_global.get_ctrl_iface_port(ifname) hapd = Hostapd(ifname, hostname=hostname, port=port) @@ -419,20 +425,13 @@ def add_iface(apdev, confname): def remove_bss(apdev): ifname = apdev['ifname'] - try: - hostname = apdev['hostname'] - port = apdev['port'] - logger.info("Removing BSS " + hostname + "/" + port + " " + ifname) - except: - logger.info("Removing BSS " + ifname) - hostname = None - port = 8878 - hapd_global = HostapdGlobal(hostname=hostname, port=port) + logger.info("Removing BSS " + ifname) + hapd_global = HostapdGlobal(apdev) hapd_global.remove(ifname) -def terminate(hostname=None, port=8878): +def terminate(apdev): logger.info("Terminating hostapd") - hapd_global = HostapdGlobal(hostname=hostname, port=port) + hapd_global = HostapdGlobal(apdev) hapd_global.terminate() def wpa2_params(ssid=None, passphrase=None):