From f6ddda443ddf104970722b0d94bc5be11907b83a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 14 Aug 2020 17:04:56 +0300 Subject: [PATCH] tests: sigma_dut DPP AP as TCP Enrollee/initiator Signed-off-by: Jouni Malinen --- tests/hwsim/test_sigma_dut.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/hwsim/test_sigma_dut.py b/tests/hwsim/test_sigma_dut.py index 6f66399ef..e2151cfe9 100644 --- a/tests/hwsim/test_sigma_dut.py +++ b/tests/hwsim/test_sigma_dut.py @@ -3084,6 +3084,37 @@ def test_sigma_dut_dpp_tcp_enrollee_init(dev, apdev): stop_sigma_dut(sigma) dev[1].request("DPP_CONTROLLER_STOP") +def test_sigma_dut_ap_dpp_tcp_enrollee_init(dev, apdev, params): + """sigma_dut DPP AP as TCP Enrollee/initiator""" + logdir = params['prefix'] + ".sigma-hostapd" + with HWSimRadio() as (radio, iface): + sigma = start_sigma_dut(iface, hostapd_logdir=logdir) + try: + run_sigma_dut_ap_dpp_tcp_enrollee_init(dev, apdev) + finally: + stop_sigma_dut(sigma) + dev[1].request("DPP_CONTROLLER_STOP") + +def run_sigma_dut_ap_dpp_tcp_enrollee_init(dev, apdev): + check_dpp_capab(dev[1]) + # Controller + conf_id = dev[1].dpp_configurator_add() + dev[1].set("dpp_configurator_params", + "conf=ap-dpp configurator=%d" % conf_id) + id_c = dev[1].dpp_bootstrap_gen() + uri_c = dev[1].request("DPP_BOOTSTRAP_GET_URI %d" % id_c) + if "OK" not in dev[1].request("DPP_CONTROLLER_START"): + raise Exception("Failed to start Controller") + + sigma_dut_cmd_check("ap_reset_default,program,DPP") + sigma_dut_cmd_check("ap_preset_testparameters,Program,DPP,NAME,AP,oper_chn,6") + sigma_dut_cmd_check("dev_exec_action,program,DPP,DPPActionType,SetPeerBootstrap,DPPBootstrappingdata,%s,DPPBS,QR" % to_hex(uri_c)) + + cmd = "dev_exec_action,program,DPP,DPPActionType,AutomaticDPP,DPPAuthRole,Initiator,DPPProvisioningRole,Enrollee,DPPBS,QR,DPPOverTCP,127.0.0.1,DPPTimeout,6" + res = sigma_dut_cmd(cmd, timeout=10) + if "BootstrapResult,OK,AuthResult,OK,ConfResult,OK" not in res: + raise Exception("Unexpected result: " + res) + def test_sigma_dut_dpp_tcp_enrollee_init_mutual(dev, apdev): """sigma_dut DPP TCP Enrollee as initiator with mutual authentication""" check_dpp_capab(dev[0], min_ver=2)