tests: Verify STATUS-WPS passphrase on GO

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-04-06 16:52:14 +03:00
parent 679f2e7c5f
commit f44c45ac7f
2 changed files with 18 additions and 8 deletions

View file

@ -257,6 +257,8 @@ def test_autogo_tdls(dev):
def test_autogo_legacy(dev): def test_autogo_legacy(dev):
"""P2P autonomous GO and legacy clients""" """P2P autonomous GO and legacy clients"""
res = autogo(dev[0]) res = autogo(dev[0])
if dev[0].get_group_status_field("passphrase", extra="WPS") != res['passphrase']:
raise Exception("passphrase mismatch")
logger.info("Connect P2P client") logger.info("Connect P2P client")
connect_cli(dev[0], dev[1]) connect_cli(dev[0], dev[1])

View file

@ -249,8 +249,12 @@ class WpaSupplicant:
raise Exception("Association with the AP timed out") raise Exception("Association with the AP timed out")
self.dump_monitor() self.dump_monitor()
def get_status(self): def get_status(self, extra=None):
res = self.request("STATUS") if extra:
extra = "-" + extra
else:
extra = ""
res = self.request("STATUS" + extra)
lines = res.splitlines() lines = res.splitlines()
vals = dict() vals = dict()
for l in lines: for l in lines:
@ -261,14 +265,18 @@ class WpaSupplicant:
logger.info(self.ifname + ": Ignore unexpected STATUS line: " + l) logger.info(self.ifname + ": Ignore unexpected STATUS line: " + l)
return vals return vals
def get_status_field(self, field): def get_status_field(self, field, extra=None):
vals = self.get_status() vals = self.get_status(extra)
if field in vals: if field in vals:
return vals[field] return vals[field]
return None return None
def get_group_status(self): def get_group_status(self, extra=None):
res = self.group_request("STATUS") if extra:
extra = "-" + extra
else:
extra = ""
res = self.group_request("STATUS" + extra)
lines = res.splitlines() lines = res.splitlines()
vals = dict() vals = dict()
for l in lines: for l in lines:
@ -276,8 +284,8 @@ class WpaSupplicant:
vals[name] = value vals[name] = value
return vals return vals
def get_group_status_field(self, field): def get_group_status_field(self, field, extra=None):
vals = self.get_group_status() vals = self.get_group_status(extra)
if field in vals: if field in vals:
return vals[field] return vals[field]
return None return None