tests: DPP Relay and dynamic Controller addition
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
parent
ca682f80a9
commit
ff7cc1d490
1 changed files with 32 additions and 21 deletions
|
@ -5536,7 +5536,15 @@ def test_dpp_controller_init_through_relay(dev, apdev, params):
|
||||||
dev[0].set("dpp_config_processing", "0", allow_fail=True)
|
dev[0].set("dpp_config_processing", "0", allow_fail=True)
|
||||||
dev[1].request("DPP_CONTROLLER_STOP")
|
dev[1].request("DPP_CONTROLLER_STOP")
|
||||||
|
|
||||||
def run_dpp_controller_init_through_relay(dev, apdev, params):
|
def test_dpp_controller_init_through_relay_dynamic(dev, apdev, params):
|
||||||
|
"""DPP Controller initiating through Relay (dynamic addition)"""
|
||||||
|
try:
|
||||||
|
run_dpp_controller_init_through_relay(dev, apdev, params, dynamic=True)
|
||||||
|
finally:
|
||||||
|
dev[0].set("dpp_config_processing", "0", allow_fail=True)
|
||||||
|
dev[1].request("DPP_CONTROLLER_STOP")
|
||||||
|
|
||||||
|
def run_dpp_controller_init_through_relay(dev, apdev, params, dynamic=False):
|
||||||
check_dpp_capab(dev[0], min_ver=2)
|
check_dpp_capab(dev[0], min_ver=2)
|
||||||
check_dpp_capab(dev[1], min_ver=2)
|
check_dpp_capab(dev[1], min_ver=2)
|
||||||
cap_lo = os.path.join(params['prefix'], ".lo.pcap")
|
cap_lo = os.path.join(params['prefix'], ".lo.pcap")
|
||||||
|
@ -5547,16 +5555,17 @@ def run_dpp_controller_init_through_relay(dev, apdev, params):
|
||||||
conf_id = dev[1].dpp_configurator_add()
|
conf_id = dev[1].dpp_configurator_add()
|
||||||
dev[1].set("dpp_configurator_params",
|
dev[1].set("dpp_configurator_params",
|
||||||
"conf=sta-dpp configurator=%d" % conf_id)
|
"conf=sta-dpp configurator=%d" % conf_id)
|
||||||
id_c = dev[1].dpp_bootstrap_gen()
|
if not dynamic:
|
||||||
res = dev[1].request("DPP_BOOTSTRAP_INFO %d" % id_c)
|
id_c = dev[1].dpp_bootstrap_gen()
|
||||||
pkhash = None
|
res = dev[1].request("DPP_BOOTSTRAP_INFO %d" % id_c)
|
||||||
for line in res.splitlines():
|
pkhash = None
|
||||||
name, value = line.split('=')
|
for line in res.splitlines():
|
||||||
if name == "pkhash":
|
name, value = line.split('=')
|
||||||
pkhash = value
|
if name == "pkhash":
|
||||||
break
|
pkhash = value
|
||||||
if not pkhash:
|
break
|
||||||
raise Exception("Could not fetch public key hash from Controller")
|
if not pkhash:
|
||||||
|
raise Exception("Could not fetch public key hash from Controller")
|
||||||
if "OK" not in dev[1].request("DPP_CONTROLLER_START"):
|
if "OK" not in dev[1].request("DPP_CONTROLLER_START"):
|
||||||
raise Exception("Failed to start Controller")
|
raise Exception("Failed to start Controller")
|
||||||
|
|
||||||
|
@ -5564,8 +5573,9 @@ def run_dpp_controller_init_through_relay(dev, apdev, params):
|
||||||
port = 11111
|
port = 11111
|
||||||
params = {"ssid": "unconfigured",
|
params = {"ssid": "unconfigured",
|
||||||
"channel": "6",
|
"channel": "6",
|
||||||
"dpp_controller": "ipaddr=127.0.0.1 pkhash=" + pkhash,
|
|
||||||
"dpp_relay_port": str(port)}
|
"dpp_relay_port": str(port)}
|
||||||
|
if not dynamic:
|
||||||
|
params["dpp_controller"] = "ipaddr=127.0.0.1 pkhash=" + pkhash
|
||||||
relay = hostapd.add_ap(apdev[0], params)
|
relay = hostapd.add_ap(apdev[0], params)
|
||||||
check_dpp_capab(relay)
|
check_dpp_capab(relay)
|
||||||
|
|
||||||
|
@ -5599,15 +5609,16 @@ def run_dpp_controller_init_through_relay(dev, apdev, params):
|
||||||
dev[0].wait_disconnected()
|
dev[0].wait_disconnected()
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
|
|
||||||
if "OK" not in dev[0].request("DPP_RECONFIG %s" % network):
|
if not dynamic:
|
||||||
raise Exception("Failed to start reconfiguration")
|
if "OK" not in dev[0].request("DPP_RECONFIG %s" % network):
|
||||||
ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=15)
|
raise Exception("Failed to start reconfiguration")
|
||||||
if ev is None:
|
ev = dev[0].wait_event(["DPP-NETWORK-ID"], timeout=15)
|
||||||
raise Exception("DPP network id not reported for reconfiguration")
|
if ev is None:
|
||||||
network2 = int(ev.split(' ')[1])
|
raise Exception("DPP network id not reported for reconfiguration")
|
||||||
if network == network2:
|
network2 = int(ev.split(' ')[1])
|
||||||
raise Exception("Network ID did not change")
|
if network == network2:
|
||||||
dev[0].wait_connected()
|
raise Exception("Network ID did not change")
|
||||||
|
dev[0].wait_connected()
|
||||||
|
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
wt.close()
|
wt.close()
|
||||||
|
|
Loading…
Reference in a new issue