tests: DPP chirp with an AP as a standalone Configurator

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2021-03-07 13:18:01 +02:00
parent fd13693cac
commit 96279a5c51
2 changed files with 34 additions and 0 deletions

View file

@ -439,6 +439,20 @@ class Hostapd:
raise Exception("Failed to generate bootstrapping info")
return int(res)
def dpp_bootstrap_set(self, id, conf=None, configurator=None, ssid=None,
extra=None):
cmd = "DPP_BOOTSTRAP_SET %d" % id
if ssid:
cmd += " ssid=" + binascii.hexlify(ssid.encode()).decode()
if extra:
cmd += " " + extra
if conf:
cmd += " conf=" + conf
if configurator is not None:
cmd += " configurator=%d" % configurator
if "OK" not in self.request(cmd):
raise Exception("Failed to set bootstrapping parameters")
def dpp_listen(self, freq, netrole=None, qr=None, role=None):
cmd = "DPP_LISTEN " + str(freq)
if netrole:

View file

@ -5489,6 +5489,26 @@ def test_dpp_chirp_configurator(dev, apdev):
wait_auth_success(dev[0], dev[1], dev[1], dev[0])
def test_dpp_chirp_ap_as_configurator(dev, apdev):
"""DPP chirp with an AP as a standalone Configurator"""
check_dpp_capab(dev[0], min_ver=2)
hapd = hostapd.add_ap(apdev[0], {"ssid": "unconfigured"})
check_dpp_capab(hapd, min_ver=2)
id1 = dev[0].dpp_bootstrap_gen(chan="81/1")
uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id1)
conf_id = hapd.dpp_configurator_add()
idc = hapd.dpp_qr_code(uri)
hapd.dpp_bootstrap_set(idc, conf="sta-dpp", configurator=conf_id)
hapd.dpp_listen(2412)
if "OK" not in dev[0].request("DPP_CHIRP own=%d iter=2" % id1):
raise Exception("DPP_CHIRP failed")
wait_auth_success(dev[0], hapd, hapd, dev[0])
def test_dpp_chirp_configurator_inits(dev, apdev):
"""DPP chirp with a standalone Configurator initiating"""
check_dpp_capab(dev[0])