tests: wpa_supplicant DUMP/GET global parameter

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-02-08 22:06:07 +02:00
parent 10263dc2a4
commit 7ebc7e8fa6
2 changed files with 25 additions and 0 deletions

View file

@ -1333,3 +1333,17 @@ def test_wpas_ctrl_misc(dev, apdev):
raise Exception("Invalid INTERFACE_REMOVE accepted") raise Exception("Invalid INTERFACE_REMOVE accepted")
if "FAIL" not in dev[0].global_request("SET foo"): if "FAIL" not in dev[0].global_request("SET foo"):
raise Exception("Invalid global SET accepted") raise Exception("Invalid global SET accepted")
def test_wpas_ctrl_dump(dev, apdev):
"""wpa_supplicant ctrl_iface and DUMP/GET global parameters"""
vals = dev[0].get_config()
logger.info("Config values from DUMP: " + str(vals))
for field in vals:
res = dev[0].request("GET " + field)
if res == 'FAIL\n':
res = "null"
if res != vals[field]:
print "'{}' != '{}'".format(res, vals[field])
raise Exception("Mismatch in config field " + field)
if "beacon_int" not in vals:
raise Exception("Missing config field")

View file

@ -1050,3 +1050,14 @@ class WpaSupplicant:
def get_group_ifname(self): def get_group_ifname(self):
return self.group_ifname if self.group_ifname else self.ifname return self.group_ifname if self.group_ifname else self.ifname
def get_config(self):
res = self.request("DUMP")
if res.startswith("FAIL"):
raise Exception("DUMP failed")
lines = res.splitlines()
vals = dict()
for l in lines:
[name,value] = l.split('=', 1)
vals[name] = value
return vals