Skip to content

Commit 1a8ad67

Browse files
filipwasilrestyled-commitsarkq
authored
Extending wpa supplicant mock with paf support by introducing nan simulator (project-chip#42481)
* commissioning and connectivity improvements related to wifi-paf * brought back original signal name * removed unused emits from NaN simulator * removed the c-like size store * Restyled by isort * fixes in type hints * cleanup in sdk files. added BSS list * Too much changes in one PR * Restyled by autopep8 * Removed not used signals * Improved quality of python code * refactor * do not store reference to mock in wpa supplicant mock * Updates after review: - Tuple -> tuple - Dict -> dict - No timeouts - interfaces_info -> interfaces_names * Better python, removed not needed GVariant checks * fix: scan done emited from scan method * fix: moved network creation to interface to avoid indices * Simplifications * further simplifications * Introducing Scanning property to WpaSupplicantMock * Extra debug info when started scanning * Restyled by autopep8 * fixing mypy issues * mypy fixes - constructors * Restyled by autopep8 * reverted constructor changes * Update src/python_testing/matter_testing_infrastructure/matter/testing/linux/wifi.py Co-authored-by: Arkadiusz Bokowy <arkadiusz.bokowy@gmail.com> --------- Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Arkadiusz Bokowy <arkadiusz.bokowy@gmail.com>
1 parent 063ce4b commit 1a8ad67

4 files changed

Lines changed: 440 additions & 31 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,28 @@ jobs:
466466
--summary-file test-summaries/ble-wifi.json \
467467
"
468468
469+
- name: Run WiFiPAF-WiFi commissioning test
470+
env:
471+
# Disable TSAN bug reporting, as it reports tons of (hopefully) false positives.
472+
# The reason for that is WPA supplicant integration which involves GIO globals
473+
# (glib internals) that TSAN does not understand...
474+
TSAN_OPTIONS: report_bugs=0
475+
run: |
476+
./scripts/run_in_build_env.sh \
477+
"./scripts/tests/run_test_suite.py \
478+
--find-path $PWD/objdir-clone \
479+
--find-path $PWD/scripts \
480+
--runner chip_tool_python \
481+
--target TestOperationalState \
482+
--test-order random \
483+
run \
484+
--iterations 1 \
485+
--test-timeout-seconds 120 \
486+
--tool-path chip-tool:./objdir-clone/linux-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT}/chip-tool \
487+
--app-path all-clusters:./objdir-clone/linux-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
488+
--commissioning-method wifipaf-wifi \
489+
"
490+
469491
- name: Run Tests using matter-repl (skip slow)
470492
if: github.event_name == 'pull_request'
471493
run: |

