tests: Allow full apdev to be passed to add_ap() function
This allows the full apdev dict to be passed to the add_ap() function instead of just ifname. This allows us to handle also remote hosts while we can check apdev['hostname'], apdev['port']. The old style ifname argument is still accepted to avoid having to convert all callers in a single commit. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
This commit is contained in:
parent
f89c32e63f
commit
78b8319317
1 changed files with 16 additions and 3 deletions
|
@ -339,9 +339,22 @@ class Hostapd:
|
||||||
return vals
|
return vals
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def add_ap(ifname, params, wait_enabled=True, no_enable=False, timeout=30,
|
def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30):
|
||||||
hostname=None, port=8878):
|
if isinstance(apdev, dict):
|
||||||
|
ifname = apdev['ifname']
|
||||||
|
try:
|
||||||
|
hostname = apdev['hostname']
|
||||||
|
port = apdev['port']
|
||||||
|
logger.info("Starting AP " + hostname + "/" + port + " " + ifname)
|
||||||
|
except:
|
||||||
logger.info("Starting AP " + ifname)
|
logger.info("Starting AP " + ifname)
|
||||||
|
hostname = None
|
||||||
|
port = 8878
|
||||||
|
else:
|
||||||
|
ifname = apdev
|
||||||
|
logger.info("Starting AP " + ifname + " (old add_ap argument type)")
|
||||||
|
hostname = None
|
||||||
|
port = 8878
|
||||||
hapd_global = HostapdGlobal(hostname=hostname, port=port)
|
hapd_global = HostapdGlobal(hostname=hostname, port=port)
|
||||||
hapd_global.remove(ifname)
|
hapd_global.remove(ifname)
|
||||||
hapd_global.add(ifname)
|
hapd_global.add(ifname)
|
||||||
|
|
Loading…
Reference in a new issue