aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>2016-04-07 05:38:03 (GMT)
committerJouni Malinen <j@w1.fi>2016-04-24 13:18:49 (GMT)
commit625bf74436db9cefbff575804fb430a68d7d8cee (patch)
treed198256da1f823d242a836608bd1a876514eaeb6 /tests
parent9cd6f4c015aad7f4f35b2507ab0ecc4efd92640c (diff)
downloadhostap-625bf74436db9cefbff575804fb430a68d7d8cee.zip
hostap-625bf74436db9cefbff575804fb430a68d7d8cee.tar.gz
hostap-625bf74436db9cefbff575804fb430a68d7d8cee.tar.bz2
tests: Pass apdev param to HostapdGlobal()
Pass apdev param to HostapdGlobal() to support operating with a remote test host. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/hostapd.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index 3aecbee..6c6cba6 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -21,7 +21,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
@@ -356,7 +362,7 @@ def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30):
logger.info("Starting AP " + ifname + " (old add_ap argument type)")
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)
@@ -400,7 +406,7 @@ def add_bss(apdev, ifname, 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)
@@ -417,7 +423,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)
@@ -433,21 +439,17 @@ def remove_bss(apdev, ifname=None):
logger.info("Removing BSS " + hostname + "/" + port + " " + ifname)
except:
logger.info("Removing BSS " + ifname)
- hostname = None
- port = 8878
- hapd_global = HostapdGlobal(hostname=hostname, port=port)
+ hapd_global = HostapdGlobal(apdev)
hapd_global.remove(ifname)
def terminate(apdev):
try:
hostname = apdev['hostname']
port = apdev['port']
- logger.info("Terminating hostapd " + apdev['hostname'] + "/" + apdev['port'])
+ logger.info("Terminating hostapd " + hostname + "/" + port)
except:
- hostname = None
- port = 8878
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):