diff --git a/tests/hwsim/test_dpp.py b/tests/hwsim/test_dpp.py index 87946c01d..ca6092a69 100644 --- a/tests/hwsim/test_dpp.py +++ b/tests/hwsim/test_dpp.py @@ -1881,7 +1881,7 @@ def test_dpp_auto_connect_2_conf_ver1(dev, apdev): dev[0].set("dpp_config_processing", "0", allow_fail=True) def run_dpp_auto_connect(dev, apdev, processing, ap_version=0, sta_version=0, - sta1_version=0): + sta1_version=0, stop_after_prov=False): check_dpp_capab(dev[0]) check_dpp_capab(dev[1]) @@ -1920,6 +1920,8 @@ def run_dpp_auto_connect(dev, apdev, processing, ap_version=0, sta_version=0, if ev is None: raise Exception("DPP network profile not generated") id = ev.split(' ')[1] + if stop_after_prov: + return id, hapd if processing == 1: dev[0].select_network(id, freq=2412) diff --git a/tests/hwsim/test_dpp3.py b/tests/hwsim/test_dpp3.py new file mode 100644 index 000000000..e50f199f3 --- /dev/null +++ b/tests/hwsim/test_dpp3.py @@ -0,0 +1,49 @@ +# Test cases for Device Provisioning Protocol (DPP) version 3 +# Copyright (c) 2021, Qualcomm Innovation Center, Inc. +# +# This software may be distributed under the terms of the BSD license. +# See README for more details. + +from test_dpp import check_dpp_capab, run_dpp_auto_connect + +def test_dpp_network_intro_version(dev, apdev): + """DPP Network Introduction and protocol version""" + check_dpp_capab(dev[0], min_ver=3) + + try: + id, hapd = run_dpp_auto_connect(dev, apdev, 1, stop_after_prov=True) + dev[0].select_network(id, freq=2412) + dev[0].wait_connected() + finally: + dev[0].set("dpp_config_processing", "0", allow_fail=True) + +def test_dpp_network_intro_version_change(dev, apdev): + """DPP Network Introduction and protocol version change""" + check_dpp_capab(dev[0], min_ver=3) + + try: + dev[0].set("dpp_version_override", "2") + id, hapd = run_dpp_auto_connect(dev, apdev, 1, stop_after_prov=True) + dev[0].set("dpp_version_override", "3") + dev[0].select_network(id, freq=2412) + dev[0].wait_connected() + finally: + dev[0].set("dpp_config_processing", "0", allow_fail=True) + +def test_dpp_network_intro_version_missing_req(dev, apdev): + """DPP Network Introduction and protocol version missing from request""" + check_dpp_capab(dev[0], min_ver=3) + + try: + dev[0].set("dpp_version_override", "2") + id, hapd = run_dpp_auto_connect(dev, apdev, 1, stop_after_prov=True) + dev[0].set("dpp_version_override", "3") + dev[0].set("dpp_test", "92") + dev[0].select_network(id, freq=2412) + ev = dev[0].wait_event(["DPP-INTRO"], timeout=10) + if ev is None: + raise Exception("DPP network introduction result not seen on STA") + if "status=8" not in ev: + raise Exception("Unexpected network introduction result on STA: " + ev) + finally: + dev[0].set("dpp_config_processing", "0", allow_fail=True)