scripts/tests/chiptest/test_definition.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ def Run(self, runner: Runner, apps_register: AppsRegister, subproc_info_repo: Su
468468
op_network: str = 'WiFi',
469469
thread_ba_host: str | None = None,
470470
thread_ba_port: int | None = None,
471+
wifipaf_wifi: bool = False
471472
):
472473
"""
473474
Executes the given test case using the provided runner for execution.
@@ -476,7 +477,8 @@ def Run(self, runner: Runner, apps_register: AppsRegister, subproc_info_repo: Su
476477
for target in self.targets:
477478
log.info('Executing %s::%s', self.name, target.name)
478479
self._RunImpl(target, runner, apps_register, subproc_info_repo, pics_file, timeout_seconds, dry_run,
479-
test_runtime, ble_controller_app, ble_controller_tool, op_network, thread_ba_host, thread_ba_port)
480+
test_runtime, ble_controller_app, ble_controller_tool, op_network, thread_ba_host, thread_ba_port,
481+
wifipaf_wifi)
480482

481483
def _RunImpl(self, target: TestTarget, runner: Runner, apps_register: AppsRegister, subproc_info_repo: SubprocessInfoRepo,
482484
pics_file: Path, timeout_seconds: int | None, dry_run: bool = False,
@@ -485,7 +487,8 @@ def _RunImpl(self, target: TestTarget, runner: Runner, apps_register: AppsRegist
485487
ble_controller_tool: int | None = None,
486488
op_network: str = 'WiFi',
487489
thread_ba_host: str | None = None,
488-
thread_ba_port: int | None = None):
490+
thread_ba_port: int | None = None,
491+
wifipaf_wifi: bool = False):
489492
runner.capture_delegate = ExecutionCapture()
490493

491494
tool_storage_dir = None
@@ -515,6 +518,8 @@ def _RunImpl(self, target: TestTarget, runner: Runner, apps_register: AppsRegist
515518
subproc = subproc.with_args("--ble-controller", str(ble_controller_app))
516519
if op_network == 'WiFi':
517520
subproc = subproc.with_args("--wifi")
521+
elif wifipaf_wifi:
522+
subproc = subproc.with_args("--wifi", "--wifipaf", "freq_list=2437")
518523

519524
app = App(runner, subproc)
520525
# Add the App to the register immediately, so if it fails during
@@ -575,6 +580,9 @@ def _RunImpl(self, target: TestTarget, runner: Runner, apps_register: AppsRegist
575580
pairing_cmd = pairing_cmd.with_args(
576581
"pairing", "code-thread", TEST_NODE_ID, f"hex:{TEST_THREAD_DATASET}", TEST_SETUP_QR_CODE)
577582
pairing_server_args = ["--ble-controller", str(ble_controller_tool)]
583+
elif wifipaf_wifi:
584+
pairing_cmd = pairing_cmd.with_args("pairing", "wifipaf-wifi", TEST_NODE_ID,
585+
"MatterAP", "MatterAPPassword", TEST_PASSCODE, TEST_DISCRIMINATOR)
578586
elif op_network == 'Thread' and thread_ba_host is not None and thread_ba_port is not None:
579587
pairing_cmd = pairing_cmd.with_args(
580588
"pairing", "thread-meshcop", TEST_NODE_ID, f"hex:{TEST_THREAD_DATASET}", setupCode,

scripts/tests/run_test_suite.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,11 @@ class CommissioningMethod(enum.StrEnum):
297297
BLE_WIFI = "ble-wifi"
298298
BLE_THREAD = "ble-thread"
299299
THREAD_MESHCOP = "thread-meshcop"
300+
WIFIPAF_WIFI = "wifipaf-wifi"
300301

301302
@property
302303
def wifi_required(self) -> bool:
303-
return self in {CommissioningMethod.BLE_WIFI}
304+
return self in {CommissioningMethod.BLE_WIFI, CommissioningMethod.WIFIPAF_WIFI}
304305

305306
@property
306307
def thread_required(self) -> bool:
@@ -520,20 +521,24 @@ def handle_deprecated_pathopt(key, path, kind):
520521

521522
try:
522523
if sys.platform == 'linux':
524+
app_name = 'wlx-app' if wifi_required else 'eth-app'
525+
tool_name = 'wlx-tool' if commissioning_method == 'wifipaf-wifi' else 'eth-tool'
526+
523527
to_terminate.append(ns := chiptest.linux.IsolatedNetworkNamespace(
524528
index=0,
525529
# Do not bring up the app interface link automatically when doing BLE-WiFi commissioning.
526530
app_link_up=not wifi_required,
527531
add_ula=not thread_required,
528532
# Change the app link name so the interface will be recognized as WiFi or Ethernet
529533
# depending on the commissioning method used.
530-
app_link_name='wlx-app' if wifi_required else 'eth-app'))
534+
app_link_name='wlx-app' if wifi_required else 'eth-app',
535+
tool_link_name=tool_name))
531536

532537
match commissioning_method:
533538
case CommissioningMethod.BLE_WIFI:
534539
to_terminate.append(chiptest.linux.DBusTestSystemBus())
535540
to_terminate.append(chiptest.linux.BluetoothMock())
536-
to_terminate.append(chiptest.linux.WpaSupplicantMock("MatterAP", "MatterAPPassword", ns))
541+
to_terminate.append(chiptest.linux.WpaSupplicantMock([app_name], "MatterAP", "MatterAPPassword", ns))
537542
ble_controller_app = 0 # Bind app to the first BLE controller
538543
ble_controller_tool = 1 # Bind tool to the second BLE controller
539544
case CommissioningMethod.BLE_THREAD:
@@ -546,6 +551,9 @@ def handle_deprecated_pathopt(key, path, kind):
546551
to_terminate.append(tbr := chiptest.linux.ThreadBorderRouter(TEST_THREAD_DATASET, ns))
547552
thread_ba_host = tbr.get_border_agent_host()
548553
thread_ba_port = tbr.get_border_agent_port()
554+
case CommissioningMethod.WIFIPAF_WIFI:
555+
to_terminate.append(chiptest.linux.DBusTestSystemBus())
556+
to_terminate.append(chiptest.linux.WpaSupplicantMock([app_name, tool_name], "MatterAP", "MatterAPPassword", ns))
549557

550558
to_terminate.append(executor := chiptest.linux.LinuxNamespacedExecutor(ns))
551559
elif sys.platform == 'darwin':
@@ -576,6 +584,7 @@ def handle_deprecated_pathopt(key, path, kind):
576584
op_network='Thread' if thread_required else 'WiFi',
577585
thread_ba_host=thread_ba_host,
578586
thread_ba_port=thread_ba_port,
587+
wifipaf_wifi=commissioning_method == CommissioningMethod.WIFIPAF_WIFI
579588
)))
580589
if result.exception is not None:
581590
if isinstance(result.exception, BaseException):

0 commit comments

Comments
 (0)