adding backend support for nfc-wifi command#293
adding backend support for nfc-wifi command#293ArnoldBraine wants to merge 144 commits intoproject-chip:mainfrom
Conversation
* Updated package-dependency-list.txt * Updated missing dependencies
* Reverting the BR_VARIANT option to the otbr start script * Adding TODO to the script * Adding missing comment char * Updating Script Comment Year Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com> * Adding switch parameters options to the script --------- Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com>
* replace erro with warning * Update test_collections/matter/sdk_tests/support/python_testing/models/python_test_parser.py Co-authored-by: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com> * black error fix * pr review --------- Co-authored-by: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com>
* Fixing intermittent problem with Python's Base Manager Creating the manager now only once in the SDK Container Init * Refactoring and updating the unit tests with related mocks
* Updated python_testing references after sdk refactoring * Removed no wanted file changes * Updated matter_testing references * Fixed line too long * Fixed code - black * Updated SDK SHA * Removed commented code
* Isolate SDK docker pull script * Changes after code review --------- Co-authored-by: Romulo Quidute Filho <rquidute@apple.com>
* Isolate SDK docker pull script * Rebasing * Apply suggestions from code review Co-authored-by: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com> * Move call tp update-pull-sdk-docker-image.sh from setup.sh to update-sample-apps.sh * Changes after code review * Fixed CI issues * Code review fixes * Fixed unit tests * Fixed mypy --------- Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com> Co-authored-by: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com> Co-authored-by: Romulo Quidute Filho <rquidute@apple.com>
* Implemented changes for custom python test * code review * Code review * Code reviewd * Fixed code violations * Chanegs after code review * Remove unused import
* Fixed some python tests not listed * code review
* Implement support to export project config * Fix mypy * Changed the returned schema and service endpoint name * Added import project config * Apply suggestions from code review Co-authored-by: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com> * code review --------- Co-authored-by: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com>
* Added support to negated PICS * Fixed flake * Code review. No consider negatives PICS * Update app/pics_applicable_test_cases.py * Code review
* Remove unused file * Updated cspell
* Fix CI issues from v2.12 branch * Fixed merge * Fix test case * Updated SDK_DOCKER_IMAGE url * Updated SDK_DOCKER_IMAGE url
…ing (#173) * Add support for configuring terms and conditions in device commissioning This commit introduces a new `enhanced_setup_flow` configuration property to the test harness backend, allowing device manufacturers to define the terms and conditions (T&C) that must be acknowledged and set during device commissioning. These values are critical for supporting the Terms and Conditions Certification Test Suite. Key changes include: - Added the `EnhancedSetupFlowConfig` class to `DutConfig`, which allows specifying the T&C version and user response required during commissioning. - Updated `generate_command_arguments` in `utils.py` to append the necessary arguments for T&C validation and the device's commissioning method. - Adjusted model validation to ensure the `enhanced_setup_flow` field is processed correctly within `DutConfig`. These changes ensure the test harness can enforce manufacturer-specific T&C values during the commissioning process, aligning with the broader requirements of T&C validation. * * Ran ./scripts/format.sh * Update test_collections/matter/test_environment_config.py Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com> * Update app/user_prompt_support/uploaded_file_support.py Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com> * Update test_collections/matter/sdk_tests/support/performance_tests/utils.py Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com> * Update test_collections/matter/sdk_tests/support/python_testing/models/utils.py Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com> * Update test_collections/matter/sdk_tests/support/python_testing/models/utils.py Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com> * Update test_collections/matter/sdk_tests/support/python_testing/__init__.py Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com> * Revert changes to test_collections/matter/sdk_tests/support/performance_tests/utils.py * Restyle test_environment_config.py * test: Add in-test-commissioning-method parameter for manual commissioning validation Add new parameter to control commissioning flow during tests, allowing manual validation of the commissioning process instead of auto-commissioning. This enables test cases to verify terms and conditions acknowledgements during the commissioning flow. - Add in-test-commissioning-method parameter to test flags - Support manual commissioning flow validation - Enable testing of T&C acknowledgement scenarios * Add new field "enhanced_setup_flow" to exception message * Cherry-pick test_python_parser.py from origin/main * Cherry-pick python_test_parser.py from origin/main * Revert "Cherry-pick python_test_parser.py from origin/main" This reverts commit 5d65ce5. * Revert "Cherry-pick test_python_parser.py from origin/main" This reverts commit 2cd99b7. * Removed broken test `test_python_parser.py` * Revert "Removed broken test `test_python_parser.py`" This reverts commit 48c0e32. --------- Co-authored-by: Romulo Quidute Filho <116586593+rquidute@users.noreply.github.com>
Updated Node.js installation source from setup_18.x to setup_20.x to align with Ubuntu 22.04 base image requirements
* First implementation * Implement prompt and copy files from/to contanier * Unit tests * Updated SKA SHA * Unit test typo fixes * Mypy flake8 fixes * Mypy fixes * Update test_collections/matter/sdk_tests/support/python_testing/models/utils.py Co-authored-by: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com> * Update test_collections/matter/sdk_tests/support/utils.py Co-authored-by: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com> * Code review * Review fixes * Remove unused import --------- Co-authored-by: Carolina Lopes <116589288+ccruzagralopes@users.noreply.github.com>
* Add logs for project config * Updated cspell.json * Update app/test_engine/test_runner.py Co-authored-by: hiltonlima <116589806+hiltonlima@users.noreply.github.com> * Fixed unit test * Unit test * Unit test --------- Co-authored-by: hiltonlima <116589806+hiltonlima@users.noreply.github.com>
* Improve test_harness_client by using argparse * Code review
* Added commissioning logs * Update test_collections/matter/sdk_tests/support/python_testing/models/utils.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update test_collections/matter/sdk_tests/support/python_testing/models/utils.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Flake8 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Add equivalent shell command when using docker api * Update app/container_manager/docker_shell_commands.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update app/container_manager/docker_shell_commands.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update app/container_manager/docker_shell_commands.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update test_collections/matter/sdk_tests/support/sdk_container.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update app/container_manager/docker_shell_commands.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update app/container_manager/docker_shell_commands.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Code review * Flake8 * Code review * Code review * Code review --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Created shared constants script and added two Enums to the file * Adding MessageKeysEnum as shared, removed original and changing all related imports * Adding TestStateEnum and changing all relevant imports * Exchanging for a app relative import in the models' init file * Updating Copyright's Date Year * Reverting python_tests SHA since it's not ready yet * Updating Matter test scripts SHA
* Creating test manager and updating code logic to improve Python Testing initialization * Updating file's year and removing Optional import from test manager * Removing code duplication * Adding forward reference type hint to Python Testing init * Removing unnecessary imports and changing a too long line error from the test manager * Removing unnecessary comment
* Updated SDK version to 68e03c17300eb42c0d3946130aa2a8f7a2a06632 for v1.5 final release * Updated SDK_SHA to ca9d1118e097fe947b2aec1ba84f265d6cf2447e * Update .version_information Co-authored-by: antonio-amjr <116589331+antonio-amjr@users.noreply.github.com> --------- Co-authored-by: antonio-amjr <116589331+antonio-amjr@users.noreply.github.com>
* Updated SDK version to 68e03c17300eb42c0d3946130aa2a8f7a2a06632 for v1.5 final release * Updated SDK_SHA to ca9d1118e097fe947b2aec1ba84f265d6cf2447e * Implement code to make log synchronization configurable * Run black * Code review * Updated python_tests submodule * Code review
* Fixing Custom Name for presentation and adding symbolic links for easy access to the custom folders * Gemini's suggestion: Improving readability for the custom suffix variable processing logic
* Fixing Backend's API for the CLI Test Run Execution * Gemini suggestions: Updating logic for efficiency Also avoiding modifying external variable. * Solve flake8 error in singleton.py file
…ng directories (#285) * Fix update-paa-certs.sh permission error * Code review
* Adding chip-server information API * Updating endpoint to use Chip Server Info schema
…rds without pagination (#286) * Add sort_order to GET test_run_execution * Add support to sort results and retrive all records from test_run_execution * Update app/tests/crud/test_test_run_execution.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update app/crud/crud_test_run_execution.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update app/crud/crud_test_run_execution.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Improved logic to load json file, while launching. This avoids unpredicable unit tests failing due to race condition * Flake8 * Code review - Mock read python test JSON file * Code review - organize imports and remove useless code * Code review - flake8 * Code review - flake8 * Code review - fix unit test * Code revier * Code review --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…g Code (#287) * Updating CHIP Server Info endpoint to include Manual Pairing Code * Gemini's Suggestion: Improving logic * Adding break to leave out of the for loop as soon as possible
* Skip load custom tests step if no custom tests were found * Update test_collections/matter/sdk_tests/support/python_testing/test_manager.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…#289) * Adding support to the CLI's double dash extra arguments feature * Improving logic and fixing comment * Updating endpoint's comments Adding note for the scenario where both configs are provided
…n logging (#290) * Implemented configuration for enabling/disabling container information logging * Code review - Gemini
…#291) * Fixes for Python tests being loaded twice during Test Harness startup * Code review
….1-beta1+winter2026 version
Summary of ChangesHello @ArnoldBraine, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces full backend support for NFC-WiFi commissioning, enabling devices to be paired using a combination of Near Field Communication and Wi-Fi. The changes integrate this new pairing mode across various utility functions, configuration enums, and testing frameworks, ensuring a robust and testable implementation for NFC-WiFi based device commissioning. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds backend support for the nfc-wifi command, which is a good extension of the existing functionality. The changes are logical and cover configuration, command generation, and testing. I've identified a bug in one of the new tests where an incorrect value is being asserted, which needs to be fixed. Additionally, I've provided several suggestions to improve code readability, consistency, and maintainability by reducing code duplication and adhering to Python's style conventions. Addressing these points will enhance the overall quality of the code.
test_collections/matter/sdk_tests/support/tests/python_tests/test_utils.py
Outdated
Show resolved
Hide resolved
| if ( | ||
| pairing_mode == DutPairingModeEnum.BLE_WIFI | ||
| or pairing_mode == DutPairingModeEnum.NFC_WIFI | ||
| ): |
| chip_server._ChipServer__node_id = None | ||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_pairing_NFC_wifi_command_params() -> None: |
There was a problem hiding this comment.
According to PEP 8 naming conventions, function names should be in snake_case. To maintain consistency with other tests in this file, please rename test_pairing_NFC_wifi_command_params.
| async def test_pairing_NFC_wifi_command_params() -> None: | |
| async def test_pairing_nfc_wifi_command_params() -> None: |
| setup_code, | ||
| discriminator, | ||
| ) | ||
|
|
| if ( | ||
| self.config_matter.dut_config.pairing_mode is DutPairingModeEnum.NFC_THREAD | ||
| or self.config_matter.dut_config.pairing_mode is DutPairingModeEnum.NFC_WIFI | ||
| ): |
| async def __pair_with_dut_nfc_wifi(self) -> bool: | ||
| if self.config_matter.network.wifi is None: | ||
| raise DUTCommissioningError("Tool config is missing wifi config.") | ||
|
|
||
| return await self.runner.pairing_nfc_wifi( | ||
| ssid=self.config_matter.network.wifi.ssid, | ||
| password=self.config_matter.network.wifi.password, | ||
| setup_code=self.config_matter.dut_config.setup_code, | ||
| discriminator=self.config_matter.dut_config.discriminator, | ||
| ) |
There was a problem hiding this comment.
This new method __pair_with_dut_nfc_wifi is very similar to __pair_with_dut_ble_wifi and __pair_with_dut_wifipaf_wifi, leading to code duplication. To improve maintainability, consider refactoring this logic into a shared private helper method.
For example, you could create a helper that takes the specific pairing function as an argument:
from typing import Callable
async def __pair_with_dut_wifi(self, pairing_method: Callable) -> bool:
if self.config_matter.network.wifi is None:
raise DUTCommissioningError("Tool config is missing wifi config.")
return await pairing_method(
ssid=self.config_matter.network.wifi.ssid,
password=self.config_matter.network.wifi.password,
setup_code=self.config_matter.dut_config.setup_code,
discriminator=self.config_matter.dut_config.discriminator,
)Then, this method and the others could be simplified to:
async def __pair_with_dut_nfc_wifi(self) -> bool:
return await self.__pair_with_dut_wifi(self.runner.pairing_nfc_wifi)This would reduce code duplication and make the code easier to maintain. While this change would also affect other methods outside this diff, it's a good opportunity to consider this refactoring.
antonio-amjr
left a comment
There was a problem hiding this comment.
Hi @ArnoldBraine,
Can you please rebase the PR to point to the appropriate release branch?
Since we're working on the Matter 1.6, the base should be v2.15-develop branch.
…est_utils.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
7a438f2 to
e613c3d
Compare
I had trouble with rebasing the PR, so i created a new one with the right base: #294 |
Summary
Adding support for nfc-wifi using the reference pull requests from @OlivierGre
Add nfc-thread pairing mode #185
Change to be able to use NFC Commissioning in YAML test. #201
Disable Polkit in chip-cert-bins #269