From 99461068c56955478126f69ad20d6d5dd74e7324 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 20 Jun 2023 11:40:54 -0400 Subject: [PATCH 01/36] Make the comma split work in zsh (#27347) * Make the comma split work in zsh * Update string substitution a bit * Remove extra conditional * Use zsh_version to determine how to read * Slight simplification * Cleanup variables as well * Restyled by shfmt --------- Co-authored-by: Andrei Litvin Co-authored-by: Restyled.io --- scripts/setup/bootstrap.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/setup/bootstrap.sh b/scripts/setup/bootstrap.sh index af00b719fcfd5d..925183b9e3f353 100644 --- a/scripts/setup/bootstrap.sh +++ b/scripts/setup/bootstrap.sh @@ -33,7 +33,11 @@ _install_additional_pip_requirements() { done if ! [ -z "$_SETUP_PLATFORM" ]; then - IFS="," read -r -a _PLATFORMS <<<"$_SETUP_PLATFORM" + if [ -n "$ZSH_VERSION" ]; then + IFS="," read -r -A _PLATFORMS <<<"$_SETUP_PLATFORM" + else + IFS="," read -r -a _PLATFORMS <<<"$_SETUP_PLATFORM" + fi for platform in "${_PLATFORMS[@]}"; do # Allow none as an alias of nothing extra installed (like -p none) if [ "$platform" != "none" ]; then @@ -43,7 +47,10 @@ _install_additional_pip_requirements() { -c "$_CHIP_ROOT/scripts/setup/constraints.txt" fi done + unset _PLATFORMS fi + + unset _SETUP_PLATFORM } _bootstrap_or_activate() { From fcdc27aab9ddcf1afd4dfec9975712f27717c5bf Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Tue, 20 Jun 2023 18:06:24 +0200 Subject: [PATCH 02/36] [matter_yamltests] Allow response field to be configured from the config section (#27323) --- .../matter_yamltests/errors.py | 11 ++++++++ .../matter_yamltests/yaml_loader.py | 25 +++++++++++++++---- .../py_matter_yamltests/test_yaml_loader.py | 2 +- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/scripts/py_matter_yamltests/matter_yamltests/errors.py b/scripts/py_matter_yamltests/matter_yamltests/errors.py index 97a71a24133106..b6205dad9efabb 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/errors.py +++ b/scripts/py_matter_yamltests/matter_yamltests/errors.py @@ -176,3 +176,14 @@ def __init__(self, content): self.tag_key_with_error(content, 'wait') self.tag_key_with_error(content, 'response') + + +class TestStepResponseVariableError(TestStepError): + """Raise when a test step response use a variable but this variable does not exist in the config section. + """ + + def __init__(self, content): + message = 'The variable does not exist in the config section.' + super().__init__(message) + + self.tag_key_with_error(content, 'response') diff --git a/scripts/py_matter_yamltests/matter_yamltests/yaml_loader.py b/scripts/py_matter_yamltests/matter_yamltests/yaml_loader.py index f806127c96f7d1..63170fbcc66460 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/yaml_loader.py +++ b/scripts/py_matter_yamltests/matter_yamltests/yaml_loader.py @@ -16,8 +16,8 @@ from typing import Tuple, Union from .errors import (TestStepError, TestStepGroupResponseError, TestStepInvalidTypeError, TestStepKeyError, - TestStepNodeIdAndGroupIdError, TestStepValueAndValuesError, TestStepVerificationStandaloneError, - TestStepWaitResponseError) + TestStepNodeIdAndGroupIdError, TestStepResponseVariableError, TestStepValueAndValuesError, + TestStepVerificationStandaloneError, TestStepWaitResponseError) from .fixes import add_yaml_support_for_scientific_notation_without_dot try: @@ -78,12 +78,13 @@ def __check_content(self, content): tests = content.get('tests', []) for step_index, step in enumerate(tests): try: - self.__check_test_step(step) + config = content.get('config', {}) + self.__check_test_step(config, step) except TestStepError as e: e.update_context(step, step_index) raise - def __check_test_step(self, content): + def __check_test_step(self, config: dict, content): schema = { 'label': str, 'identity': str, @@ -101,7 +102,7 @@ def __check_test_step(self, content): 'verification': str, 'PICS': str, 'arguments': dict, - 'response': (dict, list), + 'response': (dict, list, str), # Can be a variable 'minInterval': int, 'maxInterval': int, 'timedInteractionTimeoutMs': int, @@ -116,6 +117,7 @@ def __check_test_step(self, content): self.__rule_step_with_verification_should_be_disabled_or_interactive( content) self.__rule_wait_should_not_expect_a_response(content) + self.__rule_response_variable_should_exist_in_config(config, content) if 'arguments' in content: arguments = content.get('arguments') @@ -123,6 +125,13 @@ def __check_test_step(self, content): if 'response' in content: response = content.get('response') + + # If the response is a variable, update the response value with the content of the variable such + # such that the error message looks nice if needed. + if isinstance(response, str): + response = config.get(response) + content['response'] = response + if isinstance(response, list): [self.__check_test_step_response(x) for x in response] else: @@ -241,3 +250,9 @@ def __rule_response_value_and_values_are_mutually_exclusive(self, content): def __rule_wait_should_not_expect_a_response(self, content): if 'wait' in content and 'response' in content: raise TestStepWaitResponseError(content) + + def __rule_response_variable_should_exist_in_config(self, config, content): + if 'response' in content: + response = content.get('response') + if isinstance(response, str) and response not in config: + raise TestStepResponseVariableError(content) diff --git a/scripts/py_matter_yamltests/test_yaml_loader.py b/scripts/py_matter_yamltests/test_yaml_loader.py index 067dc831627907..146c30e0a13dc6 100644 --- a/scripts/py_matter_yamltests/test_yaml_loader.py +++ b/scripts/py_matter_yamltests/test_yaml_loader.py @@ -301,7 +301,7 @@ def test_key_tests_step_response_key(self): _, _, _, _, tests = load(content.format(value=value)) self.assertEqual(tests, [{'response': [{'value': True}]}]) - wrong_values = self._get_wrong_values([dict, list], spaces=6) + wrong_values = self._get_wrong_values([dict, list, str], spaces=6) for value in wrong_values: x = content.format(value=value) self.assertRaises(TestStepInvalidTypeError, load, x) From 6cb274fb22cc48a043852bd54c3d2c8cd8713fcd Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Tue, 20 Jun 2023 12:12:40 -0400 Subject: [PATCH 03/36] Testing buildjet vs github actions cache (#27344) --- .github/workflows/build.yaml | 10 +++++----- .github/workflows/chef.yaml | 6 +++--- .github/workflows/cirque.yaml | 4 ++-- .github/workflows/darwin-tests.yaml | 2 +- .github/workflows/darwin.yaml | 2 +- .github/workflows/examples-ameba.yaml | 2 +- .github/workflows/examples-asr.yaml | 2 +- .github/workflows/examples-bouffalolab.yaml | 2 +- .github/workflows/examples-cc13x2x7_26x2x7.yaml | 2 +- .github/workflows/examples-cc32xx.yaml | 2 +- .github/workflows/examples-efr32.yaml | 2 +- .github/workflows/examples-esp32.yaml | 4 ++-- .github/workflows/examples-infineon.yaml | 2 +- .github/workflows/examples-k32w.yaml | 2 +- .github/workflows/examples-linux-arm.yaml | 2 +- .github/workflows/examples-linux-imx.yaml | 2 +- .github/workflows/examples-linux-standalone.yaml | 2 +- .github/workflows/examples-mbed.yaml | 2 +- .github/workflows/examples-mw320.yaml | 2 +- .github/workflows/examples-nrfconnect.yaml | 2 +- .github/workflows/examples-openiotsdk.yaml | 2 +- .github/workflows/examples-qpg.yaml | 2 +- .github/workflows/examples-telink.yaml | 2 +- .github/workflows/examples-tizen.yaml | 2 +- .github/workflows/full-android.yaml | 2 +- .github/workflows/fuzzing-build.yaml | 4 ++-- .github/workflows/java-tests.yaml | 3 +-- .github/workflows/lint.yml | 3 +-- .github/workflows/qemu.yaml | 4 ++-- .github/workflows/release_artifacts.yaml | 4 ++-- .github/workflows/smoketest-android.yaml | 2 +- .github/workflows/smoketest-darwin.yaml | 2 +- .github/workflows/tests.yaml | 8 ++++---- .github/workflows/zap_regeneration.yaml | 2 +- .github/workflows/zap_templates.yaml | 2 +- 35 files changed, 49 insertions(+), 51 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9774faa586efbe..1d3f78f13539bc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -70,7 +70,7 @@ jobs: sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -187,7 +187,7 @@ jobs: sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -349,7 +349,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -408,7 +408,7 @@ jobs: mkdir -p ~/Library/Logs/DiagnosticReports || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -508,7 +508,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index c426996c187054..54e29b684e06cd 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -50,7 +50,7 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -86,7 +86,7 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform esp32 - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -122,7 +122,7 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform nrfconnect - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 98baf36f6d61f3..65acf7398b3f57 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -66,7 +66,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 if: ${{ !env.ACT }} with: @@ -88,7 +88,7 @@ jobs: id: cirque-bootstrap-cache-key run: echo "val=$(scripts/tests/cirque_tests.sh cachekeyhash)" >> $GITHUB_OUTPUT - name: Cirque Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 if: ${{ !env.ACT }} with: diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 29f34356e5f607..83edf05a47b82a 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -69,7 +69,7 @@ jobs: mkdir objdir-clone || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index f724c0134de616..51b8261e1fbb87 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -52,7 +52,7 @@ jobs: run: brew install python@3.9 - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 0e3d2e867ac431..245141b6faa359 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -53,7 +53,7 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform ameba - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index a8fd72fc3bfe28..f0f72503534e58 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -51,7 +51,7 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform asr - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 3441ad51d2bc2a..580e3f5caffa21 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -60,7 +60,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-cc13x2x7_26x2x7.yaml b/.github/workflows/examples-cc13x2x7_26x2x7.yaml index 0ebe1b067dbd49..7f34d31ebe61e9 100644 --- a/.github/workflows/examples-cc13x2x7_26x2x7.yaml +++ b/.github/workflows/examples-cc13x2x7_26x2x7.yaml @@ -63,7 +63,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index 712648d99870fe..4a941e17cb0aa5 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -61,7 +61,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 1772f5b931333e..daf30304cd70ae 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -66,7 +66,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index 5d36782b23f599..a448cd81d5553a 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -60,7 +60,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -179,7 +179,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform esp32 - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index e05a56b215a693..27105ffc7a6407 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -60,7 +60,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml index 1744acc20e91ba..935b9a837dc22b 100644 --- a/.github/workflows/examples-k32w.yaml +++ b/.github/workflows/examples-k32w.yaml @@ -62,7 +62,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 3b293599b00787..2c6133227a4c36 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -60,7 +60,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index bb633d23f9ad8c..4b5bf670c463ea 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -52,7 +52,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index 8504087a83455e..fd954ad63bb499 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -60,7 +60,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index e32c75300ec63a..3d330fcd4cd848 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -76,7 +76,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 0d1a285f0de841..15a429e7bd087f 100755 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -62,7 +62,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index cc2daca2f7c266..9b248461e5deeb 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -75,7 +75,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 08f46969daee9b..74dcb2f1206848 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -65,7 +65,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index ab7d33b5ccab90..1be72db151799a 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -62,7 +62,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 74e050bb05f438..3faeacb75057e1 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -61,7 +61,7 @@ jobs: run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index a0f33c521040cd..2931bd1ea4c001 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -55,7 +55,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform tizen - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index 5f9582c5eced37..adff0f36bad483 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -66,7 +66,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform android - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 4e589a98460b2b..0441c68285f02a 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -57,7 +57,7 @@ jobs: mkdir objdir-clone || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -117,7 +117,7 @@ jobs: mkdir objdir-clone || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index 37ebeeea0a01fa..b0f1de052a3396 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -60,7 +60,7 @@ jobs: mkdir objdir-clone || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -248,4 +248,3 @@ jobs: path: objdir-clone/ # objdirs are big; don't hold on to them too long. retention-days: 5 - diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index da846e5939ea0a..4acf3be4de4d3b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -60,7 +60,7 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -222,4 +222,3 @@ jobs: if: always() run: | git grep -n 'SuccessOrExit([^=)]*(' -- './*' ':(exclude).github/workflows/lint.yml' && exit 1 || exit 0 - diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 2459ecbcaa5576..bb18146c47e0bc 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -58,7 +58,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform esp32 - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -122,7 +122,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform tizen - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index a525a97db0742d..e7fa612e92f1b4 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -49,7 +49,7 @@ jobs: ref: "${{ github.event.inputs.releaseTag }}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -104,7 +104,7 @@ jobs: ref: "${{ github.event.inputs.releaseTag }}" - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 21837f201ccfec..bd4361e6667d65 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -57,7 +57,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform android - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/smoketest-darwin.yaml b/.github/workflows/smoketest-darwin.yaml index 13f328b02988e8..0c6409f8bfdd42 100644 --- a/.github/workflows/smoketest-darwin.yaml +++ b/.github/workflows/smoketest-darwin.yaml @@ -52,7 +52,7 @@ jobs: run: brew install python@3.9 - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 75a29d165a3eba..2160399601c92d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -83,7 +83,7 @@ jobs: mkdir objdir-clone || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -353,7 +353,7 @@ jobs: mkdir objdir-clone || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -476,7 +476,7 @@ jobs: mkdir objdir-clone || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} @@ -569,7 +569,7 @@ jobs: mkdir objdir-clone || true - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index f30714c2a6bf65..ce173fce271490 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -53,7 +53,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 04cb6b8990af72..9970300975771d 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -54,7 +54,7 @@ jobs: run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Bootstrap cache - uses: actions/cache@v3 + uses: buildjet/cache@v3 timeout-minutes: 10 with: key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} From 2ac9777344ed6dea1ac9865137ae716914a21418 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 20 Jun 2023 12:13:46 -0400 Subject: [PATCH 04/36] Make updated tracing scope/begin/end/instant use char* instead of enums (#27327) * Create varargs macros for tracing, including tests * Add matter trace scope macros * Add missing semicolon * Add labels to trace end * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Use a buildconfig header for tracing configuration * Fix missing include * Restyled by gn --------- Co-authored-by: Restyled.io Co-authored-by: Andrei Litvin --- .../general-commissioning-server.cpp | 6 +- .../network-commissioning.cpp | 12 +- .../operational-credentials-server.cpp | 16 +- src/controller/CHIPDeviceController.cpp | 66 +++--- src/lib/dnssd/IncrementalResolve.cpp | 10 +- src/protocols/secure_channel/CASESession.cpp | 22 +- src/protocols/secure_channel/PASESession.cpp | 22 +- src/tracing/BUILD.gn | 31 ++- src/tracing/backend.h | 39 ++-- src/tracing/log_json/log_json_tracing.cpp | 192 ++---------------- src/tracing/log_json/log_json_tracing.h | 6 +- src/tracing/macros.h | 35 +++- src/tracing/registry.cpp | 14 +- src/tracing/registry.h | 6 +- src/tracing/scope.h | 30 ++- src/tracing/scopes.h | 121 ----------- src/tracing/tests/BUILD.gn | 2 +- src/tracing/tests/TestTracing.cpp | 93 +++------ src/tracing/tracing_args.gni | 24 +++ 19 files changed, 251 insertions(+), 496 deletions(-) delete mode 100644 src/tracing/scopes.h diff --git a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp index 6e5893a5ef7248..09a3e6afa98fad 100644 --- a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp +++ b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp @@ -156,7 +156,7 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler * const Commands::ArmFailSafe::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("ArmFailSafe", "GeneralCommissioning"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::GeneralCommissioning_ArmFailSafe); + MATTER_TRACE_SCOPE("ArmFailSafe", "GeneralCommissioning"); auto & failSafeContext = Server::GetInstance().GetFailSafeContext(); Commands::ArmFailSafeResponse::Type response; @@ -219,7 +219,7 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback( const Commands::CommissioningComplete::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("CommissioningComplete", "GeneralCommissioning"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::GeneralCommissioning_CommissioningComplete); + MATTER_TRACE_SCOPE("CommissioningComplete", "GeneralCommissioning"); DeviceControlServer * devCtrl = &DeviceLayer::DeviceControlServer::DeviceControlSvr(); auto & failSafe = Server::GetInstance().GetFailSafeContext(); @@ -287,7 +287,7 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandH const Commands::SetRegulatoryConfig::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("SetRegulatoryConfig", "GeneralCommissioning"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::GeneralCommissioning_SetRegulatoryConfig); + MATTER_TRACE_SCOPE("SetRegulatoryConfig", "GeneralCommissioning"); DeviceControlServer * server = &DeviceLayer::DeviceControlServer::DeviceControlSvr(); Commands::SetRegulatoryConfigResponse::Type response; diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index 7dea1a6f3e55fc..53b4ffee95bc83 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -245,7 +245,7 @@ void Instance::OnNetworkingStatusChange(NetworkCommissioning::Status aCommission void Instance::HandleScanNetworks(HandlerContext & ctx, const Commands::ScanNetworks::DecodableType & req) { MATTER_TRACE_EVENT_SCOPE("HandleScanNetwork", "NetworkCommissioning"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleScanNetwork); + MATTER_TRACE_SCOPE("HandleScanNetwork", "NetworkCommissioning"); if (mFeatureFlags.Has(Feature::kWiFiNetworkInterface)) { ByteSpan ssid; @@ -318,7 +318,7 @@ bool CheckFailSafeArmed(CommandHandlerInterface::HandlerContext & ctx) void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req) { MATTER_TRACE_EVENT_SCOPE("HandleAddOrUpdateWiFiNetwork", "NetworkCommissioning"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleAddOrUpdateWiFiNetwork); + MATTER_TRACE_SCOPE("HandleAddOrUpdateWiFiNetwork", "NetworkCommissioning"); VerifyOrReturn(CheckFailSafeArmed(ctx)); @@ -377,7 +377,7 @@ void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands void Instance::HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Commands::AddOrUpdateThreadNetwork::DecodableType & req) { MATTER_TRACE_EVENT_SCOPE("HandleAddOrUpdateThreadNetwork", "NetworkCommissioning"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleAddOrUpdateThreadNetwork); + MATTER_TRACE_SCOPE("HandleAddOrUpdateThreadNetwork", "NetworkCommissioning"); VerifyOrReturn(CheckFailSafeArmed(ctx)); @@ -415,7 +415,7 @@ void Instance::CommitSavedBreadcrumb() void Instance::HandleRemoveNetwork(HandlerContext & ctx, const Commands::RemoveNetwork::DecodableType & req) { MATTER_TRACE_EVENT_SCOPE("HandleRemoveNetwork", "NetworkCommissioning"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleRemoveNetwork); + MATTER_TRACE_SCOPE("HandleRemoveNetwork", "NetworkCommissioning"); VerifyOrReturn(CheckFailSafeArmed(ctx)); @@ -438,7 +438,7 @@ void Instance::HandleRemoveNetwork(HandlerContext & ctx, const Commands::RemoveN void Instance::HandleConnectNetwork(HandlerContext & ctx, const Commands::ConnectNetwork::DecodableType & req) { MATTER_TRACE_EVENT_SCOPE("HandleConnectNetwork", "NetworkCommissioning"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleConnectNetwork); + MATTER_TRACE_SCOPE("HandleConnectNetwork", "NetworkCommissioning"); if (req.networkID.size() > DeviceLayer::NetworkCommissioning::kMaxNetworkIDLen) { ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::InvalidValue); @@ -457,7 +457,7 @@ void Instance::HandleConnectNetwork(HandlerContext & ctx, const Commands::Connec void Instance::HandleReorderNetwork(HandlerContext & ctx, const Commands::ReorderNetwork::DecodableType & req) { MATTER_TRACE_EVENT_SCOPE("HandleReorderNetwork", "NetworkCommissioning"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::NetworkCommissioning_HandleReorderNetwork); + MATTER_TRACE_SCOPE("HandleReorderNetwork", "NetworkCommissioning"); Commands::NetworkConfigResponse::Type response; MutableCharSpan debugText; #if CHIP_CONFIG_NETWORK_COMMISSIONING_DEBUG_TEXT_BUFFER_SIZE diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 765c0de0c3d9a4..1846cb24b46c84 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -409,7 +409,7 @@ bool emberAfOperationalCredentialsClusterRemoveFabricCallback(app::CommandHandle const Commands::RemoveFabric::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("RemoveFabric", "OperationalCredentials"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_RemoveFabric); + MATTER_TRACE_SCOPE("RemoveFabric", "OperationalCredentials"); auto & fabricBeingRemoved = commandData.fabricIndex; ChipLogProgress(Zcl, "OpCreds: Received a RemoveFabric Command for FabricIndex 0x%x", @@ -470,7 +470,7 @@ bool emberAfOperationalCredentialsClusterUpdateFabricLabelCallback(app::CommandH const Commands::UpdateFabricLabel::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("UpdateFabricLabel", "OperationalCredentials"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_UpdateFabricLabel); + MATTER_TRACE_SCOPE("UpdateFabricLabel", "OperationalCredentials"); auto & label = commandData.label; auto ourFabricIndex = commandObj->GetAccessingFabricIndex(); auto finalStatus = Status::Failure; @@ -593,7 +593,7 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co const Commands::AddNOC::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("AddNOC", "OperationalCredentials"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_AddNOC); + MATTER_TRACE_SCOPE("AddNOC", "OperationalCredentials"); auto & NOCValue = commandData.NOCValue; auto & ICACValue = commandData.ICACValue; auto & adminVendorId = commandData.adminVendorId; @@ -767,7 +767,7 @@ bool emberAfOperationalCredentialsClusterUpdateNOCCallback(app::CommandHandler * const Commands::UpdateNOC::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("UpdateNOC", "OperationalCredentials"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_UpdateNOC); + MATTER_TRACE_SCOPE("UpdateNOC", "OperationalCredentials"); auto & NOCValue = commandData.NOCValue; auto & ICACValue = commandData.ICACValue; @@ -860,7 +860,7 @@ bool emberAfOperationalCredentialsClusterCertificateChainRequestCallback( const Commands::CertificateChainRequest::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("CertificateChainRequest", "OperationalCredentials"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_CertificateChainRequest); + MATTER_TRACE_SCOPE("CertificateChainRequest", "OperationalCredentials"); auto & certificateType = commandData.certificateType; CHIP_ERROR err = CHIP_NO_ERROR; @@ -909,7 +909,7 @@ bool emberAfOperationalCredentialsClusterAttestationRequestCallback(app::Command const Commands::AttestationRequest::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("AttestationRequest", "OperationalCredentials"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_AttestationRequest); + MATTER_TRACE_SCOPE("AttestationRequest", "OperationalCredentials"); auto & attestationNonce = commandData.attestationNonce; auto finalStatus = Status::Failure; @@ -1006,7 +1006,7 @@ bool emberAfOperationalCredentialsClusterCSRRequestCallback(app::CommandHandler const Commands::CSRRequest::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("CSRRequest", "OperationalCredentials"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_CSRRequest); + MATTER_TRACE_SCOPE("CSRRequest", "OperationalCredentials"); ChipLogProgress(Zcl, "OpCreds: Received a CSRRequest command"); chip::Platform::ScopedMemoryBuffer nocsrElements; @@ -1142,7 +1142,7 @@ bool emberAfOperationalCredentialsClusterAddTrustedRootCertificateCallback( const Commands::AddTrustedRootCertificate::DecodableType & commandData) { MATTER_TRACE_EVENT_SCOPE("AddTrustedRootCertificate", "OperationalCredentials"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::OperationalCredentials_AddTrustedRootCertificate); + MATTER_TRACE_SCOPE("AddTrustedRootCertificate", "OperationalCredentials"); auto & fabricTable = Server::GetInstance().GetFabricTable(); auto finalStatus = Status::Failure; diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index acb524769ed37a..e095201d37767c 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -521,7 +521,7 @@ void DeviceCommissioner::Shutdown() CommissioneeDeviceProxy * DeviceCommissioner::FindCommissioneeDevice(NodeId id) { MATTER_TRACE_EVENT_SCOPE("FindCommissioneeDevice", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_FindCommissioneeDevice); + MATTER_TRACE_SCOPE("FindCommissioneeDevice", "DeviceCommissioner"); CommissioneeDeviceProxy * foundDevice = nullptr; mCommissioneeDevicePool.ForEachActiveObject([&](auto * deviceProxy) { if (deviceProxy->GetDeviceId() == id) @@ -592,7 +592,7 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, const char * se DiscoveryType discoveryType, Optional resolutionData) { MATTER_TRACE_EVENT_SCOPE("PairDevice", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_PairDevice); + MATTER_TRACE_SCOPE("PairDevice", "DeviceCommissioner"); if (mDefaultCommissioner == nullptr) { @@ -609,7 +609,7 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, const char * se Optional resolutionData) { MATTER_TRACE_EVENT_SCOPE("PairDevice", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_PairDevice); + MATTER_TRACE_SCOPE("PairDevice", "DeviceCommissioner"); return mSetUpCodePairer.PairDevice(remoteDeviceId, setUpCode, SetupCodePairerBehaviour::kCommission, discoveryType, resolutionData); } @@ -617,7 +617,7 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, const char * se CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParameters & params) { MATTER_TRACE_EVENT_SCOPE("PairDevice", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_PairDevice); + MATTER_TRACE_SCOPE("PairDevice", "DeviceCommissioner"); ReturnErrorOnFailure(EstablishPASEConnection(remoteDeviceId, params)); return Commission(remoteDeviceId); } @@ -626,7 +626,7 @@ CHIP_ERROR DeviceCommissioner::PairDevice(NodeId remoteDeviceId, RendezvousParam CommissioningParameters & commissioningParams) { MATTER_TRACE_EVENT_SCOPE("PairDevice", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_PairDevice); + MATTER_TRACE_SCOPE("PairDevice", "DeviceCommissioner"); ReturnErrorOnFailure(EstablishPASEConnection(remoteDeviceId, rendezvousParams)); return Commission(remoteDeviceId, commissioningParams); } @@ -635,7 +635,7 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, co Optional resolutionData) { MATTER_TRACE_EVENT_SCOPE("EstablishPASEConnection", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_EstablishPASEConnection); + MATTER_TRACE_SCOPE("EstablishPASEConnection", "DeviceCommissioner"); return mSetUpCodePairer.PairDevice(remoteDeviceId, setUpCode, SetupCodePairerBehaviour::kPaseOnly, discoveryType, resolutionData); } @@ -643,7 +643,7 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, co CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, RendezvousParameters & params) { MATTER_TRACE_EVENT_SCOPE("EstablishPASEConnection", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_EstablishPASEConnection); + MATTER_TRACE_SCOPE("EstablishPASEConnection", "DeviceCommissioner"); CHIP_ERROR err = CHIP_NO_ERROR; CommissioneeDeviceProxy * device = nullptr; CommissioneeDeviceProxy * current = nullptr; @@ -831,7 +831,7 @@ CHIP_ERROR DeviceCommissioner::Commission(NodeId remoteDeviceId, CommissioningPa CHIP_ERROR DeviceCommissioner::Commission(NodeId remoteDeviceId) { MATTER_TRACE_EVENT_SCOPE("Commission", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_Commission); + MATTER_TRACE_SCOPE("Commission", "DeviceCommissioner"); CommissioneeDeviceProxy * device = FindCommissioneeDevice(remoteDeviceId); if (device == nullptr || (!device->IsSecureConnected() && !device->IsSessionSetupInProgress())) { @@ -876,7 +876,7 @@ DeviceCommissioner::ContinueCommissioningAfterDeviceAttestation(DeviceProxy * de Credentials::AttestationVerificationResult attestationResult) { MATTER_TRACE_EVENT_SCOPE("continueCommissioningDevice", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_continueCommissioningDevice); + MATTER_TRACE_SCOPE("continueCommissioningDevice", "DeviceCommissioner"); if (device == nullptr || device != mDeviceBeingCommissioned) { ChipLogError(Controller, "Invalid device for commissioning %p", device); @@ -941,7 +941,7 @@ CHIP_ERROR DeviceCommissioner::StopPairing(NodeId remoteDeviceId) CHIP_ERROR DeviceCommissioner::UnpairDevice(NodeId remoteDeviceId) { MATTER_TRACE_EVENT_SCOPE("UnpairDevice", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_UnpairDevice); + MATTER_TRACE_SCOPE("UnpairDevice", "DeviceCommissioner"); VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); return AutoCurrentFabricRemover::RemoveCurrentFabric(this, remoteDeviceId); @@ -1010,7 +1010,7 @@ CHIP_ERROR DeviceCommissioner::SendCertificateChainRequestCommand(DeviceProxy * Optional timeout) { MATTER_TRACE_EVENT_SCOPE("SendCertificateChainRequestCommand", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_SendCertificateChainRequestCommand); + MATTER_TRACE_SCOPE("SendCertificateChainRequestCommand", "DeviceCommissioner"); ChipLogDetail(Controller, "Sending Certificate Chain request to %p device", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1024,7 +1024,7 @@ CHIP_ERROR DeviceCommissioner::SendCertificateChainRequestCommand(DeviceProxy * void DeviceCommissioner::OnCertificateChainFailureResponse(void * context, CHIP_ERROR error) { MATTER_TRACE_EVENT_SCOPE("OnCertificateChainFailureResponse", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnCertificateChainFailureResponse); + MATTER_TRACE_SCOPE("OnCertificateChainFailureResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device failed to receive the Certificate Chain request Response: %s", chip::ErrorStr(error)); DeviceCommissioner * commissioner = reinterpret_cast(context); commissioner->CommissioningStageComplete(error); @@ -1034,7 +1034,7 @@ void DeviceCommissioner::OnCertificateChainResponse( void * context, const chip::app::Clusters::OperationalCredentials::Commands::CertificateChainResponse::DecodableType & response) { MATTER_TRACE_EVENT_SCOPE("OnCertificateChainResponse", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnCertificateChainResponse); + MATTER_TRACE_SCOPE("OnCertificateChainResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Received certificate chain from the device"); DeviceCommissioner * commissioner = reinterpret_cast(context); @@ -1048,7 +1048,7 @@ CHIP_ERROR DeviceCommissioner::SendAttestationRequestCommand(DeviceProxy * devic Optional timeout) { MATTER_TRACE_EVENT_SCOPE("SendAttestationRequestCommand", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_SendAttestationRequestCommand); + MATTER_TRACE_SCOPE("SendAttestationRequestCommand", "DeviceCommissioner"); ChipLogDetail(Controller, "Sending Attestation request to %p device", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1063,7 +1063,7 @@ CHIP_ERROR DeviceCommissioner::SendAttestationRequestCommand(DeviceProxy * devic void DeviceCommissioner::OnAttestationFailureResponse(void * context, CHIP_ERROR error) { MATTER_TRACE_EVENT_SCOPE("OnAttestationFailureResponse", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnAttestationFailureResponse); + MATTER_TRACE_SCOPE("OnAttestationFailureResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device failed to receive the Attestation Information Response: %s", chip::ErrorStr(error)); DeviceCommissioner * commissioner = reinterpret_cast(context); commissioner->CommissioningStageComplete(error); @@ -1073,7 +1073,7 @@ void DeviceCommissioner::OnAttestationResponse(void * context, const OperationalCredentials::Commands::AttestationResponse::DecodableType & data) { MATTER_TRACE_EVENT_SCOPE("OnAttestationResponse", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnAttestationResponse); + MATTER_TRACE_SCOPE("OnAttestationResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Received Attestation Information from the device"); DeviceCommissioner * commissioner = reinterpret_cast(context); @@ -1086,7 +1086,7 @@ void DeviceCommissioner::OnDeviceAttestationInformationVerification( void * context, const Credentials::DeviceAttestationVerifier::AttestationInfo & info, AttestationVerificationResult result) { MATTER_TRACE_EVENT_SCOPE("OnDeviceAttestationInformationVerification", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnDeviceAttestationInformationVerification); + MATTER_TRACE_SCOPE("OnDeviceAttestationInformationVerification", "DeviceCommissioner"); DeviceCommissioner * commissioner = reinterpret_cast(context); if (!commissioner->mDeviceBeingCommissioned) @@ -1255,7 +1255,7 @@ void DeviceCommissioner::ExtendArmFailSafeForDeviceAttestation(const Credentials CHIP_ERROR DeviceCommissioner::ValidateAttestationInfo(const Credentials::DeviceAttestationVerifier::AttestationInfo & info) { MATTER_TRACE_EVENT_SCOPE("ValidateAttestationInfo", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_ValidateAttestationInfo); + MATTER_TRACE_SCOPE("ValidateAttestationInfo", "DeviceCommissioner"); VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(mDeviceAttestationVerifier != nullptr, CHIP_ERROR_INCORRECT_STATE); @@ -1270,7 +1270,7 @@ CHIP_ERROR DeviceCommissioner::ValidateCSR(DeviceProxy * proxy, const ByteSpan & const ByteSpan & AttestationSignature, const ByteSpan & dac, const ByteSpan & csrNonce) { MATTER_TRACE_EVENT_SCOPE("ValidateCSR", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_ValidateCSR); + MATTER_TRACE_SCOPE("ValidateCSR", "DeviceCommissioner"); VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(mDeviceAttestationVerifier != nullptr, CHIP_ERROR_INCORRECT_STATE); @@ -1290,7 +1290,7 @@ CHIP_ERROR DeviceCommissioner::SendOperationalCertificateSigningRequestCommand(D Optional timeout) { MATTER_TRACE_EVENT_SCOPE("SendOperationalCertificateSigningRequestCommand", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_SendOperationalCertificateSigningRequestCommand); + MATTER_TRACE_SCOPE("SendOperationalCertificateSigningRequestCommand", "DeviceCommissioner"); ChipLogDetail(Controller, "Sending CSR request to %p device", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1305,7 +1305,7 @@ CHIP_ERROR DeviceCommissioner::SendOperationalCertificateSigningRequestCommand(D void DeviceCommissioner::OnCSRFailureResponse(void * context, CHIP_ERROR error) { MATTER_TRACE_EVENT_SCOPE("OnCSRFailureResponse", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnCSRFailureResponse); + MATTER_TRACE_SCOPE("OnCSRFailureResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device failed to receive the CSR request Response: %s", chip::ErrorStr(error)); DeviceCommissioner * commissioner = static_cast(context); commissioner->CommissioningStageComplete(error); @@ -1315,7 +1315,7 @@ void DeviceCommissioner::OnOperationalCertificateSigningRequest( void * context, const OperationalCredentials::Commands::CSRResponse::DecodableType & data) { MATTER_TRACE_EVENT_SCOPE("OnOperationalCertificateSigningRequest", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnOperationalCertificateSigningRequest); + MATTER_TRACE_SCOPE("OnOperationalCertificateSigningRequest", "DeviceCommissioner"); ChipLogProgress(Controller, "Received certificate signing request from the device"); DeviceCommissioner * commissioner = static_cast(context); @@ -1329,7 +1329,7 @@ void DeviceCommissioner::OnDeviceNOCChainGeneration(void * context, CHIP_ERROR s Optional adminSubject) { MATTER_TRACE_EVENT_SCOPE("OnDeviceNOCChainGeneration", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnDeviceNOCChainGeneration); + MATTER_TRACE_SCOPE("OnDeviceNOCChainGeneration", "DeviceCommissioner"); DeviceCommissioner * commissioner = static_cast(context); // The placeholder IPK is not satisfactory, but is there to fill the NocChain struct on error. It will still fail. @@ -1362,7 +1362,7 @@ CHIP_ERROR DeviceCommissioner::IssueNOCChain(const ByteSpan & NOCSRElements, Nod chip::Callback::Callback * callback) { MATTER_TRACE_EVENT_SCOPE("IssueNOCChain", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_IssueNOCChain); + MATTER_TRACE_SCOPE("IssueNOCChain", "DeviceCommissioner"); VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); ChipLogProgress(Controller, "Getting certificate chain for the device on fabric idx %u", static_cast(mFabricIndex)); @@ -1385,7 +1385,7 @@ CHIP_ERROR DeviceCommissioner::ProcessCSR(DeviceProxy * proxy, const ByteSpan & const ByteSpan & csrNonce) { MATTER_TRACE_EVENT_SCOPE("ProcessOpCSR", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_ProcessOpCSR); + MATTER_TRACE_SCOPE("ProcessOpCSR", "DeviceCommissioner"); VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); ChipLogProgress(Controller, "Getting certificate chain for the device from the issuer"); @@ -1414,7 +1414,7 @@ CHIP_ERROR DeviceCommissioner::SendOperationalCertificate(DeviceProxy * device, Optional timeout) { MATTER_TRACE_EVENT_SCOPE("SendOperationalCertificate", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_SendOperationalCertificate); + MATTER_TRACE_SCOPE("SendOperationalCertificate", "DeviceCommissioner"); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1468,7 +1468,7 @@ CHIP_ERROR DeviceCommissioner::ConvertFromOperationalCertStatus(OperationalCrede void DeviceCommissioner::OnAddNOCFailureResponse(void * context, CHIP_ERROR error) { MATTER_TRACE_EVENT_SCOPE("OnAddNOCFailureResponse", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnAddNOCFailureResponse); + MATTER_TRACE_SCOPE("OnAddNOCFailureResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device failed to receive the operational certificate Response: %s", chip::ErrorStr(error)); DeviceCommissioner * commissioner = static_cast(context); commissioner->CommissioningStageComplete(error); @@ -1478,7 +1478,7 @@ void DeviceCommissioner::OnOperationalCertificateAddResponse( void * context, const OperationalCredentials::Commands::NOCResponse::DecodableType & data) { MATTER_TRACE_EVENT_SCOPE("OnOperationalCertificateAddResponse", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnOperationalCertificateAddResponse); + MATTER_TRACE_SCOPE("OnOperationalCertificateAddResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device returned status %d on receiving the NOC", to_underlying(data.statusCode)); DeviceCommissioner * commissioner = static_cast(context); @@ -1505,7 +1505,7 @@ CHIP_ERROR DeviceCommissioner::SendTrustedRootCertificate(DeviceProxy * device, Optional timeout) { MATTER_TRACE_EVENT_SCOPE("SendTrustedRootCertificate", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_SendTrustedRootCertificate); + MATTER_TRACE_SCOPE("SendTrustedRootCertificate", "DeviceCommissioner"); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); ChipLogProgress(Controller, "Sending root certificate to the device"); @@ -1522,7 +1522,7 @@ CHIP_ERROR DeviceCommissioner::SendTrustedRootCertificate(DeviceProxy * device, void DeviceCommissioner::OnRootCertSuccessResponse(void * context, const chip::app::DataModel::NullObjectType &) { MATTER_TRACE_EVENT_SCOPE("OnRootCertSuccessResponse", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnRootCertSuccessResponse); + MATTER_TRACE_SCOPE("OnRootCertSuccessResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device confirmed that it has received the root certificate"); DeviceCommissioner * commissioner = static_cast(context); commissioner->CommissioningStageComplete(CHIP_NO_ERROR); @@ -1531,7 +1531,7 @@ void DeviceCommissioner::OnRootCertSuccessResponse(void * context, const chip::a void DeviceCommissioner::OnRootCertFailureResponse(void * context, CHIP_ERROR error) { MATTER_TRACE_EVENT_SCOPE("OnRootCertFailureResponse", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnRootCertFailureResponse); + MATTER_TRACE_SCOPE("OnRootCertFailureResponse", "DeviceCommissioner"); ChipLogProgress(Controller, "Device failed to receive the root certificate Response: %s", chip::ErrorStr(error)); DeviceCommissioner * commissioner = static_cast(context); commissioner->CommissioningStageComplete(error); @@ -1540,7 +1540,7 @@ void DeviceCommissioner::OnRootCertFailureResponse(void * context, CHIP_ERROR er CHIP_ERROR DeviceCommissioner::OnOperationalCredentialsProvisioningCompletion(DeviceProxy * device) { MATTER_TRACE_EVENT_SCOPE("OnOperationalCredentialsProvisioningCompletion", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_OnOperationalCredentialsProvisioningCompletion); + MATTER_TRACE_SCOPE("OnOperationalCredentialsProvisioningCompletion", "DeviceCommissioner"); ChipLogProgress(Controller, "Operational credentials provisioned on device %p", device); VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -1732,7 +1732,7 @@ void DeviceCommissioner::CommissioningStageComplete(CHIP_ERROR err, Commissionin { // Once this stage is complete, reset mDeviceBeingCommissioned - this will be reset when the delegate calls the next step. MATTER_TRACE_EVENT_SCOPE("CommissioningStageComplete", "DeviceCommissioner"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::DeviceCommissioner_CommissioningStageComplete); + MATTER_TRACE_SCOPE("CommissioningStageComplete", "DeviceCommissioner"); if (mDeviceBeingCommissioned == nullptr) { // We are getting a stray callback (e.g. due to un-cancellable diff --git a/src/lib/dnssd/IncrementalResolve.cpp b/src/lib/dnssd/IncrementalResolve.cpp index 1b8915acd10470..baa150a6569320 100644 --- a/src/lib/dnssd/IncrementalResolve.cpp +++ b/src/lib/dnssd/IncrementalResolve.cpp @@ -24,7 +24,6 @@ #include #include #include -#include namespace chip { namespace Dnssd { @@ -241,7 +240,7 @@ IncrementalResolver::RequiredInformationFlags IncrementalResolver::GetMissingReq CHIP_ERROR IncrementalResolver::OnRecord(Inet::InterfaceId interface, const ResourceData & data, BytesRange packetRange) { - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::Resolve_IncrementalRecordParse); + MATTER_TRACE_SCOPE("Incremental record parse", "Resolver"); if (!IsActive()) { @@ -253,15 +252,14 @@ CHIP_ERROR IncrementalResolver::OnRecord(Inet::InterfaceId interface, const Reso case QType::TXT: if (data.GetName() != mRecordName.Get()) { - MATTER_TRACE_INSTANT(::chip::Tracing::Instant::Resolve_TxtNotApplicable); - + MATTER_TRACE_INSTANT("TXT not applicable", "Resolver"); return CHIP_NO_ERROR; } return OnTxtRecord(data, packetRange); case QType::A: { if (data.GetName() != mTargetHostName.Get()) { - MATTER_TRACE_INSTANT(::chip::Tracing::Instant::Resolve_Ipv4NotApplicable); + MATTER_TRACE_INSTANT("IPv4 not applicable", "Resolver"); return CHIP_NO_ERROR; } @@ -284,7 +282,7 @@ CHIP_ERROR IncrementalResolver::OnRecord(Inet::InterfaceId interface, const Reso case QType::AAAA: { if (data.GetName() != mTargetHostName.Get()) { - MATTER_TRACE_INSTANT(::chip::Tracing::Instant::Resolve_Ipv6NotApplicable); + MATTER_TRACE_INSTANT("IPv6 not applicable", "Resolver"); return CHIP_NO_ERROR; } diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index 4974dd76a283cd..e21633a0a8ba2f 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -433,7 +433,7 @@ CHIP_ERROR CASESession::EstablishSession(SessionManager & sessionManager, Fabric Optional mrpLocalConfig) { MATTER_TRACE_EVENT_SCOPE("EstablishSession", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_EstablishSession); + MATTER_TRACE_SCOPE("EstablishSession", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; // Return early on error here, as we have not initialized any state yet @@ -582,7 +582,7 @@ CHIP_ERROR CASESession::RecoverInitiatorIpk() CHIP_ERROR CASESession::SendSigma1() { MATTER_TRACE_EVENT_SCOPE("SendSigma1", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_SendSigma1); + MATTER_TRACE_SCOPE("SendSigma1", "CASESession"); const size_t mrpParamsSize = mLocalMRPConfig.HasValue() ? TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(uint16_t)) : 0; size_t data_len = TLV::EstimateStructOverhead(kSigmaParamRandomNumberSize, // initiatorRandom sizeof(uint16_t), // initiatorSessionId, @@ -689,7 +689,7 @@ CHIP_ERROR CASESession::SendSigma1() CHIP_ERROR CASESession::HandleSigma1_and_SendSigma2(System::PacketBufferHandle && msg) { MATTER_TRACE_EVENT_SCOPE("HandleSigma1_and_SendSigma2", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_HandleSigma1_and_SendSigma2); + MATTER_TRACE_SCOPE("HandleSigma1_and_SendSigma2", "CASESession"); ReturnErrorOnFailure(HandleSigma1(std::move(msg))); return CHIP_NO_ERROR; @@ -775,7 +775,7 @@ CHIP_ERROR CASESession::TryResumeSession(SessionResumptionStorage::ConstResumpti CHIP_ERROR CASESession::HandleSigma1(System::PacketBufferHandle && msg) { MATTER_TRACE_EVENT_SCOPE("HandleSigma1", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_HandleSigma1); + MATTER_TRACE_SCOPE("HandleSigma1", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; @@ -860,7 +860,7 @@ CHIP_ERROR CASESession::HandleSigma1(System::PacketBufferHandle && msg) CHIP_ERROR CASESession::SendSigma2Resume() { MATTER_TRACE_EVENT_SCOPE("SendSigma2Resume", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_SendSigma2Resume); + MATTER_TRACE_SCOPE("SendSigma2Resume", "CASESession"); const size_t mrpParamsSize = mLocalMRPConfig.HasValue() ? TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(uint16_t)) : 0; size_t max_sigma2_resume_data_len = TLV::EstimateStructOverhead( SessionResumptionStorage::kResumptionIdSize, CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES, sizeof(uint16_t), mrpParamsSize); @@ -915,7 +915,7 @@ CHIP_ERROR CASESession::SendSigma2Resume() CHIP_ERROR CASESession::SendSigma2() { MATTER_TRACE_EVENT_SCOPE("SendSigma2", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_SendSigma2); + MATTER_TRACE_SCOPE("SendSigma2", "CASESession"); VerifyOrReturnError(GetLocalSessionId().HasValue(), CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(mFabricsTable != nullptr, CHIP_ERROR_INCORRECT_STATE); @@ -1054,7 +1054,7 @@ CHIP_ERROR CASESession::SendSigma2() CHIP_ERROR CASESession::HandleSigma2Resume(System::PacketBufferHandle && msg) { MATTER_TRACE_EVENT_SCOPE("HandleSigma2Resume", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_HandleSigma2Resume); + MATTER_TRACE_SCOPE("HandleSigma2Resume", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; TLV::TLVType containerType = TLV::kTLVType_Structure; @@ -1121,7 +1121,7 @@ CHIP_ERROR CASESession::HandleSigma2Resume(System::PacketBufferHandle && msg) CHIP_ERROR CASESession::HandleSigma2_and_SendSigma3(System::PacketBufferHandle && msg) { MATTER_TRACE_EVENT_SCOPE("HandleSigma2_and_SendSigma3", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_HandleSigma2_and_SendSigma3); + MATTER_TRACE_SCOPE("HandleSigma2_and_SendSigma3", "CASESession"); ReturnErrorOnFailure(HandleSigma2(std::move(msg))); ReturnErrorOnFailure(SendSigma3a()); @@ -1131,7 +1131,7 @@ CHIP_ERROR CASESession::HandleSigma2_and_SendSigma3(System::PacketBufferHandle & CHIP_ERROR CASESession::HandleSigma2(System::PacketBufferHandle && msg) { MATTER_TRACE_EVENT_SCOPE("HandleSigma2", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_HandleSigma2); + MATTER_TRACE_SCOPE("HandleSigma2", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; TLV::TLVReader decryptedDataTlvReader; @@ -1301,7 +1301,7 @@ CHIP_ERROR CASESession::HandleSigma2(System::PacketBufferHandle && msg) CHIP_ERROR CASESession::SendSigma3a() { MATTER_TRACE_EVENT_SCOPE("SendSigma3", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_SendSigma3); + MATTER_TRACE_SCOPE("SendSigma3", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; ChipLogDetail(SecureChannel, "Sending Sigma3"); @@ -1516,7 +1516,7 @@ CHIP_ERROR CASESession::SendSigma3c(SendSigma3Data & data, CHIP_ERROR status) CHIP_ERROR CASESession::HandleSigma3a(System::PacketBufferHandle && msg) { MATTER_TRACE_EVENT_SCOPE("HandleSigma3", "CASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::CASESession_HandleSigma3); + MATTER_TRACE_SCOPE("HandleSigma3", "CASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; TLV::TLVReader decryptedDataTlvReader; diff --git a/src/protocols/secure_channel/PASESession.cpp b/src/protocols/secure_channel/PASESession.cpp index c8ee3bc97a9e96..efe1973ce971c9 100644 --- a/src/protocols/secure_channel/PASESession.cpp +++ b/src/protocols/secure_channel/PASESession.cpp @@ -136,7 +136,7 @@ CHIP_ERROR PASESession::GeneratePASEVerifier(Spake2pVerifier & verifier, uint32_ bool useRandomPIN, uint32_t & setupPINCode) { MATTER_TRACE_EVENT_SCOPE("GeneratePASEVerifier", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_GeneratePASEVerifier); + MATTER_TRACE_SCOPE("GeneratePASEVerifier", "PASESession"); if (useRandomPIN) { @@ -152,7 +152,7 @@ CHIP_ERROR PASESession::GeneratePASEVerifier(Spake2pVerifier & verifier, uint32_ CHIP_ERROR PASESession::SetupSpake2p() { MATTER_TRACE_EVENT_SCOPE("SetupSpake2p", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_SetupSpake2p); + MATTER_TRACE_SCOPE("SetupSpake2p", "PASESession"); uint8_t context[kSHA256_Hash_Length] = { 0 }; MutableByteSpan contextSpan{ context }; @@ -214,7 +214,7 @@ CHIP_ERROR PASESession::Pair(SessionManager & sessionManager, uint32_t peerSetUp SessionEstablishmentDelegate * delegate) { MATTER_TRACE_EVENT_SCOPE("Pair", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_Pair); + MATTER_TRACE_SCOPE("Pair", "PASESession"); ReturnErrorCodeIf(exchangeCtxt == nullptr, CHIP_ERROR_INVALID_ARGUMENT); CHIP_ERROR err = Init(sessionManager, peerSetUpPINCode, delegate); SuccessOrExit(err); @@ -269,7 +269,7 @@ CHIP_ERROR PASESession::DeriveSecureSession(CryptoContext & session) const CHIP_ERROR PASESession::SendPBKDFParamRequest() { MATTER_TRACE_EVENT_SCOPE("SendPBKDFParamRequest", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_SendPBKDFParamRequest); + MATTER_TRACE_SCOPE("SendPBKDFParamRequest", "PASESession"); VerifyOrReturnError(GetLocalSessionId().HasValue(), CHIP_ERROR_INCORRECT_STATE); @@ -319,7 +319,7 @@ CHIP_ERROR PASESession::SendPBKDFParamRequest() CHIP_ERROR PASESession::HandlePBKDFParamRequest(System::PacketBufferHandle && msg) { MATTER_TRACE_EVENT_SCOPE("HandlePBKDFParamRequest", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_HandlePBKDFParamRequest); + MATTER_TRACE_SCOPE("HandlePBKDFParamRequest", "PASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; @@ -383,7 +383,7 @@ CHIP_ERROR PASESession::HandlePBKDFParamRequest(System::PacketBufferHandle && ms CHIP_ERROR PASESession::SendPBKDFParamResponse(ByteSpan initiatorRandom, bool initiatorHasPBKDFParams) { MATTER_TRACE_EVENT_SCOPE("SendPBKDFParamResponse", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_SendPBKDFParamResponse); + MATTER_TRACE_SCOPE("SendPBKDFParamResponse", "PASESession"); VerifyOrReturnError(GetLocalSessionId().HasValue(), CHIP_ERROR_INCORRECT_STATE); @@ -445,7 +445,7 @@ CHIP_ERROR PASESession::SendPBKDFParamResponse(ByteSpan initiatorRandom, bool in CHIP_ERROR PASESession::HandlePBKDFParamResponse(System::PacketBufferHandle && msg) { MATTER_TRACE_EVENT_SCOPE("HandlePBKDFParamResponse", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_HandlePBKDFParamResponse); + MATTER_TRACE_SCOPE("HandlePBKDFParamResponse", "PASESession"); CHIP_ERROR err = CHIP_NO_ERROR; System::PacketBufferTLVReader tlvReader; @@ -542,7 +542,7 @@ CHIP_ERROR PASESession::HandlePBKDFParamResponse(System::PacketBufferHandle && m CHIP_ERROR PASESession::SendMsg1() { MATTER_TRACE_EVENT_SCOPE("SendMsg1", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_SendMsg1); + MATTER_TRACE_SCOPE("SendMsg1", "PASESession"); const size_t max_msg_len = TLV::EstimateStructOverhead(kMAX_Point_Length); System::PacketBufferHandle msg = System::PacketBufferHandle::New(max_msg_len); VerifyOrReturnError(!msg.IsNull(), CHIP_ERROR_NO_MEMORY); @@ -576,7 +576,7 @@ CHIP_ERROR PASESession::SendMsg1() CHIP_ERROR PASESession::HandleMsg1_and_SendMsg2(System::PacketBufferHandle && msg1) { MATTER_TRACE_EVENT_SCOPE("HandleMsg1_and_SendMsg2", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_HandleMsg1_and_SendMsg2); + MATTER_TRACE_SCOPE("HandleMsg1_and_SendMsg2", "PASESession"); CHIP_ERROR err = CHIP_NO_ERROR; uint8_t Y[kMAX_Point_Length]; @@ -647,7 +647,7 @@ CHIP_ERROR PASESession::HandleMsg1_and_SendMsg2(System::PacketBufferHandle && ms CHIP_ERROR PASESession::HandleMsg2_and_SendMsg3(System::PacketBufferHandle && msg2) { MATTER_TRACE_EVENT_SCOPE("HandleMsg2_and_SendMsg3", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_HandleMsg2_and_SendMsg3); + MATTER_TRACE_SCOPE("HandleMsg2_and_SendMsg3", "PASESession"); CHIP_ERROR err = CHIP_NO_ERROR; uint8_t verifier[kMAX_Hash_Length]; @@ -724,7 +724,7 @@ CHIP_ERROR PASESession::HandleMsg2_and_SendMsg3(System::PacketBufferHandle && ms CHIP_ERROR PASESession::HandleMsg3(System::PacketBufferHandle && msg) { MATTER_TRACE_EVENT_SCOPE("HandleMsg3", "PASESession"); - MATTER_TRACE_SCOPE(::chip::Tracing::Scope::PASESession_HandleMsg3); + MATTER_TRACE_SCOPE("HandleMsg3", "PASESession"); CHIP_ERROR err = CHIP_NO_ERROR; ChipLogDetail(SecureChannel, "Received spake2p msg3"); diff --git a/src/tracing/BUILD.gn b/src/tracing/BUILD.gn index 218962c9805ec1..5a081a943b3b12 100644 --- a/src/tracing/BUILD.gn +++ b/src/tracing/BUILD.gn @@ -15,10 +15,27 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") +import("${chip_root}/build/chip/buildconfig_header.gni") import("${chip_root}/src/tracing/tracing_args.gni") -config("tracing_enabled") { - defines = [ "MATTER_TRACING_ENABLED" ] +buildconfig_header("tracing_buildconfig") { + header = "build_config.h" + header_dir = "matter/tracing" + + defines = [] + + if (matter_enable_tracing_support) { + defines += [ "MATTER_TRACING_ENABLED=1" ] + } + + if (matter_trace_config == "multiplexed") { + defines += [ "MATTER_TRACE_MULTIPLEXED=1" ] + } else if (matter_trace_config == "none") { + defines += [ "MATTER_TRACE_NONE=1" ] + } else { + # Expect a separate config to be set, that provides + # matter/tracing/macros_impl.h + } } static_library("tracing") { @@ -29,12 +46,16 @@ static_library("tracing") { "registry.cpp", "registry.h", "scope.h", - "scopes.h", ] - public_deps = [ "${chip_root}/src/lib/support" ] + public_deps = [ + ":tracing_buildconfig", + "${chip_root}/src/lib/support", + ] if (matter_enable_tracing_support) { - public_configs = [ ":tracing_enabled" ] + if (matter_trace_config != "multiplexed" && matter_trace_config != "none") { + public_configs += [ matter_trace_config ] + } } } diff --git a/src/tracing/backend.h b/src/tracing/backend.h index adf6b75a97828e..db8eb58a73eb35 100644 --- a/src/tracing/backend.h +++ b/src/tracing/backend.h @@ -18,7 +18,6 @@ #include #include -#include namespace chip { namespace Tracing { @@ -34,35 +33,31 @@ class Backend : public ::chip::IntrusiveListNodeBase<> /// Begin a trace for the specified scope. /// - /// Scopes must be completed by a corresponding - /// TraceEnd call. - virtual void TraceBegin(Scope scope) = 0; + /// Scope WILL be completed by a corresponding TraceEnd call. + virtual void TraceBegin(const char * label, const char * group) {} - /// Tracing end assumes completing a previously - /// started scope with TraceBegin and nesting is assumed. + /// Tracing end assumes completing a previously started scope with TraceBegin + /// and nesting is assumed. /// /// Expect scopes like: - /// TraceBegin(Foo) - /// TraceBegin(Bar) - /// TraceEnd(Bar) - /// TraceEnd(Foo) + /// TraceBegin("foo", "A") + /// TraceBegin("bar", "A") /// - /// The following is NOT acceptable: - /// TraceBegin(Foo) - /// TraceBegin(Bar) - /// TraceEnd(Foo) - /// TraceEnd(Bar) - virtual void TraceEnd(Scope scope) = 0; + /// // NOT VALID HERE: TraceEnd("foo", "A") + /// + /// TraceEnd("bar", "A") // ends "BAR" + /// TraceEnd("foo", "A") // ends "FOO" + virtual void TraceEnd(const char * label, const char * group) {} /// Trace a zero-sized event - virtual void TraceInstant(Instant instant) = 0; + virtual void TraceInstant(const char * label, const char * group) {} - virtual void LogMessageSend(MessageSendInfo &) { TraceInstant(Instant::Log_MessageSend); } - virtual void LogMessageReceived(MessageReceivedInfo &) { TraceInstant(Instant::Log_MessageReceived); } + virtual void LogMessageSend(MessageSendInfo &) { TraceInstant("MessageSent", "Messaging"); } + virtual void LogMessageReceived(MessageReceivedInfo &) { TraceInstant("MessageReceived", "Messaging"); } - virtual void LogNodeLookup(NodeLookupInfo &) { TraceInstant(Instant::Log_NodeLookup); } - virtual void LogNodeDiscovered(NodeDiscoveredInfo &) { TraceInstant(Instant::Log_NodeDiscovered); } - virtual void LogNodeDiscoveryFailed(NodeDiscoveryFailedInfo &) { TraceInstant(Instant::Log_NodeDiscoveryFailed); } + virtual void LogNodeLookup(NodeLookupInfo &) { TraceInstant("Lookup", "DNSSD"); } + virtual void LogNodeDiscovered(NodeDiscoveredInfo &) { TraceInstant("Node Discovered", "DNSSD"); } + virtual void LogNodeDiscoveryFailed(NodeDiscoveryFailedInfo &) { TraceInstant("Discovery Failed", "DNSSD"); } }; } // namespace Tracing diff --git a/src/tracing/log_json/log_json_tracing.cpp b/src/tracing/log_json/log_json_tracing.cpp index 933009d67bea94..1dc46c1ab02a09 100644 --- a/src/tracing/log_json/log_json_tracing.cpp +++ b/src/tracing/log_json/log_json_tracing.cpp @@ -36,177 +36,6 @@ namespace { using chip::StringBuilder; -std::string ScopeToString(Scope scope) -{ - switch (scope) - { - case Scope::CASESession_EstablishSession: - return "CASESession::EstablishSession"; - case Scope::CASESession_HandleSigma1: - return "CASESession::HandleSigma1"; - case Scope::CASESession_HandleSigma1_and_SendSigma2: - return "CASESession_HandleSigma1_and::SendSigma2"; - case Scope::CASESession_HandleSigma2: - return "CASESession::HandleSigma2"; - case Scope::CASESession_HandleSigma2_and_SendSigma3: - return "CASESession_HandleSigma2_and::SendSigma3"; - case Scope::CASESession_HandleSigma2Resume: - return "CASESession::HandleSigma2Resume"; - case Scope::CASESession_HandleSigma3: - return "CASESession::HandleSigma3"; - case Scope::CASESession_SendSigma1: - return "CASESession::SendSigma1"; - case Scope::CASESession_SendSigma2: - return "CASESession::SendSigma2"; - case Scope::CASESession_SendSigma2Resume: - return "CASESession::SendSigma2Resume"; - case Scope::CASESession_SendSigma3: - return "CASESession::SendSigma3"; - case Scope::DeviceCommissioner_Commission: - return "DeviceCommissioner::Commission"; - case Scope::DeviceCommissioner_CommissioningStageComplete: - return "DeviceCommissioner::CommissioningStageComplete"; - case Scope::DeviceCommissioner_continueCommissioningDevice: - return "DeviceCommissioner::continueCommissioningDevice"; - case Scope::DeviceCommissioner_EstablishPASEConnection: - return "DeviceCommissioner::EstablishPASEConnection"; - case Scope::DeviceCommissioner_FindCommissioneeDevice: - return "DeviceCommissioner::FindCommissioneeDevice"; - case Scope::DeviceCommissioner_IssueNOCChain: - return "DeviceCommissioner::IssueNOCChain"; - case Scope::DeviceCommissioner_OnAddNOCFailureResponse: - return "DeviceCommissioner::OnAddNOCFailureResponse"; - case Scope::DeviceCommissioner_OnAttestationFailureResponse: - return "DeviceCommissioner::OnAttestationFailureResponse"; - case Scope::DeviceCommissioner_OnAttestationResponse: - return "DeviceCommissioner::OnAttestationResponse"; - case Scope::DeviceCommissioner_OnCertificateChainFailureResponse: - return "DeviceCommissioner::OnCertificateChainFailureResponse"; - case Scope::DeviceCommissioner_OnCertificateChainResponse: - return "DeviceCommissioner::OnCertificateChainResponse"; - case Scope::DeviceCommissioner_OnCSRFailureResponse: - return "DeviceCommissioner::OnCSRFailureResponse"; - case Scope::DeviceCommissioner_OnDeviceAttestationInformationVerification: - return "DeviceCommissioner::OnDeviceAttestationInformationVerification"; - case Scope::DeviceCommissioner_OnDeviceNOCChainGeneration: - return "DeviceCommissioner::OnDeviceNOCChainGeneration"; - case Scope::DeviceCommissioner_OnOperationalCertificateAddResponse: - return "DeviceCommissioner::OnOperationalCertificateAddResponse"; - case Scope::DeviceCommissioner_OnOperationalCertificateSigningRequest: - return "DeviceCommissioner::OnOperationalCertificateSigningRequest"; - case Scope::DeviceCommissioner_OnOperationalCredentialsProvisioningCompletion: - return "DeviceCommissioner::OnOperationalCredentialsProvisioningCompletion"; - case Scope::DeviceCommissioner_OnRootCertFailureResponse: - return "DeviceCommissioner::OnRootCertFailureResponse"; - case Scope::DeviceCommissioner_OnRootCertSuccessResponse: - return "DeviceCommissioner::OnRootCertSuccessResponse"; - case Scope::DeviceCommissioner_PairDevice: - return "DeviceCommissioner::PairDevice"; - case Scope::DeviceCommissioner_ProcessOpCSR: - return "DeviceCommissioner::ProcessOpCSR"; - case Scope::DeviceCommissioner_SendAttestationRequestCommand: - return "DeviceCommissioner::SendAttestationRequestCommand"; - case Scope::DeviceCommissioner_SendCertificateChainRequestCommand: - return "DeviceCommissioner::SendCertificateChainRequestCommand"; - case Scope::DeviceCommissioner_SendOperationalCertificate: - return "DeviceCommissioner::SendOperationalCertificate"; - case Scope::DeviceCommissioner_SendOperationalCertificateSigningRequestCommand: - return "DeviceCommissioner::SendOperationalCertificateSigningRequestCommand"; - case Scope::DeviceCommissioner_SendTrustedRootCertificate: - return "DeviceCommissioner::SendTrustedRootCertificate"; - case Scope::DeviceCommissioner_UnpairDevice: - return "DeviceCommissioner::UnpairDevice"; - case Scope::DeviceCommissioner_ValidateAttestationInfo: - return "DeviceCommissioner::ValidateAttestationInfo"; - case Scope::DeviceCommissioner_ValidateCSR: - return "DeviceCommissioner::ValidateCSR"; - case Scope::GeneralCommissioning_ArmFailSafe: - return "GeneralCommissioning::ArmFailSafe"; - case Scope::GeneralCommissioning_CommissioningComplete: - return "GeneralCommissioning::CommissioningComplete"; - case Scope::GeneralCommissioning_SetRegulatoryConfig: - return "GeneralCommissioning::SetRegulatoryConfig"; - case Scope::NetworkCommissioning_HandleAddOrUpdateThreadNetwork: - return "NetworkCommissioning::HandleAddOrUpdateThreadNetwork"; - case Scope::NetworkCommissioning_HandleAddOrUpdateWiFiNetwork: - return "NetworkCommissioning::HandleAddOrUpdateWiFiNetwork"; - case Scope::NetworkCommissioning_HandleConnectNetwork: - return "NetworkCommissioning::HandleConnectNetwork"; - case Scope::NetworkCommissioning_HandleRemoveNetwork: - return "NetworkCommissioning::HandleRemoveNetwork"; - case Scope::NetworkCommissioning_HandleReorderNetwork: - return "NetworkCommissioning::HandleReorderNetwork"; - case Scope::NetworkCommissioning_HandleScanNetwork: - return "NetworkCommissioning::HandleScanNetwork"; - case Scope::OperationalCredentials_AddNOC: - return "OperationalCredentials::AddNOC"; - case Scope::OperationalCredentials_AddTrustedRootCertificate: - return "OperationalCredentials::AddTrustedRootCertificate"; - case Scope::OperationalCredentials_AttestationRequest: - return "OperationalCredentials::AttestationRequest"; - case Scope::OperationalCredentials_CertificateChainRequest: - return "OperationalCredentials::CertificateChainRequest"; - case Scope::OperationalCredentials_CSRRequest: - return "OperationalCredentials::CSRRequest"; - case Scope::OperationalCredentials_RemoveFabric: - return "OperationalCredentials::RemoveFabric"; - case Scope::OperationalCredentials_UpdateFabricLabel: - return "OperationalCredentials::UpdateFabricLabel"; - case Scope::OperationalCredentials_UpdateNOC: - return "OperationalCredentials::UpdateNOC"; - case Scope::PASESession_GeneratePASEVerifier: - return "PASESession::GeneratePASEVerifier"; - case Scope::PASESession_HandleMsg1_and_SendMsg2: - return "PASESession_HandleMsg1_and::SendMsg2"; - case Scope::PASESession_HandleMsg2_and_SendMsg3: - return "PASESession_HandleMsg2_and::SendMsg3"; - case Scope::PASESession_HandleMsg3: - return "PASESession::HandleMsg3"; - case Scope::PASESession_HandlePBKDFParamRequest: - return "PASESession::HandlePBKDFParamRequest"; - case Scope::PASESession_HandlePBKDFParamResponse: - return "PASESession::HandlePBKDFParamResponse"; - case Scope::PASESession_Pair: - return "PASESession::Pair"; - case Scope::PASESession_SendMsg1: - return "PASESession::SendMsg1"; - case Scope::PASESession_SendPBKDFParamRequest: - return "PASESession::SendPBKDFParamRequest"; - case Scope::PASESession_SendPBKDFParamResponse: - return "PASESession::SendPBKDFParamResponse"; - case Scope::PASESession_SetupSpake2p: - return "PASESession::SetupSpake2p"; - case Scope::Resolve_IncrementalRecordParse: - return "Resolve::IncrementalRecordParse"; - default: { - StringBuilder<64> builder; - builder.Add("Scope::Unknown("); - builder.Add(static_cast(scope)); - builder.Add(")"); - return builder.c_str(); - } - } -} - -std::string InstantToString(Instant instant) -{ - switch (instant) - { - case Instant::Resolve_TxtNotApplicable: - return "Resolve::TxtNotApplicable"; - case Instant::Resolve_Ipv4NotApplicable: - return "Resolve::Ipv4NotApplicable"; - case Instant::Resolve_Ipv6NotApplicable: - return "Resolve::Ipv6NotApplicable"; - default: { - StringBuilder<64> builder; - builder.Add("Instant::Unknown("); - builder.Add(static_cast(instant)); - builder.Add(")"); - return builder.c_str(); - } - } -} /// Writes the given value to chip log void LogJsonValue(Json::Value const & value) { @@ -279,27 +108,30 @@ void DecodePayloadData(Json::Value & value, chip::ByteSpan payload) } // namespace -void LogJsonBackend::TraceBegin(Scope scope) +void LogJsonBackend::TraceBegin(const char * label, const char * group) { Json::Value value; - value["event"] = "begin"; - value["scope"] = ScopeToString(scope); + value["event"] = "TraceBegin"; + value["label"] = label; + value["group"] = group; LogJsonValue(value); } -void LogJsonBackend::TraceEnd(Scope scope) +void LogJsonBackend::TraceEnd(const char * label, const char * group) { Json::Value value; - value["event"] = "end"; - value["scope"] = ScopeToString(scope); + value["event"] = "TraceEnd"; + value["label"] = label; + value["group"] = group; LogJsonValue(value); } -void LogJsonBackend::TraceInstant(Instant instant) +void LogJsonBackend::TraceInstant(const char * label, const char * group) { Json::Value value; - value["event"] = "instant"; - value["instant"] = InstantToString(instant); + value["event"] = "TraceInstant"; + value["label"] = label; + value["group"] = group; LogJsonValue(value); } diff --git a/src/tracing/log_json/log_json_tracing.h b/src/tracing/log_json/log_json_tracing.h index ef462c9c37be95..d75de53db79899 100644 --- a/src/tracing/log_json/log_json_tracing.h +++ b/src/tracing/log_json/log_json_tracing.h @@ -31,9 +31,9 @@ class LogJsonBackend : public ::chip::Tracing::Backend public: LogJsonBackend() = default; - void TraceBegin(Scope scope) override; - void TraceEnd(Scope scope) override; - void TraceInstant(Instant instant) override; + void TraceBegin(const char * label, const char * group) override; + void TraceEnd(const char * label, const char * group) override; + void TraceInstant(const char * label, const char * group) override; void LogMessageSend(MessageSendInfo &) override; void LogMessageReceived(MessageReceivedInfo &) override; void LogNodeLookup(NodeLookupInfo &) override; diff --git a/src/tracing/macros.h b/src/tracing/macros.h index 3f9a828a161be9..ff12900d035089 100644 --- a/src/tracing/macros.h +++ b/src/tracing/macros.h @@ -17,16 +17,17 @@ */ #pragma once -#ifndef MATTER_TRACING_ENABLED +#include #define _MATTER_TRACE_DISABLE(...) \ do \ { \ } while (false) +#ifndef MATTER_TRACING_ENABLED + #define MATTER_TRACE_BEGIN(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) #define MATTER_TRACE_END(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) - #define MATTER_TRACE_INSTANT(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) #define MATTER_LOG_MESSAGE_SEND(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) @@ -40,11 +41,33 @@ #include #include -#include -#define MATTER_TRACE_BEGIN(scope) ::chip::Tracing::Internal::Begin(scope) -#define MATTER_TRACE_END(scope) ::chip::Tracing::Internal::End(scope) -#define MATTER_TRACE_INSTANT(scope) ::chip::Tracing::Internal::Instant(scope) +////////////////////// TRACE MESSAGES + +#ifdef MATTER_TRACE_NONE + +#define MATTER_TRACE_BEGIN(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_END(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) +#define MATTER_TRACE_INSTANT(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) + +#elif defined(MATTER_TRACE_MULTIPLEXED) + +// This gets forwarded to the multiplexed instance +#define MATTER_TRACE_BEGIN(label, group) ::chip::Tracing::Internal::Begin(label, group) +#define MATTER_TRACE_END(label, group) ::chip::Tracing::Internal::End(label, group) +#define MATTER_TRACE_INSTANT(label, group) ::chip::Tracing::Internal::Instant(label, group) + +#else +// if matter trace config is set, macros for this have to be provided +// +// Expected macros provided by implementations: +// MATTER_TRACE_BEGIN(label, group) +// MATTER_TRACE_END(label, group) +// MATTER_TRACE_INSTANT(label, group) +#include +#endif + +////////////////////// DATA LOGGING #define MATTER_LOG_MESSAGE_SEND(...) \ do \ diff --git a/src/tracing/registry.cpp b/src/tracing/registry.cpp index bb9862383f2857..f98f9a12e47c6b 100644 --- a/src/tracing/registry.cpp +++ b/src/tracing/registry.cpp @@ -16,6 +16,7 @@ */ #include +#include #include #include @@ -43,26 +44,27 @@ void Unregister(Backend & backend) namespace Internal { -void Begin(::chip::Tracing::Scope scope) +void Begin(const char * label, const char * group) { for (auto & backend : gTracingBackends) { - backend.TraceBegin(scope); + backend.TraceBegin(label, group); } } -void End(::chip::Tracing::Scope scope) +void End(const char * label, const char * group) { for (auto & backend : gTracingBackends) { - backend.TraceEnd(scope); + backend.TraceEnd(label, group); } } -void Instant(::chip::Tracing::Instant instant) + +void Instant(const char * label, const char * group) { for (auto & backend : gTracingBackends) { - backend.TraceInstant(instant); + backend.TraceInstant(label, group); } } diff --git a/src/tracing/registry.h b/src/tracing/registry.h index b3a5a6aaf1564f..755c1162e50784 100644 --- a/src/tracing/registry.h +++ b/src/tracing/registry.h @@ -59,9 +59,9 @@ class ScopedRegistration // Internal calls, that will delegate to appropriate backends as needed namespace Internal { -void Begin(::chip::Tracing::Scope scope); -void End(::chip::Tracing::Scope scope); -void Instant(::chip::Tracing::Instant instant); +void Begin(const char * label, const char * group); +void End(const char * label, const char * group); +void Instant(const char * label, const char * group); void LogMessageSend(::chip::Tracing::MessageSendInfo & info); void LogMessageReceived(::chip::Tracing::MessageReceivedInfo & info); diff --git a/src/tracing/scope.h b/src/tracing/scope.h index 5bbcd078bd6a4b..71dd04ff660b03 100644 --- a/src/tracing/scope.h +++ b/src/tracing/scope.h @@ -17,11 +17,18 @@ */ #pragma once +#include + #include -#include #ifdef MATTER_TRACING_ENABLED +#ifdef MATTER_TRACE_NONE + +#define MATTER_TRACE_SCOPE(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) + +#elif defined(MATTER_TRACE_MULTIPLEXED) + namespace chip { namespace Tracing { @@ -29,7 +36,7 @@ namespace Tracing { /// /// Usage: /// { -/// ::chip::Tracing::Scoped scope(::chip::Tracing::Scope::CASESession_SendSigma1); +/// ::chip::Tracing::Scoped scope("label", "group"); /// // TRACE_BEGIN called here /// /// // ... add code here @@ -39,11 +46,12 @@ namespace Tracing { class Scoped { public: - inline Scoped(Scope scope) : mScope(scope) { MATTER_TRACE_BEGIN(scope); } - inline ~Scoped() { MATTER_TRACE_END(mScope); } + inline Scoped(const char * label, const char * group) : mLabel(label), mGroup(group) { MATTER_TRACE_BEGIN(label, group); } + inline ~Scoped() { MATTER_TRACE_END(mLabel, mGroup); } private: - Scope mScope; + const char * mLabel; + const char * mGroup; }; } // namespace Tracing @@ -62,13 +70,15 @@ class Scoped /// // ... add code here /// /// } // TRACE_END called here -#define MATTER_TRACE_SCOPE(scope) ::chip::Tracing::Scoped _MACRO_CONCAT(_trace_scope, __COUNTER__)(scope) +#define MATTER_TRACE_SCOPE(label, group) ::chip::Tracing::Scoped _MACRO_CONCAT(_trace_scope, __COUNTER__)(label, group) + +#else +// backends MUST provide a config for this +#include +#endif #else // ifdef MATTER_TRACING_ENABLED -#define MATTER_TRACE_SCOPE(scope) \ - do \ - { \ - } while (false) +#define MATTER_TRACE_SCOPE(...) _MATTER_TRACE_DISABLE(__VA_ARGS__) #endif diff --git a/src/tracing/scopes.h b/src/tracing/scopes.h deleted file mode 100644 index 5447652a9cd52b..00000000000000 --- a/src/tracing/scopes.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -namespace chip { -namespace Tracing { - -/// Trace scopes defined as an enumeration, since various tracing back-ends -/// may need to use constant strings for tracing. -/// -/// As a result, tracing scopes in CHIP are from a known list. -enum class Scope -{ - UndefinedDoNotUse = 0, - - CASESession_EstablishSession = 1, - CASESession_HandleSigma1 = 2, - CASESession_HandleSigma1_and_SendSigma2 = 3, - CASESession_HandleSigma2 = 4, - CASESession_HandleSigma2_and_SendSigma3 = 5, - CASESession_HandleSigma2Resume = 6, - CASESession_HandleSigma3 = 7, - CASESession_SendSigma1 = 8, - CASESession_SendSigma2 = 9, - CASESession_SendSigma2Resume = 10, - CASESession_SendSigma3 = 11, - DeviceCommissioner_Commission = 12, - DeviceCommissioner_CommissioningStageComplete = 13, - DeviceCommissioner_continueCommissioningDevice = 14, - DeviceCommissioner_EstablishPASEConnection = 15, - DeviceCommissioner_FindCommissioneeDevice = 16, - DeviceCommissioner_IssueNOCChain = 17, - DeviceCommissioner_OnAddNOCFailureResponse = 18, - DeviceCommissioner_OnAttestationFailureResponse = 19, - DeviceCommissioner_OnAttestationResponse = 20, - DeviceCommissioner_OnCertificateChainFailureResponse = 21, - DeviceCommissioner_OnCertificateChainResponse = 22, - DeviceCommissioner_OnCSRFailureResponse = 23, - DeviceCommissioner_OnDeviceAttestationInformationVerification = 24, - DeviceCommissioner_OnDeviceNOCChainGeneration = 25, - DeviceCommissioner_OnOperationalCertificateAddResponse = 26, - DeviceCommissioner_OnOperationalCertificateSigningRequest = 27, - DeviceCommissioner_OnOperationalCredentialsProvisioningCompletion = 28, - DeviceCommissioner_OnRootCertFailureResponse = 29, - DeviceCommissioner_OnRootCertSuccessResponse = 30, - DeviceCommissioner_PairDevice = 31, - DeviceCommissioner_ProcessOpCSR = 32, - DeviceCommissioner_SendAttestationRequestCommand = 33, - DeviceCommissioner_SendCertificateChainRequestCommand = 34, - DeviceCommissioner_SendOperationalCertificate = 35, - DeviceCommissioner_SendOperationalCertificateSigningRequestCommand = 36, - DeviceCommissioner_SendTrustedRootCertificate = 37, - DeviceCommissioner_UnpairDevice = 38, - DeviceCommissioner_ValidateAttestationInfo = 39, - DeviceCommissioner_ValidateCSR = 40, - GeneralCommissioning_ArmFailSafe = 41, - GeneralCommissioning_CommissioningComplete = 42, - GeneralCommissioning_SetRegulatoryConfig = 43, - NetworkCommissioning_HandleAddOrUpdateThreadNetwork = 44, - NetworkCommissioning_HandleAddOrUpdateWiFiNetwork = 45, - NetworkCommissioning_HandleConnectNetwork = 46, - NetworkCommissioning_HandleRemoveNetwork = 47, - NetworkCommissioning_HandleReorderNetwork = 48, - NetworkCommissioning_HandleScanNetwork = 49, - OperationalCredentials_AddNOC = 50, - OperationalCredentials_AddTrustedRootCertificate = 51, - OperationalCredentials_AttestationRequest = 52, - OperationalCredentials_CertificateChainRequest = 53, - OperationalCredentials_CSRRequest = 54, - OperationalCredentials_RemoveFabric = 55, - OperationalCredentials_UpdateFabricLabel = 56, - OperationalCredentials_UpdateNOC = 57, - PASESession_GeneratePASEVerifier = 58, - PASESession_HandleMsg1_and_SendMsg2 = 59, - PASESession_HandleMsg2_and_SendMsg3 = 60, - PASESession_HandleMsg3 = 61, - PASESession_HandlePBKDFParamRequest = 62, - PASESession_HandlePBKDFParamResponse = 63, - PASESession_Pair = 64, - PASESession_SendMsg1 = 65, - PASESession_SendPBKDFParamRequest = 66, - PASESession_SendPBKDFParamResponse = 67, - PASESession_SetupSpake2p = 68, - Resolve_IncrementalRecordParse = 69, -}; - -/// An event that happened at an instant (like a zero sized scope) -enum class Instant -{ - UndefinedDoNotUse = 0, - - // General instant notifications - Resolve_TxtNotApplicable = 1, - Resolve_Ipv4NotApplicable = 2, - Resolve_Ipv6NotApplicable = 3, - - // Used if and only if default "Log*" requests - // are not implemented in the backend. - Log_MessageSend = 1000, - Log_MessageReceived = 1001, - Log_NodeLookup = 1002, - Log_NodeDiscovered = 1003, - Log_NodeDiscoveryFailed = 1004, -}; - -} // namespace Tracing -} // namespace chip diff --git a/src/tracing/tests/BUILD.gn b/src/tracing/tests/BUILD.gn index 081a8309e6c382..8d193e538e04fd 100644 --- a/src/tracing/tests/BUILD.gn +++ b/src/tracing/tests/BUILD.gn @@ -19,7 +19,7 @@ import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") import("${chip_root}/src/tracing/tracing_args.gni") -if (matter_enable_tracing_support) { +if (matter_enable_tracing_support && matter_trace_config == "multiplexed") { chip_test_suite("tests") { output_name = "libTracingTests" diff --git a/src/tracing/tests/TestTracing.cpp b/src/tracing/tests/TestTracing.cpp index 2026f376daa3ab..f0ae8710c796fd 100644 --- a/src/tracing/tests/TestTracing.cpp +++ b/src/tracing/tests/TestTracing.cpp @@ -21,6 +21,7 @@ #include #include +#include #include using namespace chip; @@ -32,35 +33,24 @@ namespace { class LoggingTraceBackend : public Backend { public: - enum class TraceEventType - { - BEGIN, - END - }; - - struct ReceivedTraceEvent - { - TraceEventType type; - Scope scope; - - bool operator==(const ReceivedTraceEvent & other) const { return (type == other.type) && (scope == other.scope); } - }; - LoggingTraceBackend() {} - const std::vector & traces() const { return mTraces; } + const std::vector & traces() const { return mTraces; } // Implementation - void TraceBegin(Scope scope) override { mTraces.push_back(ReceivedTraceEvent{ TraceEventType::BEGIN, scope }); } + void TraceBegin(const char * label, const char * group) override + { + mTraces.push_back(std::string("BEGIN:") + group + ":" + label); + } - void TraceEnd(Scope scope) override { mTraces.push_back(ReceivedTraceEvent{ TraceEventType::END, scope }); } + void TraceEnd(const char * label, const char * group) override { mTraces.push_back(std::string("END:") + group + ":" + label); } - void TraceInstant(Instant instant) override + void TraceInstant(const char * label, const char * group) override { - // NOT SUPPORTED HERE + mTraces.push_back(std::string("INSTANT:") + group + ":" + label); } private: - std::vector mTraces; + std::vector mTraces; }; void TestBasicTracing(nlTestSuite * inSuite, void * inContext) @@ -70,32 +60,25 @@ void TestBasicTracing(nlTestSuite * inSuite, void * inContext) { ScopedRegistration scope(backend); - MATTER_TRACE_SCOPE(Scope::CASESession_SendSigma1); + MATTER_TRACE_SCOPE("A", "Group"); { - MATTER_TRACE_SCOPE(Scope::CASESession_SendSigma2); + MATTER_TRACE_SCOPE("B", "Group"); // direct scope begin/end (not usual, but should work) - MATTER_TRACE_BEGIN(Scope::OperationalCredentials_AddNOC); - MATTER_TRACE_BEGIN(Scope::OperationalCredentials_UpdateNOC); - MATTER_TRACE_END(Scope::OperationalCredentials_UpdateNOC); - MATTER_TRACE_END(Scope::OperationalCredentials_AddNOC); + MATTER_TRACE_BEGIN("C", "Group"); + MATTER_TRACE_BEGIN("D", "Group"); + MATTER_TRACE_END("D", "Group"); + MATTER_TRACE_INSTANT("FOO", "Group"); + MATTER_TRACE_END("C", "Group"); } { - MATTER_TRACE_SCOPE(Scope::CASESession_SendSigma3); + MATTER_TRACE_SCOPE("E", "Group"); } } - std::vector expected = { - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::CASESession_SendSigma1 }, - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::CASESession_SendSigma2 }, - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::OperationalCredentials_AddNOC }, - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::OperationalCredentials_UpdateNOC }, - { LoggingTraceBackend::TraceEventType::END, Scope::OperationalCredentials_UpdateNOC }, - { LoggingTraceBackend::TraceEventType::END, Scope::OperationalCredentials_AddNOC }, - { LoggingTraceBackend::TraceEventType::END, Scope::CASESession_SendSigma2 }, - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::CASESession_SendSigma3 }, - { LoggingTraceBackend::TraceEventType::END, Scope::CASESession_SendSigma3 }, - { LoggingTraceBackend::TraceEventType::END, Scope::CASESession_SendSigma1 }, + std::vector expected = { + "BEGIN:Group:A", "BEGIN:Group:B", "BEGIN:Group:C", "BEGIN:Group:D", "END:Group:D", "INSTANT:Group:FOO", + "END:Group:C", "END:Group:B", "BEGIN:Group:E", "END:Group:E", "END:Group:A", }; NL_TEST_ASSERT(inSuite, backend.traces().size() == expected.size()); @@ -110,51 +93,39 @@ void TestMultipleBackends(nlTestSuite * inSuite, void * inContext) { ScopedRegistration register1(b1); - MATTER_TRACE_SCOPE(Scope::CASESession_SendSigma1); + MATTER_TRACE_SCOPE("1", "G"); { ScopedRegistration register2(b2); - MATTER_TRACE_SCOPE(Scope::CASESession_SendSigma2); + MATTER_TRACE_SCOPE("2", "G"); { ScopedRegistration register3(b3); - MATTER_TRACE_SCOPE(Scope::CASESession_SendSigma3); + MATTER_TRACE_SCOPE("3", "G"); } { - MATTER_TRACE_SCOPE(Scope::OperationalCredentials_AddNOC); + MATTER_TRACE_SCOPE("4", "G"); } } } - std::vector expected1 = { - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::CASESession_SendSigma1 }, - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::CASESession_SendSigma2 }, - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::CASESession_SendSigma3 }, - { LoggingTraceBackend::TraceEventType::END, Scope::CASESession_SendSigma3 }, - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::OperationalCredentials_AddNOC }, - { LoggingTraceBackend::TraceEventType::END, Scope::OperationalCredentials_AddNOC }, - { LoggingTraceBackend::TraceEventType::END, Scope::CASESession_SendSigma2 }, - { LoggingTraceBackend::TraceEventType::END, Scope::CASESession_SendSigma1 }, + std::vector expected1 = { + "BEGIN:G:1", "BEGIN:G:2", "BEGIN:G:3", "END:G:3", "BEGIN:G:4", "END:G:4", "END:G:2", "END:G:1", }; NL_TEST_ASSERT(inSuite, b1.traces().size() == expected1.size()); NL_TEST_ASSERT(inSuite, std::equal(b1.traces().begin(), b1.traces().end(), expected1.begin(), expected1.end())); - std::vector expected2 = { - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::CASESession_SendSigma2 }, - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::CASESession_SendSigma3 }, - { LoggingTraceBackend::TraceEventType::END, Scope::CASESession_SendSigma3 }, - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::OperationalCredentials_AddNOC }, - { LoggingTraceBackend::TraceEventType::END, Scope::OperationalCredentials_AddNOC }, - { LoggingTraceBackend::TraceEventType::END, Scope::CASESession_SendSigma2 }, + std::vector expected2 = { + "BEGIN:G:2", "BEGIN:G:3", "END:G:3", "BEGIN:G:4", "END:G:4", "END:G:2", }; NL_TEST_ASSERT(inSuite, b2.traces().size() == expected2.size()); NL_TEST_ASSERT(inSuite, std::equal(b2.traces().begin(), b2.traces().end(), expected2.begin(), expected2.end())); - std::vector expected3 = { - { LoggingTraceBackend::TraceEventType::BEGIN, Scope::CASESession_SendSigma3 }, - { LoggingTraceBackend::TraceEventType::END, Scope::CASESession_SendSigma3 }, + std::vector expected3 = { + "BEGIN:G:3", + "END:G:3", }; NL_TEST_ASSERT(inSuite, b3.traces().size() == expected3.size()); diff --git a/src/tracing/tracing_args.gni b/src/tracing/tracing_args.gni index 7ae979be92a911..7c4cde545848d2 100644 --- a/src/tracing/tracing_args.gni +++ b/src/tracing/tracing_args.gni @@ -17,4 +17,28 @@ declare_args() { # the impact minimal (the backends themselves add some size), however # for now tracing is opt-in matter_enable_tracing_support = target_os == "linux" + + # Defines the trace backend. Current matter tracing splits the logic + # into two parts: + # - data logging, well defined and using type-safe data + # - trace begin/end/instant states for monitoring execution and + # checking execution time and performance + # For tracing specifically, due to performance constraints, several + # backends prefer to be the one and only tracing provider (e.g. + # pw_tracing uses tokenization to reduce string sizes and allow + # for fast tracing even when the communication channels are slow). + # + # The setting below controls the destination of the tracing macros + # with the following values available: + # - "none" makes tracing completely disabled + # - "multiplexed" allows using the "backend.h" for tracing, which + # will multiplex however will only work on fast backends (e.g. + # large systems with fast logging when writing to logs) + # - any other value will provide a tracing config, which + # MUST include a path to `matter/tracing/macros_impl.h` + if (target_os == "linux") { + matter_trace_config = "multiplexed" + } else { + matter_trace_config = "none" + } } From 662d0bd33bf6d9c3d14602dc2be1d12cb89a5fd9 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Tue, 20 Jun 2023 12:15:53 -0400 Subject: [PATCH 05/36] Update README.md to include all platforms and examples (#27331) * Update README.md * Removing "Examples - " * Restyled by prettier-markdown * Fixing word list --------- Co-authored-by: Restyled.io --- .github/.wordlist.txt | 5 +++-- README.md | 32 +++++++++++++++++++++----------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 4375a4e77f3204..04179cb874c403 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -87,8 +87,8 @@ ARMmbed armv ASAN asdk -AssertionError ASR +AssertionError AST ASYNC atomics @@ -954,6 +954,7 @@ OnOffClusterTest OnOffSwitchConfiguration OnPlatformEvent OO +openiotsdk openjdk OpenOCD OpenSSL @@ -1247,8 +1248,8 @@ SoftwareVersion softwareVersionStr SoftwareVersionString softwareVersionValid -sphinxcontrib SparkFun +sphinxcontrib SPI spiflash spinel diff --git a/README.md b/README.md index 1dd90182ee5181..6c66045ce4cce3 100644 --- a/README.md +++ b/README.md @@ -3,20 +3,30 @@ [![Builds](https://github.com/project-chip/connectedhomeip/workflows/Builds/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/build.yaml) **Examples:** -[![Examples - EFR32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20EFR32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-efr32.yaml) -[![Examples - ESP32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ESP32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-esp32.yaml) -[![Examples - i.MX Linux](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20i.MX%20Linux/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-imx.yaml) -[![Examples - K32W with SE051](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20K32W%20with%20SE051/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-k32w.yaml) -[![Examples - Linux Standalone](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Linux%20Standalone/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-standalone.yaml) -[![Examples - nRF Connect SDK](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20nRF%20Connect%20SDK/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-nrfconnect.yaml) -[![Examples - QPG](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20QPG/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-qpg.yaml) -[![Examples - TI CC26X2X7](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC26X2X7/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc13x2x7_26x2x7.yaml) -[![Examples - TI CC32XX](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC32XX/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc32xx.yaml) -[![Build example - Infineon](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-infineon.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-infineon.yaml) -[![Build example - BouffaloLab](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20BouffaloLab/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-bouffalolab.yaml) +[![Ameba](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Ameba/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-ameba.yaml) +[![ASR](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ASR/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-asr.yaml) +[![BouffaloLab](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20BouffaloLab/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-bouffalolab.yaml) +[![TI CC26X2X7](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC26X2X7/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc13x2x7_26x2x7.yaml) +[![TI CC32XX](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC32XX/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc32xx.yaml) +[![EFR32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20EFR32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-efr32.yaml) +[![ESP32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ESP32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-esp32.yaml) +[![Infineon](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-infineon.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-infineon.yaml) +[![i.MX Linux](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20i.MX%20Linux/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-imx.yaml) +[![K32W with SE051](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20K32W%20with%20SE051/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-k32w.yaml) +[![Linux ARM](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Linux%20ARM/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-arm.yaml) +[![Linux Standalone](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Linux%20Standalone/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-standalone.yaml) +[![Linux Standalone](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Linux%20Standalone/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-linux-standalone.yaml) +[![Mbed OS](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Mbed%20OS/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-mbed.yaml) +[![MW320](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20MW320/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-mw320.yaml) +[![nRF Connect SDK](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20nRF%20Connect%20SDK/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-nrfconnect.yaml) +[![Open IoT SDK](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Open%20IoT%20SDK/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-openiotsdk.yaml) +[![QPG](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20QPG/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-qpg.yaml) +[![Telink](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Telink/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-telink.yaml) +[![Tizen](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Tizen/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-tizen.yaml) **Platforms:** [![Android](https://github.com/project-chip/connectedhomeip/workflows/Android/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/android.yaml) +[![Darwin](https://github.com/project-chip/connectedhomeip/workflows/Darwin/badge.svg)](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/darwin.yaml) **Tests:** [![Unit / Integration Tests](https://github.com/project-chip/connectedhomeip/workflows/Unit%20/%20Integration%20Tests/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/unit_integration_test.yaml) From 1542e1720e607f4b6c3124165efa2018018c61bd Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Tue, 20 Jun 2023 13:08:42 -0400 Subject: [PATCH 06/36] Updating java timeouts --- .github/workflows/java-tests.yaml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index b0f1de052a3396..199514749eeb00 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -79,7 +79,7 @@ jobs: .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Generate unit tests - timeout-minutes: 1 + timeout-minutes: 2 run: | scripts/run_in_build_env.sh \ './scripts/build/build_examples.py \ @@ -87,11 +87,11 @@ jobs: gen \ ' - name: Build unit tests - timeout-minutes: 25 + timeout-minutes: 30 run: scripts/run_in_build_env.sh 'ninja -C out/linux-x64-tests src:java_controller_tests' - name: Run unit tests - timeout-minutes: 10 + timeout-minutes: 15 # TODO: this direct path loading is not maintainable. Our build system should define and # support test classes. run: | @@ -103,7 +103,7 @@ jobs: chip.tlv.TlvReaderTest \ chip.jsontlv.JsonToTlvToJsonTest - name: Build Java Matter Controller and all clusters app - timeout-minutes: 50 + timeout-minutes: 60 run: | scripts/run_in_build_env.sh './scripts/build_python.sh --install_wheel build-env' ./scripts/run_in_build_env.sh \ @@ -113,7 +113,7 @@ jobs: build \ " - name: Run Discover Commissionables Test - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -125,7 +125,7 @@ jobs: --factoryreset \ ' - name: Run Pairing Onnetwork Test - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -137,7 +137,7 @@ jobs: --factoryreset \ ' - name: Run IM Invoke Test - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -149,7 +149,7 @@ jobs: --factoryreset \ ' - name: Run IM Read Test - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -161,7 +161,7 @@ jobs: --factoryreset \ ' - name: Run IM Write Test - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -173,7 +173,7 @@ jobs: --factoryreset \ ' - name: Run IM Subscribe Test - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -185,7 +185,7 @@ jobs: --factoryreset \ ' - name: Run Pairing AlreadyDiscovered Test - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -197,7 +197,7 @@ jobs: --factoryreset \ ' - name: Run Pairing Address-PaseOnly Test - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -209,7 +209,7 @@ jobs: --factoryreset \ ' - name: Run Pairing SetupQRCode Test - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -221,7 +221,7 @@ jobs: --factoryreset \ ' - name: Run Pairing ManualCode Test - timeout-minutes: 10 + timeout-minutes: 15 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ From 22bbc067d08ae7ca4b77901172c4c95b43c4d650 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Tue, 20 Jun 2023 13:10:31 -0400 Subject: [PATCH 07/36] Updating issue templates (#27353) Co-authored-by: Boris Zbarsky --- ...{1-bug-report.yaml => 001-bug-report.yaml} | 15 +-- .../{2-1.0-issue.yaml => 002-1.0-issue.yaml} | 15 +-- .github/ISSUE_TEMPLATE/003-1.1-issue.yaml | 98 +++++++++++++++++++ .github/ISSUE_TEMPLATE/004-1.2-issue.yaml | 98 +++++++++++++++++++ .github/ISSUE_TEMPLATE/005-1.3-issue.yaml | 98 +++++++++++++++++++ ...-trivial-fix.yaml => 049-trivial-fix.yaml} | 3 +- ...-tooling-fix.yaml => 050-tooling-fix.yaml} | 17 ++-- ...latform-fix.yaml => 060-platform-fix.yaml} | 15 +-- ...-request.yaml => 080-feature-request.yaml} | 1 + ...-sve-1.0-issue.yaml => 090-sve-issue.yaml} | 17 ++-- .github/ISSUE_TEMPLATE/091-cert-blocker.yaml | 80 +++++++++++++++ ...ue.yaml => 099-github-workflow-issue.yaml} | 1 + .../100-documentation-issue.yaml | 1 + 13 files changed, 421 insertions(+), 38 deletions(-) rename .github/ISSUE_TEMPLATE/{1-bug-report.yaml => 001-bug-report.yaml} (89%) rename .github/ISSUE_TEMPLATE/{2-1.0-issue.yaml => 002-1.0-issue.yaml} (91%) create mode 100644 .github/ISSUE_TEMPLATE/003-1.1-issue.yaml create mode 100644 .github/ISSUE_TEMPLATE/004-1.2-issue.yaml create mode 100644 .github/ISSUE_TEMPLATE/005-1.3-issue.yaml rename .github/ISSUE_TEMPLATE/{70-trivial-fix.yaml => 049-trivial-fix.yaml} (98%) rename .github/ISSUE_TEMPLATE/{50-tooling-fix.yaml => 050-tooling-fix.yaml} (89%) rename .github/ISSUE_TEMPLATE/{60-platform-fix.yaml => 060-platform-fix.yaml} (90%) rename .github/ISSUE_TEMPLATE/{80-feature-request.yaml => 080-feature-request.yaml} (96%) rename .github/ISSUE_TEMPLATE/{3-sve-1.0-issue.yaml => 090-sve-issue.yaml} (91%) create mode 100644 .github/ISSUE_TEMPLATE/091-cert-blocker.yaml rename .github/ISSUE_TEMPLATE/{99-github-workflow-issue.yaml => 099-github-workflow-issue.yaml} (97%) diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.yaml b/.github/ISSUE_TEMPLATE/001-bug-report.yaml similarity index 89% rename from .github/ISSUE_TEMPLATE/1-bug-report.yaml rename to .github/ISSUE_TEMPLATE/001-bug-report.yaml index 3e30ed6dd3088c..8944e002c5ecc3 100644 --- a/.github/ISSUE_TEMPLATE/1-bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/001-bug-report.yaml @@ -1,6 +1,7 @@ name: "\U0001F41B Bug report" description: Create a report to help Matter title: "[BUG] " +labels: [bug, "needs triage"] body: - type: markdown attributes: @@ -12,13 +13,13 @@ body: label: Reproduction steps description: "How do you trigger this bug? Please walk us through it step by step." placeholder: | - Please list reproduction steps step by step. - Place shell commands between ```. - Attach logs as files instead of pasting them in. - 1. - 2. - 3. - ... + Please list reproduction steps step by step. + Place shell commands between ```. + Attach logs as files instead of pasting them in. + 1. + 2. + 3. + ... validations: required: true - type: input diff --git a/.github/ISSUE_TEMPLATE/2-1.0-issue.yaml b/.github/ISSUE_TEMPLATE/002-1.0-issue.yaml similarity index 91% rename from .github/ISSUE_TEMPLATE/2-1.0-issue.yaml rename to .github/ISSUE_TEMPLATE/002-1.0-issue.yaml index 93fbf8bec7e533..78c0e9cf10a766 100644 --- a/.github/ISSUE_TEMPLATE/2-1.0-issue.yaml +++ b/.github/ISSUE_TEMPLATE/002-1.0-issue.yaml @@ -1,6 +1,7 @@ name: "\U0001F680 1.0 Issue" description: Create an issue that is required for Matter 1.0 release title: "[1.0] " +labels: [bug, "V1.0", "needs triage"] body: - type: markdown attributes: @@ -12,13 +13,13 @@ body: label: Reproduction steps description: "How do you trigger this bug? Please walk us through it step by step." placeholder: | - Please list reproduction steps step by step. - Place shell commands between ```. - Attach logs as files instead of pasting them in. - 1. - 2. - 3. - ... + Please list reproduction steps step by step. + Place shell commands between ```. + Attach logs as files instead of pasting them in. + 1. + 2. + 3. + ... validations: required: true - type: input diff --git a/.github/ISSUE_TEMPLATE/003-1.1-issue.yaml b/.github/ISSUE_TEMPLATE/003-1.1-issue.yaml new file mode 100644 index 00000000000000..cd6179d91fe6c7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/003-1.1-issue.yaml @@ -0,0 +1,98 @@ +name: "\U0001F680 1.1 Issue" +description: Create an issue that is required for Matter 1.1 release +title: "[1.1] " +labels: [bug, "V1.1", "needs triage"] +body: + - type: markdown + attributes: + value: | + Thanks for reporting an issue against the Matter SDK! We need information about the bug report to follow up, so please help us out by filling out this information. + - type: textarea + id: repro + attributes: + label: Reproduction steps + description: "How do you trigger this bug? Please walk us through it step by step." + placeholder: | + Please list reproduction steps step by step. + Place shell commands between ```. + Attach logs as files instead of pasting them in. + 1. + 2. + 3. + ... + validations: + required: true + - type: input + id: prevalence + attributes: + label: Bug prevalence + description: "How often do you or others encounter this bug?" + placeholder: "Example: Whenever I do this, 1-2 times a week, day, hour, etc" + validations: + required: true + - type: input + attributes: + label: GitHub hash of the SDK that was being used + description: Hash of the GitHub SDK used + validations: + required: true + - type: dropdown + attributes: + label: Platform + description: What platforms are affected? + multiple: true + options: + - ameba + - android + - cc13x2_cc26x2 + - darwin + - efr32 + - esp32 + - freeRTOS + - IMX8 + - k32w + - nrf connect + - nrf + - python + - raspi + - vscode + - windows + - other + - core + validations: + required: true + - type: input + id: platform-versions + attributes: + label: Platform Version(s) + description: "What platform version(s) are affected [optional]" + placeholder: "eg: 1.1, N/A" + - type: dropdown + attributes: + label: Type + description: What type of issue is this? + multiple: true + options: + - Test Improvement + - Common Cluster Logic + - Spec Compliance Issue + - Security Issue + - Platform Issue + - Core SDK Memory Issue + - Core SDK Crash + - Core SDK Performance Improvement + - Core SDK Interopability Issue + validations: + required: true + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false + - type: markdown + attributes: + value: "Thanks for helping us get to 1.1!" diff --git a/.github/ISSUE_TEMPLATE/004-1.2-issue.yaml b/.github/ISSUE_TEMPLATE/004-1.2-issue.yaml new file mode 100644 index 00000000000000..dd67cd7addbdea --- /dev/null +++ b/.github/ISSUE_TEMPLATE/004-1.2-issue.yaml @@ -0,0 +1,98 @@ +name: "\U0001F680 1.2 Issue" +description: Create an issue that is required for Matter 1.2 release +title: "[1.2] " +labels: [bug, "V1.2", "needs triage"] +body: + - type: markdown + attributes: + value: | + Thanks for reporting an issue against the Matter SDK! We need information about the bug report to follow up, so please help us out by filling out this information. + - type: textarea + id: repro + attributes: + label: Reproduction steps + description: "How do you trigger this bug? Please walk us through it step by step." + placeholder: | + Please list reproduction steps step by step. + Place shell commands between ```. + Attach logs as files instead of pasting them in. + 1. + 2. + 3. + ... + validations: + required: true + - type: input + id: prevalence + attributes: + label: Bug prevalence + description: "How often do you or others encounter this bug?" + placeholder: "Example: Whenever I do this, 1-2 times a week, day, hour, etc" + validations: + required: true + - type: input + attributes: + label: GitHub hash of the SDK that was being used + description: Hash of the GitHub SDK used + validations: + required: true + - type: dropdown + attributes: + label: Platform + description: What platforms are affected? + multiple: true + options: + - ameba + - android + - cc13x2_cc26x2 + - darwin + - efr32 + - esp32 + - freeRTOS + - IMX8 + - k32w + - nrf connect + - nrf + - python + - raspi + - vscode + - windows + - other + - core + validations: + required: true + - type: input + id: platform-versions + attributes: + label: Platform Version(s) + description: "What platform version(s) are affected [optional]" + placeholder: "eg: 1.2, N/A" + - type: dropdown + attributes: + label: Type + description: What type of issue is this? + multiple: true + options: + - Test Improvement + - Common Cluster Logic + - Spec Compliance Issue + - Security Issue + - Platform Issue + - Core SDK Memory Issue + - Core SDK Crash + - Core SDK Performance Improvement + - Core SDK Interopability Issue + validations: + required: true + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false + - type: markdown + attributes: + value: "Thanks for helping us get to 1.2!" diff --git a/.github/ISSUE_TEMPLATE/005-1.3-issue.yaml b/.github/ISSUE_TEMPLATE/005-1.3-issue.yaml new file mode 100644 index 00000000000000..a904231a9e6020 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/005-1.3-issue.yaml @@ -0,0 +1,98 @@ +name: "\U0001F680 1.3 Issue" +description: Create an issue that is required for Matter 1.3 release +title: "[1.3] " +labels: [bug, "V1.3", "needs triage"] +body: + - type: markdown + attributes: + value: | + Thanks for reporting an issue against the Matter SDK! We need information about the bug report to follow up, so please help us out by filling out this information. + - type: textarea + id: repro + attributes: + label: Reproduction steps + description: "How do you trigger this bug? Please walk us through it step by step." + placeholder: | + Please list reproduction steps step by step. + Place shell commands between ```. + Attach logs as files instead of pasting them in. + 1. + 2. + 3. + ... + validations: + required: true + - type: input + id: prevalence + attributes: + label: Bug prevalence + description: "How often do you or others encounter this bug?" + placeholder: "Example: Whenever I do this, 1-2 times a week, day, hour, etc" + validations: + required: true + - type: input + attributes: + label: GitHub hash of the SDK that was being used + description: Hash of the GitHub SDK used + validations: + required: true + - type: dropdown + attributes: + label: Platform + description: What platforms are affected? + multiple: true + options: + - ameba + - android + - cc13x2_cc26x2 + - darwin + - efr32 + - esp32 + - freeRTOS + - IMX8 + - k32w + - nrf connect + - nrf + - python + - raspi + - vscode + - windows + - other + - core + validations: + required: true + - type: input + id: platform-versions + attributes: + label: Platform Version(s) + description: "What platform version(s) are affected [optional]" + placeholder: "eg: 1.3, N/A" + - type: dropdown + attributes: + label: Type + description: What type of issue is this? + multiple: true + options: + - Test Improvement + - Common Cluster Logic + - Spec Compliance Issue + - Security Issue + - Platform Issue + - Core SDK Memory Issue + - Core SDK Crash + - Core SDK Performance Improvement + - Core SDK Interopability Issue + validations: + required: true + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false + - type: markdown + attributes: + value: "Thanks for helping us get to 1.3!" diff --git a/.github/ISSUE_TEMPLATE/70-trivial-fix.yaml b/.github/ISSUE_TEMPLATE/049-trivial-fix.yaml similarity index 98% rename from .github/ISSUE_TEMPLATE/70-trivial-fix.yaml rename to .github/ISSUE_TEMPLATE/049-trivial-fix.yaml index dd7108d7c60326..7c82d950e9f7f4 100644 --- a/.github/ISSUE_TEMPLATE/70-trivial-fix.yaml +++ b/.github/ISSUE_TEMPLATE/049-trivial-fix.yaml @@ -1,6 +1,7 @@ name: "\U0001F3C3 Trivial Fix" description: Create an issue for a trivial fix title: "[Trivial] " +labels: [bug, "needs triage"] body: - type: markdown attributes: @@ -59,7 +60,7 @@ body: placeholder: "eg: 1.0.1, N/A" - type: dropdown attributes: - label: Type + label: Testing description: How was this tested? multiple: true options: diff --git a/.github/ISSUE_TEMPLATE/50-tooling-fix.yaml b/.github/ISSUE_TEMPLATE/050-tooling-fix.yaml similarity index 89% rename from .github/ISSUE_TEMPLATE/50-tooling-fix.yaml rename to .github/ISSUE_TEMPLATE/050-tooling-fix.yaml index 74888c105040a9..667c8946b2804e 100644 --- a/.github/ISSUE_TEMPLATE/50-tooling-fix.yaml +++ b/.github/ISSUE_TEMPLATE/050-tooling-fix.yaml @@ -1,6 +1,7 @@ name: "\U0001F3C3 Tooling Fix/Feature" description: Create an issue for a tooling specific fix/feature -title: "[Platform] " +title: "[Tooling] " +labels: ["tools", "needs triage"] body: - type: markdown attributes: @@ -12,13 +13,13 @@ body: label: Reproduction steps / Feature description: "How do you trigger this issue and/or can you please explain this new feature? Please walk us through it step by step." placeholder: | - Please list reproduction steps step by step. - Place shell commands between ```. - Attach logs as files instead of pasting them in. - 1. - 2. - 3. - ... + Please list reproduction steps step by step. + Place shell commands between ```. + Attach logs as files instead of pasting them in. + 1. + 2. + 3. + ... validations: required: true - type: dropdown diff --git a/.github/ISSUE_TEMPLATE/60-platform-fix.yaml b/.github/ISSUE_TEMPLATE/060-platform-fix.yaml similarity index 90% rename from .github/ISSUE_TEMPLATE/60-platform-fix.yaml rename to .github/ISSUE_TEMPLATE/060-platform-fix.yaml index b6878edede4826..691a5cedc6f604 100644 --- a/.github/ISSUE_TEMPLATE/60-platform-fix.yaml +++ b/.github/ISSUE_TEMPLATE/060-platform-fix.yaml @@ -1,6 +1,7 @@ name: "\U0001F9F0 Platform Fix" description: Create an issue for a platform specific fix title: "[Platform] " +labels: ["platform", "needs triage"] body: - type: markdown attributes: @@ -12,13 +13,13 @@ body: label: Reproduction steps description: "How do you trigger this issue? Please walk us through it step by step." placeholder: | - Please list reproduction steps step by step. - Place shell commands between ```. - Attach logs as files instead of pasting them in. - 1. - 2. - 3. - ... + Please list reproduction steps step by step. + Place shell commands between ```. + Attach logs as files instead of pasting them in. + 1. + 2. + 3. + ... validations: required: true - type: dropdown diff --git a/.github/ISSUE_TEMPLATE/80-feature-request.yaml b/.github/ISSUE_TEMPLATE/080-feature-request.yaml similarity index 96% rename from .github/ISSUE_TEMPLATE/80-feature-request.yaml rename to .github/ISSUE_TEMPLATE/080-feature-request.yaml index e62a5a02415c6b..c83b0c22acaa98 100644 --- a/.github/ISSUE_TEMPLATE/80-feature-request.yaml +++ b/.github/ISSUE_TEMPLATE/080-feature-request.yaml @@ -1,6 +1,7 @@ name: "\U0001F4A1 Feature Request" description: Create an feature to be considered future release title: "[Feature] " +labels: ["feature work", "feature request", "needs triage"] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/3-sve-1.0-issue.yaml b/.github/ISSUE_TEMPLATE/090-sve-issue.yaml similarity index 91% rename from .github/ISSUE_TEMPLATE/3-sve-1.0-issue.yaml rename to .github/ISSUE_TEMPLATE/090-sve-issue.yaml index 340e9ff38aeea6..6ea65341230a35 100644 --- a/.github/ISSUE_TEMPLATE/3-sve-1.0-issue.yaml +++ b/.github/ISSUE_TEMPLATE/090-sve-issue.yaml @@ -1,6 +1,7 @@ name: "\U0001F9EA SVE Issue" description: Create an issue that is required for SVE title: "[SVE] " +labels: [bug, "sve", "request sve", "needs triage"] body: - type: markdown attributes: @@ -12,13 +13,13 @@ body: label: Reproduction steps description: "How do you trigger this bug? Please walk us through it step by step." placeholder: | - Please list reproduction steps step by step. - Place shell commands between ```. - Attach logs as files instead of pasting them in. - 1. - 2. - 3. - ... + Please list reproduction steps step by step. + Place shell commands between ```. + Attach logs as files instead of pasting them in. + 1. + 2. + 3. + ... validations: required: true - type: input @@ -85,7 +86,7 @@ body: required: true - type: dropdown attributes: - label: Type + label: Testing description: How was this tested? multiple: true options: diff --git a/.github/ISSUE_TEMPLATE/091-cert-blocker.yaml b/.github/ISSUE_TEMPLATE/091-cert-blocker.yaml new file mode 100644 index 00000000000000..bf24349cd393be --- /dev/null +++ b/.github/ISSUE_TEMPLATE/091-cert-blocker.yaml @@ -0,0 +1,80 @@ +name: "\U0001F41B Cert Blocker" +description: Create a report to identify matter certification blockers +title: "[CERT-BLOCKER] " +labels: [bug, "cert blocker", "needs triage"] +body: + - type: markdown + attributes: + value: | + Thanks for reporting an issue against the Matter SDK! We need information about the cert blocker to follow up, so please help us out by filling out this information. + - type: textarea + id: repro + attributes: + label: Reproduction steps + description: "How do you trigger this bug? Please walk us through it step by step." + placeholder: | + Please list reproduction steps step by step. + Place shell commands between ```. + Attach logs as files instead of pasting them in. + 1. + 2. + 3. + ... + validations: + required: true + - type: input + id: prevalence + attributes: + label: Bug prevalence + description: "How often do you or others encounter this bug?" + placeholder: "Example: Whenever I do this, 1-2 times a week, day, hour, etc" + validations: + required: true + - type: input + attributes: + label: GitHub hash of the SDK that was being used + description: Hash of the GitHub SDK used + validations: + required: true + - type: dropdown + attributes: + label: Platform + description: What platforms are affected? + multiple: true + options: + - ameba + - android + - cc13x2_cc26x2 + - darwin + - efr32 + - esp32 + - freeRTOS + - IMX8 + - k32w + - nrf + - python + - raspi + - vscode + - windows + - other + - core + validations: + required: true + - type: input + id: platform-versions + attributes: + label: Platform Version(s) + description: "What platform version(s) are affected [optional]" + placeholder: "eg: 1.2.1, N/A" + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false + - type: markdown + attributes: + value: "Thanks for submitting a cert blocker!" diff --git a/.github/ISSUE_TEMPLATE/99-github-workflow-issue.yaml b/.github/ISSUE_TEMPLATE/099-github-workflow-issue.yaml similarity index 97% rename from .github/ISSUE_TEMPLATE/99-github-workflow-issue.yaml rename to .github/ISSUE_TEMPLATE/099-github-workflow-issue.yaml index 831a6e6ab14c05..eefa5f0f984c61 100644 --- a/.github/ISSUE_TEMPLATE/99-github-workflow-issue.yaml +++ b/.github/ISSUE_TEMPLATE/099-github-workflow-issue.yaml @@ -1,6 +1,7 @@ name: "\U0001F477 GitHub / CI / Workflow" description: Create an issue to improve CI / Workflows title: "[Workflow] " +labels: ["workflows", "needs triage"] body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/100-documentation-issue.yaml b/.github/ISSUE_TEMPLATE/100-documentation-issue.yaml index 69e23c81bd887e..51971d1d010b5f 100644 --- a/.github/ISSUE_TEMPLATE/100-documentation-issue.yaml +++ b/.github/ISSUE_TEMPLATE/100-documentation-issue.yaml @@ -1,6 +1,7 @@ name: "\U0001F5BA Documentation Issue" description: Create an issue to improve documentation title: "[Documentation] " +labels: ["documentation", "needs triage"] body: - type: markdown attributes: From 16aea8a03aae932a4423030e5f475d2d72a19f82 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Tue, 20 Jun 2023 14:16:15 -0400 Subject: [PATCH 08/36] Upping timeouts more --- .github/workflows/java-tests.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index 199514749eeb00..a2414e68d588b2 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -185,7 +185,7 @@ jobs: --factoryreset \ ' - name: Run Pairing AlreadyDiscovered Test - timeout-minutes: 15 + timeout-minutes: 25 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -197,7 +197,7 @@ jobs: --factoryreset \ ' - name: Run Pairing Address-PaseOnly Test - timeout-minutes: 15 + timeout-minutes: 25 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -209,7 +209,7 @@ jobs: --factoryreset \ ' - name: Run Pairing SetupQRCode Test - timeout-minutes: 15 + timeout-minutes: 25 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ @@ -221,7 +221,7 @@ jobs: --factoryreset \ ' - name: Run Pairing ManualCode Test - timeout-minutes: 15 + timeout-minutes: 25 run: | scripts/run_in_build_env.sh \ './scripts/tests/run_java_test.py \ From d50a9420ddcdda56c3cdacefca301c0462bf2f5d Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Tue, 20 Jun 2023 20:44:18 +0200 Subject: [PATCH 09/36] Followup for #27314 to change the type int of the return value of GetDataTypeSizeInBits from int to Optional[int] (#27357) --- scripts/py_matter_idl/matter_idl/generators/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/py_matter_idl/matter_idl/generators/types.py b/scripts/py_matter_idl/matter_idl/generators/types.py index dd9ed047584012..a22275bf29bb0f 100644 --- a/scripts/py_matter_idl/matter_idl/generators/types.py +++ b/scripts/py_matter_idl/matter_idl/generators/types.py @@ -427,7 +427,7 @@ def IsSignedDataType(data_type: DataType) -> bool: return sized_type.is_signed -def GetDataTypeSizeInBits(data_type: DataType) -> int: +def GetDataTypeSizeInBits(data_type: DataType) -> Optional[int]: """ Returns the size in bits for a given data type or None if the data type can not be found. """ From 4c2f53aa584ae3ad578c95bb84bbfa14b97bb15a Mon Sep 17 00:00:00 2001 From: manjunath-grl <102359958+manjunath-grl@users.noreply.github.com> Date: Wed, 21 Jun 2023 00:42:46 +0530 Subject: [PATCH 10/36] Added new tests JUN 20 (#27345) * Added new automated tests TC_DRLK_2_12 TC_FAN_1_1 TC_FAN_2_1 TC_FAN_2_2 TC_FAN_2_3 TC_FAN_2_4 TC_FAN_3_1 TC_FAN_3_2 TC_FAN_3_4 TC_LVL_7_1 Modified tests: TC_LVL_6_1 TC_DRLK_2_3 * Auto generated files * Restyled by whitespace --------- Co-authored-by: Restyled.io --- src/app/tests/suites/certification/PICS.yaml | 144 + .../certification/Test_TC_DRLK_2_12.yaml | 455 + .../certification/Test_TC_DRLK_2_3.yaml | 16 +- .../suites/certification/Test_TC_FAN_1_1.yaml | 188 + .../suites/certification/Test_TC_FAN_2_1.yaml | 72 + .../suites/certification/Test_TC_FAN_2_2.yaml | 64 + .../suites/certification/Test_TC_FAN_2_3.yaml | 49 + .../suites/certification/Test_TC_FAN_2_4.yaml | 49 + .../suites/certification/Test_TC_FAN_3_1.yaml | 144 + .../suites/certification/Test_TC_FAN_3_2.yaml | 66 + .../suites/certification/Test_TC_FAN_3_4.yaml | 59 + .../suites/certification/Test_TC_LVL_6_1.yaml | 1 + .../suites/certification/Test_TC_LVL_7_1.yaml | 357 +- .../tests/suites/certification/ci-pics-values | 53 +- src/app/tests/suites/ciTests.json | 17 +- src/app/tests/suites/manualTests.json | 2 +- .../chip-tool/zap-generated/test/Commands.h | 3419 +++++- .../zap-generated/test/Commands.h | 10220 +++++++++++----- 18 files changed, 11667 insertions(+), 3708 deletions(-) create mode 100644 src/app/tests/suites/certification/Test_TC_DRLK_2_12.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FAN_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FAN_2_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FAN_2_3.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FAN_2_4.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FAN_3_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FAN_3_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FAN_3_4.yaml diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 67ce7560c7456c..4c45ae86d767c6 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -2637,6 +2637,84 @@ PICS: - label: "Does the DUT(server) support the ExpiringUserTimeOut attribute?" id: DRLK.S.A0035 + # + #Server ReadOnly attribute + # + - label: + "Does the DUT(server) support the EnableLocalProgramming attribute and + is ReadOnly" + id: DRLK.S.A0028.ReadOnly + + - label: + "Does the DUT(server) support the LocalProgrammingFeatures attribute + and is ReadOnly" + id: DRLK.S.A002c.ReadOnly + + # + # Server write attributes + # + + - label: "Does the DUT(server) support the DoorOpen Events attribute?" + id: DRLK.S.A0004.Write + + - label: "Does the DUT(server) support the DoorClosedEvents attribute?" + id: DRLK.S.A0005.Write + + - label: "Does the DUT(server) support the OpenPeriod attribute?" + id: DRLK.S.A0006.Write + + - label: "Does the DUT(server) support the Language attribute?" + id: DRLK.S.A0021.Write + + - label: "Does the DUT(server) support the LEDSettings attribute?" + id: DRLK.S.A0022.Write + + - label: "Does the DUT(server) support the AutoRelockTime attribute?" + id: DRLK.S.A0023.Write + + - label: "Does the DUT(server) support the SoundVolume attribute?" + id: DRLK.S.A0024.Write + + - label: "Does the DUT(server) support the OperatingMode attribute?" + id: DRLK.S.A0025.Write + + - label: + "Does the DUT(server) support the EnableLocalProgramming attribute?" + id: DRLK.S.A0028.Write + + - label: "Does the DUT(server) support the EnableOneTouchLocking attribute?" + id: DRLK.S.A0029.Write + + - label: "Does the DUT(server) support the EnableInsideStatusLED attribute?" + id: DRLK.S.A002a.Write + + - label: + "Does the DUT(server) support the EnablePrivacyModeButton attribute?" + id: DRLK.S.A002b.Write + + - label: + "Does the DUT(server) support the LocalProgrammingFeatures attribute?" + id: DRLK.S.A002c.Write + + - label: "Does the DUT(server) support the WrongCodeEntryLimit attribute?" + id: DRLK.S.A0030.Write + + - label: + "Does the DUT(server) support the UserCodedTemporaryDisableTime + attribute?" + id: DRLK.S.A0031.Write + + - label: "Does the DUT(server) support the SendPINOverTheAir attribute?" + id: DRLK.S.A0032.Write + + - label: + "Does the DUT(server) support the RequirePINForRemoteOperation + attribute?" + id: DRLK.S.A0033.Write + + - label: "Does the DUT(server) support the ExpiringUserTimeOut attribute?" + id: DRLK.S.A0035.Write + # # server / commandsReceived # @@ -9301,3 +9379,69 @@ PICS: - label: "Does the device implement the (0xFFFD) ClusterRevision attribute ?" id: RNCONC.S.Afffd + + ## Fan control + + # Features + - label: "Does the device support multiple speeds from 0-100" + id: FAN.S.F00 + + - label: "Does the device support automatic mode" + id: FAN.S.F01 + + - label: "Does the device support rocking movement" + id: FAN.S.F02 + + - label: "Does the device support wind emulation" + id: FAN.S.F03 + + - label: "Does the device support the step command" + id: FAN.S.F04 + + - label: "Does the device support the direction attribute" + id: FAN.S.F05 + + # + # Server Attributes + # + - label: "Does the device implement the FanMode attribute?" + id: FAN.S.A0000 + + - label: "Does the device implement the FanModeSequence attribute?" + id: FAN.S.A0001 + + - label: "Does the device implement the PercentSetting attribute?" + id: FAN.S.A0002 + + - label: "Does the device implement the PercentCurrent attribute?" + id: FAN.S.A0003 + + - label: "Does the device implement the SpeedMax attribute?" + id: FAN.S.A0004 + + - label: "Does the device implement the SpeedSetting attribute?" + id: FAN.S.A0005 + + - label: "Does the device implement the SpeedCurrent attribute?" + id: FAN.S.A0006 + + - label: "Does the device implement the RockSupport attribute?" + id: FAN.S.A0007 + + - label: "Does the device implement the RockSetting attribute?" + id: FAN.S.A0008 + + - label: "Does the device implement the WindSupport attribute?" + id: FAN.S.A0009 + + - label: "Does the device implement the WindSetting attribute?" + id: FAN.S.A000A + + - label: "Does the device implement the AirflowDirection attribute?" + id: FAN.S.A000B + + # + #Server commands + # + - label: "Does the device implement receiving the Step command?" + id: FAN.S.C00.Rsp diff --git a/src/app/tests/suites/certification/Test_TC_DRLK_2_12.yaml b/src/app/tests/suites/certification/Test_TC_DRLK_2_12.yaml new file mode 100644 index 00000000000000..1436be10bff296 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_DRLK_2_12.yaml @@ -0,0 +1,455 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 121.3.2. [TC-DRLK-2.12] Verification for Ubolt Door command [DUT-Server] + +PICS: + - DRLK.S + +config: + nodeId: 0x12344321 + cluster: "Door Lock" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Create new user" + command: "SetUser" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "OperationType" + value: 0 + - name: "UserIndex" + value: 1 + - name: "UserName" + value: "xxx" + - name: "UserUniqueID" + value: 6452 + - name: "UserStatus" + value: 1 + - name: "UserType" + value: 0 + - name: "CredentialRule" + value: 0 + + - label: "Read the user back and verify its fields" + command: "GetUser" + arguments: + values: + - name: "UserIndex" + value: 1 + response: + values: + - name: "UserIndex" + value: 1 + - name: "UserName" + value: "xxx" + - name: "UserUniqueID" + value: 6452 + - name: "UserStatus" + value: 1 + - name: "UserType" + value: 0 + - name: "CredentialRule" + value: 0 + - name: "Credentials" + value: [] + - name: "CreatorFabricIndex" + value: 1 + - name: "LastModifiedFabricIndex" + value: 1 + - name: "NextUserIndex" + value: null + + - label: "Create new PIN credential and lock/unlock user" + command: "SetCredential" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "OperationType" + value: 0 + - name: "Credential" + value: { CredentialType: 1, CredentialIndex: 1 } + - name: "CredentialData" + value: "123456" + - name: "UserIndex" + value: 1 + - name: "UserStatus" + value: null + - name: "UserType" + value: null + response: + values: + - name: "Status" + value: 0 + - name: "UserIndex" + value: null + - name: "NextCredentialIndex" + value: 2 + + - label: "Verify created PIN credential" + command: "GetCredentialStatus" + arguments: + values: + - name: "Credential" + value: { CredentialType: 1, CredentialIndex: 1 } + response: + values: + - name: "CredentialExists" + value: true + - name: "UserIndex" + value: 1 + - name: "CreatorFabricIndex" + value: 1 + - name: "LastModifiedFabricIndex" + value: 1 + - name: "NextCredentialIndex" + value: null + + - label: + "Step 1: TH writes the RequirePINforRemoteOperation attribute value as + False on the DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write + command: "writeAttribute" + attribute: "RequirePINforRemoteOperation" + arguments: + value: false + + - label: + "Step 1: TH writes the RequirePINforRemoteOperation attribute value as + False on the DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write + command: "writeAttribute" + attribute: "RequirePINforRemoteOperation" + arguments: + value: false + response: + error: UNSUPPORTED_WRITE + + - label: + "Step 2: TH reads the RequirePINforRemoteOperation attribute from the + DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033 + command: "readAttribute" + attribute: "RequirePINforRemoteOperation" + response: + value: false + + - label: "Step 3: TH sends Ubolt Door Command to the DUT without PINCode" + PICS: DRLK.S.C27.Rsp && DRLK.S.F0c + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + + - label: "Step 4: TH sends Ubolt Door Command to the DUT with PINCode" + PICS: DRLK.S.C27.Rsp && DRLK.S.F0c + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + + - label: + "Step 5: TH writes the RequirePINforRemoteOperation attribute value as + true on the DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write + command: "writeAttribute" + attribute: "RequirePINforRemoteOperation" + arguments: + value: true + + - label: + "Step 5: TH writes the RequirePINforRemoteOperation attribute value as + true on the DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write + command: "writeAttribute" + attribute: "RequirePINforRemoteOperation" + arguments: + value: true + response: + error: UNSUPPORTED_WRITE + + - label: + "Step 6: TH reads the RequirePINforRemoteOperation attribute from the + DUT" + PICS: DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033 + command: "readAttribute" + attribute: "RequirePINforRemoteOperation" + response: + value: true + + - label: "Step 7: TH sends Ubolt Door Command to the DUT with valid PINCode" + PICS: DRLK.S.C27.Rsp && DRLK.S.F0c + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + + - label: + "Step 8: TH sends Unbolt Door Command to the DUT with Invalid PINCode" + PICS: DRLK.S.C27.Rsp && DRLK.S.F0c + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123458" + response: + error: FAILURE + + - label: "Step 9: TH sends Unbolt Door Command to the DUT without PINCode" + PICS: DRLK.S.C27.Rsp && DRLK.S.F0c + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + response: + error: FAILURE + + - label: + "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the + DUT" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030.Write + command: "writeAttribute" + attribute: "WrongCodeEntryLimit" + arguments: + value: 3 + + - label: + "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the + DUT" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0030.Write + command: "writeAttribute" + attribute: "WrongCodeEntryLimit" + arguments: + value: 3 + response: + error: UNSUPPORTED_WRITE + + - label: + "Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 + Seconds on the DUT and Verify that the DUT sends Success response" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031.Write + command: "writeAttribute" + attribute: "UserCodeTemporaryDisableTime" + arguments: + value: 15 + + - label: + "Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 + Seconds on the DUT and Verify that the DUT sends Success response" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0031.Write + command: "writeAttribute" + attribute: "UserCodeTemporaryDisableTime" + arguments: + value: 15 + response: + error: UNSUPPORTED_WRITE + + - label: + "Step 12a: TH sends Unbolt Door Command to the DUT with invalid + PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123457" + response: + error: FAILURE + + - label: + "Step 12b: TH sends Unbolt Door Command to the DUT with invalid + PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123458" + response: + error: FAILURE + + - label: + "Step 12c: TH sends Unbolt Door Command to the DUT with invalid + PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123459" + response: + error: FAILURE + + - label: + "Step 12d: TH sends Unbolt Door Command to the DUT with invalid + PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123460" + response: + error: FAILURE + + - label: + "Step 13: TH reads UserCodedTemporaryDisableTime attribute from DUT" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031 + command: "readAttribute" + attribute: "UserCodeTemporaryDisableTime" + response: + value: 15 + + - label: + "Step 14: TH sends Unbolt Door Command to the DUT with valid PINCode + before UserCodeTemporaryDisableTime expires" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + response: + error: FAILURE + + - label: "Wait for UserCodeTemporaryDisableTime expires" + cluster: "DelayCommands" + command: "WaitForMs" + PICS: DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031 + arguments: + values: + - name: "ms" + value: 15000 + + - label: + "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on + the DUT" + PICS: DRLK.S.A0023.Write && PICS_SDK_CI_ONLY + command: "writeAttribute" + attribute: "AutoRelockTime" + arguments: + value: 10 + + - label: + "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on + the DUT" + PICS: DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP + command: "writeAttribute" + attribute: "AutoRelockTime" + arguments: + value: 60 + + - label: + "Step 15: TH writes AutoRelockTime attribute value as 10 seconds on + the DUT" + PICS: PICS_SDK_CI_ONLY && !DRLK.S.A0023.Write + command: "writeAttribute" + attribute: "AutoRelockTime" + arguments: + value: 10 + response: + error: UNSUPPORTED_WRITE + + - label: + "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on + the DUT" + PICS: PICS_SKIP_SAMPLE_APP && !DRLK.S.A0023.Write + command: "writeAttribute" + attribute: "AutoRelockTime" + arguments: + value: 60 + response: + error: UNSUPPORTED_WRITE + + - label: "Step 16: TH reads the AutoRelockTime attribute from the DUT" + PICS: DRLK.S.A0023 && PICS_SDK_CI_ONLY + command: "readAttribute" + attribute: "AutoRelockTime" + response: + value: 10 + + - label: "Step 16: TH reads the AutoRelockTime attribute from the DUT" + PICS: DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP + command: "readAttribute" + attribute: "AutoRelockTime" + response: + value: 60 + + - label: + "Step 17: TH sends the Unbolt Door command to the DUT with valid + PINCode" + PICS: DRLK.S.C27.Rsp + command: "UnboltDoor" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "PINCode" + value: "123456" + + - label: "Wait for AutoRelockTime Expires" + cluster: "DelayCommands" + command: "WaitForMs" + PICS: DRLK.S.A0023 && PICS_SDK_CI_ONLY + arguments: + values: + - name: "ms" + value: 10000 + + - label: "Wait for AutoRelockTime Expires" + cluster: "DelayCommands" + command: "WaitForMs" + PICS: DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP + arguments: + values: + - name: "ms" + value: 60000 + + - label: "Step 18: TH reads LockState attribute" + PICS: DRLK.S.A0000 && DRLK.S.C01.Rsp + command: "readAttribute" + attribute: "LockState" + response: + value: 1 + + - label: "Cleanup the created user" + command: "ClearUser" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "UserIndex" + value: 1 + + - label: "Clean the created credential" + PICS: DRLK.S.C26.Rsp + command: "ClearCredential" + timedInteractionTimeoutMs: 1000 + arguments: + values: + - name: "Credential" + value: { CredentialType: 1, CredentialIndex: 1 } diff --git a/src/app/tests/suites/certification/Test_TC_DRLK_2_3.yaml b/src/app/tests/suites/certification/Test_TC_DRLK_2_3.yaml index 45df632606a5e3..10720a900e55e4 100644 --- a/src/app/tests/suites/certification/Test_TC_DRLK_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_DRLK_2_3.yaml @@ -224,7 +224,7 @@ tests: - label: "TH writes WrongCodeEntryLimit attribute value as 3 on the DUT and Verify that the DUT sends Success response" - PICS: DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030 + PICS: DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030.Write command: "writeAttribute" attribute: "WrongCodeEntryLimit" arguments: @@ -233,7 +233,7 @@ tests: - label: "TH writes WrongCodeEntryLimit attribute value as 3 on the DUT and verify DUT responds with UNSUPPORTED_WRITE" - PICS: DRLK.S.F00 && DRLK.S.F01 && ! DRLK.S.A0030 + PICS: DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0030.Write command: "writeAttribute" attribute: "WrongCodeEntryLimit" arguments: @@ -244,7 +244,7 @@ tests: - label: "TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify that the DUT sends Success response" - PICS: DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031 + PICS: DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031.Write command: "writeAttribute" attribute: "UserCodeTemporaryDisableTime" arguments: @@ -253,7 +253,7 @@ tests: - label: "TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify that the DUT sends Success response" - PICS: DRLK.S.F00 && DRLK.S.F01 && ! DRLK.S.A0031 + PICS: DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0031.Write command: "writeAttribute" attribute: "UserCodeTemporaryDisableTime" arguments: @@ -335,21 +335,21 @@ tests: value: 15000 - label: "TH writes AutoRelockTime attribute value as 10 seconds on the DUT" - PICS: DRLK.S.A0023 && PICS_SDK_CI_ONLY + PICS: DRLK.S.A0023.Write && PICS_SDK_CI_ONLY command: "writeAttribute" attribute: "AutoRelockTime" arguments: value: 10 - label: "TH writes AutoRelockTime attribute value as 60 seconds on the DUT" - PICS: DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP + PICS: DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP command: "writeAttribute" attribute: "AutoRelockTime" arguments: value: 60 - label: "TH writes AutoRelockTime attribute value as 10 seconds on the DUT" - PICS: "!DRLK.S.A0023 && PICS_SDK_CI_ONLY" + PICS: " !DRLK.S.A0023.Write && PICS_SDK_CI_ONLY " command: "writeAttribute" attribute: "AutoRelockTime" arguments: @@ -358,7 +358,7 @@ tests: error: UNSUPPORTED_WRITE - label: "TH writes AutoRelockTime attribute value as 60 seconds on the DUT" - PICS: "!DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP" + PICS: " !DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP " command: "writeAttribute" attribute: "AutoRelockTime" arguments: diff --git a/src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml b/src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml new file mode 100644 index 00000000000000..eabed515952248 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_1_1.yaml @@ -0,0 +1,188 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.1.1. [TC-FAN-1.1] Global attributes with DUT as Server + +PICS: + - FAN.S + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + #Issue : https://github.com/project-chip/connectedhomeip/issues/27320 + - label: "Read the global attribute: ClusterRevision" + verification: | + ./chip-tool fancontrol read cluster-revision 1 1 + + On TH(chip-tool), Verify the ClusterRevision attribute value as 3: + + [1685097285.665923][29977:29979] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0202 Attribute 0x0000_FFFD DataVersion: 2714837972 + [1685097285.666069][29977:29979] CHIP:TOO: ClusterRevision: 2 + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "message" + value: "Please enter 'y' for success" + - name: "expectedValue" + value: "y" + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: + " !FAN.S.F00 && !FAN.S.F01 && !FAN.S.F02 && !FAN.S.F03 && !FAN.S.F04 + && !FAN.S.F05 " + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given FAN.S.F00(Condition) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given FAN.S.F01(Warning) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given FAN.S.F02(Condition) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4] + + - label: + "Given FAN.S.F03(Warning) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8] + + - label: + "Given FAN.S.F04(Warning) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10] + + - label: + "Given FAN.S.F05(Warning) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FAN.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1, 2, 3, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent FAN.S.F00 (SPD) attribute in AttributeList" + PICS: FAN.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [4, 5, 6] + + - label: + "Read the feature dependent FAN.S.F02(RCK) attribute in AttributeList" + PICS: FAN.S.F02 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [7, 8] + + - label: + "Read the feature dependent FAN.S.F03(WND) attribute in AttributeList" + PICS: FAN.S.F03 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [9, 10] + + - label: + "Read the feature dependent FAN.S.F05(DIR) attribute in AttributeList" + PICS: FAN.S.F05 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [11] + + - label: "Read the global attribute: AcceptedCommandList" + PICS: " !FAN.S.C00.Rsp " + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + value: [] + constraints: + type: list + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: FAN.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] diff --git a/src/app/tests/suites/certification/Test_TC_FAN_2_1.yaml b/src/app/tests/suites/certification/Test_TC_FAN_2_1.yaml new file mode 100644 index 00000000000000..e9575ba38acbb7 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_2_1.yaml @@ -0,0 +1,72 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.1. [TC-FAN-2.1] Mandatory Attributes with DUT as Server + +PICS: + - FAN.S + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the the FanMode attribute" + PICS: FAN.S.A0000 + command: "readAttribute" + attribute: "FanMode" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 6 + + - label: "TH reads from the DUT the the FanModeSequence attribute" + PICS: FAN.S.A0001 + command: "readAttribute" + attribute: "FanModeSequence" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 5 + + - label: "TH reads from the DUT the the PercentSetting attribute" + PICS: FAN.S.A0002 + command: "readAttribute" + attribute: "PercentSetting" + response: + constraints: + type: int8u + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the the PercentCurrent attribute" + PICS: FAN.S.A0003 + command: "readAttribute" + attribute: "PercentCurrent" + response: + constraints: + type: int8u + minValue: 0 + maxValue: 100 diff --git a/src/app/tests/suites/certification/Test_TC_FAN_2_2.yaml b/src/app/tests/suites/certification/Test_TC_FAN_2_2.yaml new file mode 100644 index 00000000000000..9c7bf546a44ae3 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_2_2.yaml @@ -0,0 +1,64 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.2. [TC-FAN-2.2] Optional speed attributes with DUT as Server + +PICS: + - FAN.S + - FAN.S.F00 + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the the SpeedMax attribute" + PICS: FAN.S.A0004 + command: "readAttribute" + attribute: "SpeedMax" + response: + saveAs: SpeedMaxValue + constraints: + type: int8u + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the the SpeedSetting attribute" + PICS: FAN.S.A0005 && FAN.S.A0004 + command: "readAttribute" + attribute: "SpeedSetting" + response: + constraints: + type: int8u + minValue: 0 + maxValue: SpeedMaxValue + + - label: "TH reads from the DUT the the SpeedCurrent attribute" + PICS: FAN.S.A0006 && FAN.S.A0004 + command: "readAttribute" + attribute: "SpeedCurrent" + response: + constraints: + type: int8u + minValue: 0 + maxValue: SpeedMaxValue diff --git a/src/app/tests/suites/certification/Test_TC_FAN_2_3.yaml b/src/app/tests/suites/certification/Test_TC_FAN_2_3.yaml new file mode 100644 index 00000000000000..0c6141c77e41f6 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_2_3.yaml @@ -0,0 +1,49 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.3. [TC-FAN-2.3] Optional rock attributes with DUT as Server + +PICS: + - FAN.S + - FAN.S.F02 + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the the RockSupport attribute" + PICS: FAN.S.A0007 + command: "readAttribute" + attribute: "RockSupport" + response: + constraints: + type: bitmap8 + + - label: "TH reads from the DUT the the RockSetting attribute" + PICS: FAN.S.A0008 + command: "readAttribute" + attribute: "RockSetting" + response: + constraints: + type: bitmap8 diff --git a/src/app/tests/suites/certification/Test_TC_FAN_2_4.yaml b/src/app/tests/suites/certification/Test_TC_FAN_2_4.yaml new file mode 100644 index 00000000000000..d73f364456fcec --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_2_4.yaml @@ -0,0 +1,49 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.4. [TC-FAN-2.4] Optional wind attributes with DUT as Server + +PICS: + - FAN.S + - FAN.S.F03 + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the the WindSupport attribute" + PICS: FAN.S.A0009 + command: "readAttribute" + attribute: "WindSupport" + response: + constraints: + type: bitmap8 + + - label: "TH reads from the DUT the the WindSetting attribute" + PICS: FAN.S.A000A + command: "readAttribute" + attribute: "WindSetting" + response: + constraints: + type: bitmap8 diff --git a/src/app/tests/suites/certification/Test_TC_FAN_3_1.yaml b/src/app/tests/suites/certification/Test_TC_FAN_3_1.yaml new file mode 100644 index 00000000000000..217821b5aebbeb --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_3_1.yaml @@ -0,0 +1,144 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.6. [TC-FAN-3.1] Mandatory functionality with DUT as Server + +PICS: + - FAN.S + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + ConfigPercentSetting: + type: int8u + defaultValue: 30 + +tests: + - label: "Step 1: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: + "Step 2a: TH writes a supported FanMode attribute that is other than + off to DUT" + PICS: FAN.S.A0000 + command: "writeAttribute" + attribute: "FanMode" + arguments: + value: 3 + + - label: "Wait 1000ms" + PICS: FAN.S.A0000 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 2b: TH reads from the DUT the the FanMode attribute" + PICS: FAN.S.A0000 + command: "readAttribute" + attribute: "FanMode" + response: + value: 3 + + - label: "Step 2.1a: TH writes the Off value of FanMode attribute to DUT" + PICS: FAN.S.A0000 + command: "writeAttribute" + attribute: "FanMode" + arguments: + value: 0 + + - label: "Wait 1000ms" + PICS: FAN.S.A0000 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 2.1b: TH reads from the DUT the PercentSetting attribute" + PICS: FAN.S.A0002 + command: "readAttribute" + attribute: "PercentSetting" + response: + value: 0 + + - label: "Step 2.1c: TH reads from the DUT the PercentCurrent attribute" + PICS: FAN.S.A0003 + command: "readAttribute" + attribute: "PercentCurrent" + response: + value: 0 + + - label: + "Step 3a: TH writes PercentSetting attribute a non-zero value to DUT" + PICS: FAN.S.A0002 + command: "writeAttribute" + attribute: "PercentSetting" + arguments: + value: ConfigPercentSetting + + - label: "Wait 1000ms" + PICS: FAN.S.A0002 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 3b: TH reads from the DUT the PercentCurrent attribute" + PICS: FAN.S.A0003 + command: "readAttribute" + attribute: "PercentCurrent" + response: + value: ConfigPercentSetting + + - label: "Step 3c: TH reads from the DUT the PercentSetting attribute" + PICS: FAN.S.A0002 + command: "readAttribute" + attribute: "PercentSetting" + response: + value: ConfigPercentSetting + + - label: "Step 3.1a: TH writes PercentSetting attribute a zero value to DUT" + PICS: FAN.S.A0002 + command: "writeAttribute" + attribute: "PercentSetting" + arguments: + value: 0 + + - label: "Wait 1000ms" + PICS: FAN.S.A0002 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 3.1b: TH reads from the DUT the the FanMode attribute" + PICS: FAN.S.A0000 + command: "readAttribute" + attribute: "FanMode" + response: + value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_FAN_3_2.yaml b/src/app/tests/suites/certification/Test_TC_FAN_3_2.yaml new file mode 100644 index 00000000000000..d2130d7fcf1216 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_3_2.yaml @@ -0,0 +1,66 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.7. [TC-FAN-3.2] Optional speed functionality with DUT as Server + +PICS: + - FAN.S + - FAN.S.F00 + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + ConfigSpeedSetting: + type: int8u + defaultValue: 50 + +tests: + - label: "Step 1: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 2: TH writes SpeedSetting attribute a valid value to DUT" + PICS: FAN.S.A0005 + command: "writeAttribute" + attribute: "SpeedSetting" + arguments: + value: ConfigSpeedSetting + + - label: "Wait 1000ms" + PICS: FAN.S.A0005 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 3: TH reads from the DUT the the SpeedSetting attribute" + PICS: FAN.S.A0005 + command: "readAttribute" + attribute: "SpeedSetting" + response: + value: ConfigSpeedSetting + + - label: "Step 4: TH reads from the DUT the the SpeedCurrent attribute" + PICS: FAN.S.A0006 + command: "readAttribute" + attribute: "SpeedCurrent" + response: + value: ConfigSpeedSetting diff --git a/src/app/tests/suites/certification/Test_TC_FAN_3_4.yaml b/src/app/tests/suites/certification/Test_TC_FAN_3_4.yaml new file mode 100644 index 00000000000000..3b38aa97f30495 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FAN_3_4.yaml @@ -0,0 +1,59 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 263.2.9. [TC-FAN-3.4] Optional wind functionality with DUT as Server + +PICS: + - FAN.S + - FAN.S.F03 + +config: + nodeId: 0x12344321 + cluster: "Fan Control" + endpoint: 1 + ConfigWindSetting: + type: bitmap8 + defaultValue: 1 + +tests: + - label: "Step 1: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 2: TH writes WindSetting attribute a valid value to DUT" + PICS: FAN.S.A0008 + command: "writeAttribute" + attribute: "WindSetting" + arguments: + value: ConfigWindSetting + + - label: "Wait 1000ms" + PICS: FAN.S.A0008 + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Step 3: TH reads from the DUT the the WindSetting attribute" + PICS: FAN.S.A0008 + command: "readAttribute" + attribute: "WindSetting" + response: + value: ConfigWindSetting diff --git a/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml index 907eae64ca7980..e23342eade6a4b 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml @@ -16,6 +16,7 @@ name: 24.6.1. [TC-LVL-6.1] Stop Verification (DUT as Server) PICS: - LVL.S + - LVL.S.M.VarRate config: nodeId: 0x12344321 diff --git a/src/app/tests/suites/certification/Test_TC_LVL_7_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_7_1.yaml index 31aedbdc90904e..05fed1f640e8c3 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_7_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_7_1.yaml @@ -23,204 +23,213 @@ PICS: config: nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 + cluster: "Level Control" + endpoint: 1 + RandomLevelValue: + type: int8u + defaultValue: 100 + RandomFrequencyValue: + type: int16u + defaultValue: 30000 tests: - - label: "TH writes 0x00 to the Options attribute" + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + #Adding below step resolve the issue https://github.com/CHIP-Specifications/chip-certification-tool/issues/499 + - label: + "Precondition: write default value of OnOffTransitionTime attribute" + PICS: LVL.S.A0010 + command: "writeAttribute" + attribute: "OnOffTransitionTime" + arguments: + value: 0 + + - label: "Step 0a: TH writes 0 to the Options attribute" PICS: LVL.S.A000f - verification: | - ./chip-tool levelcontrol write options 0x00 1 1 - verify that DUT sends a success response On TH(chip-tool) - [1658732283.094610][3087:3092] CHIP:DMG: WriteResponseMessage = - [1658732283.094656][3087:3092] CHIP:DMG: { - [1658732283.094696][3087:3092] CHIP:DMG: AttributeStatusIBs = - [1658732283.094863][3087:3092] CHIP:DMG: [ - [1658732283.094914][3087:3092] CHIP:DMG: AttributeStatusIB = - [1658732283.094965][3087:3092] CHIP:DMG: { - [1658732283.095012][3087:3092] CHIP:DMG: AttributePathIB = - [1658732283.095068][3087:3092] CHIP:DMG: { - [1658732283.095129][3087:3092] CHIP:DMG: Endpoint = 0x1, - [1658732283.095197][3087:3092] CHIP:DMG: Cluster = 0x8, - [1658732283.095259][3087:3092] CHIP:DMG: Attribute = 0x0000_000F, - [1658732283.095322][3087:3092] CHIP:DMG: } - [1658732283.095385][3087:3092] CHIP:DMG: - [1658732283.095446][3087:3092] CHIP:DMG: StatusIB = - [1658732283.095505][3087:3092] CHIP:DMG: { - [1658732283.095564][3087:3092] CHIP:DMG: status = 0x00 (SUCCESS), - [1658732283.095626][3087:3092] CHIP:DMG: }, - [1658732283.095682][3087:3092] CHIP:DMG: - [1658732283.095731][3087:3092] CHIP:DMG: }, - [1658732283.095786][3087:3092] CHIP:DMG: - [1658732283.095830][3087:3092] CHIP:DMG: ], - [1658732283.095883][3087:3092] CHIP:DMG: - [1658732283.095927][3087:3092] CHIP:DMG: InteractionModelRevision = 1 - [1658732283.095970][3087:3092] CHIP:DMG: } - disabled: true - - - label: "TH sends On command to DUT" - PICS: OO.S.C01.Rsp - verification: | - ./chip-tool onoff on 1 1 - verify that DUT sends a success response On TH(chip-tool) - [1658731148.428641][2894:2899] CHIP:DMG: InteractionModelRevision = 1 - [1658731148.428665][2894:2899] CHIP:DMG: }, - [1658731148.428723][2894:2899] CHIP:DMG: Received Command Response Status for Endpoint=1 Cluster=0x0000_0006 Command=0x0000_0001 Status=0x0 - [1658731148.428766][2894:2899] CHIP:DMG: ICR moving to [AwaitingDe] - [1658731148.428828][2894:2899] CHIP:EM: Sending Standalone Ack for MessageCounter:77812182 on exchange 38946i - disabled: true - - - label: "TH reads the MinLevel attribute from the DUT" - PICS: LVL.S.A0002 - verification: | - ./chip-tool levelcontrol read min-level 1 1 - - Record the MinLevel attribute value for usage in later steps, this is optional attribute implemented in RPI, may vary based on DUT implementation on TH(chip-tool) log + command: "writeAttribute" + attribute: "Options" + arguments: + value: 0 - [1658919507.800574][3717:3722] CHIP:DMG: } - [1658919507.800774][3717:3722] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0002 DataVersion: 3233313015 - [1658919507.800931][3717:3722] CHIP:TOO: min level: 1 - [1658919507.801058][3717:3722] CHIP:EM: Sending Standalone Ack for MessageCounter:165803473 on exchange 38651i - disabled: true + - label: "Step 0b: TH sends On command to DUT" + cluster: "On/Off" + PICS: OO.S.C01.Rsp + command: "On" - - label: "TH reads the MaxLevel attribute from the DUT" + - label: "Step 1a: TH reads the MinLevel attribute from the DUT" + PICS: LVL.S.A0002 + command: "readAttribute" + attribute: "MinLevel" + response: + saveAs: minLevelValue + constraints: + type: int8u + minValue: 0 + maxValue: 254 + + - label: "Step 1b: TH reads the MaxLevel attribute from the DUT" PICS: LVL.S.A0003 - verification: | - ./chip-tool levelcontrol read max-level 1 1 - Record the MaxLevel attribute value for usage in later steps, this is optional attribute implemented in RPI, may vary based on DUT implementation on TH(chip-tool) log - - - [1654065684.869569][10048:10053] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0003 DataVersion: 540248549 - [1654065684.869621][10048:10053] CHIP:TOO: max level: 254 - [1654065684.869737][10048:10053] CHIP:EM: Sending Standalone Ack for MessageCounter:9018536 on exchange 12814i - disabled: true + command: "readAttribute" + attribute: "MaxLevel" + response: + saveAs: maxLevelValue + constraints: + type: int8u + minValue: 0 + maxValue: 254 - label: - "TH sends a MoveToLevel command to DUT, with the Level field set to a - value between the MinLevel and MaxLevel values (if present, otherwise - between 0x01 and 0xFE) and the TransitionTime field set to 0x0000 - (move immediately)." + "Step 1c: TH sends a MoveToLevel command to DUT, with the Level field + set to a value between the MinLevel and MaxLevel values (if present, + otherwise between 0x01 and 0xFE) and the TransitionTime field set to + 0x0000 (move immediately)." PICS: LVL.S.C00.Rsp - verification: | - ./chip-tool levelcontrol move-to-level 253 0 0 0 1 1 - verify that DUT sends a successful (value 0x00) status response on TH(chip-tool) log - - - [1661759404.121731][104632:104637] CHIP:DMG: InvokeResponseMessage = - [1661759404.121739][104632:104637] CHIP:DMG: { - [1661759404.121750][104632:104637] CHIP:DMG: suppressResponse = false, - [1661759404.121759][104632:104637] CHIP:DMG: InvokeResponseIBs = - [1661759404.121774][104632:104637] CHIP:DMG: [ - [1661759404.121782][104632:104637] CHIP:DMG: InvokeResponseIB = - [1661759404.121797][104632:104637] CHIP:DMG: { - [1661759404.121805][104632:104637] CHIP:DMG: CommandStatusIB = - [1661759404.121817][104632:104637] CHIP:DMG: { - [1661759404.121826][104632:104637] CHIP:DMG: CommandPathIB = - [1661759404.121838][104632:104637] CHIP:DMG: { - [1661759404.121849][104632:104637] CHIP:DMG: EndpointId = 0x1, - [1661759404.121862][104632:104637] CHIP:DMG: ClusterId = 0x8, - [1661759404.121871][104632:104637] CHIP:DMG: CommandId = 0x0, - [1661759404.121878][104632:104637] CHIP:DMG: }, - [1661759404.121889][104632:104637] CHIP:DMG: - [1661759404.121896][104632:104637] CHIP:DMG: StatusIB = - [1661759404.121906][104632:104637] CHIP:DMG: { - [1661759404.121914][104632:104637] CHIP:DMG: status = 0x00 (SUCCESS), - [1661759404.121922][104632:104637] CHIP:DMG: }, - [1661759404.121930][104632:104637] CHIP:DMG: - [1661759404.121937][104632:104637] CHIP:DMG: }, - [1661759404.121947][104632:104637] CHIP:DMG: - [1661759404.121954][104632:104637] CHIP:DMG: }, - [1661759404.121964][104632:104637] CHIP:DMG: - [1661759404.121970][104632:104637] CHIP:DMG: ], - [1661759404.121981][104632:104637] CHIP:DMG: - [1661759404.121988][104632:104637] CHIP:DMG: InteractionModelRevision = 1 - [1661759404.121995][104632:104637] CHIP:DMG: }, - [1661759404.122021][104632:104637] CHIP:DMG: Received Command Response Status for Endpoint=1 Cluster=0x0000_0008 Command=0x0000_0000 Status=0x0 - [1661759404.122040][104632:104637] CHIP:DMG: ICR moving to [AwaitingDe] - disabled: true - - - label: "TH reads CurrentLevel attribute from DUT" + command: "MoveToLevel" + arguments: + values: + - name: "Level" + value: RandomLevelValue + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Wait 100ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: "Step 1d: TH reads CurrentLevel attribute from DUT" PICS: LVL.S.C00.Rsp && LVL.S.A0000 - verification: | - ./chip-tool levelcontrol read current-level 1 1 - verify that the CurrentLevel attribute has the value given in 1c On TH(chip-tool) + command: "readAttribute" + attribute: "CurrentLevel" + response: + value: RandomLevelValue - [1654065859.401140][10188:10193] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0000 DataVersion: 540248551 - [1654065859.401197][10188:10193] CHIP:TOO: current level: 253 - [1654065859.401268][10188:10193] CHIP:EM: Sending Standalone Ack for MessageCounter:2942065 on exchange 21982i - disabled: true - - - label: "TH reads the CurrentFrequency attribute." + - label: "Step 2a: TH reads the CurrentFrequency attribute." PICS: LVL.S.A0004 - verification: | - ./chip-tool levelcontrol read current-frequency 1 1 - verify the CurrentFrequency attribute value On TH(chip-tool) - [1654065889.927185][10196:10201] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0004 DataVersion: 540248551 - [1654065889.927213][10196:10201] CHIP:TOO: current frequency: 0 - [1654065889.927247][10196:10201] CHIP:EM: Sending Standalone Ack for MessageCounter:9499985 on exchange 53579i - disabled: true - - - label: "TH reads the MinFrequency attribute." + command: "readAttribute" + attribute: "CurrentFrequency" + response: + saveAs: CurrentFrequencyValue + constraints: + type: int16u + minValue: 0 + maxValue: 65535 + + - label: "Step 2b: TH reads the MinFrequency attribute." PICS: LVL.S.A0005 - verification: | - ./chip-tool levelcontrol read min-frequency 1 1 - verify the MinFrequency attribute value On TH(chip-tool) - - [1654066011.412756][10228:10233] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0005 DataVersion: 540248551 - [1654066011.412814][10228:10233] CHIP:TOO: min frequency: 0 - [1654066011.412890][10228:10233] CHIP:EM: Sending Standalone Ack for MessageCounter:4631273 on exchange 37550i - disabled: true + command: "readAttribute" + attribute: "MinFrequency" + response: + saveAs: MinFrequencyValue + constraints: + type: int16u + minValue: 0 + maxValue: 65535 - - label: "TH reads the MaxFrequency attribute." + - label: + "Step 2c: TH reads the MaxFrequency attribute and check, if fmax < + fmin, FAIL the test." PICS: LVL.S.A0006 - verification: | - ./chip-tool levelcontrol read max-frequency 1 1 - verify the MaxFrequency attribute value On TH(chip-tool) - - [1654066035.586373][10241:10246] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0008 Attribute 0x0000_0006 DataVersion: 540248551 - [1654066035.586435][10241:10246] CHIP:TOO: max frequency: 0 - [1654066035.586512][10241:10246] CHIP:EM: Sending Standalone Ack for MessageCounter:13631899 on exchange 38194i - disabled: true + command: "readAttribute" + attribute: "MaxFrequency" + response: + saveAs: MaxFrequencyValue + constraints: + type: int16u + minValue: MinFrequencyValue + maxValue: 65535 - label: - "TH sends a MoveToClosestFrequency command to DUT, with the frequency - field set to a random value frand, chosen such that: fmin < frand < - fmax" - PICS: LVL.S.C08.Rsp - verification: | - Frequency feature is Optional & is not verifiable at this moment. Please skip this step - disabled: true - - - label: "TH reads the CurrentFrequency attribute." - PICS: LVL.S.C08.Rsp && LVL.S.A0004 - verification: | - ./chip-tool levelcontrol read current-frequency 1 1 - disabled: true + "Step 2d: sanity check on values read in steps 2a..2c, if fc < fmin, + FAIL the test and fc > fmax, FAIL the test" + PICS: LVL.S.A0004 + command: "readAttribute" + attribute: "CurrentFrequency" + response: + constraints: + type: int16u + minValue: MinFrequencyValue + maxValue: MaxFrequencyValue - label: - "TH sends a MoveToClosestFrequency command to DUT, with the frequency - field set to fmax + 1" + "Step 3a: TH sends a MoveToClosestFrequency command to DUT, with the + frequency field set to a random value frand, chosen such that: fmin < + frand < fmax" PICS: LVL.S.C08.Rsp - verification: | - Optional command based on Feature support - disabled: true - - - label: "TH reads the CurrentFrequency attribute." + command: "MoveToClosestFrequency" + arguments: + values: + - name: "Frequency" + value: RandomFrequencyValue + + - label: "Wait 100ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: "Step 3b: TH reads the CurrentFrequency attribute." PICS: LVL.S.C08.Rsp && LVL.S.A0004 - verification: | - ./chip-tool levelcontrol read current-frequency 1 1 - disabled: true + command: "readAttribute" + attribute: "CurrentFrequency" + response: + value: RandomFrequencyValue - label: - "TH sends a MoveToClosestFrequency command to DUT, with the frequency - field set to fmin - 1" - PICS: LVL.S.C08.Rsp + "Step 4a: TH sends a MoveToClosestFrequency command to DUT, with the + frequency field set to fmax + 1" + PICS: LVL.S.C08.Rsp && PICS_USER_PROMPT verification: | Frequency feature is Optional & is not verifiable at this moment. Please skip this step - disabled: true + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Please enter 'y' for success" + - name: "expectedValue" + value: "y" + + - label: "Step 4b: TH reads the CurrentFrequency attribute." + PICS: LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT + command: "readAttribute" + attribute: "CurrentFrequency" + response: + value: RandomFrequencyValue - - label: "TH reads the CurrentFrequency attribute." - PICS: LVL.S.C08.Rsp && LVL.S.A0004 + - label: + "Step 5a: TH sends a MoveToClosestFrequency command to DUT, with the + frequency field set to fmin - 1" + PICS: LVL.S.C08.Rsp && PICS_USER_PROMPT verification: | - ./chip-tool levelcontrol read current-frequency 1 1 - disabled: true + Frequency feature is Optional & is not verifiable at this moment. Please skip this step + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Please enter 'y' for success" + - name: "expectedValue" + value: "y" + + - label: "Step 5b: TH reads the CurrentFrequency attribute." + PICS: LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT + command: "readAttribute" + attribute: "CurrentFrequency" + response: + value: RandomFrequencyValue diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index bc2daf1bc488b6..52ca1f4b04899a 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -490,7 +490,7 @@ LVL.S.C04.Rsp=1 LVL.S.C05.Rsp=1 LVL.S.C06.Rsp=1 LVL.S.C07.Rsp=1 -LVL.S.C08.Rsp=1 +LVL.S.C08.Rsp=0 LVL.S.M.VarRate=1 LVL.C=1 @@ -1467,6 +1467,30 @@ DRLK.S.A0032=1 DRLK.S.A0033=1 DRLK.S.A0035=1 +#ReadOnly attributes +DRLK.S.A0028.ReadOnly=1 +DRLK.S.A002c.ReadOnly=1 + +#write attributes +DRLK.S.A0004.Write=0 +DRLK.S.A0005.Write=0 +DRLK.S.A0006.Write=0 +DRLK.S.A0021.Write=1 +DRLK.S.A0022.Write=0 +DRLK.S.A0023.Write=1 +DRLK.S.A0024.Write=1 +DRLK.S.A0025.Write=1 +DRLK.S.A0028.Write=0 +DRLK.S.A0029.Write=1 +DRLK.S.A002a.Write=1 +DRLK.S.A002b.Write=1 +DRLK.S.A002c.Write=1 +DRLK.S.A0030.Write=1 +DRLK.S.A0031.Write=1 +DRLK.S.A0032.Write=1 +DRLK.S.A0033.Write=1 +DRLK.S.A0035.Write=0 + DRLK.C=1 DRLK.C.F0a=0 DRLK.C.F0b=0 @@ -2529,3 +2553,30 @@ RNCONC.S.Afffa=1 RNCONC.S.Afffb=1 RNCONC.S.Afffc=1 RNCONC.S.Afffd=1 + +# Fan Control + +#Features +FAN.S.F00=1 +FAN.S.F01=1 +FAN.S.F02=0 +FAN.S.F03=0 +FAN.S.F04=0 +FAN.S.F05=0 + +#Server Attributes +FAN.S.A0000=1 +FAN.S.A0001=1 +FAN.S.A0002=1 +FAN.S.A0003=1 +FAN.S.A0004=1 +FAN.S.A0005=1 +FAN.S.A0006=1 +FAN.S.A0007=1 +FAN.S.A0008=1 +FAN.S.A0009=1 +FAN.S.A000A=1 +FAN.S.A000B=1 + +#Server commands +FAN.S.C00.Rsp=1 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 156d22d600efe8..b0c40ab16561f4 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -57,6 +57,16 @@ "DiagnosticsLogs": ["Test_TC_DLOG_1_1"], "FlowMeasurement": ["Test_TC_FLW_1_1", "Test_TC_FLW_2_1"], "FixedLabel": ["Test_TC_FLABEL_1_1", "Test_TC_FLABEL_2_1"], + "FanControl": [ + "Test_TC_FAN_1_1", + "Test_TC_FAN_2_1", + "Test_TC_FAN_2_2", + "Test_TC_FAN_2_3", + "Test_TC_FAN_2_4", + "Test_TC_FAN_3_1", + "Test_TC_FAN_3_2", + "Test_TC_FAN_3_4" + ], "GeneralCommissioning": ["Test_TC_CGEN_1_1", "Test_TC_CGEN_2_1"], "GeneralDiagnostics": ["Test_TC_DGGEN_1_1", "Test_TC_DGGEN_2_1"], "Identify": [ @@ -82,7 +92,8 @@ "Test_TC_LVL_3_1", "Test_TC_LVL_4_1", "Test_TC_LVL_5_1", - "Test_TC_LVL_6_1" + "Test_TC_LVL_6_1", + "Test_TC_LVL_7_1" ], "LocalizationConfiguration": ["Test_TC_LCFG_1_1"], "TimeFormatLocalization": ["Test_TC_LTIME_1_2"], @@ -264,7 +275,8 @@ "Test_TC_DRLK_2_6", "Test_TC_DRLK_2_7", "Test_TC_DRLK_2_9", - "Test_TC_DRLK_2_11" + "Test_TC_DRLK_2_11", + "Test_TC_DRLK_2_12" ], "Groups": [ "TestGroupMessaging", @@ -339,6 +351,7 @@ "EthernetNetworkDiagnostics", "FlowMeasurement", "FixedLabel", + "FanControl", "GeneralCommissioning", "GeneralDiagnostics", "Identify", diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json index ad01f9f5eb80ec..215812bfef9f43 100644 --- a/src/app/tests/suites/manualTests.json +++ b/src/app/tests/suites/manualTests.json @@ -264,7 +264,7 @@ "Test_TC_DRLK_3_3" ], "LocalizationConfiguration": ["Test_TC_LCFG_2_1"], - "LevelControl": ["Test_TC_LVL_7_1", "Test_TC_LVL_8_1"], + "LevelControl": ["Test_TC_LVL_8_1"], "OnOff": ["Test_TC_OO_2_3"], "RelativeHumidityMeasurement": ["Test_TC_RH_2_2"], "Switch": ["Test_TC_SWTCH_2_2", "Test_TC_SWTCH_3_2"], diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 676f52894f4490..9e921715689829 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -109,6 +109,14 @@ class TestList : public Command printf("Test_TC_FLW_2_1\n"); printf("Test_TC_FLABEL_1_1\n"); printf("Test_TC_FLABEL_2_1\n"); + printf("Test_TC_FAN_1_1\n"); + printf("Test_TC_FAN_2_1\n"); + printf("Test_TC_FAN_2_2\n"); + printf("Test_TC_FAN_2_3\n"); + printf("Test_TC_FAN_2_4\n"); + printf("Test_TC_FAN_3_1\n"); + printf("Test_TC_FAN_3_2\n"); + printf("Test_TC_FAN_3_4\n"); printf("Test_TC_CGEN_1_1\n"); printf("Test_TC_CGEN_2_1\n"); printf("Test_TC_DGGEN_1_1\n"); @@ -127,6 +135,7 @@ class TestList : public Command printf("Test_TC_LVL_4_1\n"); printf("Test_TC_LVL_5_1\n"); printf("Test_TC_LVL_6_1\n"); + printf("Test_TC_LVL_7_1\n"); printf("Test_TC_LCFG_1_1\n"); printf("Test_TC_LUNIT_1_2\n"); printf("Test_TC_LUNIT_3_1\n"); @@ -290,6 +299,7 @@ class TestList : public Command printf("Test_TC_DRLK_2_7\n"); printf("Test_TC_DRLK_2_9\n"); printf("Test_TC_DRLK_2_11\n"); + printf("Test_TC_DRLK_2_12\n"); printf("TestGroupMessaging\n"); printf("TestGroupsCluster\n"); printf("TestGroupKeyManagementCluster\n"); @@ -562,7 +572,6 @@ class ManualTestList : public Command printf("Test_TC_DRLK_3_2\n"); printf("Test_TC_DRLK_3_3\n"); printf("Test_TC_LCFG_2_1\n"); - printf("Test_TC_LVL_7_1\n"); printf("Test_TC_LVL_8_1\n"); printf("Test_TC_OO_2_3\n"); printf("Test_TC_RH_2_2\n"); @@ -35459,10 +35468,10 @@ class Test_TC_FLABEL_2_1Suite : public TestCommand } }; -class Test_TC_CGEN_1_1Suite : public TestCommand +class Test_TC_FAN_1_1Suite : public TestCommand { public: - Test_TC_CGEN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CGEN_1_1", 7, credsIssuerConfig) + Test_TC_FAN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_1_1", 16, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -35470,7 +35479,7 @@ class Test_TC_CGEN_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CGEN_1_1Suite() {} + ~Test_TC_FAN_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -35501,12 +35510,7 @@ class Test_TC_CGEN_1_1Suite : public TestCommand break; case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - } + shouldContinue = true; break; case 2: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -35518,6 +35522,60 @@ class Test_TC_CGEN_1_1Suite : public TestCommand } break; case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + } + break; + case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList value; @@ -35527,7 +35585,6 @@ class Test_TC_CGEN_1_1Suite : public TestCommand VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); @@ -35536,38 +35593,65 @@ class Test_TC_CGEN_1_1Suite : public TestCommand VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); } break; - case 4: + case 10: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::DecodableList value; + chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); - } VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); } break; - case 5: + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 11UL)); + } + break; + case 14: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); } break; - case 6: + case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); } break; default: @@ -35594,43 +35678,107 @@ class Test_TC_CGEN_1_1Suite : public TestCommand } case 1: { LogStep(1, "Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::ClusterRevision::Id, true, chip::NullOptional); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); } case 2: { LogStep(2, "Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::FeatureMap::Id, true, chip::NullOptional); + VerifyOrDo(!ShouldSkip(" !FAN.S.F00 && !FAN.S.F01 && !FAN.S.F02 && !FAN.S.F03 && !FAN.S.F04 && !FAN.S.F05 "), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); } case 3: { - LogStep(3, "Read the global attribute: AttributeList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); + LogStep(3, "Given FAN.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); } case 4: { - LogStep(4, "Read the global attribute: EventList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::EventList::Id, true, chip::NullOptional); + LogStep(4, "Given FAN.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); } case 5: { - LogStep(5, "Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + LogStep(5, "Given FAN.S.F02(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); } case 6: { - LogStep(6, "Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + LogStep(6, "Given FAN.S.F03(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "Given FAN.S.F04(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "Given FAN.S.F05(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FAN.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 9: { + LogStep(9, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 10: { + LogStep(10, "Read the feature dependent FAN.S.F00 (SPD) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("FAN.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 11: { + LogStep(11, "Read the feature dependent FAN.S.F02(RCK) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("FAN.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 12: { + LogStep(12, "Read the feature dependent FAN.S.F03(WND) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("FAN.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 13: { + LogStep(13, "Read the feature dependent FAN.S.F05(DIR) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("FAN.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip(" !FAN.S.C00.Rsp "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AcceptedCommandList::Id, + true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("FAN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AcceptedCommandList::Id, + true, chip::NullOptional); } } return CHIP_NO_ERROR; } }; -class Test_TC_CGEN_2_1Suite : public TestCommand +class Test_TC_FAN_2_1Suite : public TestCommand { public: - Test_TC_CGEN_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CGEN_2_1", 8, credsIssuerConfig) + Test_TC_FAN_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_2_1", 5, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -35638,7 +35786,7 @@ class Test_TC_CGEN_2_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_CGEN_2_1Suite() {} + ~Test_TC_FAN_2_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -35670,53 +35818,41 @@ class Test_TC_CGEN_2_1Suite : public TestCommand case 1: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint64_t value; + chip::app::Clusters::FanControl::FanModeType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int64u", "int64u")); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 6U)); } break; case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 1ULL)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum value; + chip::app::Clusters::FanControl::FanModeSequenceType value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); } break; - case 5: + case 3: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum value; + chip::app::DataModel::Nullable value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfo::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); } break; - case 7: + case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - bool value; + uint8_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); } break; default: @@ -35742,61 +35878,38 @@ class Test_TC_CGEN_2_1Suite : public TestCommand return WaitForCommissionee(kIdentityAlpha, value); } case 1: { - LogStep(1, "TH1 reads the BreadCrumb Attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); + LogStep(1, "TH reads from the DUT the the FanMode attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, true, + chip::NullOptional); } case 2: { - LogStep(2, "TH1 writes the BreadCrumb attribute as 1 to the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint64_t value; - value = 1ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, value, chip::NullOptional, chip::NullOptional); + LogStep(2, "TH reads from the DUT the the FanModeSequence attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanModeSequence::Id, true, + chip::NullOptional); } case 3: { - LogStep(3, "TH1 reads the BreadCrumb attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); + LogStep(3, "TH reads from the DUT the the PercentSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, + chip::NullOptional); } case 4: { - LogStep(4, "TH1 reads the RegulatoryConfig attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::RegulatoryConfig::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "TH1 reads the LocationCapability attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::LocationCapability::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, - "TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the BasicCommissioningInfo attribute has " - "the following field: FailSafeExpiryLengthSeconds field value is within a duration range of 0 to 65535"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::BasicCommissioningInfo::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "TH1 reads SupportsConcurrentConnection attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CGEN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::SupportsConcurrentConnection::Id, true, chip::NullOptional); + LogStep(4, "TH reads from the DUT the the PercentCurrent attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentCurrent::Id, true, + chip::NullOptional); } } return CHIP_NO_ERROR; } }; -class Test_TC_DGGEN_1_1Suite : public TestCommand +class Test_TC_FAN_2_2Suite : public TestCommand { public: - Test_TC_DGGEN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGGEN_1_1", 19, credsIssuerConfig) + Test_TC_FAN_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_2_2", 4, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -35804,7 +35917,1136 @@ class Test_TC_DGGEN_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_DGGEN_1_1Suite() {} + ~Test_TC_FAN_2_2Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + uint8_t SpeedMaxValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + SpeedMaxValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, SpeedMaxValue)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, SpeedMaxValue)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the the SpeedMax attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedMax::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the the SpeedSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0005 && FAN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, true, + chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the the SpeedCurrent attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0006 && FAN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedCurrent::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_2_3Suite : public TestCommand +{ +public: + Test_TC_FAN_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_2_3", 3, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FAN_2_3Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the the RockSupport attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::RockSupport::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the the RockSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::RockSetting::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_2_4Suite : public TestCommand +{ +public: + Test_TC_FAN_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_2_4", 3, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FAN_2_4Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the the WindSupport attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::WindSupport::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the the WindSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A000A"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::WindSetting::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_3_1Suite : public TestCommand +{ +public: + Test_TC_FAN_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_3_1", 15, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigPercentSetting", 0, UINT8_MAX, &mConfigPercentSetting); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FAN_3_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mConfigPercentSetting; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::FanControl::FanModeType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("fanMode", value, 3U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("percentSetting", value)); + VerifyOrReturn(CheckValue("percentSetting.Value()", value.Value(), 0U)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("percentCurrent", value, 0U)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn( + CheckValue("percentCurrent", value, mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("percentSetting", value)); + VerifyOrReturn(CheckValue("percentSetting.Value()", value.Value(), + mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::FanControl::FanModeType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("fanMode", value, 0U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Step 1: Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Step 2a: TH writes a supported FanMode attribute that is other than off to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::FanControl::FanModeType value; + value = static_cast(3); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 2: { + LogStep(2, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 3: { + LogStep(3, "Step 2b: TH reads from the DUT the the FanMode attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, true, + chip::NullOptional); + } + case 4: { + LogStep(4, "Step 2.1a: TH writes the Off value of FanMode attribute to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::FanControl::FanModeType value; + value = static_cast(0); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 5: { + LogStep(5, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 6: { + LogStep(6, "Step 2.1b: TH reads from the DUT the PercentSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "Step 2.1c: TH reads from the DUT the PercentCurrent attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentCurrent::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "Step 3a: TH writes PercentSetting attribute a non-zero value to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 9: { + LogStep(9, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 10: { + LogStep(10, "Step 3b: TH reads from the DUT the PercentCurrent attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentCurrent::Id, true, + chip::NullOptional); + } + case 11: { + LogStep(11, "Step 3c: TH reads from the DUT the PercentSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, + chip::NullOptional); + } + case 12: { + LogStep(12, "Step 3.1a: TH writes PercentSetting attribute a zero value to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 13: { + LogStep(13, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 14: { + LogStep(14, "Step 3.1b: TH reads from the DUT the the FanMode attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_3_2Suite : public TestCommand +{ +public: + Test_TC_FAN_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_3_2", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigSpeedSetting", 0, UINT8_MAX, &mConfigSpeedSetting); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FAN_3_2Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mConfigSpeedSetting; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("speedSetting", value)); + VerifyOrReturn(CheckValue("speedSetting.Value()", value.Value(), + mConfigSpeedSetting.HasValue() ? mConfigSpeedSetting.Value() : 50U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn( + CheckValue("speedCurrent", value, mConfigSpeedSetting.HasValue() ? mConfigSpeedSetting.Value() : 50U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Step 1: Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Step 2: TH writes SpeedSetting attribute a valid value to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::DataModel::Nullable value; + value.SetNonNull(); + value.Value() = mConfigSpeedSetting.HasValue() ? mConfigSpeedSetting.Value() : 50U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 2: { + LogStep(2, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 3: { + LogStep(3, "Step 3: TH reads from the DUT the the SpeedSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, true, + chip::NullOptional); + } + case 4: { + LogStep(4, "Step 4: TH reads from the DUT the the SpeedCurrent attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedCurrent::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_3_4Suite : public TestCommand +{ +public: + Test_TC_FAN_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_3_4", 4, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigWindSetting", 0, UINT8_MAX, &mConfigWindSetting); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FAN_3_4Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mConfigWindSetting; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("windSetting", value, mConfigWindSetting.HasValue() ? mConfigWindSetting.Value() : 1U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Step 1: Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Step 2: TH writes WindSetting attribute a valid value to DUT"); + VerifyOrDo(!ShouldSkip("FAN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint8_t value; + value = mConfigWindSetting.HasValue() ? mConfigWindSetting.Value() : 1U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::WindSetting::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 2: { + LogStep(2, "Wait 1000ms"); + VerifyOrDo(!ShouldSkip("FAN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 3: { + LogStep(3, "Step 3: TH reads from the DUT the the WindSetting attribute"); + VerifyOrDo(!ShouldSkip("FAN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::WindSetting::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CGEN_1_1Suite : public TestCommand +{ +public: + Test_TC_CGEN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CGEN_1_1", 7, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CGEN_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Read the global attribute: EventList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::EventList::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CGEN_2_1Suite : public TestCommand +{ +public: + Test_TC_CGEN_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CGEN_2_1", 8, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CGEN_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int64u", "int64u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 1ULL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfo::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH1 reads the BreadCrumb Attribute from the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH1 writes the BreadCrumb attribute as 1 to the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint64_t value; + value = 1ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, value, chip::NullOptional, chip::NullOptional); + } + case 3: { + LogStep(3, "TH1 reads the BreadCrumb attribute from the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH1 reads the RegulatoryConfig attribute from the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::RegulatoryConfig::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "TH1 reads the LocationCapability attribute from the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::LocationCapability::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, + "TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the BasicCommissioningInfo attribute has " + "the following field: FailSafeExpiryLengthSeconds field value is within a duration range of 0 to 65535"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::BasicCommissioningInfo::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "TH1 reads SupportsConcurrentConnection attribute from the DUT"); + VerifyOrDo(!ShouldSkip("CGEN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::SupportsConcurrentConnection::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_DGGEN_1_1Suite : public TestCommand +{ +public: + Test_TC_DGGEN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGGEN_1_1", 19, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_DGGEN_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -40314,21 +41556,339 @@ class Test_TC_LVL_5_1Suite : public TestCommand return WaitForCommissionee(kIdentityAlpha, value); } case 1: { - LogStep(1, "Precondition Send On Command"); - VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::On::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Check on/off attribute value is true after on command"); - VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Precondition: write default value of OnOffTransitionTime attribute"); + LogStep(1, "Precondition Send On Command"); + VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional + + ); + } + case 2: { + LogStep(2, "Check on/off attribute value is true after on command"); + VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Precondition: write default value of OnOffTransitionTime attribute"); + VerifyOrDo(!ShouldSkip("LVL.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint16_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, + LevelControl::Attributes::OnOffTransitionTime::Id, value, chip::NullOptional, chip::NullOptional); + } + case 4: { + LogStep(4, "TH writes 0 to the Options attribute"); + VerifyOrDo(!ShouldSkip("LVL.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::BitMask value; + value = static_cast>(0U); + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::Options::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 5: { + LogStep(5, "TH sends Off command to DUT"); + VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp && LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional + + ); + } + case 6: { + LogStep(6, + "TH sends a StepWithOnOff command to DUT, with StepMode =0x00 (up), StepSize =50 and TransitionTime =0 " + "(immediate)"); + VerifyOrDo(!ShouldSkip("LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type value; + value.stepMode = static_cast(0); + value.stepSize = 50U; + value.transitionTime.SetNonNull(); + value.transitionTime.Value() = 0U; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::StepWithOnOff::Id, value, + chip::NullOptional + + ); + } + case 7: { + LogStep(7, "TH reads OnOff attribute (On/Off cluster) from DUT"); + VerifyOrDo(!ShouldSkip("OO.S.A0000 && LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "TH sends On command to DUT"); + VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional + + ); + } + case 9: { + LogStep(9, "TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)"); + VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; + value.level = 50U; + value.transitionTime.SetNonNull(); + value.transitionTime.Value() = 0U; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value, + chip::NullOptional + + ); + } + case 10: { + LogStep(10, "Reads current level attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.A0000 && LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 11: { + LogStep(11, "TH sends a Step command to the DUT with StepMode =0x00 (up), StepSize =150 and TransitionTime =300"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LevelControl::Commands::Step::Type value; + value.stepMode = static_cast(0); + value.stepSize = 150U; + value.transitionTime.SetNonNull(); + value.transitionTime.Value() = 300U; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Step::Id, value, + chip::NullOptional + + ); + } + case 12: { + LogStep(12, "Wait 10s"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 13: { + LogStep(13, "TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 14: { + LogStep(14, "Wait 10s"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 15: { + LogStep(15, "TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 16: { + LogStep(16, "Wait 10s"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 17: { + LogStep(17, "TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 18: { + LogStep(18, "Wait 5000ms"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 19: { + LogStep(19, "TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 20: { + LogStep(20, "TH reads CurrentLevel attribute from DUT (after DUT has finished the transition)"); + VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && !LVL.S.M.VarRate"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); + } + case 21: { + LogStep(21, "Precondition send Off Command"); + VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional + + ); + } + case 22: { + LogStep(22, "Check on/off attribute value is false after off command"); + VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_LVL_6_1Suite : public TestCommand +{ +public: + Test_TC_LVL_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_6_1", 18, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_LVL_6_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentLevel", value)); + VerifyOrReturn(CheckValue("currentLevel.Value()", value.Value(), 50U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 64U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 86U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintMinValue("value", value, 85U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 115U)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Precondition: write default value of OnOffTransitionTime attribute"); VerifyOrDo(!ShouldSkip("LVL.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint16_t value; @@ -40336,8 +41896,8 @@ class Test_TC_LVL_5_1Suite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnOffTransitionTime::Id, value, chip::NullOptional, chip::NullOptional); } - case 4: { - LogStep(4, "TH writes 0 to the Options attribute"); + case 2: { + LogStep(2, "TH writes 0 to the Options attribute"); VerifyOrDo(!ShouldSkip("LVL.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::BitMask value; @@ -40345,40 +41905,8 @@ class Test_TC_LVL_5_1Suite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::Options::Id, value, chip::NullOptional, chip::NullOptional); } - case 5: { - LogStep(5, "TH sends Off command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp && LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Off::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, - "TH sends a StepWithOnOff command to DUT, with StepMode =0x00 (up), StepSize =50 and TransitionTime =0 " - "(immediate)"); - VerifyOrDo(!ShouldSkip("LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type value; - value.stepMode = static_cast(0); - value.stepSize = 50U; - value.transitionTime.SetNonNull(); - value.transitionTime.Value() = 0U; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::StepWithOnOff::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "TH reads OnOff attribute (On/Off cluster) from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && LVL.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "TH sends On command to DUT"); + case 3: { + LogStep(3, "TH sends On command to DUT"); VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::OnOff::Commands::On::Type value; @@ -40386,8 +41914,8 @@ class Test_TC_LVL_5_1Suite : public TestCommand ); } - case 9: { - LogStep(9, "TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)"); + case 4: { + LogStep(4, "TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)"); VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; @@ -40401,93 +41929,120 @@ class Test_TC_LVL_5_1Suite : public TestCommand ); } - case 10: { - LogStep(10, "Reads current level attribute from DUT"); + case 5: { + LogStep(5, "TH reads CurrentLevel attribute from DUT"); VerifyOrDo(!ShouldSkip("LVL.S.A0000 && LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, chip::NullOptional); } - case 11: { - LogStep(11, "TH sends a Step command to the DUT with StepMode =0x00 (up), StepSize =150 and TransitionTime =300"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + case 6: { + LogStep(6, + "TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate field set to " + "0x05 (5 units/s)"); + VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::Step::Type value; - value.stepMode = static_cast(0); - value.stepSize = 150U; - value.transitionTime.SetNonNull(); - value.transitionTime.Value() = 300U; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Step::Id, value, + chip::app::Clusters::LevelControl::Commands::Move::Type value; + value.moveMode = static_cast(0); + value.rate.SetNonNull(); + value.rate.Value() = 5U; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value, chip::NullOptional ); } - case 12: { - LogStep(12, "Wait 10s"); + case 7: { + LogStep(7, "Wait 5000ms"); ListFreer listFreer; chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; + value.ms = 5000UL; return WaitForMs(kIdentityAlpha, value); } - case 13: { - LogStep(13, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); + case 8: { + LogStep(8, "Sends stop command to DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LevelControl::Commands::Stop::Type value; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Stop::Id, value, + chip::NullOptional + + ); } - case 14: { - LogStep(14, "Wait 10s"); + case 9: { + LogStep(9, "Physically verify that the device has stopped transitioning"); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && LVL.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); } - case 15: { - LogStep(15, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), + case 10: { + LogStep(10, "TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.C03.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, chip::NullOptional); } - case 16: { - LogStep(16, "Wait 10s"); + case 11: { + LogStep(11, + "TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate field set to " + "0x05 (5 units/s)"); + VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); + chip::app::Clusters::LevelControl::Commands::Move::Type value; + value.moveMode = static_cast(0); + value.rate.SetNonNull(); + value.rate.Value() = 5U; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value, + chip::NullOptional + + ); } - case 18: { - LogStep(18, "Wait 5000ms"); + case 12: { + LogStep(12, "Wait 5000ms"); ListFreer listFreer; chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; value.ms = 5000UL; return WaitForMs(kIdentityAlpha, value); } - case 19: { - LogStep(19, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && LVL.S.M.VarRate"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); + case 13: { + LogStep(13, "TH sends a StopWithOnOff command to the DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Type value; + value.optionsMask = static_cast>(0U); + value.optionsOverride = static_cast>(0U); + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::StopWithOnOff::Id, value, + chip::NullOptional + + ); } - case 20: { - LogStep(20, "TH reads CurrentLevel attribute from DUT (after DUT has finished the transition)"); - VerifyOrDo(!ShouldSkip("LVL.S.C02.Rsp && LVL.S.A0000 && !LVL.S.M.VarRate"), + case 14: { + LogStep(14, "Physically verify that the device has stopped transitioning"); + VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && LVL.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); + } + case 15: { + LogStep(15, "Reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.C07.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, chip::NullOptional); } - case 21: { - LogStep(21, "Precondition send Off Command"); + case 16: { + LogStep(16, "Precondition send Off Command"); VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::OnOff::Commands::Off::Type value; @@ -40495,8 +42050,8 @@ class Test_TC_LVL_5_1Suite : public TestCommand ); } - case 22: { - LogStep(22, "Check on/off attribute value is false after off command"); + case 17: { + LogStep(17, "Check on/off attribute value is false after off command"); VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); } @@ -40505,18 +42060,20 @@ class Test_TC_LVL_5_1Suite : public TestCommand } }; -class Test_TC_LVL_6_1Suite : public TestCommand +class Test_TC_LVL_7_1Suite : public TestCommand { public: - Test_TC_LVL_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_6_1", 18, credsIssuerConfig) + Test_TC_LVL_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_7_1", 20, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("RandomLevelValue", 0, UINT8_MAX, &mRandomLevelValue); + AddArgument("RandomFrequencyValue", 0, UINT16_MAX, &mRandomFrequencyValue); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_LVL_6_1Suite() {} + ~Test_TC_LVL_7_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -40527,8 +42084,16 @@ class Test_TC_LVL_6_1Suite : public TestCommand chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mRandomLevelValue; + chip::Optional mRandomFrequencyValue; chip::Optional mTimeout; + uint8_t minLevelValue; + uint8_t maxLevelValue; + uint16_t CurrentFrequencyValue; + uint16_t MinFrequencyValue; + uint16_t MaxFrequencyValue; + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } // @@ -40556,14 +42121,24 @@ class Test_TC_LVL_6_1Suite : public TestCommand break; case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); + minLevelValue = value; + } break; case 5: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::Nullable value; + uint8_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentLevel", value)); - VerifyOrReturn(CheckValue("currentLevel.Value()", value.Value(), 50U)); + VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); + maxLevelValue = value; } break; case 6: @@ -40575,26 +42150,56 @@ class Test_TC_LVL_6_1Suite : public TestCommand break; case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("currentLevel", value)); + VerifyOrReturn(CheckValue("currentLevel.Value()", value.Value(), + mRandomLevelValue.HasValue() ? mRandomLevelValue.Value() : 100U)); + } break; case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + CurrentFrequencyValue = value; + } break; case 10: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::Nullable value; + uint16_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 64U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 86U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + MinFrequencyValue = value; } break; case 11: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinFrequencyValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + MaxFrequencyValue = value; + } break; case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinFrequencyValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxFrequencyValue)); + } break; case 13: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -40606,21 +42211,36 @@ class Test_TC_LVL_6_1Suite : public TestCommand case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - chip::app::DataModel::Nullable value; + uint16_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 85U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 115U)); + VerifyOrReturn(CheckValue("currentFrequency", value, + mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); } break; case 16: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; break; case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { - bool value; + uint16_t value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 0)); + VerifyOrReturn(CheckValue("currentFrequency", value, + mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("currentFrequency", value, + mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); } break; default: @@ -40655,7 +42275,7 @@ class Test_TC_LVL_6_1Suite : public TestCommand LevelControl::Attributes::OnOffTransitionTime::Id, value, chip::NullOptional, chip::NullOptional); } case 2: { - LogStep(2, "TH writes 0 to the Options attribute"); + LogStep(2, "Step 0a: TH writes 0 to the Options attribute"); VerifyOrDo(!ShouldSkip("LVL.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::BitMask value; @@ -40664,7 +42284,7 @@ class Test_TC_LVL_6_1Suite : public TestCommand chip::NullOptional, chip::NullOptional); } case 3: { - LogStep(3, "TH sends On command to DUT"); + LogStep(3, "Step 0b: TH sends On command to DUT"); VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::OnOff::Commands::On::Type value; @@ -40673,11 +42293,26 @@ class Test_TC_LVL_6_1Suite : public TestCommand ); } case 4: { - LogStep(4, "TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)"); + LogStep(4, "Step 1a: TH reads the MinLevel attribute from the DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinLevel::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "Step 1b: TH reads the MaxLevel attribute from the DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MaxLevel::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, + "Step 1c: TH sends a MoveToLevel command to DUT, with the Level field set to a value between the MinLevel and " + "MaxLevel values (if present, otherwise between 0x01 and 0xFE) and the TransitionTime field set to 0x0000 " + "(move immediately)."); VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 50U; + value.level = mRandomLevelValue.HasValue() ? mRandomLevelValue.Value() : 100U; value.transitionTime.SetNonNull(); value.transitionTime.Value() = 0U; value.optionsMask = static_cast>(0U); @@ -40687,104 +42322,74 @@ class Test_TC_LVL_6_1Suite : public TestCommand ); } - case 5: { - LogStep(5, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0000 && LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, - "TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate field set to " - "0x05 (5 units/s)"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::Move::Type value; - value.moveMode = static_cast(0); - value.rate.SetNonNull(); - value.rate.Value() = 5U; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value, - chip::NullOptional - - ); - } case 7: { - LogStep(7, "Wait 5000ms"); + LogStep(7, "Wait 100ms"); ListFreer listFreer; chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; + value.ms = 100UL; return WaitForMs(kIdentityAlpha, value); } case 8: { - LogStep(8, "Sends stop command to DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::Stop::Type value; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Stop::Id, value, - chip::NullOptional - - ); + LogStep(8, "Step 1d: TH reads CurrentLevel attribute from DUT"); + VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + chip::NullOptional); } case 9: { - LogStep(9, "Physically verify that the device has stopped transitioning"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && LVL.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); + LogStep(9, "Step 2a: TH reads the CurrentFrequency attribute."); + VerifyOrDo(!ShouldSkip("LVL.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, + true, chip::NullOptional); } case 10: { - LogStep(10, "TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.C03.Rsp && LVL.S.A0000"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, + LogStep(10, "Step 2b: TH reads the MinFrequency attribute."); + VerifyOrDo(!ShouldSkip("LVL.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinFrequency::Id, true, chip::NullOptional); } case 11: { - LogStep(11, - "TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate field set to " - "0x05 (5 units/s)"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::Move::Type value; - value.moveMode = static_cast(0); - value.rate.SetNonNull(); - value.rate.Value() = 5U; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::Move::Id, value, - chip::NullOptional - - ); + LogStep(11, "Step 2c: TH reads the MaxFrequency attribute and check, if fmax < fmin, FAIL the test."); + VerifyOrDo(!ShouldSkip("LVL.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MaxFrequency::Id, true, + chip::NullOptional); } case 12: { - LogStep(12, "Wait 5000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); + LogStep( + 12, + "Step 2d: sanity check on values read in steps 2a..2c, if fc < fmin, FAIL the test and fc > fmax, FAIL the test"); + VerifyOrDo(!ShouldSkip("LVL.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, + true, chip::NullOptional); } case 13: { - LogStep(13, "TH sends a StopWithOnOff command to the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(13, + "Step 3a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to a random value " + "frand, chosen such that: fmin < frand < fmax"); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Type value; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::StopWithOnOff::Id, value, - chip::NullOptional + chip::app::Clusters::LevelControl::Commands::MoveToClosestFrequency::Type value; + value.frequency = mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToClosestFrequency::Id, + value, chip::NullOptional ); } case 14: { - LogStep(14, "Physically verify that the device has stopped transitioning"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && LVL.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(14, "Wait 100ms"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 100UL; + return WaitForMs(kIdentityAlpha, value); + } + case 15: { + LogStep(15, "Step 3b: TH reads the CurrentFrequency attribute."); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, + true, chip::NullOptional); + } + case 16: { + LogStep(16, "Step 4a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to fmax + 1"); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp && PICS_USER_PROMPT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); @@ -40792,26 +42397,29 @@ class Test_TC_LVL_6_1Suite : public TestCommand value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); return UserPrompt(kIdentityAlpha, value); } - case 15: { - LogStep(15, "Reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.C07.Rsp && LVL.S.A0000"), + case 17: { + LogStep(17, "Step 4b: TH reads the CurrentFrequency attribute."); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, + true, chip::NullOptional); } - case 16: { - LogStep(16, "Precondition send Off Command"); - VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + case 18: { + LogStep(18, "Step 5a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to fmin - 1"); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp && PICS_USER_PROMPT"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Off::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional - - ); + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt(kIdentityAlpha, value); } - case 17: { - LogStep(17, "Check on/off attribute value is false after off command"); - VerifyOrDo(!ShouldSkip("OO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + case 19: { + LogStep(19, "Step 5b: TH reads the CurrentFrequency attribute."); + VerifyOrDo(!ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, + true, chip::NullOptional); } } return CHIP_NO_ERROR; @@ -99041,7 +100649,8 @@ class Test_TC_DRLK_2_3Suite : public TestCommand case 16: { LogStep(16, "TH writes WrongCodeEntryLimit attribute value as 3 on the DUT and Verify that the DUT sends Success response"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint8_t value; value = 3U; @@ -99051,7 +100660,8 @@ class Test_TC_DRLK_2_3Suite : public TestCommand case 17: { LogStep(17, "TH writes WrongCodeEntryLimit attribute value as 3 on the DUT and verify DUT responds with UNSUPPORTED_WRITE"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && ! DRLK.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0030.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint8_t value; value = 3U; @@ -99062,7 +100672,8 @@ class Test_TC_DRLK_2_3Suite : public TestCommand LogStep(18, "TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify that the DUT sends " "Success response"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint8_t value; value = 15U; @@ -99074,7 +100685,8 @@ class Test_TC_DRLK_2_3Suite : public TestCommand LogStep(19, "TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify that the DUT sends " "Success response"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && ! DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0031.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint8_t value; value = 15U; @@ -99158,7 +100770,7 @@ class Test_TC_DRLK_2_3Suite : public TestCommand } case 27: { LogStep(27, "TH writes AutoRelockTime attribute value as 10 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint32_t value; value = 10UL; @@ -99167,7 +100779,7 @@ class Test_TC_DRLK_2_3Suite : public TestCommand } case 28: { LogStep(28, "TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint32_t value; value = 60UL; @@ -99176,7 +100788,7 @@ class Test_TC_DRLK_2_3Suite : public TestCommand } case 29: { LogStep(29, "TH writes AutoRelockTime attribute value as 10 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("!DRLK.S.A0023 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip(" !DRLK.S.A0023.Write && PICS_SDK_CI_ONLY "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint32_t value; value = 10UL; @@ -99185,7 +100797,8 @@ class Test_TC_DRLK_2_3Suite : public TestCommand } case 30: { LogStep(30, "TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); - VerifyOrDo(!ShouldSkip("!DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip(" !DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP "), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; uint32_t value; value = 60UL; @@ -101418,7 +103031,575 @@ class Test_TC_DRLK_2_11Suite : public TestCommand return WaitForCommissionee(kIdentityAlpha, value); } case 1: { - LogStep(1, "Create new user with default parameters"); + LogStep(1, "Create new user with default parameters"); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::SetUser::Type value; + value.operationType = static_cast(0); + value.userIndex = 1U; + value.userName.SetNonNull(); + value.userName.Value() = chip::Span("xxxgarbage: not in length on purpose", 3); + value.userUniqueID.SetNonNull(); + value.userUniqueID.Value() = 6452UL; + value.userStatus.SetNonNull(); + value.userStatus.Value() = static_cast(1); + value.userType.SetNonNull(); + value.userType.Value() = static_cast(0); + value.credentialRule.SetNonNull(); + value.credentialRule.Value() = static_cast(0); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 2: { + LogStep(2, "Read the user back and verify its fields"); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, + chip::NullOptional + + ); + } + case 3: { + LogStep(3, "TH reads NumberOfTotalUsersSupported and saves for future use."); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::NumberOfTotalUsersSupported::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads MinPINCodeLength and saves for future use."); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MinPINCodeLength::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads MaxPINCodeLength and saves for future use."); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MaxPINCodeLength::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads MinRFIDCodeLength and saves for future use."); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MinRFIDCodeLength::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads MaxRFIDCodeLength and saves for future use."); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A0019"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MaxRFIDCodeLength::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "TH sends Set Credential Command to DUT with type PIN"); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + value.credentialData = mPINCredentialData.HasValue() ? mPINCredentialData.Value() + : chip::ByteSpan(chip::Uint8::from_const_char("123456"), 6); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 1U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 9: { + LogStep(9, "TH sends Set Credential Command to DUT with type RFID"); + VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 1U; + + value.credentialData = mRFIDCredentialData.HasValue() + ? mRFIDCredentialData.Value() + : chip::ByteSpan(chip::Uint8::from_const_char("RFIDTESTDATA"), 12); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 1U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 10: { + LogStep(10, "TH sends Set Credential Command to DUT with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; + value.operationType = static_cast(0); + + value.credential.credentialType = static_cast(4); + value.credential.credentialIndex = 1U; + + value.credentialData = mFingerVeinCredentialData.HasValue() ? mFingerVeinCredentialData.Value() + : chip::ByteSpan(chip::Uint8::from_const_char("123456"), 6); + value.userIndex.SetNonNull(); + value.userIndex.Value() = 1U; + value.userStatus.SetNull(); + value.userType.SetNull(); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 11: { + LogStep(11, "TH sends Get Credential Status Command with type PIN"); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 12: { + LogStep(12, "TH sends Get Credential Status Command with type RFID"); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 13: { + LogStep(13, "TH sends Get Credential Status Command with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(4); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 14: { + LogStep(14, "TH sends Clear Credential Command to DUT with type PIN"); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); + + value.credential.Value().credentialType = static_cast(1); + value.credential.Value().credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 15: { + LogStep(15, "TH sends Get Credential Status Command with type RFID"); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 16: { + LogStep(16, "TH sends Get Credential Status Command with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(4); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 17: { + LogStep(17, "TH sends Clear Credential Command to DUT with type RFID"); + VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); + + value.credential.Value().credentialType = static_cast(2); + value.credential.Value().credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 18: { + LogStep(18, "TH sends Get Credential Status Command with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(4); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 19: { + LogStep(19, "TH sends Clear Credential Command to DUT with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); + + value.credential.Value().credentialType = static_cast(4); + value.credential.Value().credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(10000), chip::NullOptional + + ); + } + case 20: { + LogStep(20, "TH sends Get Credential Status Command to DUT with type PIN"); + VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(1); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 21: { + LogStep(21, "TH sends Get Credential Status Command to DUT with type RFID"); + VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(2); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + case 22: { + LogStep(22, "TH sends Get Credential Status Command to DUT with type FingerVein"); + VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + + value.credential.credentialType = static_cast(4); + value.credential.credentialIndex = 1U; + + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional + + ); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_DRLK_2_12Suite : public TestCommand +{ +public: + Test_TC_DRLK_2_12Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_12", 39, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_DRLK_2_12Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); + VerifyOrReturn(CheckValueNonNull("userName", value.userName)); + VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("xxx", 3))); + VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); + VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 6452UL)); + VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); + VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 1U)); + VerifyOrReturn(CheckValueNonNull("userType", value.userType)); + VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 0U)); + VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); + VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 0U)); + VerifyOrReturn(CheckValueNonNull("credentials", value.credentials)); + { + auto iter_1 = value.credentials.Value().begin(); + VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 0)); + } + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1U)); + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1U)); + VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("status", value.status, 0U)); + VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); + VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("credentialExists", value.credentialExists, true)); + VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); + VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); + VerifyOrReturn(CheckValueNonNull("creatorFabricIndex", value.creatorFabricIndex)); + VerifyOrReturn(CheckValue("creatorFabricIndex.Value()", value.creatorFabricIndex.Value(), 1U)); + VerifyOrReturn(CheckValueNonNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); + VerifyOrReturn(CheckValue("lastModifiedFabricIndex.Value()", value.lastModifiedFabricIndex.Value(), 1U)); + VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("requirePINforRemoteOperation", value, false)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("requirePINforRemoteOperation", value, true)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("userCodeTemporaryDisableTime", value, 15U)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("autoRelockTime", value, 10UL)); + } + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("autoRelockTime", value, 60UL)); + } + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNonNull("lockState", value)); + VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); + } + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Create new user"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::SetUser::Type value; value.operationType = static_cast(0); @@ -101434,7 +103615,7 @@ class Test_TC_DRLK_2_11Suite : public TestCommand value.credentialRule.SetNonNull(); value.credentialRule.Value() = static_cast(0); return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional + chip::Optional(1000), chip::NullOptional ); } @@ -101449,39 +103630,7 @@ class Test_TC_DRLK_2_11Suite : public TestCommand ); } case 3: { - LogStep(3, "TH reads NumberOfTotalUsersSupported and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::NumberOfTotalUsersSupported::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "TH reads MinPINCodeLength and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MinPINCodeLength::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "TH reads MaxPINCodeLength and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MaxPINCodeLength::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "TH reads MinRFIDCodeLength and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MinRFIDCodeLength::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "TH reads MaxRFIDCodeLength and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A0019"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::MaxRFIDCodeLength::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "TH sends Set Credential Command to DUT with type PIN"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(3, "Create new PIN credential and lock/unlock user"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; value.operationType = static_cast(0); @@ -101489,239 +103638,371 @@ class Test_TC_DRLK_2_11Suite : public TestCommand value.credential.credentialType = static_cast(1); value.credential.credentialIndex = 1U; - value.credentialData = mPINCredentialData.HasValue() ? mPINCredentialData.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("123456"), 6); + value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); value.userIndex.SetNonNull(); value.userIndex.Value() = 1U; value.userStatus.SetNull(); value.userType.SetNull(); return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional + chip::Optional(1000), chip::NullOptional ); } - case 9: { - LogStep(9, "TH sends Set Credential Command to DUT with type RFID"); - VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); + case 4: { + LogStep(4, "Verify created PIN credential"); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); + chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - value.credential.credentialType = static_cast(2); + value.credential.credentialType = static_cast(1); value.credential.credentialIndex = 1U; - value.credentialData = mRFIDCredentialData.HasValue() - ? mRFIDCredentialData.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("RFIDTESTDATA"), 12); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 1U; - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, + chip::NullOptional ); } - case 10: { - LogStep(10, "TH sends Set Credential Command to DUT with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx"), + case 5: { + LogStep(5, "Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(4); - value.credential.credentialIndex = 1U; + bool value; + value = false; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, + chip::NullOptional); + } + case 6: { + LogStep(6, "Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + bool value; + value = false; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, + chip::NullOptional); + } + case 7: { + LogStep(7, "Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::RequirePINforRemoteOperation::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Step 3: TH sends Ubolt Door Command to the DUT without PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional - value.credentialData = mFingerVeinCredentialData.HasValue() ? mFingerVeinCredentialData.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("123456"), 6); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 1U; - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional + ); + } + case 9: { + LogStep(9, "Step 4: TH sends Ubolt Door Command to the DUT with PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + value.PINCode.Emplace(); + value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional ); } + case 10: { + LogStep(10, "Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + bool value; + value = true; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, + chip::NullOptional); + } case 11: { - LogStep(11, "TH sends Get Credential Status Command with type PIN"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + LogStep(11, "Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); + bool value; + value = true; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::RequirePINforRemoteOperation::Id, value, chip::NullOptional, + chip::NullOptional); } case 12: { - LogStep(12, "TH sends Get Credential Status Command with type RFID"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + LogStep(12, "Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::RequirePINforRemoteOperation::Id, true, chip::NullOptional); } case 13: { - LogStep(13, "TH sends Get Credential Status Command with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(13, "Step 7: TH sends Ubolt Door Command to the DUT with valid PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(4); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + value.PINCode.Emplace(); + value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional ); } case 14: { - LogStep(14, "TH sends Clear Credential Command to DUT with type PIN"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(14, "Step 8: TH sends Unbolt Door Command to the DUT with Invalid PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(1); - value.credential.Value().credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + value.PINCode.Emplace(); + value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123458garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional ); } case 15: { - LogStep(15, "TH sends Get Credential Status Command with type RFID"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(15, "Step 9: TH sends Unbolt Door Command to the DUT without PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional ); } case 16: { - LogStep(16, "TH sends Get Credential Status Command with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + LogStep(16, "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(4); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); + uint8_t value; + value = 3U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, + value, chip::NullOptional, chip::NullOptional); } case 17: { - LogStep(17, "TH sends Clear Credential Command to DUT with type RFID"); - VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogStep(17, "Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0030.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(2); - value.credential.Value().credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); + uint8_t value; + value = 3U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, + value, chip::NullOptional, chip::NullOptional); } case 18: { - LogStep(18, "TH sends Get Credential Status Command with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + LogStep(18, + "Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify that the " + "DUT sends Success response"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(4); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional + uint8_t value; + value = 15U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, value, chip::NullOptional, + chip::NullOptional); + } + case 19: { + LogStep(19, + "Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify that the " + "DUT sends Success response"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0031.Write"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint8_t value; + value = 15U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, value, chip::NullOptional, + chip::NullOptional); + } + case 20: { + LogStep(20, "Step 12a: TH sends Unbolt Door Command to the DUT with invalid PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + value.PINCode.Emplace(); + value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123457garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional ); } - case 19: { - LogStep(19, "TH sends Clear Credential Command to DUT with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + case 21: { + LogStep(21, "Step 12b: TH sends Unbolt Door Command to the DUT with invalid PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + value.PINCode.Emplace(); + value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123458garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional - value.credential.Value().credentialType = static_cast(4); - value.credential.Value().credentialIndex = 1U; + ); + } + case 22: { + LogStep(22, "Step 12c: TH sends Unbolt Door Command to the DUT with invalid PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + value.PINCode.Emplace(); + value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123459garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional + ); + } + case 23: { + LogStep(23, "Step 12d: TH sends Unbolt Door Command to the DUT with invalid PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + value.PINCode.Emplace(); + value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123460garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional ); } - case 20: { - LogStep(20, "TH sends Get Credential Status Command to DUT with type PIN"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + case 24: { + LogStep(24, "Step 13: TH reads UserCodedTemporaryDisableTime attribute from DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, + DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, true, chip::NullOptional); + } + case 25: { + LogStep( + 25, + "Step 14: TH sends Unbolt Door Command to the DUT with valid PINCode before UserCodeTemporaryDisableTime expires"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + value.PINCode.Emplace(); + value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional ); } - case 21: { - LogStep(21, "TH sends Get Credential Status Command to DUT with type RFID"); - VerifyOrDo(!ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), + case 26: { + LogStep(26, "Wait for UserCodeTemporaryDisableTime expires"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 1U; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 15000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 27: { + LogStep(27, "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint32_t value; + value = 10UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 28: { + LogStep(28, "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint32_t value; + value = 60UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 29: { + LogStep(29, "Step 15: TH writes AutoRelockTime attribute value as 10 seconds on the DUT"); + VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY && !DRLK.S.A0023.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint32_t value; + value = 10UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 30: { + LogStep(30, "Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT"); + VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && !DRLK.S.A0023.Write"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + uint32_t value; + value = 60UL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 31: { + LogStep(31, "Step 16: TH reads the AutoRelockTime attribute from the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, true, + chip::NullOptional); + } + case 32: { + LogStep(32, "Step 16: TH reads the AutoRelockTime attribute from the DUT"); + VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AutoRelockTime::Id, true, + chip::NullOptional); + } + case 33: { + LogStep(33, "Step 17: TH sends the Unbolt Door command to the DUT with valid PINCode"); + VerifyOrDo(!ShouldSkip("DRLK.S.C27.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; + value.PINCode.Emplace(); + value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, + chip::Optional(1000), chip::NullOptional - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional + ); + } + case 34: { + LogStep(34, "Wait for AutoRelockTime Expires"); + VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 35: { + LogStep(35, "Wait for AutoRelockTime Expires"); + VerifyOrDo(!ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 60000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 36: { + LogStep(36, "Step 18: TH reads LockState attribute"); + VerifyOrDo(!ShouldSkip("DRLK.S.A0000 && DRLK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, + chip::NullOptional); + } + case 37: { + LogStep(37, "Cleanup the created user"); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; + value.userIndex = 1U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, + chip::Optional(1000), chip::NullOptional ); } - case 22: { - LogStep(22, "TH sends Get Credential Status Command to DUT with type FingerVein"); - VerifyOrDo(!ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); + case 38: { + LogStep(38, "Clean the created credential"); + VerifyOrDo(!ShouldSkip("DRLK.S.C26.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; + chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; + value.credential.SetNonNull(); - value.credential.credentialType = static_cast(4); - value.credential.credentialIndex = 1U; + value.credential.Value().credentialType = static_cast(1); + value.credential.Value().credentialIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, + chip::Optional(1000), chip::NullOptional ); } @@ -128348,61 +130629,6 @@ class Test_TC_LCFG_2_1Suite : public TestCommand } }; -class Test_TC_LVL_7_1Suite : public TestCommand -{ -public: - Test_TC_LVL_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_7_1", 0, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LVL_7_1Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } - - // - // Tests methods - // - - void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override - { - bool shouldContinue = false; - - switch (mTestIndex - 1) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - } - - if (shouldContinue) - { - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - } - - CHIP_ERROR DoTestStep(uint16_t testIndex) override - { - using namespace chip::app::Clusters; - switch (testIndex) - {} - return CHIP_NO_ERROR; - } -}; - class Test_TC_LVL_8_1Suite : public TestCommand { public: @@ -134776,6 +137002,14 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -134794,6 +137028,7 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -134957,6 +137192,7 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -135218,7 +137454,6 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index b5e5873650ad46..721bd0e654840e 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -97,6 +97,14 @@ class TestList : public Command { printf("Test_TC_FLW_1_1\n"); printf("Test_TC_FLW_2_1\n"); printf("Test_TC_FLABEL_1_1\n"); + printf("Test_TC_FAN_1_1\n"); + printf("Test_TC_FAN_2_1\n"); + printf("Test_TC_FAN_2_2\n"); + printf("Test_TC_FAN_2_3\n"); + printf("Test_TC_FAN_2_4\n"); + printf("Test_TC_FAN_3_1\n"); + printf("Test_TC_FAN_3_2\n"); + printf("Test_TC_FAN_3_4\n"); printf("Test_TC_CGEN_1_1\n"); printf("Test_TC_CGEN_2_1\n"); printf("Test_TC_DGGEN_1_1\n"); @@ -115,6 +123,7 @@ class TestList : public Command { printf("Test_TC_LVL_4_1\n"); printf("Test_TC_LVL_5_1\n"); printf("Test_TC_LVL_6_1\n"); + printf("Test_TC_LVL_7_1\n"); printf("Test_TC_LCFG_1_1\n"); printf("Test_TC_LUNIT_1_2\n"); printf("Test_TC_LUNIT_3_1\n"); @@ -262,6 +271,7 @@ class TestList : public Command { printf("Test_TC_DRLK_2_7\n"); printf("Test_TC_DRLK_2_9\n"); printf("Test_TC_DRLK_2_11\n"); + printf("Test_TC_DRLK_2_12\n"); printf("TestGroupsCluster\n"); printf("TestGroupKeyManagementCluster\n"); printf("Test_TC_G_1_1\n"); @@ -47490,11 +47500,11 @@ class Test_TC_FLABEL_1_1 : public TestCommandBridge { } }; -class Test_TC_CGEN_1_1 : public TestCommandBridge { +class Test_TC_FAN_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_CGEN_1_1() - : TestCommandBridge("Test_TC_CGEN_1_1") + Test_TC_FAN_1_1() + : TestCommandBridge("Test_TC_FAN_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -47504,7 +47514,7 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_CGEN_1_1() {} + ~Test_TC_FAN_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -47512,11 +47522,11 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CGEN_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CGEN_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -47534,27 +47544,125 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { break; case 1: ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("PICS_USER_PROMPT")) { + NextTest(); + return; + } err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip(" !FAN.S.F00 && !FAN.S.F01 && !FAN.S.F02 && !FAN.S.F03 && !FAN.S.F04 && !FAN.S.F05 ")) { + NextTest(); + return; + } err = TestReadTheGlobalAttributeFeatureMap_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given FAN.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F00")) { + NextTest(); + return; + } + err = TestGivenFANSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: EventList\n"); - err = TestReadTheGlobalAttributeEventList_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Given FAN.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F01")) { + NextTest(); + return; + } + err = TestGivenFANSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_5(); + ChipLogProgress( + chipTool, " ***** Test Step 5 : Given FAN.S.F02(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F02")) { + NextTest(); + return; + } + err = TestGivenFANSF02ConditionEnsureFeaturemapHasTheCorrectBitSet_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Given FAN.S.F03(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F03")) { + NextTest(); + return; + } + err = TestGivenFANSF03WarningEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Given FAN.S.F04(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F04")) { + NextTest(); + return; + } + err = TestGivenFANSF04WarningEnsureFeaturemapHasTheCorrectBitSet_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given FAN.S.F05(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FAN.S.F05")) { + NextTest(); + return; + } + err = TestGivenFANSF05WarningEnsureFeaturemapHasTheCorrectBitSet_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Read the feature dependent FAN.S.F00 (SPD) attribute in AttributeList\n"); + if (ShouldSkip("FAN.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentFansf00SpdAttributeInAttributeList_10(); + break; + case 11: + ChipLogProgress( + chipTool, " ***** Test Step 11 : Read the feature dependent FAN.S.F02(RCK) attribute in AttributeList\n"); + if (ShouldSkip("FAN.S.F02")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentFansf02rckAttributeInAttributeList_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Read the feature dependent FAN.S.F03(WND) attribute in AttributeList\n"); + if (ShouldSkip("FAN.S.F03")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentFansf03wndAttributeInAttributeList_12(); + break; + case 13: + ChipLogProgress( + chipTool, " ***** Test Step 13 : Read the feature dependent FAN.S.F05(DIR) attribute in AttributeList\n"); + if (ShouldSkip("FAN.S.F05")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentFansf05dirAttributeInAttributeList_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip(" !FAN.S.C00.Rsp ")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("FAN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_15(); break; } @@ -47588,6 +47696,33 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { case 6: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -47601,7 +47736,7 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; + const uint16_t mTestCount = 16; chip::Optional mNodeId; chip::Optional mCluster; @@ -47617,49 +47752,69 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { } CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); } - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + CHIP_ERROR TestGivenFANSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + NSLog(@"Given FAN.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFANSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FAN.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); NextTest(); @@ -47668,13 +47823,87 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestGivenFANSF02ConditionEnsureFeaturemapHasTheCorrectBitSet_5() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FAN.S.F02(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFANSF03WarningEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FAN.S.F03(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFANSF04WarningEnsureFeaturemapHasTheCorrectBitSet_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FAN.S.F04(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFANSF05WarningEnsureFeaturemapHasTheCorrectBitSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FAN.S.F05(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -47687,7 +47916,6 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); @@ -47701,39 +47929,99 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeEventList_4() + CHIP_ERROR TestReadTheFeatureDependentFansf00SpdAttributeInAttributeList_10() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: EventList Error: %@", err); + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent FAN.S.F00 (SPD) attribute in AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_5() + CHIP_ERROR TestReadTheFeatureDependentFansf02rckAttributeInAttributeList_11() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent FAN.S.F02(RCK) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentFansf03wndAttributeInAttributeList_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent FAN.S.F03(WND) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentFansf05dirAttributeInAttributeList_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent FAN.S.F05(DIR) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 11UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -47741,35 +48029,32 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 4UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("AcceptedCommandList", [actualValue count], static_cast(0))); + } + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_6() + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_15() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 5UL)); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); NextTest(); }]; @@ -47778,11 +48063,11 @@ class Test_TC_CGEN_1_1 : public TestCommandBridge { } }; -class Test_TC_CGEN_2_1 : public TestCommandBridge { +class Test_TC_FAN_2_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_CGEN_2_1() - : TestCommandBridge("Test_TC_CGEN_2_1") + Test_TC_FAN_2_1() + : TestCommandBridge("Test_TC_FAN_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -47792,7 +48077,7 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_CGEN_2_1() {} + ~Test_TC_FAN_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -47800,11 +48085,11 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CGEN_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CGEN_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -47821,63 +48106,36 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH1 reads the BreadCrumb Attribute from the DUT\n"); - if (ShouldSkip("CGEN.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the the FanMode attribute\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1(); + err = TestThReadsFromTheDutTheTheFanModeAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH1 writes the BreadCrumb attribute as 1 to the DUT\n"); - if (ShouldSkip("CGEN.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the the FanModeSequence attribute\n"); + if (ShouldSkip("FAN.S.A0001")) { NextTest(); return; } - err = TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2(); + err = TestThReadsFromTheDutTheTheFanModeSequenceAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH1 reads the BreadCrumb attribute from the DUT\n"); - if (ShouldSkip("CGEN.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the the PercentSetting attribute\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3(); + err = TestThReadsFromTheDutTheThePercentSettingAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH1 reads the RegulatoryConfig attribute from the DUT\n"); - if (ShouldSkip("CGEN.S.A0002")) { - NextTest(); - return; - } - err = TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH1 reads the LocationCapability attribute from the DUT\n"); - if (ShouldSkip("CGEN.S.A0003")) { - NextTest(); - return; - } - err = TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5(); - break; - case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the " - "BasicCommissioningInfo attribute has the following field: FailSafeExpiryLengthSeconds field value is within a " - "duration range of 0 to 65535\n"); - if (ShouldSkip("CGEN.S.A0001")) { - NextTest(); - return; - } - err = TestTh1ReadsBasicCommissioningInfoAttributeFromDutAndVerifyThatTheBasicCommissioningInfoAttributeHasTheFollowingFieldFailSafeExpiryLengthSecondsFieldValueIsWithinADurationRangeOf0To65535_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH1 reads SupportsConcurrentConnection attribute from the DUT\n"); - if (ShouldSkip("CGEN.S.A0004")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the the PercentCurrent attribute\n"); + if (ShouldSkip("FAN.S.A0003")) { NextTest(); return; } - err = TestTh1ReadsSupportsConcurrentConnectionAttributeFromTheDut_7(); + err = TestThReadsFromTheDutTheThePercentCurrentAttribute_4(); break; } @@ -47905,15 +48163,6 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -47927,7 +48176,7 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -47942,67 +48191,67 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1() + CHIP_ERROR TestThReadsFromTheDutTheTheFanModeAttribute_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads the BreadCrumb Attribute from the DUT Error: %@", err); + [cluster readAttributeFanModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the FanMode attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("breadcrumb", "int64u", "int64u")); + VerifyOrReturn(CheckConstraintType("fanMode", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("fanMode", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("fanMode", [value unsignedCharValue], 6U)); + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2() + CHIP_ERROR TestThReadsFromTheDutTheTheFanModeSequenceAttribute_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id breadcrumbArgument; - breadcrumbArgument = [NSNumber numberWithUnsignedLongLong:1ULL]; - [cluster writeAttributeBreadcrumbWithValue:breadcrumbArgument - completion:^(NSError * _Nullable err) { - NSLog(@"TH1 writes the BreadCrumb attribute as 1 to the DUT Error: %@", err); + [cluster readAttributeFanModeSequenceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the FanModeSequence attribute Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("fanModeSequence", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("fanModeSequence", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("fanModeSequence", [value unsignedCharValue], 5U)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3() + CHIP_ERROR TestThReadsFromTheDutTheThePercentSettingAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads the BreadCrumb attribute from the DUT Error: %@", err); + [cluster readAttributePercentSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the PercentSetting attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("Breadcrumb", actualValue, 1ULL)); + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("percentSetting", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("percentSetting", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("percentSetting", [value unsignedCharValue], 100U)); } NextTest(); @@ -48011,45 +48260,165 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4() + CHIP_ERROR TestThReadsFromTheDutTheThePercentCurrentAttribute_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeRegulatoryConfigWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads the RegulatoryConfig attribute from the DUT Error: %@", err); + [cluster readAttributePercentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the PercentCurrent attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("regulatoryConfig", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("regulatoryConfig", [value unsignedCharValue], 2U)); + VerifyOrReturn(CheckConstraintType("percentCurrent", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("percentCurrent", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("percentCurrent", [value unsignedCharValue], 100U)); NextTest(); }]; return CHIP_NO_ERROR; } +}; + +class Test_TC_FAN_2_2 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FAN_2_2() + : TestCommandBridge("Test_TC_FAN_2_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - CHIP_ERROR TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5() + ~Test_TC_FAN_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_2_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the the SpeedMax attribute\n"); + if (ShouldSkip("FAN.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheTheSpeedMaxAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the the SpeedSetting attribute\n"); + if (ShouldSkip("FAN.S.A0005 && FAN.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheTheSpeedSettingAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the the SpeedCurrent attribute\n"); + if (ShouldSkip("FAN.S.A0006 && FAN.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheTheSpeedCurrentAttribute_3(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nonnull SpeedMaxValue; + + CHIP_ERROR TestThReadsFromTheDutTheTheSpeedMaxAttribute_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLocationCapabilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads the LocationCapability attribute from the DUT Error: %@", err); + [cluster readAttributeSpeedMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the SpeedMax attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("locationCapability", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("locationCapability", [value unsignedCharValue], 2U)); + VerifyOrReturn(CheckConstraintType("speedMax", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("speedMax", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("speedMax", [value unsignedCharValue], 100U)); + { + SpeedMaxValue = value; + } NextTest(); }]; @@ -48057,46 +48426,47 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR - TestTh1ReadsBasicCommissioningInfoAttributeFromDutAndVerifyThatTheBasicCommissioningInfoAttributeHasTheFollowingFieldFailSafeExpiryLengthSecondsFieldValueIsWithinADurationRangeOf0To65535_6() + CHIP_ERROR TestThReadsFromTheDutTheTheSpeedSettingAttribute_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeBasicCommissioningInfoWithCompletion:^( - MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nullable value, NSError * _Nullable err) { - NSLog( - @"TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the BasicCommissioningInfo attribute has the " - @"following field: FailSafeExpiryLengthSeconds field value is within a duration range of 0 to 65535 Error: %@", - err); + [cluster readAttributeSpeedSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the SpeedSetting attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("speedSetting", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("speedSetting", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("speedSetting", [value unsignedCharValue], SpeedMaxValue)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestTh1ReadsSupportsConcurrentConnectionAttributeFromTheDut_7() + CHIP_ERROR TestThReadsFromTheDutTheTheSpeedCurrentAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeSupportsConcurrentConnectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH1 reads SupportsConcurrentConnection attribute from the DUT Error: %@", err); + [cluster readAttributeSpeedCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the SpeedCurrent attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("supportsConcurrentConnection", "boolean", "boolean")); + VerifyOrReturn(CheckConstraintType("speedCurrent", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("speedCurrent", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("speedCurrent", [value unsignedCharValue], SpeedMaxValue)); + NextTest(); }]; @@ -48104,11 +48474,11 @@ class Test_TC_CGEN_2_1 : public TestCommandBridge { } }; -class Test_TC_DGGEN_1_1 : public TestCommandBridge { +class Test_TC_FAN_2_3 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DGGEN_1_1() - : TestCommandBridge("Test_TC_DGGEN_1_1") + Test_TC_FAN_2_3() + : TestCommandBridge("Test_TC_FAN_2_3") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -48118,7 +48488,7 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DGGEN_1_1() {} + ~Test_TC_FAN_2_3() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -48126,11 +48496,11 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DGGEN_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_2_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DGGEN_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_2_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -48147,170 +48517,408 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - if (ShouldSkip("DGGEN.S.Afffd")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the the RockSupport attribute\n"); + if (ShouldSkip("FAN.S.A0007")) { NextTest(); return; } - err = TestReadTheGlobalAttributeClusterRevision_1(); + err = TestThReadsFromTheDutTheTheRockSupportAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("DGGEN.S.Afffc")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the the RockSetting attribute\n"); + if (ShouldSkip("FAN.S.A0008")) { NextTest(); return; } - err = TestReadTheGlobalAttributeFeatureMap_2(); + err = TestThReadsFromTheDutTheTheRockSettingAttribute_2(); break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - if (ShouldSkip("DGGEN.S.Afffb")) { + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheTheRockSupportAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRockSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the RockSupport attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("rockSupport", "bitmap8", "bitmap8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheTheRockSettingAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRockSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the RockSetting attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("rockSetting", "bitmap8", "bitmap8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_2_4 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FAN_2_4() + : TestCommandBridge("Test_TC_FAN_2_4") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_FAN_2_4() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_2_4\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_2_4\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the the WindSupport attribute\n"); + if (ShouldSkip("FAN.S.A0009")) { NextTest(); return; } - err = TestReadTheGlobalAttributeAttributeList_3(); + err = TestThReadsFromTheDutTheTheWindSupportAttribute_1(); break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read optional attribute(UpTime) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0002 && DGGEN.S.Afffb")) { + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the the WindSetting attribute\n"); + if (ShouldSkip("FAN.S.A000A")) { NextTest(); return; } - err = TestReadOptionalAttributeUpTimeInAttributeList_4(); + err = TestThReadsFromTheDutTheTheWindSettingAttribute_2(); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read optional attribute(TotalOperationalHours) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0003 && DGGEN.S.Afffb")) { + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheTheWindSupportAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeWindSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the WindSupport attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("windSupport", "bitmap8", "bitmap8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheTheWindSettingAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeWindSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the the WindSetting attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("windSetting", "bitmap8", "bitmap8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FAN_3_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FAN_3_1() + : TestCommandBridge("Test_TC_FAN_3_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigPercentSetting", 0, UINT8_MAX, &mConfigPercentSetting); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_FAN_3_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_3_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_3_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Step 1: Wait for the commissioned device to be retrieved\n"); + err = TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress( + chipTool, " ***** Test Step 1 : Step 2a: TH writes a supported FanMode attribute that is other than off to DUT\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestReadOptionalAttributeTotalOperationalHoursInAttributeList_5(); + err = TestStep2aThWritesASupportedFanModeAttributeThatIsOtherThanOffToDut_1(); break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read optional attribute(BootReason) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0004 && DGGEN.S.Afffb")) { + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestReadOptionalAttributeBootReasonInAttributeList_6(); + err = TestWait1000ms_2(); break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read optional attribute(ActiveHardwareFaults) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0005 && DGGEN.S.Afffb")) { + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 2b: TH reads from the DUT the the FanMode attribute\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestReadOptionalAttributeActiveHardwareFaultsInAttributeList_7(); + err = TestStep2bThReadsFromTheDutTheTheFanModeAttribute_3(); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read optional attribute(ActiveRadioFaults) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0006 && DGGEN.S.Afffb")) { + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 2.1a: TH writes the Off value of FanMode attribute to DUT\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestReadOptionalAttributeActiveRadioFaultsInAttributeList_8(); + err = TestStep21aThWritesTheOffValueOfFanModeAttributeToDut_4(); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read optional attribute(ActiveNetworkFaults) in AttributeList\n"); - if (ShouldSkip("DGGEN.S.A0007 && DGGEN.S.Afffb")) { + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestReadOptionalAttributeActiveNetworkFaultsInAttributeList_9(); + err = TestWait1000ms_5(); break; - case 10: - ChipLogProgress(chipTool, - " ***** Test Step 10 : TH reads AttributeList attribute from DUT. 1.The list SHALL NOT contain any additional " - "values in the standard or scoped range: (0x0000_0000 - 0x0000_4FFF) and (0x0000_F000 - 0x0000_FFFE) 2.The list " - "MAY contain values in the Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_4FFF), where XXXX " - "is the allowed MEI range (0x0001 - 0xFFF1), these values SHALL be ignored. 3.The list SHALL NOT contain any " - "values in the Test Vendor or invalid range: (0x0000_5000 - 0x0000_EFFF and 0x0000_FFFF), (0xXXXX_5000 - " - "0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afffb")) { + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 2.1b: TH reads from the DUT the PercentSetting attribute\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestThReadsAttributeListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x00004fffAnd0x0000F0000x0000Fffe2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX4fffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000050000x0000EfffAnd0x0000Ffff0xXXXX50000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_10(); + err = TestStep21bThReadsFromTheDutThePercentSettingAttribute_6(); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read the global attribute: EventList\n"); - if (ShouldSkip("DGGEN.S.Afffa")) { + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 2.1c: TH reads from the DUT the PercentCurrent attribute\n"); + if (ShouldSkip("FAN.S.A0003")) { NextTest(); return; } - err = TestReadTheGlobalAttributeEventList_11(); + err = TestStep21cThReadsFromTheDutThePercentCurrentAttribute_7(); break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Read optional event(HardwareFaultChange) in EventList\n"); - if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E00")) { + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 3a: TH writes PercentSetting attribute a non-zero value to DUT\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestReadOptionalEventHardwareFaultChangeInEventList_12(); + err = TestStep3aThWritesPercentSettingAttributeANonZeroValueToDut_8(); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read optional event(RadioFaultChange) in EventList\n"); - if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E01")) { + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestReadOptionalEventRadioFaultChangeInEventList_13(); + err = TestWait1000ms_9(); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Read optional event(NetworkFaultChange) in EventList\n"); - if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E02")) { + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 3b: TH reads from the DUT the PercentCurrent attribute\n"); + if (ShouldSkip("FAN.S.A0003")) { NextTest(); return; } - err = TestReadOptionalEventNetworkFaultChangeInEventList_14(); + err = TestStep3bThReadsFromTheDutThePercentCurrentAttribute_10(); break; - case 15: - ChipLogProgress(chipTool, - " ***** Test Step 15 : TH reads EventList attribute from DUT. 1.The list MAY contain values in the Manufacturer " - "Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI range (0x0001 - " - "0xFFF1), these values SHALL be ignored. 2.The list SHALL NOT contain any values in the Test Vendor or invalid " - "range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where XXXX is " - "the allowed MEI range (0x0001 - 0xFFF1)\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afffa")) { + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 3c: TH reads from the DUT the PercentSetting attribute\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestThReadsEventListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_15(); + err = TestStep3cThReadsFromTheDutThePercentSettingAttribute_11(); break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Read the global attribute: AcceptedCommandList\n"); - if (ShouldSkip("DGGEN.S.Afff9")) { + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Step 3.1a: TH writes PercentSetting attribute a zero value to DUT\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestReadTheGlobalAttributeAcceptedCommandList_16(); + err = TestStep31aThWritesPercentSettingAttributeAZeroValueToDut_12(); break; - case 17: - ChipLogProgress(chipTool, - " ***** Test Step 17 : TH reads AcceptedCommandList attribute from DUT. 1.The list SHALL NOT contain any " - "additional values in the standard or scoped range: (0x0000_0000 - 0x0000_00FF). 2.The list MAY contain values in " - "the Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI " - "range (0x0001 - 0xFFF1), these values SHALL be ignored.3.The list SHALL NOT contain any values in the Test Vendor " - "or invalid range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where " - "XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afff9")) { + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0002")) { NextTest(); return; } - err = TestThReadsAcceptedCommandListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x000000ff2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_17(); + err = TestWait1000ms_13(); break; - case 18: - ChipLogProgress(chipTool, - " ***** Test Step 18 : TH reads GeneratedCommandList attribute from DUT. 1.The list MAY contain values in the " - "Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI range " - "(0x0001 - 0xFFF1), these values SHALL be ignored. 2.The list SHALL NOT contain any values in the Test Vendor or " - "invalid range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where " - "XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afff8")) { + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Step 3.1b: TH reads from the DUT the the FanMode attribute\n"); + if (ShouldSkip("FAN.S.A0000")) { NextTest(); return; } - err = TestThReadsGeneratedCommandListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_18(); + err = TestStep31bThReadsFromTheDutTheTheFanModeAttribute_14(); break; } @@ -48368,18 +48976,6 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { case 14: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -48393,14 +48989,15 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 19; + const uint16_t mTestCount = 15; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mConfigPercentSetting; chip::Optional mTimeout; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0() { chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; @@ -48408,174 +49005,107 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR TestStep2aThWritesASupportedFanModeAttributeThatIsOtherThanOffToDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id fanModeArgument; + fanModeArgument = [NSNumber numberWithUnsignedChar:3U]; + [cluster + writeAttributeFanModeWithValue:fanModeArgument + completion:^(NSError * _Nullable err) { + NSLog( + @"Step 2a: TH writes a supported FanMode attribute that is other than off to DUT Error: %@", + err); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + CHIP_ERROR TestWait1000ms_2() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestStep2bThReadsFromTheDutTheTheFanModeAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + [cluster readAttributeFanModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2b: TH reads from the DUT the the FanMode attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + VerifyOrReturn(CheckValue("FanMode", actualValue, 3U)); } - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestStep21aThWritesTheOffValueOfFanModeAttributeToDut_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id fanModeArgument; + fanModeArgument = [NSNumber numberWithUnsignedChar:0U]; + [cluster writeAttributeFanModeWithValue:fanModeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 2.1a: TH writes the Off value of FanMode attribute to DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOptionalAttributeUpTimeInAttributeList_4() + CHIP_ERROR TestWait1000ms_5() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestStep21bThReadsFromTheDutThePercentSettingAttribute_6() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(UpTime) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadOptionalAttributeTotalOperationalHoursInAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(TotalOperationalHours) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadOptionalAttributeBootReasonInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(BootReason) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadOptionalAttributeActiveHardwareFaultsInAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(ActiveHardwareFaults) in AttributeList Error: %@", err); + [cluster readAttributePercentSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2.1b: TH reads from the DUT the PercentSetting attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("PercentSetting", actualValue)); + VerifyOrReturn(CheckValue("PercentSetting", actualValue, 0U)); + } NextTest(); }]; @@ -48583,22 +49113,22 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOptionalAttributeActiveRadioFaultsInAttributeList_8() + CHIP_ERROR TestStep21cThReadsFromTheDutThePercentCurrentAttribute_7() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(ActiveRadioFaults) in AttributeList Error: %@", err); + [cluster readAttributePercentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2.1c: TH reads from the DUT the PercentCurrent attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("PercentCurrent", actualValue, 0U)); + } NextTest(); }]; @@ -48606,79 +49136,55 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOptionalAttributeActiveNetworkFaultsInAttributeList_9() + CHIP_ERROR TestStep3aThWritesPercentSettingAttributeANonZeroValueToDut_8() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional attribute(ActiveNetworkFaults) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id percentSettingArgument; + percentSettingArgument = mConfigPercentSetting.HasValue() ? [NSNumber numberWithUnsignedChar:mConfigPercentSetting.Value()] + : [NSNumber numberWithUnsignedChar:30U]; + [cluster + writeAttributePercentSettingWithValue:percentSettingArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 3a: TH writes PercentSetting attribute a non-zero value to DUT Error: %@", + err); - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR - TestThReadsAttributeListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x00004fffAnd0x0000F0000x0000Fffe2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX4fffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000050000x0000EfffAnd0x0000Ffff0xXXXX50000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_10() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeEventList_11() + CHIP_ERROR TestWait1000ms_9() { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: EventList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("eventList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); } - CHIP_ERROR TestReadOptionalEventHardwareFaultChangeInEventList_12() + CHIP_ERROR TestStep3bThReadsFromTheDutThePercentCurrentAttribute_10() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional event(HardwareFaultChange) in EventList Error: %@", err); + [cluster readAttributePercentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3b: TH reads from the DUT the PercentCurrent attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("eventList", value, 0UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValue( + "PercentCurrent", actualValue, mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U)); + } NextTest(); }]; @@ -48686,22 +49192,24 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOptionalEventRadioFaultChangeInEventList_13() + CHIP_ERROR TestStep3cThReadsFromTheDutThePercentSettingAttribute_11() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional event(RadioFaultChange) in EventList Error: %@", err); + [cluster readAttributePercentSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3c: TH reads from the DUT the PercentSetting attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("eventList", value, 1UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("PercentSetting", actualValue)); + VerifyOrReturn(CheckValue( + "PercentSetting", actualValue, mConfigPercentSetting.HasValue() ? mConfigPercentSetting.Value() : 30U)); + } NextTest(); }]; @@ -48709,101 +49217,77 @@ class Test_TC_DGGEN_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOptionalEventNetworkFaultChangeInEventList_14() + CHIP_ERROR TestStep31aThWritesPercentSettingAttributeAZeroValueToDut_12() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read optional event(NetworkFaultChange) in EventList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id percentSettingArgument; + percentSettingArgument = [NSNumber numberWithUnsignedChar:0U]; + [cluster + writeAttributePercentSettingWithValue:percentSettingArgument + completion:^(NSError * _Nullable err) { + NSLog( + @"Step 3.1a: TH writes PercentSetting attribute a zero value to DUT Error: %@", err); - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("eventList", value, 2UL)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR - TestThReadsEventListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_15() + CHIP_ERROR TestWait1000ms_13() { - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_16() + CHIP_ERROR TestStep31bThReadsFromTheDutTheTheFanModeAttribute_14() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + [cluster readAttributeFanModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3.1b: TH reads from the DUT the the FanMode attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("FanMode", actualValue, 0U)); + } NextTest(); }]; return CHIP_NO_ERROR; } - - CHIP_ERROR - TestThReadsAcceptedCommandListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x000000ff2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_17() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR - TestThReadsGeneratedCommandListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_18() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } }; -class Test_TC_DGGEN_2_1 : public TestCommandBridge { +class Test_TC_FAN_3_2 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DGGEN_2_1() - : TestCommandBridge("Test_TC_DGGEN_2_1") + Test_TC_FAN_3_2() + : TestCommandBridge("Test_TC_FAN_3_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigSpeedSetting", 0, UINT8_MAX, &mConfigSpeedSetting); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DGGEN_2_1() {} + ~Test_TC_FAN_3_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -48811,11 +49295,11 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DGGEN_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_3_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DGGEN_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_3_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -48828,138 +49312,40 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Step 1: Wait for the commissioned device to be retrieved\n"); + err = TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads NetworkInterfaces structure attribute from DUT.\n"); - if (ShouldSkip("DGGEN.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : Step 2: TH writes SpeedSetting attribute a valid value to DUT\n"); + if (ShouldSkip("FAN.S.A0005")) { NextTest(); return; } - err = TestThReadsNetworkInterfacesStructureAttributeFromDut_1(); + err = TestStep2ThWritesSpeedSettingAttributeAValidValueToDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads a RebootCount attribute value from DUT.\n"); - if (ShouldSkip("DGGEN.S.A0001")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0005")) { NextTest(); return; } - err = TestThReadsARebootCountAttributeValueFromDut_2(); + err = TestWait1000ms_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reboot target device\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3: TH reads from the DUT the the SpeedSetting attribute\n"); + if (ShouldSkip("FAN.S.A0005")) { NextTest(); return; } - err = TestRebootTargetDevice_3(); + err = TestStep3ThReadsFromTheDutTheTheSpeedSettingAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reboot target device(DUT)\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestRebootTargetDeviceDUT_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reboot target device\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestRebootTargetDevice_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reboot target device(DUT)\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestRebootTargetDeviceDUT_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_7(); - break; - case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : DUT reboots and TH reads a UpTime attribute value of DUT since some arbitrary start time of " - "DUT rebooting.\n"); - if (ShouldSkip("DGGEN.S.A0002")) { - NextTest(); - return; - } - err = TestDutRebootsAndThReadsAUpTimeAttributeValueOfDutSinceSomeArbitraryStartTimeOfDutRebooting_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads a TotalOperationalHours attribute value from DUT.\n"); - if (ShouldSkip("DGGEN.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsATotalOperationalHoursAttributeValueFromDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reboot target device\n"); - if (ShouldSkip("PICS_SDK_CI_ONLY")) { - NextTest(); - return; - } - err = TestRebootTargetDevice_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reboot target device(DUT)\n"); - if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { - NextTest(); - return; - } - err = TestRebootTargetDeviceDUT_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : TH reads BootReason attribute value from DUT.\n"); - if (ShouldSkip("DGGEN.S.A0004")) { - NextTest(); - return; - } - err = TestThReadsBootReasonAttributeValueFromDut_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : TH reads ActiveHardwareFaults attribute value from DUT.\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0005")) { - NextTest(); - return; - } - err = TestThReadsActiveHardwareFaultsAttributeValueFromDut_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : TH reads ActiveRadioFaults attribute value from DUT.\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0006")) { - NextTest(); - return; - } - err = TestThReadsActiveRadioFaultsAttributeValueFromDut_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : TH reads ActiveNetworkFaults attribute value from DUT.\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0007")) { - NextTest(); - return; - } - err = TestThReadsActiveNetworkFaultsAttributeValueFromDut_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : TH reads TestEventTriggersEnabled attribute value\n"); - if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0008")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 4: TH reads from the DUT the the SpeedCurrent attribute\n"); + if (ShouldSkip("FAN.S.A0006")) { NextTest(); return; } - err = TestThReadsTestEventTriggersEnabledAttributeValue_17(); + err = TestStep4ThReadsFromTheDutTheTheSpeedCurrentAttribute_4(); break; } @@ -48987,45 +49373,6 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { case 4: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -49039,14 +49386,15 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mConfigSpeedSetting; chip::Optional mTimeout; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0() { chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; @@ -49054,44 +49402,55 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThReadsNetworkInterfacesStructureAttributeFromDut_1() + CHIP_ERROR TestStep2ThWritesSpeedSettingAttributeAValidValueToDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeNetworkInterfacesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads NetworkInterfaces structure attribute from DUT. Error: %@", err); + id speedSettingArgument; + speedSettingArgument = mConfigSpeedSetting.HasValue() ? [NSNumber numberWithUnsignedChar:mConfigSpeedSetting.Value()] + : [NSNumber numberWithUnsignedChar:50U]; + [cluster + writeAttributeSpeedSettingWithValue:speedSettingArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 2: TH writes SpeedSetting attribute a valid value to DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("networkInterfaces", "list", "list")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsARebootCountAttributeValueFromDut_2() + CHIP_ERROR TestWait1000ms_2() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestStep3ThReadsFromTheDutTheTheSpeedSettingAttribute_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeRebootCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads a RebootCount attribute value from DUT. Error: %@", err); + [cluster readAttributeSpeedSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3: TH reads from the DUT the the SpeedSetting attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("rebootCount", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("rebootCount", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("rebootCount", [value unsignedShortValue], 65535U)); + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("SpeedSetting", actualValue)); + VerifyOrReturn( + CheckValue("SpeedSetting", actualValue, mConfigSpeedSetting.HasValue() ? mConfigSpeedSetting.Value() : 50U)); + } NextTest(); }]; @@ -49099,116 +49458,143 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRebootTargetDevice_3() - { - - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot("alpha", value); - } - - CHIP_ERROR TestRebootTargetDeviceDUT_4() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message - = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestRebootTargetDevice_5() - { - - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot("alpha", value); - } - - CHIP_ERROR TestRebootTargetDeviceDUT_6() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message - = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_7() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestDutRebootsAndThReadsAUpTimeAttributeValueOfDutSinceSomeArbitraryStartTimeOfDutRebooting_8() + CHIP_ERROR TestStep4ThReadsFromTheDutTheTheSpeedCurrentAttribute_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeUpTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"DUT reboots and TH reads a UpTime attribute value of DUT since some arbitrary start time of DUT rebooting. " - @"Error: %@", - err); + [cluster readAttributeSpeedCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 4: TH reads from the DUT the the SpeedCurrent attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("upTime", "int64u", "int64u")); + { + id actualValue = value; + VerifyOrReturn( + CheckValue("SpeedCurrent", actualValue, mConfigSpeedSetting.HasValue() ? mConfigSpeedSetting.Value() : 50U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } +}; - CHIP_ERROR TestThReadsATotalOperationalHoursAttributeValueFromDut_9() +class Test_TC_FAN_3_4 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FAN_3_4() + : TestCommandBridge("Test_TC_FAN_3_4") + , mTestIndex(0) { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("ConfigWindSetting", 0, UINT8_MAX, &mConfigWindSetting); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + ~Test_TC_FAN_3_4() {} - [cluster readAttributeTotalOperationalHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads a TotalOperationalHours attribute value from DUT. Error: %@", err); + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FAN_3_4\n"); + } - VerifyOrReturn(CheckConstraintType("totalOperationalHours", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("totalOperationalHours", [value unsignedIntValue], 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("totalOperationalHours", [value unsignedIntValue], 4294967294UL)); + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FAN_3_4\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - NextTest(); - }]; + Wait(); - return CHIP_NO_ERROR; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Step 1: Wait for the commissioned device to be retrieved\n"); + err = TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Step 2: TH writes WindSetting attribute a valid value to DUT\n"); + if (ShouldSkip("FAN.S.A0008")) { + NextTest(); + return; + } + err = TestStep2ThWritesWindSettingAttributeAValidValueToDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 1000ms\n"); + if (ShouldSkip("FAN.S.A0008")) { + NextTest(); + return; + } + err = TestWait1000ms_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3: TH reads from the DUT the the WindSetting attribute\n"); + if (ShouldSkip("FAN.S.A0008")) { + NextTest(); + return; + } + err = TestStep3ThReadsFromTheDutTheTheWindSettingAttribute_3(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestRebootTargetDevice_10() + void OnStatusUpdate(const chip::app::StatusIB & status) override { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot("alpha", value); + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); } - CHIP_ERROR TestRebootTargetDeviceDUT_11() + chip::System::Clock::Timeout GetWaitDuration() const override { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message - = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_12() +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mConfigWindSetting; + chip::Optional mTimeout; + + CHIP_ERROR TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0() { chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; @@ -49216,75 +49602,66 @@ class Test_TC_DGGEN_2_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThReadsBootReasonAttributeValueFromDut_13() + CHIP_ERROR TestStep2ThWritesWindSettingAttributeAValidValueToDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device - endpointID:@(0) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeBootReasonWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads BootReason attribute value from DUT. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id windSettingArgument; + windSettingArgument = mConfigWindSetting.HasValue() ? [NSNumber numberWithUnsignedChar:mConfigWindSetting.Value()] + : [NSNumber numberWithUnsignedChar:1U]; + [cluster writeAttributeWindSettingWithValue:windSettingArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 2: TH writes WindSetting attribute a valid value to DUT Error: %@", err); - VerifyOrReturn(CheckConstraintMinValue("bootReason", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("bootReason", [value unsignedCharValue], 6U)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsActiveHardwareFaultsAttributeValueFromDut_14() + CHIP_ERROR TestWait1000ms_2() { - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); } - CHIP_ERROR TestThReadsActiveRadioFaultsAttributeValueFromDut_15() + CHIP_ERROR TestStep3ThReadsFromTheDutTheTheWindSettingAttribute_3() { - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - CHIP_ERROR TestThReadsActiveNetworkFaultsAttributeValueFromDut_16() - { + [cluster readAttributeWindSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3: TH reads from the DUT the the WindSetting attribute Error: %@", err); - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - CHIP_ERROR TestThReadsTestEventTriggersEnabledAttributeValue_17() - { + { + id actualValue = value; + VerifyOrReturn( + CheckValue("WindSetting", actualValue, mConfigWindSetting.HasValue() ? mConfigWindSetting.Value() : 1U)); + } - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + NextTest(); + }]; + + return CHIP_NO_ERROR; } }; -class Test_TC_I_1_1 : public TestCommandBridge { +class Test_TC_CGEN_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_I_1_1() - : TestCommandBridge("Test_TC_I_1_1") + Test_TC_CGEN_1_1() + : TestCommandBridge("Test_TC_CGEN_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -49294,7 +49671,7 @@ class Test_TC_I_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_I_1_1() {} + ~Test_TC_CGEN_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -49302,11 +49679,11 @@ class Test_TC_I_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CGEN_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CGEN_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -49323,43 +49700,29 @@ class Test_TC_I_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); - err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the FeatureMap attribute from the DUT\n"); - err = TestThReadsTheFeatureMapAttributeFromTheDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + err = TestReadTheGlobalAttributeFeatureMap_2(); break; case 3: ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: EventList\n"); + err = TestReadTheGlobalAttributeEventList_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the optional command(TriggerEffect) in AcceptedCommandList\n"); - if (ShouldSkip("I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandTriggerEffectInAcceptedCommandList_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_5(); break; case 6: ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: GeneratedCommandList\n"); err = TestReadTheGlobalAttributeGeneratedCommandList_6(); break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : Read EventList attribute from the DUT. For this cluster the list is usually empty but it can " - "contain manufacturer specific event IDs.\n"); - if (ShouldSkip("PICS_USER_PROMPT")) { - NextTest(); - return; - } - err = TestReadEventListAttributeFromTheDutForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_7(); - break; } if (CHIP_NO_ERROR != err) { @@ -49392,9 +49755,6 @@ class Test_TC_I_1_1 : public TestCommandBridge { case 6: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -49408,7 +49768,7 @@ class Test_TC_I_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 7; chip::Optional mNodeId; chip::Optional mCluster; @@ -49423,21 +49783,23 @@ class Test_TC_I_1_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThReadsTheClusterRevisionAttributeFromTheDut_1() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the ClusterRevision attribute from the DUT Error: %@", err); + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 4U)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); } VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); @@ -49447,15 +49809,17 @@ class Test_TC_I_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsTheFeatureMapAttributeFromTheDut_2() + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the FeatureMap attribute from the DUT Error: %@", err); + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -49475,7 +49839,9 @@ class Test_TC_I_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -49486,6 +49852,9 @@ class Test_TC_I_1_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); @@ -49499,41 +49868,50 @@ class Test_TC_I_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() + CHIP_ERROR TestReadTheGlobalAttributeEventList_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalCommandTriggerEffectInAcceptedCommandList_5() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_5() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command(TriggerEffect) in AcceptedCommandList Error: %@", err); + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 64UL)); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 4UL)); NextTest(); }]; @@ -49545,7 +49923,9 @@ class Test_TC_I_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -49553,35 +49933,23 @@ class Test_TC_I_1_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 5UL)); + NextTest(); }]; return CHIP_NO_ERROR; } - - CHIP_ERROR - TestReadEventListAttributeFromTheDutForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_7() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } }; -class Test_TC_I_2_1 : public TestCommandBridge { +class Test_TC_CGEN_2_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_I_2_1() - : TestCommandBridge("Test_TC_I_2_1") + Test_TC_CGEN_2_1() + : TestCommandBridge("Test_TC_CGEN_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -49591,7 +49959,7 @@ class Test_TC_I_2_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_I_2_1() {} + ~Test_TC_CGEN_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -49599,11 +49967,11 @@ class Test_TC_I_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CGEN_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CGEN_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -49620,20 +49988,63 @@ class Test_TC_I_2_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the IdentifyTime attribute from the DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : TH1 reads the BreadCrumb Attribute from the DUT\n"); + if (ShouldSkip("CGEN.S.A0000")) { NextTest(); return; } - err = TestThReadsTheIdentifyTimeAttributeFromTheDut_1(); + err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the IdentifyType attribute from the DUT\n"); - if (ShouldSkip("I.S.A0001")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH1 writes the BreadCrumb attribute as 1 to the DUT\n"); + if (ShouldSkip("CGEN.S.A0000")) { NextTest(); return; } - err = TestThReadsTheIdentifyTypeAttributeFromTheDut_2(); + err = TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH1 reads the BreadCrumb attribute from the DUT\n"); + if (ShouldSkip("CGEN.S.A0000")) { + NextTest(); + return; + } + err = TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH1 reads the RegulatoryConfig attribute from the DUT\n"); + if (ShouldSkip("CGEN.S.A0002")) { + NextTest(); + return; + } + err = TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH1 reads the LocationCapability attribute from the DUT\n"); + if (ShouldSkip("CGEN.S.A0003")) { + NextTest(); + return; + } + err = TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5(); + break; + case 6: + ChipLogProgress(chipTool, + " ***** Test Step 6 : TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the " + "BasicCommissioningInfo attribute has the following field: FailSafeExpiryLengthSeconds field value is within a " + "duration range of 0 to 65535\n"); + if (ShouldSkip("CGEN.S.A0001")) { + NextTest(); + return; + } + err = TestTh1ReadsBasicCommissioningInfoAttributeFromDutAndVerifyThatTheBasicCommissioningInfoAttributeHasTheFollowingFieldFailSafeExpiryLengthSecondsFieldValueIsWithinADurationRangeOf0To65535_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH1 reads SupportsConcurrentConnection attribute from the DUT\n"); + if (ShouldSkip("CGEN.S.A0004")) { + NextTest(); + return; + } + err = TestTh1ReadsSupportsConcurrentConnectionAttributeFromTheDut_7(); break; } @@ -49655,6 +50066,21 @@ class Test_TC_I_2_1 : public TestCommandBridge { case 2: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -49668,7 +50094,7 @@ class Test_TC_I_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 8; chip::Optional mNodeId; chip::Optional mCluster; @@ -49683,169 +50109,375 @@ class Test_TC_I_2_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThReadsTheIdentifyTimeAttributeFromTheDut_1() + CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the IdentifyTime attribute from the DUT Error: %@", err); + [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the BreadCrumb Attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("identifyTime", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 65535U)); - + VerifyOrReturn(CheckConstraintType("breadcrumb", "int64u", "int64u")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsTheIdentifyTypeAttributeFromTheDut_2() + CHIP_ERROR TestTh1WritesTheBreadCrumbAttributeAs1ToTheDut_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads the IdentifyType attribute from the DUT Error: %@", err); + id breadcrumbArgument; + breadcrumbArgument = [NSNumber numberWithUnsignedLongLong:1ULL]; + [cluster writeAttributeBreadcrumbWithValue:breadcrumbArgument + completion:^(NSError * _Nullable err) { + NSLog(@"TH1 writes the BreadCrumb attribute as 1 to the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTh1ReadsTheBreadCrumbAttributeFromTheDut_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the BreadCrumb attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("identifyType", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("identifyType", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("identifyType", [value unsignedCharValue], 5U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("Breadcrumb", actualValue, 1ULL)); + } NextTest(); }]; return CHIP_NO_ERROR; } -}; -class Test_TC_I_2_2 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_I_2_2() - : TestCommandBridge("Test_TC_I_2_2") - , mTestIndex(0) + CHIP_ERROR TestTh1ReadsTheRegulatoryConfigAttributeFromTheDut_4() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRegulatoryConfigWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the RegulatoryConfig attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("regulatoryConfig", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("regulatoryConfig", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_I_2_2() {} + CHIP_ERROR TestTh1ReadsTheLocationCapabilityAttributeFromTheDut_5() + { - /////////// TestCommand Interface ///////// - void NextTest() override + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLocationCapabilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads the LocationCapability attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("locationCapability", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("locationCapability", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestTh1ReadsBasicCommissioningInfoAttributeFromDutAndVerifyThatTheBasicCommissioningInfoAttributeHasTheFollowingFieldFailSafeExpiryLengthSecondsFieldValueIsWithinADurationRangeOf0To65535_6() { - CHIP_ERROR err = CHIP_NO_ERROR; - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_2\n"); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + [cluster readAttributeBasicCommissioningInfoWithCompletion:^( + MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nullable value, NSError * _Nullable err) { + NSLog( + @"TH1 reads BasicCommissioningInfo attribute from DUT and Verify that the BasicCommissioningInfo attribute has the " + @"following field: FailSafeExpiryLengthSeconds field value is within a duration range of 0 to 65535 Error: %@", + err); - Wait(); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : TH sends Identify command to DUT, with the IdentifyTime field set to 0x003c (60s).\n"); - if (ShouldSkip("I.S.C00.Rsp")) { + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTh1ReadsSupportsConcurrentConnectionAttributeFromTheDut_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSupportsConcurrentConnectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH1 reads SupportsConcurrentConnection attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("supportsConcurrentConnection", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_DGGEN_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_DGGEN_1_1() + : TestCommandBridge("Test_TC_DGGEN_1_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_DGGEN_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DGGEN_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DGGEN_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("DGGEN.S.Afffd")) { NextTest(); return; } - err = TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x003c60s_1(); + err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads immediately IdentifyTime attribute from DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("DGGEN.S.Afffc")) { NextTest(); return; } - err = TestThReadsImmediatelyIdentifyTimeAttributeFromDut_2(); + err = TestReadTheGlobalAttributeFeatureMap_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 10000ms\n"); - err = TestWait10000ms_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("DGGEN.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : After 10 seconds, the TH reads IdentifyTime attribute from DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : Read optional attribute(UpTime) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0002 && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestAfter10SecondsTheThReadsIdentifyTimeAttributeFromDut_4(); + err = TestReadOptionalAttributeUpTimeInAttributeList_4(); break; case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : TH sends IdentifyQuery command to DUT and Verify IdentifyQueryResponse command to TH,with " - "the Timeout field set to a value in the range 0x0000 to 0x0032\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C01.Rsp && I.S.C00.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : Read optional attribute(TotalOperationalHours) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0003 && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestThSendsIdentifyQueryCommandToDutAndVerifyIdentifyQueryResponseCommandToTHwithTheTimeoutFieldSetToAValueInTheRange0x0000To0x0032_5(); + err = TestReadOptionalAttributeTotalOperationalHoursInAttributeList_5(); break; case 6: - ChipLogProgress(chipTool, - " ***** Test Step 6 : TH sends Identify command to DUT, with the IdentifyTime field set to 0x0000 (stop " - "identifying).\n"); - if (ShouldSkip("I.S.C00.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 6 : Read optional attribute(BootReason) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0004 && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x0000StopIdentifying_6(); + err = TestReadOptionalAttributeBootReasonInAttributeList_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads immediately IdentifyTime attribute from DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 7 : Read optional attribute(ActiveHardwareFaults) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0005 && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestThReadsImmediatelyIdentifyTimeAttributeFromDut_7(); + err = TestReadOptionalAttributeActiveHardwareFaultsInAttributeList_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : TH writes a value of 0x000f (15s) to IdentifyTime attribute of DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : Read optional attribute(ActiveRadioFaults) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0006 && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestThWritesAValueOf0x000f15sToIdentifyTimeAttributeOfDut_8(); + err = TestReadOptionalAttributeActiveRadioFaultsInAttributeList_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 5000ms\n"); - err = TestWait5000ms_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Read optional attribute(ActiveNetworkFaults) in AttributeList\n"); + if (ShouldSkip("DGGEN.S.A0007 && DGGEN.S.Afffb")) { + NextTest(); + return; + } + err = TestReadOptionalAttributeActiveNetworkFaultsInAttributeList_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : After 5 seconds, the TH reads IdentifyTime attribute from DUT\n"); - if (ShouldSkip("I.S.A0000")) { + ChipLogProgress(chipTool, + " ***** Test Step 10 : TH reads AttributeList attribute from DUT. 1.The list SHALL NOT contain any additional " + "values in the standard or scoped range: (0x0000_0000 - 0x0000_4FFF) and (0x0000_F000 - 0x0000_FFFE) 2.The list " + "MAY contain values in the Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_4FFF), where XXXX " + "is the allowed MEI range (0x0001 - 0xFFF1), these values SHALL be ignored. 3.The list SHALL NOT contain any " + "values in the Test Vendor or invalid range: (0x0000_5000 - 0x0000_EFFF and 0x0000_FFFF), (0xXXXX_5000 - " + "0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afffb")) { NextTest(); return; } - err = TestAfter5SecondsTheThReadsIdentifyTimeAttributeFromDut_10(); + err = TestThReadsAttributeListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x00004fffAnd0x0000F0000x0000Fffe2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX4fffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000050000x0000EfffAnd0x0000Ffff0xXXXX50000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Read the global attribute: EventList\n"); + if (ShouldSkip("DGGEN.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Read optional event(HardwareFaultChange) in EventList\n"); + if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E00")) { + NextTest(); + return; + } + err = TestReadOptionalEventHardwareFaultChangeInEventList_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Read optional event(RadioFaultChange) in EventList\n"); + if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E01")) { + NextTest(); + return; + } + err = TestReadOptionalEventRadioFaultChangeInEventList_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read optional event(NetworkFaultChange) in EventList\n"); + if (ShouldSkip("DGGEN.S.Afffa && DGGEN.S.E02")) { + NextTest(); + return; + } + err = TestReadOptionalEventNetworkFaultChangeInEventList_14(); + break; + case 15: + ChipLogProgress(chipTool, + " ***** Test Step 15 : TH reads EventList attribute from DUT. 1.The list MAY contain values in the Manufacturer " + "Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI range (0x0001 - " + "0xFFF1), these values SHALL be ignored. 2.The list SHALL NOT contain any values in the Test Vendor or invalid " + "range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where XXXX is " + "the allowed MEI range (0x0001 - 0xFFF1)\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afffa")) { + NextTest(); + return; + } + err = TestThReadsEventListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("DGGEN.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : TH reads AcceptedCommandList attribute from DUT. 1.The list SHALL NOT contain any " + "additional values in the standard or scoped range: (0x0000_0000 - 0x0000_00FF). 2.The list MAY contain values in " + "the Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI " + "range (0x0001 - 0xFFF1), these values SHALL be ignored.3.The list SHALL NOT contain any values in the Test Vendor " + "or invalid range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where " + "XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afff9")) { + NextTest(); + return; + } + err = TestThReadsAcceptedCommandListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x000000ff2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : TH reads GeneratedCommandList attribute from DUT. 1.The list MAY contain values in the " + "Manufacturer Extensible Identifier (MEI) range: (0xXXXX_0000 - 0xXXXX_00FF), where XXXX is the allowed MEI range " + "(0x0001 - 0xFFF1), these values SHALL be ignored. 2.The list SHALL NOT contain any values in the Test Vendor or " + "invalid range: (0x0000_0100 - 0x0000_FFFF), (0xXXXX_0100 - 0xXXXX_FFFF) and (0xFFF1_0000 - 0xFFFF_FFFF), where " + "XXXX is the allowed MEI range (0x0001 - 0xFFF1)\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.Afff8")) { + NextTest(); + return; + } + err = TestThReadsGeneratedCommandListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_18(); break; } @@ -49891,6 +50523,30 @@ class Test_TC_I_2_2 : public TestCommandBridge { case 10: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -49904,7 +50560,7 @@ class Test_TC_I_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; + const uint16_t mTestCount = 19; chip::Optional mNodeId; chip::Optional mCluster; @@ -49919,71 +50575,220 @@ class Test_TC_I_2_2 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x003c60s_1() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterIdentifyParams alloc] init]; - params.identifyTime = [NSNumber numberWithUnsignedShort:60U]; - [cluster - identifyWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Identify command to DUT, with the IdentifyTime field set to 0x003c (60s). Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsImmediatelyIdentifyTimeAttributeFromDut_2() + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads immediately IdentifyTime attribute from DUT Error: %@", err); + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 51U)); - VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 69U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait10000ms_3() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestAfter10SecondsTheThReadsIdentifyTimeAttributeFromDut_4() + CHIP_ERROR TestReadOptionalAttributeUpTimeInAttributeList_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"After 10 seconds, the TH reads IdentifyTime attribute from DUT Error: %@", err); + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(UpTime) in AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 42U)); - VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 58U)); + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOptionalAttributeTotalOperationalHoursInAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(TotalOperationalHours) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOptionalAttributeBootReasonInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(BootReason) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOptionalAttributeActiveHardwareFaultsInAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(ActiveHardwareFaults) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOptionalAttributeActiveRadioFaultsInAttributeList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(ActiveRadioFaults) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOptionalAttributeActiveNetworkFaultsInAttributeList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional attribute(ActiveNetworkFaults) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); NextTest(); }]; @@ -49992,7 +50797,7 @@ class Test_TC_I_2_2 : public TestCommandBridge { } CHIP_ERROR - TestThSendsIdentifyQueryCommandToDutAndVerifyIdentifyQueryResponseCommandToTHwithTheTimeoutFieldSetToAValueInTheRange0x0000To0x0032_5() + TestThReadsAttributeListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x00004fffAnd0x0000F0000x0000Fffe2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX4fffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000050000x0000EfffAnd0x0000Ffff0xXXXX50000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_10() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -50002,45 +50807,45 @@ class Test_TC_I_2_2 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x0000StopIdentifying_6() + CHIP_ERROR TestReadTheGlobalAttributeEventList_11() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterIdentifyParams alloc] init]; - params.identifyTime = [NSNumber numberWithUnsignedShort:0U]; - [cluster identifyWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Identify command to DUT, with the IdentifyTime field set to 0x0000 (stop " - @"identifying). Error: %@", - err); + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("eventList", value, 3UL)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsImmediatelyIdentifyTimeAttributeFromDut_7() + CHIP_ERROR TestReadOptionalEventHardwareFaultChangeInEventList_12() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads immediately IdentifyTime attribute from DUT Error: %@", err); + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional event(HardwareFaultChange) in EventList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("IdentifyTime", actualValue, 0U)); - } + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("eventList", value, 0UL)); NextTest(); }]; @@ -50048,63 +50853,114 @@ class Test_TC_I_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThWritesAValueOf0x000f15sToIdentifyTimeAttributeOfDut_8() + CHIP_ERROR TestReadOptionalEventRadioFaultChangeInEventList_13() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id identifyTimeArgument; - identifyTimeArgument = [NSNumber numberWithUnsignedShort:15U]; - [cluster writeAttributeIdentifyTimeWithValue:identifyTimeArgument - completion:^(NSError * _Nullable err) { - NSLog(@"TH writes a value of 0x000f (15s) to IdentifyTime attribute of DUT Error: %@", - err); + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional event(RadioFaultChange) in EventList Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("eventList", value, 1UL)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait5000ms_9() + CHIP_ERROR TestReadOptionalEventNetworkFaultChangeInEventList_14() { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read optional event(NetworkFaultChange) in EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("eventList", value, 2UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestAfter5SecondsTheThReadsIdentifyTimeAttributeFromDut_10() + CHIP_ERROR + TestThReadsEventListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_15() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_16() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"After 5 seconds, the TH reads IdentifyTime attribute from DUT Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 5U)); - VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 15U)); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); NextTest(); }]; return CHIP_NO_ERROR; } + + CHIP_ERROR + TestThReadsAcceptedCommandListAttributeFromDut1TheListShallNotContainAnyAdditionalValuesInTheStandardOrScopedRange0x000000000x000000ff2TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored3TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_17() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThReadsGeneratedCommandListAttributeFromDut1TheListMayContainValuesInTheManufacturerExtensibleIdentifierMeiRange0xXXXX00000xXXXX00ffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1TheseValuesShallBeIgnored2TheListShallNotContainAnyValuesInTheTestVendorOrInvalidRange0x000001000x0000Ffff0xXXXX01000xXXXXFfffAnd0xFFF100000xFFFFFfffWhereXxxxIsTheAllowedMeiRange0x00010xFFF1_18() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } }; -class Test_TC_I_2_3 : public TestCommandBridge { +class Test_TC_DGGEN_2_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_I_2_3() - : TestCommandBridge("Test_TC_I_2_3") + Test_TC_DGGEN_2_1() + : TestCommandBridge("Test_TC_DGGEN_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -50114,7 +50970,7 @@ class Test_TC_I_2_3 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_I_2_3() {} + ~Test_TC_DGGEN_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -50122,11 +50978,11 @@ class Test_TC_I_2_3 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DGGEN_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DGGEN_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -50139,188 +50995,138 @@ class Test_TC_I_2_3 : public TestCommandBridge { // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : 1.Wait for the commissioned device to be retrieved\n"); - err = Test1WaitForTheCommissionedDeviceToBeRetrieved_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and " - "the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads NetworkInterfaces structure attribute from DUT.\n"); + if (ShouldSkip("DGGEN.S.A0000")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1(); + err = TestThReadsNetworkInterfacesStructureAttributeFromDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : DUT executes a blink effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads a RebootCount attribute value from DUT.\n"); + if (ShouldSkip("DGGEN.S.A0001")) { NextTest(); return; } - err = TestDutExecutesABlinkEffect_2(); + err = TestThReadsARebootCountAttributeValueFromDut_2(); break; case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " - "and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : Reboot target device\n"); + if (ShouldSkip("PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3(); + err = TestRebootTargetDevice_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : DUT executes a breathe effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : Reboot target device(DUT)\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestDutExecutesABreatheEffect_4(); + err = TestRebootTargetDeviceDUT_4(); break; case 5: - ChipLogProgress(chipTool, - " ***** Test Step 5 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay and " - "the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : Reboot target device\n"); + if (ShouldSkip("PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5(); + err = TestRebootTargetDevice_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : DUT executes an okay effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 6 : Reboot target device(DUT)\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestDutExecutesAnOkayEffect_6(); + err = TestRebootTargetDeviceDUT_6(); break; case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b channel " - "change and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : DUT executes a channel change effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, + " ***** Test Step 8 : DUT reboots and TH reads a UpTime attribute value of DUT since some arbitrary start time of " + "DUT rebooting.\n"); + if (ShouldSkip("DGGEN.S.A0002")) { NextTest(); return; } - err = TestDutExecutesAChannelChangeEffect_8(); + err = TestDutRebootsAndThReadsAUpTimeAttributeValueOfDutSinceSomeArbitraryStartTimeOfDutRebooting_8(); break; case 9: - ChipLogProgress(chipTool, - " ***** Test Step 9 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " - "and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads a TotalOperationalHours attribute value from DUT.\n"); + if (ShouldSkip("DGGEN.S.A0003")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9(); + err = TestThReadsATotalOperationalHoursAttributeValueFromDut_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : DUT executes a breathe effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : Reboot target device\n"); + if (ShouldSkip("PICS_SDK_CI_ONLY")) { NextTest(); return; } - err = TestDutExecutesABreatheEffect_10(); + err = TestRebootTargetDevice_10(); break; case 11: - ChipLogProgress(chipTool, - " ***** Test Step 11 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe finish " - "effect and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 11 : Reboot target device(DUT)\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11(); + err = TestRebootTargetDeviceDUT_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : DUT stops the breathe effect after the current effect sequence\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_12(); break; case 13: - ChipLogProgress(chipTool, - " ***** Test Step 13 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " - "and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 13 : TH reads BootReason attribute value from DUT.\n"); + if (ShouldSkip("DGGEN.S.A0004")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13(); + err = TestThReadsBootReasonAttributeValueFromDut_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : DUT executes a breathe effect\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 14 : TH reads ActiveHardwareFaults attribute value from DUT.\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0005")) { NextTest(); return; } - err = TestDutExecutesABreatheEffect_14(); + err = TestThReadsActiveHardwareFaultsAttributeValueFromDut_14(); break; case 15: - ChipLogProgress(chipTool, - " ***** Test Step 15 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " - "effect and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 15 : TH reads ActiveRadioFaults attribute value from DUT.\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0006")) { NextTest(); return; } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15(); + err = TestThReadsActiveRadioFaultsAttributeValueFromDut_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : DUT stops the breathe effect as soon as possible.\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 16 : TH reads ActiveNetworkFaults attribute value from DUT.\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0007")) { NextTest(); return; } - err = TestDutStopsTheBreatheEffectAsSoonAsPossible_16(); + err = TestThReadsActiveNetworkFaultsAttributeValueFromDut_16(); break; case 17: - ChipLogProgress(chipTool, - " ***** Test Step 17 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " - "and the effect variant field set to 0x42 unknown\n"); - if (ShouldSkip("I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Check DUT executes a blink effect.\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestCheckDutExecutesABlinkEffect_18(); - break; - case 19: - ChipLogProgress(chipTool, - " ***** Test Step 19 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " - "effect and the effect variant field set to 0x00 default\n"); - if (ShouldSkip("I.S.C40.Rsp")) { - NextTest(); - return; - } - err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19(); - break; - case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : DUT stops any effect that may be still running as soon as possible\n"); - if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 17 : TH reads TestEventTriggersEnabled attribute value\n"); + if (ShouldSkip("PICS_USER_PROMPT && DGGEN.S.A0008")) { NextTest(); return; } - err = TestDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20(); + err = TestThReadsTestEventTriggersEnabledAttributeValue_17(); break; } @@ -50387,15 +51193,6 @@ class Test_TC_I_2_3 : public TestCommandBridge { case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -50409,14 +51206,14 @@ class Test_TC_I_2_3 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; + const uint16_t mTestCount = 18; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; - CHIP_ERROR Test1WaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() { chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; @@ -50424,207 +51221,192 @@ class Test_TC_I_2_3 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1() + CHIP_ERROR TestThReadsNetworkInterfacesStructureAttributeFromDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:0U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " - @"and the effect variant field set to 0x00 default Error: %@", - err); + [cluster readAttributeNetworkInterfacesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads NetworkInterfaces structure attribute from DUT. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("networkInterfaces", "list", "list")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestDutExecutesABlinkEffect_2() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3() + CHIP_ERROR TestThReadsARebootCountAttributeValueFromDut_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " - @"breathe and the effect variant field set to 0x00 default Error: %@", - err); + [cluster readAttributeRebootCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads a RebootCount attribute value from DUT. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("rebootCount", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("rebootCount", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("rebootCount", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestDutExecutesABreatheEffect_4() + CHIP_ERROR TestRebootTargetDevice_3() + { + + chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; + return Reboot("alpha", value); + } + + CHIP_ERROR TestRebootTargetDeviceDUT_4() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.message + = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); value.expectedValue.Emplace(); value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); return UserPrompt("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5() + CHIP_ERROR TestRebootTargetDevice_5() { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:2U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay " - @"and the effect variant field set to 0x00 default Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; + chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; + return Reboot("alpha", value); } - CHIP_ERROR TestDutExecutesAnOkayEffect_6() + CHIP_ERROR TestRebootTargetDeviceDUT_6() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.message + = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); value.expectedValue.Emplace(); value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); return UserPrompt("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7() + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_7() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestDutRebootsAndThReadsAUpTimeAttributeValueOfDutSinceSomeArbitraryStartTimeOfDutRebooting_8() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:11U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b " - @"channel change and the effect variant field set to 0x00 default Error: %@", - err); + [cluster readAttributeUpTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"DUT reboots and TH reads a UpTime attribute value of DUT since some arbitrary start time of DUT rebooting. " + @"Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("upTime", "int64u", "int64u")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestDutExecutesAChannelChangeEffect_8() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9() + CHIP_ERROR TestThReadsATotalOperationalHoursAttributeValueFromDut_9() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " - @"breathe and the effect variant field set to 0x00 default Error: %@", - err); + [cluster readAttributeTotalOperationalHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads a TotalOperationalHours attribute value from DUT. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("totalOperationalHours", "int32u", "int32u")); + VerifyOrReturn(CheckConstraintMinValue("totalOperationalHours", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("totalOperationalHours", [value unsignedIntValue], 4294967294UL)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestDutExecutesABreatheEffect_10() + CHIP_ERROR TestRebootTargetDevice_10() + { + + chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; + return Reboot("alpha", value); + } + + CHIP_ERROR TestRebootTargetDeviceDUT_11() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.message + = chip::Span("Please reboot the DUT and enter 'y' after DUT startsgarbage: not in length on purpose", 52); value.expectedValue.Emplace(); value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); return UserPrompt("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11() + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_12() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsBootReasonAttributeValueFromDut_13() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:254U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe " - @"finish effect and the effect variant field set to 0x00 default Error: %@", - err); + [cluster readAttributeBootReasonWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads BootReason attribute value from DUT. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintMinValue("bootReason", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("bootReason", [value unsignedCharValue], 6U)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12() + CHIP_ERROR TestThReadsActiveHardwareFaultsAttributeValueFromDut_14() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -50634,32 +51416,17 @@ class Test_TC_I_2_3 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13() + CHIP_ERROR TestThReadsActiveRadioFaultsAttributeValueFromDut_15() { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " - @"breathe and the effect variant field set to 0x00 default Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); } - CHIP_ERROR TestDutExecutesABreatheEffect_14() + CHIP_ERROR TestThReadsActiveNetworkFaultsAttributeValueFromDut_16() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -50669,102 +51436,7 @@ class Test_TC_I_2_3 : public TestCommandBridge { return UserPrompt("alpha", value); } - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:255U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " - @"effect and the effect variant field set to 0x00 default Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestDutStopsTheBreatheEffectAsSoonAsPossible_16() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:0U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:66U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " - @"and the effect variant field set to 0x42 unknown Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCheckDutExecutesABlinkEffect_18() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR - TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; - params.effectIdentifier = [NSNumber numberWithUnsignedChar:255U]; - params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; - [cluster triggerEffectWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " - @"effect and the effect variant field set to 0x00 default Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20() + CHIP_ERROR TestThReadsTestEventTriggersEnabledAttributeValue_17() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; @@ -50775,11 +51447,11 @@ class Test_TC_I_2_3 : public TestCommandBridge { } }; -class Test_TC_ILL_1_1 : public TestCommandBridge { +class Test_TC_I_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ILL_1_1() - : TestCommandBridge("Test_TC_ILL_1_1") + Test_TC_I_1_1() + : TestCommandBridge("Test_TC_I_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -50789,7 +51461,7 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_ILL_1_1() {} + ~Test_TC_I_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -50797,11 +51469,11 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -50818,50 +51490,42 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); + err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - err = TestReadTheGlobalAttributeFeatureMap_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the FeatureMap attribute from the DUT\n"); + err = TestThReadsTheFeatureMapAttributeFromTheDut_2(); break; case 3: ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the optional attribute(Tolerance) in AttributeList\n"); - if (ShouldSkip("ILL.S.A0003")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeToleranceInAttributeList_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the optional attribute(LightSensorType) in AttributeList\n"); - if (ShouldSkip("ILL.S.A0004")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the optional command(TriggerEffect) in AcceptedCommandList\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeLightSensorTypeInAttributeList_5(); + err = TestReadTheOptionalCommandTriggerEffectInAcceptedCommandList_5(); break; case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_6(); + break; + case 7: ChipLogProgress(chipTool, - " ***** Test Step 6 : Read EventList attribute from the DUT.For this cluster the list is usually empty but it can " + " ***** Test Step 7 : Read EventList attribute from the DUT. For this cluster the list is usually empty but it can " "contain manufacturer specific event IDs.\n"); if (ShouldSkip("PICS_USER_PROMPT")) { NextTest(); return; } - err = TestReadEventListAttributeFromTheDUTForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_8(); + err = TestReadEventListAttributeFromTheDutForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_7(); break; } @@ -50898,9 +51562,6 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -50914,7 +51575,7 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + const uint16_t mTestCount = 8; chip::Optional mNodeId; chip::Optional mCluster; @@ -50929,23 +51590,21 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR TestThReadsTheClusterRevisionAttributeFromTheDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + NSLog(@"TH reads the ClusterRevision attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 3U)); + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 4U)); } VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); @@ -50955,17 +51614,15 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + CHIP_ERROR TestThReadsTheFeatureMapAttributeFromTheDut_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + NSLog(@"TH reads the FeatureMap attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -50985,9 +51642,7 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -50998,7 +51653,6 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); @@ -51012,45 +51666,20 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeToleranceInAttributeList_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute(Tolerance) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeLightSensorTypeInAttributeList_5() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute(LightSensorType) in AttributeList Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); NextTest(); }]; @@ -51058,50 +51687,32 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR - TestReadEventListAttributeFromTheDUTForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_6() - { - - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_7() + CHIP_ERROR TestReadTheOptionalCommandTriggerEffectInAcceptedCommandList_5() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + NSLog(@"Read the optional command(TriggerEffect) in AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("AcceptedCommandList", [actualValue count], static_cast(0))); - } - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 64UL)); + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_8() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_6() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -51120,13 +51731,24 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + + CHIP_ERROR + TestReadEventListAttributeFromTheDutForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_7() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } }; -class Test_TC_ILL_2_1 : public TestCommandBridge { +class Test_TC_I_2_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ILL_2_1() - : TestCommandBridge("Test_TC_ILL_2_1") + Test_TC_I_2_1() + : TestCommandBridge("Test_TC_I_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -51136,7 +51758,7 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_ILL_2_1() {} + ~Test_TC_I_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -51144,11 +51766,11 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -51165,44 +51787,20 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads MinMeasuredValue attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0001")) { + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the IdentifyTime attribute from the DUT\n"); + if (ShouldSkip("I.S.A0000")) { NextTest(); return; } - err = TestThReadsMinMeasuredValueAttributeFromDut_1(); + err = TestThReadsTheIdentifyTimeAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads MeasuredValue attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsMeasuredValueAttributeFromDut_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads Tolerance attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsToleranceAttributeFromDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads LightSensorType attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0004")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads the IdentifyType attribute from the DUT\n"); + if (ShouldSkip("I.S.A0001")) { NextTest(); return; } - err = TestThReadsLightSensorTypeAttributeFromDut_5(); + err = TestThReadsTheIdentifyTypeAttributeFromTheDut_2(); break; } @@ -51224,15 +51822,6 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { case 2: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; } // Go on to the next test. @@ -51246,7 +51835,7 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 3; chip::Optional mNodeId; chip::Optional mCluster; @@ -51261,104 +51850,21 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestThReadsMinMeasuredValueAttributeFromDut_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MinMeasuredValue attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 1U)); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 65533U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MaxMeasuredValue attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value unsignedShortValue], 2U)); - VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value unsignedShortValue], 65534U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsMeasuredValueAttributeFromDut_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MeasuredValue attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 65534U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsToleranceAttributeFromDut_4() + CHIP_ERROR TestThReadsTheIdentifyTimeAttributeFromTheDut_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads Tolerance attribute from DUT Error: %@", err); + [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the IdentifyTime attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("tolerance", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("tolerance", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("tolerance", [value unsignedShortValue], 2048U)); + VerifyOrReturn(CheckConstraintType("identifyTime", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 65535U)); NextTest(); }]; @@ -51366,26 +51872,21 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsLightSensorTypeAttributeFromDut_5() + CHIP_ERROR TestThReadsTheIdentifyTypeAttributeFromTheDut_2() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeLightSensorTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads LightSensorType attribute from DUT Error: %@", err); + [cluster readAttributeIdentifyTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the IdentifyType attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("lightSensorType", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("lightSensorType", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("lightSensorType", [value unsignedCharValue], 254U)); - } + VerifyOrReturn(CheckConstraintType("identifyType", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("identifyType", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("identifyType", [value unsignedCharValue], 5U)); NextTest(); }]; @@ -51394,11 +51895,11 @@ class Test_TC_ILL_2_1 : public TestCommandBridge { } }; -class Test_TC_ILL_2_2 : public TestCommandBridge { +class Test_TC_I_2_2 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ILL_2_2() - : TestCommandBridge("Test_TC_ILL_2_2") + Test_TC_I_2_2() + : TestCommandBridge("Test_TC_I_2_2") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -51408,7 +51909,7 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_ILL_2_2() {} + ~Test_TC_I_2_2() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -51416,11 +51917,11 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -51437,60 +51938,81 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads MinMeasuredValue attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0001")) { + ChipLogProgress(chipTool, + " ***** Test Step 1 : TH sends Identify command to DUT, with the IdentifyTime field set to 0x003c (60s).\n"); + if (ShouldSkip("I.S.C00.Rsp")) { NextTest(); return; } - err = TestThReadsMinMeasuredValueAttributeFromDut_1(); + err = TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x003c60s_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); - if (ShouldSkip("ILL.S.A0002")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads immediately IdentifyTime attribute from DUT\n"); + if (ShouldSkip("I.S.A0000")) { NextTest(); return; } - err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); + err = TestThReadsImmediatelyIdentifyTimeAttributeFromDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Cover the sensor or darken the room\n"); - if (ShouldSkip("PICS_USER_PROMPT")) { + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 10000ms\n"); + err = TestWait10000ms_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : After 10 seconds, the TH reads IdentifyTime attribute from DUT\n"); + if (ShouldSkip("I.S.A0000")) { NextTest(); return; } - err = TestCoverTheSensorOrDarkenTheRoom_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 1s\n"); - err = TestWait1s_4(); + err = TestAfter10SecondsTheThReadsIdentifyTimeAttributeFromDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : After a few seconds, TH reads MeasuredValue attribute from DUT.\n"); - if (ShouldSkip("ILL.S.A0000 && PICS_SKIP_SAMPLE_APP")) { + ChipLogProgress(chipTool, + " ***** Test Step 5 : TH sends IdentifyQuery command to DUT and Verify IdentifyQueryResponse command to TH,with " + "the Timeout field set to a value in the range 0x0000 to 0x0032\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C01.Rsp && I.S.C00.Tx")) { NextTest(); return; } - err = TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_5(); + err = TestThSendsIdentifyQueryCommandToDutAndVerifyIdentifyQueryResponseCommandToTHwithTheTimeoutFieldSetToAValueInTheRange0x0000To0x0032_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Expose the sensor again to light\n"); - if (ShouldSkip("PICS_USER_PROMPT")) { + ChipLogProgress(chipTool, + " ***** Test Step 6 : TH sends Identify command to DUT, with the IdentifyTime field set to 0x0000 (stop " + "identifying).\n"); + if (ShouldSkip("I.S.C00.Rsp")) { NextTest(); return; } - err = TestExposeTheSensorAgainToLight_6(); + err = TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x0000StopIdentifying_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 1s\n"); - err = TestWait1s_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads immediately IdentifyTime attribute from DUT\n"); + if (ShouldSkip("I.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsImmediatelyIdentifyTimeAttributeFromDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : After a few seconds, TH reads MeasuredValue attribute from DUT.\n"); - if (ShouldSkip("ILL.S.A0000 && PICS_SKIP_SAMPLE_APP")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : TH writes a value of 0x000f (15s) to IdentifyTime attribute of DUT\n"); + if (ShouldSkip("I.S.A0000")) { NextTest(); return; } - err = TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_8(); + err = TestThWritesAValueOf0x000f15sToIdentifyTimeAttributeOfDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 5000ms\n"); + err = TestWait5000ms_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : After 5 seconds, the TH reads IdentifyTime attribute from DUT\n"); + if (ShouldSkip("I.S.A0000")) { + NextTest(); + return; + } + err = TestAfter5SecondsTheThReadsIdentifyTimeAttributeFromDut_10(); break; } @@ -51530,6 +52052,12 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { case 8: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -51543,7 +52071,7 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + const uint16_t mTestCount = 11; chip::Optional mNodeId; chip::Optional mCluster; @@ -51557,58 +52085,72 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; return WaitForCommissionee("alpha", value); } - NSNumber * _Nullable MinMeasuredValue; - CHIP_ERROR TestThReadsMinMeasuredValueAttributeFromDut_1() + CHIP_ERROR TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x003c60s_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MinMeasuredValue attribute from DUT Error: %@", err); + __auto_type * params = [[MTRIdentifyClusterIdentifyParams alloc] init]; + params.identifyTime = [NSNumber numberWithUnsignedShort:60U]; + [cluster + identifyWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Identify command to DUT, with the IdentifyTime field set to 0x003c (60s). Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "int16u", "int16u")); - } - { - MinMeasuredValue = value; - } + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsImmediatelyIdentifyTimeAttributeFromDut_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads immediately IdentifyTime attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 51U)); + VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 69U)); NextTest(); }]; return CHIP_NO_ERROR; } - NSNumber * _Nullable MaxMeasuredValue; - CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() + CHIP_ERROR TestWait10000ms_3() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestAfter10SecondsTheThReadsIdentifyTimeAttributeFromDut_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MaxMeasuredValue attribute from DUT Error: %@", err); + [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"After 10 seconds, the TH reads IdentifyTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16u", "int16u")); - } - { - MaxMeasuredValue = value; - } + VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 42U)); + VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 58U)); NextTest(); }]; @@ -51616,42 +52158,55 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestCoverTheSensorOrDarkenTheRoom_3() + CHIP_ERROR + TestThSendsIdentifyQueryCommandToDutAndVerifyIdentifyQueryResponseCommandToTHwithTheTimeoutFieldSetToAValueInTheRange0x0000To0x0032_5() { chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for Successgarbage: not in length on purpose", 28); + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); value.expectedValue.Emplace(); value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); return UserPrompt("alpha", value); } - CHIP_ERROR TestWait1s_4() + CHIP_ERROR TestThSendsIdentifyCommandToDutWithTheIdentifyTimeFieldSetTo0x0000StopIdentifying_6() { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterIdentifyParams alloc] init]; + params.identifyTime = [NSNumber numberWithUnsignedShort:0U]; + [cluster identifyWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Identify command to DUT, with the IdentifyTime field set to 0x0000 (stop " + @"identifying). Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_5() + CHIP_ERROR TestThReadsImmediatelyIdentifyTimeAttributeFromDut_7() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"After a few seconds, TH reads MeasuredValue attribute from DUT. Error: %@", err); + [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads immediately IdentifyTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("IdentifyTime", actualValue, 0U)); } NextTest(); @@ -51660,43 +52215,50 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestExposeTheSensorAgainToLight_6() + CHIP_ERROR TestThWritesAValueOf0x000f15sToIdentifyTimeAttributeOfDut_8() { - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for Successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id identifyTimeArgument; + identifyTimeArgument = [NSNumber numberWithUnsignedShort:15U]; + [cluster writeAttributeIdentifyTimeWithValue:identifyTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"TH writes a value of 0x000f (15s) to IdentifyTime attribute of DUT Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestWait1s_7() + CHIP_ERROR TestWait5000ms_9() { chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; + value.ms = 5000UL; return WaitForMs("alpha", value); } - CHIP_ERROR TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_8() + CHIP_ERROR TestAfter5SecondsTheThReadsIdentifyTimeAttributeFromDut_10() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"After a few seconds, TH reads MeasuredValue attribute from DUT. Error: %@", err); + [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"After 5 seconds, the TH reads IdentifyTime attribute from DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 65534U)); - } + VerifyOrReturn(CheckConstraintMinValue("identifyTime", [value unsignedShortValue], 5U)); + VerifyOrReturn(CheckConstraintMaxValue("identifyTime", [value unsignedShortValue], 15U)); NextTest(); }]; @@ -51705,11 +52267,11 @@ class Test_TC_ILL_2_2 : public TestCommandBridge { } }; -class Test_TC_LVL_1_1 : public TestCommandBridge { +class Test_TC_I_2_3 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_LVL_1_1() - : TestCommandBridge("Test_TC_LVL_1_1") + Test_TC_I_2_3() + : TestCommandBridge("Test_TC_I_2_3") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -51719,7 +52281,7 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_LVL_1_1() {} + ~Test_TC_I_2_3() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -51727,11 +52289,11 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_I_2_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_I_2_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -51744,136 +52306,188 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : 1.Wait for the commissioned device to be retrieved\n"); + err = Test1WaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, + " ***** Test Step 1 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and " + "the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip(" !LVL.S.F00 && !LVL.S.F01 && !LVL.S.F02 ")) { + ChipLogProgress(chipTool, " ***** Test Step 2 : DUT executes a blink effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheGlobalAttributeFeatureMap_2(); + err = TestDutExecutesABlinkEffect_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Given LVL.S.F00(OO) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("LVL.S.F00")) { + ChipLogProgress(chipTool, + " ***** Test Step 3 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " + "and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestGivenLvlsf00ooEnsureFeaturemapHasTheCorrectBitSet_3(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Given LVL.S.F01(LT) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("LVL.S.F01")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : DUT executes a breathe effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestGivenLvlsf01ltEnsureFeaturemapHasTheCorrectBitSet_4(); + err = TestDutExecutesABreatheEffect_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Given LVL.S.F02(FQ) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("LVL.S.F02")) { + ChipLogProgress(chipTool, + " ***** Test Step 5 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay and " + "the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestGivenLvlsf02fqEnsureFeaturemapHasTheCorrectBitSet_5(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : DUT executes an okay effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestDutExecutesAnOkayEffect_6(); break; case 7: ChipLogProgress(chipTool, - " ***** Test Step 7 : Read the optional attribute(StartUpCurrentLevel and RemainingTime) in AttributeList\n"); - if (ShouldSkip("LVL.S.F01")) { + " ***** Test Step 7 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b channel " + "change and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeStartUpCurrentLevelAndRemainingTimeInAttributeList_7(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7(); break; case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : Read the optional attribute(CurrentFrequency, MinFrequency and MinFrequency) in " - "AttributeList\n"); - if (ShouldSkip("LVL.S.F02")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : DUT executes a channel change effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeCurrentFrequencyMinFrequencyAndMinFrequencyInAttributeList_8(); + err = TestDutExecutesAChannelChangeEffect_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional attribute(MinLevel) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0002")) { + ChipLogProgress(chipTool, + " ***** Test Step 9 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " + "and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeMinLevelInAttributeList_9(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the optional attribute(MaxLevel) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0003")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : DUT executes a breathe effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeMaxLevelInAttributeList_10(); + err = TestDutExecutesABreatheEffect_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Read the optional attribute(OnOffTransitionTime) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0010")) { + ChipLogProgress(chipTool, + " ***** Test Step 11 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe finish " + "effect and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeOnOffTransitionTimeInAttributeList_11(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Read the optional attribute(OnTransitionTime) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0012")) { + ChipLogProgress(chipTool, " ***** Test Step 12 : DUT stops the breathe effect after the current effect sequence\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeOnTransitionTimeInAttributeList_12(); + err = TestDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read the optional attribute(OffTransitionTime) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0013")) { + ChipLogProgress(chipTool, + " ***** Test Step 13 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe " + "and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeOffTransitionTimeInAttributeList_13(); + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Read the optional attribute(DefaultMoveRate) in AttributeList\n"); - if (ShouldSkip("LVL.S.A0014")) { + ChipLogProgress(chipTool, " ***** Test Step 14 : DUT executes a breathe effect\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheOptionalAttributeDefaultMoveRateInAttributeList_14(); + err = TestDutExecutesABreatheEffect_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_15(); + ChipLogProgress(chipTool, + " ***** Test Step 15 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + "effect and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15(); break; case 16: - ChipLogProgress( - chipTool, " ***** Test Step 16 : Read the Feature-dependent(LVL.S.F02) command in AcceptedCommandList\n"); - if (ShouldSkip("LVL.S.F02")) { + ChipLogProgress(chipTool, " ***** Test Step 16 : DUT stops the breathe effect as soon as possible.\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { NextTest(); return; } - err = TestReadTheFeatureDependentLVLSF02CommandInAcceptedCommandList_16(); + err = TestDutStopsTheBreatheEffectAsSoonAsPossible_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_17(); + ChipLogProgress(chipTool, + " ***** Test Step 17 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " + "and the effect variant field set to 0x42 unknown\n"); + if (ShouldSkip("I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Read the global attribute: EventList\n"); - err = TestReadTheGlobalAttributeEventList_18(); + ChipLogProgress(chipTool, " ***** Test Step 18 : Check DUT executes a blink effect.\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestCheckDutExecutesABlinkEffect_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + "effect and the effect variant field set to 0x00 default\n"); + if (ShouldSkip("I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : DUT stops any effect that may be still running as soon as possible\n"); + if (ShouldSkip("PICS_USER_PROMPT && I.S.C40.Rsp")) { + NextTest(); + return; + } + err = TestDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20(); break; } @@ -51943,6 +52557,12 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -51956,14 +52576,14 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 19; + const uint16_t mTestCount = 21; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR Test1WaitForTheCommissionedDeviceToBeRetrieved_0() { chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; @@ -51971,119 +52591,1666 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x00Default_1() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:0U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " + @"and the effect variant field set to 0x00 default Error: %@", + err); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 5U)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + CHIP_ERROR TestDutExecutesABlinkEffect_2() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " + @"breathe and the effect variant field set to 0x00 default Error: %@", + err); - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestGivenLvlsf00ooEnsureFeaturemapHasTheCorrectBitSet_3() + CHIP_ERROR TestDutExecutesABreatheEffect_4() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x02OkayAndTheEffectVariantFieldSetTo0x00Default_5() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given LVL.S.F00(OO) ensure featuremap has the correct bit set Error: %@", err); + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:2U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay " + @"and the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestGivenLvlsf01ltEnsureFeaturemapHasTheCorrectBitSet_4() + CHIP_ERROR TestDutExecutesAnOkayEffect_6() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x0bChannelChangeAndTheEffectVariantFieldSetTo0x00Default_7() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given LVL.S.F01(LT) ensure featuremap has the correct bit set Error: %@", err); + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:11U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x0b " + @"channel change and the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestGivenLvlsf02fqEnsureFeaturemapHasTheCorrectBitSet_5() + CHIP_ERROR TestDutExecutesAChannelChangeEffect_8() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_9() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given LVL.S.F02(FQ) ensure featuremap has the correct bit set Error: %@", err); + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " + @"breathe and the effect variant field set to 0x00 default Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_6() + CHIP_ERROR TestDutExecutesABreatheEffect_10() { - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xfeFinishEffectAndTheEffectVariantFieldSetTo0x00Default_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:254U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xfe " + @"finish effect and the effect variant field set to 0x00 default Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestDutStopsTheBreatheEffectAfterTheCurrentEffectSequence_12() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x01BreatheAndTheEffectVariantFieldSetTo0x00Default_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:1U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 " + @"breathe and the effect variant field set to 0x00 default Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestDutExecutesABreatheEffect_14() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:255U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + @"effect and the effect variant field set to 0x00 default Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestDutStopsTheBreatheEffectAsSoonAsPossible_16() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0x00BlinkAndTheEffectVariantFieldSetTo0x42Unknown_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:0U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:66U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink " + @"and the effect variant field set to 0x42 unknown Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckDutExecutesABlinkEffect_18() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsTriggerEffectCommandToDutWithTheEffectIdentifierFieldSetTo0xffStopEffectAndTheEffectVariantFieldSetTo0x00Default_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; + params.effectIdentifier = [NSNumber numberWithUnsignedChar:255U]; + params.effectVariant = [NSNumber numberWithUnsignedChar:0U]; + [cluster triggerEffectWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TriggerEffect command to DUT with the effect identifier field set to 0xff stop " + @"effect and the effect variant field set to 0x00 default Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestDutStopsAnyEffectThatMayBeStillRunningAsSoonAsPossible_20() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } +}; + +class Test_TC_ILL_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ILL_1_1() + : TestCommandBridge("Test_TC_ILL_1_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_ILL_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the optional attribute(Tolerance) in AttributeList\n"); + if (ShouldSkip("ILL.S.A0003")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeToleranceInAttributeList_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the optional attribute(LightSensorType) in AttributeList\n"); + if (ShouldSkip("ILL.S.A0004")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeLightSensorTypeInAttributeList_5(); + break; + case 6: + ChipLogProgress(chipTool, + " ***** Test Step 6 : Read EventList attribute from the DUT.For this cluster the list is usually empty but it can " + "contain manufacturer specific event IDs.\n"); + if (ShouldSkip("PICS_USER_PROMPT")) { + NextTest(); + return; + } + err = TestReadEventListAttributeFromTheDUTForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_8(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 9; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 3U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeToleranceInAttributeList_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute(Tolerance) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeLightSensorTypeInAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute(LightSensorType) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadEventListAttributeFromTheDUTForThisClusterTheListIsUsuallyEmptyButItCanContainManufacturerSpecificEventIDs_6() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("AcceptedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ILL_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ILL_2_1() + : TestCommandBridge("Test_TC_ILL_2_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_ILL_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads MinMeasuredValue attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsMinMeasuredValueAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads MeasuredValue attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsMeasuredValueAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads Tolerance attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsToleranceAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads LightSensorType attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsLightSensorTypeAttributeFromDut_5(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 6; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsMinMeasuredValueAttributeFromDut_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MinMeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 1U)); + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 65533U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MaxMeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value unsignedShortValue], 2U)); + VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value unsignedShortValue], 65534U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsMeasuredValueAttributeFromDut_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 65534U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsToleranceAttributeFromDut_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads Tolerance attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("tolerance", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("tolerance", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("tolerance", [value unsignedShortValue], 2048U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsLightSensorTypeAttributeFromDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLightSensorTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads LightSensorType attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("lightSensorType", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("lightSensorType", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("lightSensorType", [value unsignedCharValue], 254U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ILL_2_2 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ILL_2_2() + : TestCommandBridge("Test_TC_ILL_2_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_ILL_2_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ILL_2_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ILL_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads MinMeasuredValue attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsMinMeasuredValueAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads MaxMeasuredValue attribute from DUT\n"); + if (ShouldSkip("ILL.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsMaxMeasuredValueAttributeFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Cover the sensor or darken the room\n"); + if (ShouldSkip("PICS_USER_PROMPT")) { + NextTest(); + return; + } + err = TestCoverTheSensorOrDarkenTheRoom_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 1s\n"); + err = TestWait1s_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : After a few seconds, TH reads MeasuredValue attribute from DUT.\n"); + if (ShouldSkip("ILL.S.A0000 && PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Expose the sensor again to light\n"); + if (ShouldSkip("PICS_USER_PROMPT")) { + NextTest(); + return; + } + err = TestExposeTheSensorAgainToLight_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 1s\n"); + err = TestWait1s_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : After a few seconds, TH reads MeasuredValue attribute from DUT.\n"); + if (ShouldSkip("ILL.S.A0000 && PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_8(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 9; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsMinMeasuredValueAttributeFromDut_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MinMeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "int16u", "int16u")); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsMaxMeasuredValueAttributeFromDut_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MaxMeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "int16u", "int16u")); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCoverTheSensorOrDarkenTheRoom_3() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for Successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestWait1s_4() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"After a few seconds, TH reads MeasuredValue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestExposeTheSensorAgainToLight_6() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for Successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestWait1s_7() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 1000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestAfterAFewSecondsThReadsMeasuredValueAttributeFromDut_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"After a few seconds, TH reads MeasuredValue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 65534U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_LVL_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_LVL_1_1() + : TestCommandBridge("Test_TC_LVL_1_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_LVL_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip(" !LVL.S.F00 && !LVL.S.F01 && !LVL.S.F02 ")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Given LVL.S.F00(OO) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("LVL.S.F00")) { + NextTest(); + return; + } + err = TestGivenLvlsf00ooEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given LVL.S.F01(LT) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("LVL.S.F01")) { + NextTest(); + return; + } + err = TestGivenLvlsf01ltEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Given LVL.S.F02(FQ) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("LVL.S.F02")) { + NextTest(); + return; + } + err = TestGivenLvlsf02fqEnsureFeaturemapHasTheCorrectBitSet_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Read the optional attribute(StartUpCurrentLevel and RemainingTime) in AttributeList\n"); + if (ShouldSkip("LVL.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeStartUpCurrentLevelAndRemainingTimeInAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, + " ***** Test Step 8 : Read the optional attribute(CurrentFrequency, MinFrequency and MinFrequency) in " + "AttributeList\n"); + if (ShouldSkip("LVL.S.F02")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeCurrentFrequencyMinFrequencyAndMinFrequencyInAttributeList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional attribute(MinLevel) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeMinLevelInAttributeList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the optional attribute(MaxLevel) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0003")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeMaxLevelInAttributeList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Read the optional attribute(OnOffTransitionTime) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0010")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeOnOffTransitionTimeInAttributeList_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Read the optional attribute(OnTransitionTime) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0012")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeOnTransitionTimeInAttributeList_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Read the optional attribute(OffTransitionTime) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0013")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeOffTransitionTimeInAttributeList_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the optional attribute(DefaultMoveRate) in AttributeList\n"); + if (ShouldSkip("LVL.S.A0014")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeDefaultMoveRateInAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_15(); + break; + case 16: + ChipLogProgress( + chipTool, " ***** Test Step 16 : Read the Feature-dependent(LVL.S.F02) command in AcceptedCommandList\n"); + if (ShouldSkip("LVL.S.F02")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentLVLSF02CommandInAcceptedCommandList_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Read the global attribute: EventList\n"); + err = TestReadTheGlobalAttributeEventList_18(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 19; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 5U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenLvlsf00ooEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given LVL.S.F00(OO) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenLvlsf01ltEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given LVL.S.F01(LT) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenLvlsf02fqEnsureFeaturemapHasTheCorrectBitSet_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given LVL.S.F02(FQ) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { NSLog(@"Read the global attribute: AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -57216,129 +59383,758 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { err = TestPreconditionWriteDefaultValueOfOnOffTransitionTimeAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH writes 0 to the Options attribute\n"); + ChipLogProgress(chipTool, " ***** Test Step 2 : TH writes 0 to the Options attribute\n"); + if (ShouldSkip("LVL.S.A000f")) { + NextTest(); + return; + } + err = TestThWrites0ToTheOptionsAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH sends On command to DUT\n"); + if (ShouldSkip("OO.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestThSendsOnCommandToDut_3(); + break; + case 4: + ChipLogProgress(chipTool, + " ***** Test Step 4 : TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)\n"); + if (ShouldSkip("LVL.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsAMoveToLevelCommandToDutWithLevel50AndTransitionTime0Immediate_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads CurrentLevel attribute from DUT\n"); + if (ShouldSkip("LVL.S.A0000 && LVL.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThReadsCurrentLevelAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, + " ***** Test Step 6 : TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the " + "Rate field set to 0x05 (5 units/s)\n"); + if (ShouldSkip("LVL.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 5000ms\n"); + err = TestWait5000ms_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Sends stop command to DUT\n"); + if (ShouldSkip("LVL.S.C03.Rsp")) { + NextTest(); + return; + } + err = TestSendsStopCommandToDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Physically verify that the device has stopped transitioning\n"); + if (ShouldSkip("PICS_USER_PROMPT && LVL.S.C03.Rsp")) { + NextTest(); + return; + } + err = TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads CurrentLevel attribute from DUT\n"); + if (ShouldSkip("LVL.S.C01.Rsp && LVL.S.C03.Rsp && LVL.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsCurrentLevelAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the " + "Rate field set to 0x05 (5 units/s)\n"); + if (ShouldSkip("LVL.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 5000ms\n"); + err = TestWait5000ms_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : TH sends a StopWithOnOff command to the DUT\n"); + if (ShouldSkip("LVL.S.C07.Rsp")) { + NextTest(); + return; + } + err = TestThSendsAStopWithOnOffCommandToTheDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Physically verify that the device has stopped transitioning\n"); + if (ShouldSkip("PICS_USER_PROMPT && LVL.S.C07.Rsp")) { + NextTest(); + return; + } + err = TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Reads CurrentLevel attribute from DUT\n"); + if (ShouldSkip("LVL.S.C01.Rsp && LVL.S.C07.Rsp && LVL.S.A0000")) { + NextTest(); + return; + } + err = TestReadsCurrentLevelAttributeFromDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Precondition send Off Command\n"); + if (ShouldSkip("OO.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestPreconditionSendOffCommand_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Check on/off attribute value is false after off command\n"); + if (ShouldSkip("OO.S.A0000")) { + NextTest(); + return; + } + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_17(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 18; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestPreconditionWriteDefaultValueOfOnOffTransitionTimeAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id onOffTransitionTimeArgument; + onOffTransitionTimeArgument = [NSNumber numberWithUnsignedShort:0U]; + [cluster + writeAttributeOnOffTransitionTimeWithValue:onOffTransitionTimeArgument + completion:^(NSError * _Nullable err) { + NSLog( + @"Precondition: write default value of OnOffTransitionTime attribute Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWrites0ToTheOptionsAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id optionsArgument; + optionsArgument = [NSNumber numberWithUnsignedChar:0U]; + [cluster writeAttributeOptionsWithValue:optionsArgument + completion:^(NSError * _Nullable err) { + NSLog(@"TH writes 0 to the Options attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsOnCommandToDut_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster onWithCompletion:^(NSError * _Nullable err) { + NSLog(@"TH sends On command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsAMoveToLevelCommandToDutWithLevel50AndTransitionTime0Immediate_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:50U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster + moveToLevelWithParams:params + completion:^(NSError * _Nullable err) { + NSLog( + @"TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate) Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsCurrentLevelAttributeFromDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads CurrentLevel attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("CurrentLevel", actualValue)); + VerifyOrReturn(CheckValue("CurrentLevel", actualValue, 50U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:0U]; + params.rate = [NSNumber numberWithUnsignedChar:5U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster moveWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate " + @"field set to 0x05 (5 units/s) Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait5000ms_7() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestSendsStopCommandToDut_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRLevelControlClusterStopParams alloc] init]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster stopWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Sends stop command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_9() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestThReadsCurrentLevelAttributeFromDut_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads CurrentLevel attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 64U)); + VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 86U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:0U]; + params.rate = [NSNumber numberWithUnsignedChar:5U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster moveWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate " + @"field set to 0x05 (5 units/s) Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait5000ms_12() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestThSendsAStopWithOnOffCommandToTheDut_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRLevelControlClusterStopWithOnOffParams alloc] init]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster stopWithOnOffWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends a StopWithOnOff command to the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_14() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 85U)); + VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 115U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestPreconditionSendOffCommand_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster offWithCompletion:^(NSError * _Nullable err) { + NSLog(@"Precondition send Off Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_LVL_7_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_LVL_7_1() + : TestCommandBridge("Test_TC_LVL_7_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("RandomLevelValue", 0, UINT8_MAX, &mRandomLevelValue); + AddArgument("RandomFrequencyValue", 0, UINT16_MAX, &mRandomFrequencyValue); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_LVL_7_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_7_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_7_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: write default value of OnOffTransitionTime attribute\n"); + if (ShouldSkip("LVL.S.A0010")) { + NextTest(); + return; + } + err = TestPreconditionWriteDefaultValueOfOnOffTransitionTimeAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Step 0a: TH writes 0 to the Options attribute\n"); if (ShouldSkip("LVL.S.A000f")) { NextTest(); return; } - err = TestThWrites0ToTheOptionsAttribute_2(); + err = TestStep0aThWrites0ToTheOptionsAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH sends On command to DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 0b: TH sends On command to DUT\n"); if (ShouldSkip("OO.S.C01.Rsp")) { NextTest(); return; } - err = TestThSendsOnCommandToDut_3(); + err = TestStep0bThSendsOnCommandToDut_3(); break; case 4: - ChipLogProgress(chipTool, - " ***** Test Step 4 : TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate)\n"); - if (ShouldSkip("LVL.S.C00.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 1a: TH reads the MinLevel attribute from the DUT\n"); + if (ShouldSkip("LVL.S.A0002")) { NextTest(); return; } - err = TestThSendsAMoveToLevelCommandToDutWithLevel50AndTransitionTime0Immediate_4(); + err = TestStep1aThReadsTheMinLevelAttributeFromTheDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads CurrentLevel attribute from DUT\n"); - if (ShouldSkip("LVL.S.A0000 && LVL.S.C00.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 1b: TH reads the MaxLevel attribute from the DUT\n"); + if (ShouldSkip("LVL.S.A0003")) { NextTest(); return; } - err = TestThReadsCurrentLevelAttributeFromDut_5(); + err = TestStep1bThReadsTheMaxLevelAttributeFromTheDut_5(); break; case 6: ChipLogProgress(chipTool, - " ***** Test Step 6 : TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the " - "Rate field set to 0x05 (5 units/s)\n"); - if (ShouldSkip("LVL.S.C01.Rsp")) { + " ***** Test Step 6 : Step 1c: TH sends a MoveToLevel command to DUT, with the Level field set to a value between " + "the MinLevel and MaxLevel values (if present, otherwise between 0x01 and 0xFE) and the TransitionTime field set " + "to 0x0000 (move immediately).\n"); + if (ShouldSkip("LVL.S.C00.Rsp")) { NextTest(); return; } - err = TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_6(); + err = TestStep1cThSendsAMoveToLevelCommandToDutWithTheLevelFieldSetToAValueBetweenTheMinLevelAndMaxLevelValuesIfPresentOtherwiseBetween0x01And0xFEAndTheTransitionTimeFieldSetTo0x0000MoveImmediately_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 5000ms\n"); - err = TestWait5000ms_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 100ms\n"); + err = TestWait100ms_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Sends stop command to DUT\n"); - if (ShouldSkip("LVL.S.C03.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 1d: TH reads CurrentLevel attribute from DUT\n"); + if (ShouldSkip("LVL.S.C00.Rsp && LVL.S.A0000")) { NextTest(); return; } - err = TestSendsStopCommandToDut_8(); + err = TestStep1dThReadsCurrentLevelAttributeFromDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Physically verify that the device has stopped transitioning\n"); - if (ShouldSkip("PICS_USER_PROMPT && LVL.S.C03.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 2a: TH reads the CurrentFrequency attribute.\n"); + if (ShouldSkip("LVL.S.A0004")) { NextTest(); return; } - err = TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_9(); + err = TestStep2aThReadsTheCurrentFrequencyAttribute_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads CurrentLevel attribute from DUT\n"); - if (ShouldSkip("LVL.S.C01.Rsp && LVL.S.C03.Rsp && LVL.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 2b: TH reads the MinFrequency attribute.\n"); + if (ShouldSkip("LVL.S.A0005")) { NextTest(); return; } - err = TestThReadsCurrentLevelAttributeFromDut_10(); + err = TestStep2bThReadsTheMinFrequencyAttribute_10(); break; case 11: ChipLogProgress(chipTool, - " ***** Test Step 11 : TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the " - "Rate field set to 0x05 (5 units/s)\n"); - if (ShouldSkip("LVL.S.C01.Rsp")) { + " ***** Test Step 11 : Step 2c: TH reads the MaxFrequency attribute and check, if fmax < fmin, FAIL the test.\n"); + if (ShouldSkip("LVL.S.A0006")) { NextTest(); return; } - err = TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_11(); + err = TestStep2cThReadsTheMaxFrequencyAttributeAndCheckIfFmaxFminFailTheTest_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 5000ms\n"); - err = TestWait5000ms_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : TH sends a StopWithOnOff command to the DUT\n"); - if (ShouldSkip("LVL.S.C07.Rsp")) { + ChipLogProgress(chipTool, + " ***** Test Step 12 : Step 2d: sanity check on values read in steps 2a..2c, if fc < fmin, FAIL the test and fc > " + "fmax, FAIL the test\n"); + if (ShouldSkip("LVL.S.A0004")) { NextTest(); return; } - err = TestThSendsAStopWithOnOffCommandToTheDut_13(); + err = TestStep2dSanityCheckOnValuesReadInSteps2a2cIfFcFminFailTheTestAndFcFmaxFailTheTest_12(); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Physically verify that the device has stopped transitioning\n"); - if (ShouldSkip("PICS_USER_PROMPT && LVL.S.C07.Rsp")) { + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Step 3a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to " + "a random value frand, chosen such that: fmin < frand < fmax\n"); + if (ShouldSkip("LVL.S.C08.Rsp")) { NextTest(); return; } - err = TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_14(); + err = TestStep3aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToARandomValueFrandChosenSuchThatFminFrandFmax_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Wait 100ms\n"); + err = TestWait100ms_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Reads CurrentLevel attribute from DUT\n"); - if (ShouldSkip("LVL.S.C01.Rsp && LVL.S.C07.Rsp && LVL.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 3b: TH reads the CurrentFrequency attribute.\n"); + if (ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004")) { NextTest(); return; } - err = TestReadsCurrentLevelAttributeFromDut_15(); + err = TestStep3bThReadsTheCurrentFrequencyAttribute_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Precondition send Off Command\n"); - if (ShouldSkip("OO.S.C00.Rsp")) { + ChipLogProgress(chipTool, + " ***** Test Step 16 : Step 4a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to " + "fmax + 1\n"); + if (ShouldSkip("LVL.S.C08.Rsp && PICS_USER_PROMPT")) { NextTest(); return; } - err = TestPreconditionSendOffCommand_16(); + err = TestStep4aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToFmax1_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Check on/off attribute value is false after off command\n"); - if (ShouldSkip("OO.S.A0000")) { + ChipLogProgress(chipTool, " ***** Test Step 17 : Step 4b: TH reads the CurrentFrequency attribute.\n"); + if (ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT")) { NextTest(); return; } - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_17(); + err = TestStep4bThReadsTheCurrentFrequencyAttribute_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Step 5a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field set to " + "fmin - 1\n"); + if (ShouldSkip("LVL.S.C08.Rsp && PICS_USER_PROMPT")) { + NextTest(); + return; + } + err = TestStep5aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToFmin1_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Step 5b: TH reads the CurrentFrequency attribute.\n"); + if (ShouldSkip("LVL.S.C08.Rsp && LVL.S.A0004 && PICS_USER_PROMPT")) { + NextTest(); + return; + } + err = TestStep5bThReadsTheCurrentFrequencyAttribute_19(); break; } @@ -57405,6 +60201,12 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -57418,11 +60220,13 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 20; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mRandomLevelValue; + chip::Optional mRandomFrequencyValue; chip::Optional mTimeout; CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() @@ -57457,7 +60261,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThWrites0ToTheOptionsAttribute_2() + CHIP_ERROR TestStep0aThWrites0ToTheOptionsAttribute_2() { MTRBaseDevice * device = GetDevice("alpha"); @@ -57468,7 +60272,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { optionsArgument = [NSNumber numberWithUnsignedChar:0U]; [cluster writeAttributeOptionsWithValue:optionsArgument completion:^(NSError * _Nullable err) { - NSLog(@"TH writes 0 to the Options attribute Error: %@", err); + NSLog(@"Step 0a: TH writes 0 to the Options attribute Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -57478,7 +60282,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsOnCommandToDut_3() + CHIP_ERROR TestStep0bThSendsOnCommandToDut_3() { MTRBaseDevice * device = GetDevice("alpha"); @@ -57486,7 +60290,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster onWithCompletion:^(NSError * _Nullable err) { - NSLog(@"TH sends On command to DUT Error: %@", err); + NSLog(@"Step 0b: TH sends On command to DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -57495,50 +60299,51 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + NSNumber * _Nonnull minLevelValue; - CHIP_ERROR TestThSendsAMoveToLevelCommandToDutWithLevel50AndTransitionTime0Immediate_4() + CHIP_ERROR TestStep1aThReadsTheMinLevelAttributeFromTheDut_4() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:50U]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; - [cluster - moveToLevelWithParams:params - completion:^(NSError * _Nullable err) { - NSLog( - @"TH sends a MoveToLevel command to DUT, with Level =50 and TransitionTime =0 (immediate) Error: %@", - err); + [cluster readAttributeMinLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1a: TH reads the MinLevel attribute from the DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("minLevel", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("minLevel", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("minLevel", [value unsignedCharValue], 254U)); + { + minLevelValue = value; + } + + NextTest(); + }]; return CHIP_NO_ERROR; } + NSNumber * _Nonnull maxLevelValue; - CHIP_ERROR TestThReadsCurrentLevelAttributeFromDut_5() + CHIP_ERROR TestStep1bThReadsTheMaxLevelAttributeFromTheDut_5() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeMaxLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1b: TH reads the MaxLevel attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckConstraintType("maxLevel", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("maxLevel", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("maxLevel", [value unsignedCharValue], 254U)); { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("CurrentLevel", actualValue)); - VerifyOrReturn(CheckValue("CurrentLevel", actualValue, 50U)); + maxLevelValue = value; } NextTest(); @@ -57547,88 +60352,112 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_6() + CHIP_ERROR + TestStep1cThSendsAMoveToLevelCommandToDutWithTheLevelFieldSetToAValueBetweenTheMinLevelAndMaxLevelValuesIfPresentOtherwiseBetween0x01And0xFEAndTheTransitionTimeFieldSetTo0x0000MoveImmediately_6() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0U]; - params.rate = [NSNumber numberWithUnsignedChar:5U]; + __auto_type * params = [[MTRLevelControlClusterMoveToLevelParams alloc] init]; + params.level = mRandomLevelValue.HasValue() ? [NSNumber numberWithUnsignedChar:mRandomLevelValue.Value()] + : [NSNumber numberWithUnsignedChar:100U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; - [cluster moveWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate " - @"field set to 0x05 (5 units/s) Error: %@", - err); + [cluster moveToLevelWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 1c: TH sends a MoveToLevel command to DUT, with the Level field set to a value " + @"between the MinLevel and MaxLevel values (if present, otherwise between 0x01 and 0xFE) and " + @"the TransitionTime field set to 0x0000 (move immediately). Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait5000ms_7() + CHIP_ERROR TestWait100ms_7() { chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; + value.ms = 100UL; return WaitForMs("alpha", value); } - CHIP_ERROR TestSendsStopCommandToDut_8() + CHIP_ERROR TestStep1dThReadsCurrentLevelAttributeFromDut_8() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRLevelControlClusterStopParams alloc] init]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; - [cluster stopWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Sends stop command to DUT Error: %@", err); + [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 1d: TH reads CurrentLevel attribute from DUT Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("CurrentLevel", actualValue)); + VerifyOrReturn( + CheckValue("CurrentLevel", actualValue, mRandomLevelValue.HasValue() ? mRandomLevelValue.Value() : 100U)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } + NSNumber * _Nonnull CurrentFrequencyValue; - CHIP_ERROR TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_9() + CHIP_ERROR TestStep2aThReadsTheCurrentFrequencyAttribute_9() { - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2a: TH reads the CurrentFrequency attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("currentFrequency", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("currentFrequency", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentFrequency", [value unsignedShortValue], 65535U)); + { + CurrentFrequencyValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; } + NSNumber * _Nonnull MinFrequencyValue; - CHIP_ERROR TestThReadsCurrentLevelAttributeFromDut_10() + CHIP_ERROR TestStep2bThReadsTheMinFrequencyAttribute_10() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeMinFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2b: TH reads the MinFrequency attribute. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 64U)); - VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 86U)); + VerifyOrReturn(CheckConstraintType("minFrequency", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("minFrequency", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("minFrequency", [value unsignedShortValue], 65535U)); + { + MinFrequencyValue = value; } NextTest(); @@ -57636,89 +60465,107 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + NSNumber * _Nonnull MaxFrequencyValue; - CHIP_ERROR TestThSendsAMoveCommandToTheDutWithTheMoveModeFieldSetTo0x00MoveUpAndTheRateFieldSetTo0x055UnitsS_11() + CHIP_ERROR TestStep2cThReadsTheMaxFrequencyAttributeAndCheckIfFmaxFminFailTheTest_11() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0U]; - params.rate = [NSNumber numberWithUnsignedChar:5U]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; - [cluster moveWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends a Move command to the DUT, with the MoveMode field set to 0x00 (move up) and the Rate " - @"field set to 0x05 (5 units/s) Error: %@", - err); + [cluster readAttributeMaxFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2c: TH reads the MaxFrequency attribute and check, if fmax < fmin, FAIL the test. Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("maxFrequency", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("maxFrequency", [value unsignedShortValue], MinFrequencyValue)); + VerifyOrReturn(CheckConstraintMaxValue("maxFrequency", [value unsignedShortValue], 65535U)); + { + MaxFrequencyValue = value; + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWait5000ms_12() + CHIP_ERROR TestStep2dSanityCheckOnValuesReadInSteps2a2cIfFcFminFailTheTestAndFcFmaxFailTheTest_12() { - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs("alpha", value); + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2d: sanity check on values read in steps 2a..2c, if fc < fmin, FAIL the test and fc > fmax, FAIL the test " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("currentFrequency", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("currentFrequency", [value unsignedShortValue], MinFrequencyValue)); + VerifyOrReturn(CheckConstraintMaxValue("currentFrequency", [value unsignedShortValue], MaxFrequencyValue)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsAStopWithOnOffCommandToTheDut_13() + CHIP_ERROR + TestStep3aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToARandomValueFrandChosenSuchThatFminFrandFmax_13() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRLevelControlClusterStopWithOnOffParams alloc] init]; - params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; - params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; - [cluster stopWithOnOffWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends a StopWithOnOff command to the DUT Error: %@", err); + __auto_type * params = [[MTRLevelControlClusterMoveToClosestFrequencyParams alloc] init]; + params.frequency = mRandomFrequencyValue.HasValue() ? [NSNumber numberWithUnsignedShort:mRandomFrequencyValue.Value()] + : [NSNumber numberWithUnsignedShort:30000U]; + [cluster + moveToClosestFrequencyWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 3a: TH sends a MoveToClosestFrequency command to DUT, with the frequency field " + @"set to a random value frand, chosen such that: fmin < frand < fmax Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestPhysicallyVerifyThatTheDeviceHasStoppedTransitioning_14() + CHIP_ERROR TestWait100ms_14() { - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 100UL; + return WaitForMs("alpha", value); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_15() + CHIP_ERROR TestStep3bThReadsTheCurrentFrequencyAttribute_15() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 3b: TH reads the CurrentFrequency attribute. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - if (value != nil) { - - VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 85U)); - VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 115U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue( + "CurrentFrequency", actualValue, mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); } NextTest(); @@ -57727,39 +60574,66 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionSendOffCommand_16() + CHIP_ERROR TestStep4aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToFmax1_16() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestStep4bThReadsTheCurrentFrequencyAttribute_17() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster offWithCompletion:^(NSError * _Nullable err) { - NSLog(@"Precondition send Off Command Error: %@", err); + [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 4b: TH reads the CurrentFrequency attribute. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue( + "CurrentFrequency", actualValue, mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_17() + CHIP_ERROR TestStep5aThSendsAMoveToClosestFrequencyCommandToDutWithTheFrequencyFieldSetToFmin1_18() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestStep5bThReadsTheCurrentFrequencyAttribute_19() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 5b: TH reads the CurrentFrequency attribute. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + VerifyOrReturn(CheckValue( + "CurrentFrequency", actualValue, mRandomFrequencyValue.HasValue() ? mRandomFrequencyValue.Value() : 30000U)); } NextTest(); @@ -151918,7 +154792,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 16 : TH writes WrongCodeEntryLimit attribute value as 3 on the DUT and Verify that the DUT sends " "Success response\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030")) { + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0030.Write")) { NextTest(); return; } @@ -151928,7 +154802,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 17 : TH writes WrongCodeEntryLimit attribute value as 3 on the DUT and verify DUT responds with " "UNSUPPORTED_WRITE\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && ! DRLK.S.A0030")) { + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0030.Write")) { NextTest(); return; } @@ -151938,7 +154812,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 18 : TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify " "that the DUT sends Success response\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031")) { + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && DRLK.S.A0031.Write")) { NextTest(); return; } @@ -151948,7 +154822,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 19 : TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT and Verify " "that the DUT sends Success response\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && ! DRLK.S.A0031")) { + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F01 && !DRLK.S.A0031.Write")) { NextTest(); return; } @@ -152014,7 +154888,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { break; case 27: ChipLogProgress(chipTool, " ***** Test Step 27 : TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY")) { + if (ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY")) { NextTest(); return; } @@ -152022,7 +154896,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { break; case 28: ChipLogProgress(chipTool, " ***** Test Step 28 : TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP")) { + if (ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP")) { NextTest(); return; } @@ -152030,7 +154904,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { break; case 29: ChipLogProgress(chipTool, " ***** Test Step 29 : TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); - if (ShouldSkip("!DRLK.S.A0023 && PICS_SDK_CI_ONLY")) { + if (ShouldSkip(" !DRLK.S.A0023.Write && PICS_SDK_CI_ONLY ")) { NextTest(); return; } @@ -152038,7 +154912,7 @@ class Test_TC_DRLK_2_3 : public TestCommandBridge { break; case 30: ChipLogProgress(chipTool, " ***** Test Step 30 : TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); - if (ShouldSkip("!DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP")) { + if (ShouldSkip(" !DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP ")) { NextTest(); return; } @@ -155650,20 +158524,1011 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearYearDayScheduleToDut_15() + CHIP_ERROR TestThSendsClearYearDayScheduleToDut_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:0U]; + [cluster + clearYearDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Clear Year Day Schedule to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_INVALID_COMMAND)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestClearAYearDayScheduleForTheFirstUser_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster clearYearDayScheduleWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Clear a year day schedule for the first user Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex1_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster clearUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Cleanup the created user with UserIndex 1 Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex5_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; + params.userIndex = [NSNumber numberWithUnsignedShort:5U]; + [cluster clearUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Cleanup the created user with UserIndex 5 Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_DRLK_2_9 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_DRLK_2_9() + : TestCommandBridge("Test_TC_DRLK_2_9") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_DRLK_2_9() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_9\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_9\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Create new user with default parameters\n"); + err = TestCreateNewUserWithDefaultParameters_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the user back and verify its fields\n"); + err = TestReadTheUserBackAndVerifyItsFields_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : TH reads NumberOfTotalUsersSupported attribute and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { + NextTest(); + return; + } + err = TestThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH sends Set Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH sends Get Credential Status Command\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommand_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH sends Set Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH sends Set Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDut_7(); + break; + case 8: + ChipLogProgress(chipTool, + " ***** Test Step 8 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential Response " + "command with status as DUPLICATE or OCCUPIED\n"); + if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithStatusAsDuplicateOrOccupied_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential Response " + "command with response as OCCUPIED if the CredentialIndex is repeated\n"); + if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_9(); + break; + case 10: + ChipLogProgress(chipTool, + " ***** Test Step 10 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential " + "Response command with response as OCCUPIED if the CredentialIndex is repeated\n"); + if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH sends Clear Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + NextTest(); + return; + } + err = TestThSendsClearCredentialCommandToDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : TH sends Get Credential Status Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommandToDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : TH sends Set User Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { + NextTest(); + return; + } + err = TestThSendsSetUserCommandToDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : TH sends Set Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + NextTest(); + return; + } + err = TestThSendsSetCredentialCommandToDut_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : TH sends Clear Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + NextTest(); + return; + } + err = TestThSendsClearCredentialCommandToDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : TH sends Get Credential Status Command\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommand_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : TH sends Get Credential Status Command\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommand_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : TH sends Clear Credential Command to DUT\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + NextTest(); + return; + } + err = TestThSendsClearCredentialCommandToDut_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Cleanup the first created user\n"); + err = TestCleanupTheFirstCreatedUser_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Cleanup the second created user\n"); + err = TestCleanupTheSecondCreatedUser_20(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 21; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestCreateNewUserWithDefaultParameters_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userName = @"xxx"; + params.userUniqueID = [NSNumber numberWithUnsignedInt:6452UL]; + params.userStatus = [NSNumber numberWithUnsignedChar:1U]; + params.userType = [NSNumber numberWithUnsignedChar:0U]; + params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; + [cluster setUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Create new user with default parameters Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheUserBackAndVerifyItsFields_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster getUserWithParams:params + completion:^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Read the user back and verify its fields Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } + + { + id actualValue = values.userName; + VerifyOrReturn(CheckValueNonNull("UserName", actualValue)); + VerifyOrReturn(CheckValueAsString("UserName", actualValue, @"xxx")); + } + + { + id actualValue = values.userUniqueID; + VerifyOrReturn(CheckValueNonNull("UserUniqueID", actualValue)); + VerifyOrReturn(CheckValue("UserUniqueID", actualValue, 6452UL)); + } + + { + id actualValue = values.userStatus; + VerifyOrReturn(CheckValueNonNull("UserStatus", actualValue)); + VerifyOrReturn(CheckValue("UserStatus", actualValue, 1U)); + } + + { + id actualValue = values.userType; + VerifyOrReturn(CheckValueNonNull("UserType", actualValue)); + VerifyOrReturn(CheckValue("UserType", actualValue, 0U)); + } + + { + id actualValue = values.credentialRule; + VerifyOrReturn(CheckValueNonNull("CredentialRule", actualValue)); + VerifyOrReturn(CheckValue("CredentialRule", actualValue, 0U)); + } + + { + id actualValue = values.credentials; + VerifyOrReturn(CheckValueNonNull("Credentials", actualValue)); + VerifyOrReturn(CheckValue("Credentials", [actualValue count], static_cast(0))); + } + + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.nextUserIndex; + VerifyOrReturn(CheckValueNull("NextUserIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull NumberOfTotalUsersSupported; + + CHIP_ERROR TestThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads NumberOfTotalUsersSupported attribute and saves for future use. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65534U)); + { + NumberOfTotalUsersSupported = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsSetCredentialCommandToDut_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + + params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); + VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsGetCredentialStatusCommand_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } + + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsSetCredentialCommandToDut_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; + + params.credentialData = [[NSData alloc] initWithBytes:"4321" length:4]; + params.userIndex = nil; + params.userStatus = [NSNumber numberWithUnsignedChar:5U]; + params.userType = [NSNumber numberWithUnsignedChar:10U]; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 133U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsSetCredentialCommandToDut_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; + + params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; + params.userIndex = nil; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 2U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithStatusAsDuplicateOrOccupied_8() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_9() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR + TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_10() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestThSendsClearCredentialCommandToDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + + [cluster clearCredentialWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Clear Credential Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsGetCredentialStatusCommandToDut_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); + } + + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsSetUserCommandToDut_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; + params.userName = @"xxx"; + params.userUniqueID = [NSNumber numberWithUnsignedInt:6452UL]; + params.userStatus = [NSNumber numberWithUnsignedChar:1U]; + params.userType = [NSNumber numberWithUnsignedChar:0U]; + params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; + [cluster setUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Set User Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsSetCredentialCommandToDut_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + + params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsClearCredentialCommandToDut_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:65534U]; + + [cluster clearCredentialWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Clear Credential Command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsGetCredentialStatusCommand_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:65534U]; + + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); + } + + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsGetCredentialStatusCommand_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); + } + + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsClearCredentialCommandToDut_18() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:0U]; - [cluster - clearYearDayScheduleWithParams:params + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:8U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; + + [cluster clearCredentialWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Year Day Schedule to DUT Error: %@", err); + NSLog(@"TH sends Clear Credential Command to DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code @@ -155676,29 +159541,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestClearAYearDayScheduleForTheFirstUser_16() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; - params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearYearDayScheduleWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Clear a year day schedule for the first user Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex1_17() + CHIP_ERROR TestCleanupTheFirstCreatedUser_19() { MTRBaseDevice * device = GetDevice("alpha"); @@ -155709,7 +159552,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { params.userIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster clearUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created user with UserIndex 1 Error: %@", err); + NSLog(@"Cleanup the first created user Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -155719,7 +159562,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex5_18() + CHIP_ERROR TestCleanupTheSecondCreatedUser_20() { MTRBaseDevice * device = GetDevice("alpha"); @@ -155727,10 +159570,10 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:5U]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; [cluster clearUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the created user with UserIndex 5 Error: %@", err); + NSLog(@"Cleanup the second created user Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -155741,21 +159584,24 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { } }; -class Test_TC_DRLK_2_9 : public TestCommandBridge { +class Test_TC_DRLK_2_11 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_9() - : TestCommandBridge("Test_TC_DRLK_2_9") + Test_TC_DRLK_2_11() + : TestCommandBridge("Test_TC_DRLK_2_11") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("PINCredentialData", &mPINCredentialData); + AddArgument("RFIDCredentialData", &mRFIDCredentialData); + AddArgument("FingerVeinCredentialData", &mFingerVeinCredentialData); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DRLK_2_9() {} + ~Test_TC_DRLK_2_11() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -155763,11 +159609,11 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_9\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_11\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_9\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_11\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -155792,147 +159638,164 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { err = TestReadTheUserBackAndVerifyItsFields_2(); break; case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : TH reads NumberOfTotalUsersSupported attribute and saves for future use.\n"); + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads NumberOfTotalUsersSupported and saves for future use.\n"); if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { NextTest(); return; } - err = TestThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_3(); + err = TestThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH sends Set Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads MinPINCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDut_4(); + err = TestThReadsMinPINCodeLengthAndSavesForFutureUse_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH sends Get Credential Status Command\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads MaxPINCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommand_5(); + err = TestThReadsMaxPINCodeLengthAndSavesForFutureUse_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : TH sends Set Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads MinRFIDCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A001a")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDut_6(); + err = TestThReadsMinRFIDCodeLengthAndSavesForFutureUse_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH sends Set Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads MaxRFIDCodeLength and saves for future use.\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A0019")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDut_7(); + err = TestThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7(); break; case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential Response " - "command with status as DUPLICATE or OCCUPIED\n"); - if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : TH sends Set Credential Command to DUT with type PIN\n"); + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithStatusAsDuplicateOrOccupied_8(); + err = TestThSendsSetCredentialCommandToDutWithTypePin_8(); break; case 9: - ChipLogProgress(chipTool, - " ***** Test Step 9 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential Response " - "command with response as OCCUPIED if the CredentialIndex is repeated\n"); - if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : TH sends Set Credential Command to DUT with type RFID\n"); + if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_9(); + err = TestThSendsSetCredentialCommandToDutWithTypeRfid_9(); break; case 10: - ChipLogProgress(chipTool, - " ***** Test Step 10 : TH sends Set Credential Command to DUT and Verify that the DUT sends Set Credential " - "Response command with response as OCCUPIED if the CredentialIndex is repeated\n"); - if (ShouldSkip("PICS_USER_PROMPT && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : TH sends Set Credential Command to DUT with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_10(); + err = TestThSendsSetCredentialCommandToDutWithTypeFingerVein_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH sends Clear Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 11 : TH sends Get Credential Status Command with type PIN\n"); + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestThSendsClearCredentialCommandToDut_11(); + err = TestThSendsGetCredentialStatusCommandWithTypePin_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : TH sends Get Credential Status Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 12 : TH sends Get Credential Status Command with type RFID\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandToDut_12(); + err = TestThSendsGetCredentialStatusCommandWithTypeRfid_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : TH sends Set User Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 13 : TH sends Get Credential Status Command with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestThSendsSetUserCommandToDut_13(); + err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : TH sends Set Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 14 : TH sends Clear Credential Command to DUT with type PIN\n"); + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDut_14(); + err = TestThSendsClearCredentialCommandToDutWithTypePin_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : TH sends Clear Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 15 : TH sends Get Credential Status Command with type RFID\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestThSendsClearCredentialCommandToDut_15(); + err = TestThSendsGetCredentialStatusCommandWithTypeRfid_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : TH sends Get Credential Status Command\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 16 : TH sends Get Credential Status Command with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommand_16(); + err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : TH sends Get Credential Status Command\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 17 : TH sends Clear Credential Command to DUT with type RFID\n"); + if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommand_17(); + err = TestThSendsClearCredentialCommandToDutWithTypeRfid_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : TH sends Clear Credential Command to DUT\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.C26.Rsp")) { + ChipLogProgress(chipTool, " ***** Test Step 18 : TH sends Get Credential Status Command with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { NextTest(); return; } - err = TestThSendsClearCredentialCommandToDut_18(); + err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_18(); break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Cleanup the first created user\n"); - err = TestCleanupTheFirstCreatedUser_19(); + ChipLogProgress(chipTool, " ***** Test Step 19 : TH sends Clear Credential Command to DUT with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { + NextTest(); + return; + } + err = TestThSendsClearCredentialCommandToDutWithTypeFingerVein_19(); break; case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Cleanup the second created user\n"); - err = TestCleanupTheSecondCreatedUser_20(); + ChipLogProgress(chipTool, " ***** Test Step 20 : TH sends Get Credential Status Command to DUT with type PIN\n"); + if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommandToDutWithTypePin_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : TH sends Get Credential Status Command to DUT with type RFID\n"); + if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommandToDutWithTypeRfid_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : TH sends Get Credential Status Command to DUT with type FingerVein\n"); + if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + NextTest(); + return; + } + err = TestThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22(); break; } @@ -156000,7 +159863,7 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 19: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -156008,6 +159871,12 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { case 20: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -156021,11 +159890,14 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 21; + const uint16_t mTestCount = 23; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mPINCredentialData; + chip::Optional mRFIDCredentialData; + chip::Optional mFingerVeinCredentialData; chip::Optional mTimeout; CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() @@ -156141,9 +160013,8 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - NSNumber * _Nonnull NumberOfTotalUsersSupported; - CHIP_ERROR TestThReadsNumberOfTotalUsersSupportedAttributeAndSavesForFutureUse_3() + CHIP_ERROR TestThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156151,15 +160022,12 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads NumberOfTotalUsersSupported attribute and saves for future use. Error: %@", err); + NSLog(@"TH reads NumberOfTotalUsersSupported and saves for future use. Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65534U)); - { - NumberOfTotalUsersSupported = value; - } + VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65535U)); NextTest(); }]; @@ -156167,7 +160035,91 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDut_4() + CHIP_ERROR TestThReadsMinPINCodeLengthAndSavesForFutureUse_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MinPINCodeLength and saves for future use. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("minPINCodeLength", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("minPINCodeLength", [value unsignedCharValue], 255U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsMaxPINCodeLengthAndSavesForFutureUse_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MaxPINCodeLength and saves for future use. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("maxPINCodeLength", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("maxPINCodeLength", [value unsignedCharValue], 255U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsMinRFIDCodeLengthAndSavesForFutureUse_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MinRFIDCodeLength and saves for future use. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("minRFIDCodeLength", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("minRFIDCodeLength", [value unsignedCharValue], 255U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads MaxRFIDCodeLength and saves for future use. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintMinValue("maxRFIDCodeLength", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("maxRFIDCodeLength", [value unsignedCharValue], 255U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsSetCredentialCommandToDutWithTypePin_8() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156180,14 +160132,16 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; + params.credentialData = mPINCredentialData.HasValue() + ? [NSData dataWithBytes:mPINCredentialData.Value().data() length:mPINCredentialData.Value().size()] + : [[NSData alloc] initWithBytes:"123456" length:6]; params.userIndex = [NSNumber numberWithUnsignedShort:1U]; params.userStatus = nil; params.userType = nil; [cluster setCredentialWithParams:params completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + NSLog(@"TH sends Set Credential Command to DUT with type PIN Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -156213,7 +160167,103 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommand_5() + CHIP_ERROR TestThSendsSetCredentialCommandToDutWithTypeRfid_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + + params.credentialData = mRFIDCredentialData.HasValue() + ? [NSData dataWithBytes:mRFIDCredentialData.Value().data() length:mRFIDCredentialData.Value().size()] + : [[NSData alloc] initWithBytes:"RFIDTESTDATA" length:12]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends Set Credential Command to DUT with type RFID Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); + VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsSetCredentialCommandToDutWithTypeFingerVein_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + + params.credentialData = mFingerVeinCredentialData.HasValue() + ? [NSData dataWithBytes:mFingerVeinCredentialData.Value().data() length:mFingerVeinCredentialData.Value().size()] + : [[NSData alloc] initWithBytes:"123456" length:6]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"TH sends Set Credential Command to DUT with type FingerVein Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); + VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypePin_11() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156228,10 +160278,15 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { [cluster getCredentialStatusWithParams:params completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command Error: %@", err); + NSLog(@"TH sends Get Credential Status Command with type PIN Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); { id actualValue = values.userIndex; @@ -156262,120 +160317,115 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDut_6() + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeRfid_12() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - params.credentialData = [[NSData alloc] initWithBytes:"4321" length:4]; - params.userIndex = nil; - params.userStatus = [NSNumber numberWithUnsignedChar:5U]; - params.userType = [NSNumber numberWithUnsignedChar:10U]; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command with type RFID Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 133U)); - } + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - NextTest(); - }]; + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDut_7() + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_13() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; - - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = nil; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 2U)); - } + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command with type FingerVein Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - return CHIP_NO_ERROR; - } + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } - CHIP_ERROR - TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithStatusAsDuplicateOrOccupied_8() - { + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } - CHIP_ERROR - TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_9() - { + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); - } + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } - CHIP_ERROR - TestThSendsSetCredentialCommandToDutAndVerifyThatTheDutSendsSetCredentialResponseCommandWithResponseAsOccupiedIfTheCredentialIndexIsRepeated_10() - { + NextTest(); + }]; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' for successgarbage: not in length on purpose", 28); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt("alpha", value); + return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearCredentialCommandToDut_11() + CHIP_ERROR TestThSendsClearCredentialCommandToDutWithTypePin_14() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156389,7 +160439,7 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { [cluster clearCredentialWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential Command to DUT Error: %@", err); + NSLog(@"TH sends Clear Credential Command to DUT with type PIN Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -156399,7 +160449,7 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandToDut_12() + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeRfid_15() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156408,34 +160458,38 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster getCredentialStatusWithParams:params completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command to DUT Error: %@", err); + NSLog(@"TH sends Get Credential Status Command with type RFID Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); { id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); } + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); { id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); } { id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); } { id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); } { @@ -156449,74 +160503,139 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetUserCommandToDut_13() + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_16() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - params.userName = @"xxx"; - params.userUniqueID = [NSNumber numberWithUnsignedInt:6452UL]; - params.userStatus = [NSNumber numberWithUnsignedChar:1U]; - params.userType = [NSNumber numberWithUnsignedChar:0U]; - params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; - [cluster setUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Set User Command to DUT Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command with type FingerVein Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } + + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } + + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDut_14() + CHIP_ERROR TestThSendsClearCredentialCommandToDutWithTypeRfid_17() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT Error: %@", err); + [cluster clearCredentialWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends Clear Credential Command to DUT with type RFID Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + NextTest(); + }]; - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + return CHIP_NO_ERROR; + } - NextTest(); - }]; + CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command with type FingerVein Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } + + VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } + + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearCredentialCommandToDut_15() + CHIP_ERROR TestThSendsClearCredentialCommandToDutWithTypeFingerVein_19() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156525,12 +160644,12 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:65534U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster clearCredentialWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential Command to DUT Error: %@", err); + NSLog(@"TH sends Clear Credential Command to DUT with type FingerVein Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -156540,7 +160659,7 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommand_16() + CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypePin_20() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156550,12 +160669,12 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:65534U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster getCredentialStatusWithParams:params completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command Error: %@", err); + NSLog(@"TH sends Get Credential Status Command to DUT with type PIN Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -156590,7 +160709,7 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommand_17() + CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypeRfid_21() { MTRBaseDevice * device = GetDevice("alpha"); @@ -156599,13 +160718,13 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster getCredentialStatusWithParams:params completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command Error: %@", err); + NSLog(@"TH sends Get Credential Status Command to DUT with type RFID Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -156640,94 +160759,72 @@ class Test_TC_DRLK_2_9 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearCredentialCommandToDut_18() + CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:8U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:2U]; - - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential Command to DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", - err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code - : EMBER_ZCL_STATUS_FAILURE) - : 0, - EMBER_ZCL_STATUS_INVALID_COMMAND)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestCleanupTheFirstCreatedUser_19() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the first created user Error: %@", err); + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"TH sends Get Credential Status Command to DUT with type FingerVein Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - return CHIP_NO_ERROR; - } + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); + } - CHIP_ERROR TestCleanupTheSecondCreatedUser_20() - { + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); + } - __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; - params.userIndex = [NSNumber numberWithUnsignedShort:2U]; - [cluster clearUserWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"Cleanup the second created user Error: %@", err); + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); + } - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } }; -class Test_TC_DRLK_2_11 : public TestCommandBridge { +class Test_TC_DRLK_2_12 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_DRLK_2_11() - : TestCommandBridge("Test_TC_DRLK_2_11") + Test_TC_DRLK_2_12() + : TestCommandBridge("Test_TC_DRLK_2_12") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("PINCredentialData", &mPINCredentialData); - AddArgument("RFIDCredentialData", &mRFIDCredentialData); - AddArgument("FingerVeinCredentialData", &mFingerVeinCredentialData); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_DRLK_2_11() {} + ~Test_TC_DRLK_2_12() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -156735,11 +160832,11 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_11\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DRLK_2_12\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_11\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DRLK_2_12\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -156756,172 +160853,312 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Create new user with default parameters\n"); - err = TestCreateNewUserWithDefaultParameters_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Create new user\n"); + err = TestCreateNewUser_1(); break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Read the user back and verify its fields\n"); err = TestReadTheUserBackAndVerifyItsFields_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads NumberOfTotalUsersSupported and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.A0011")) { - NextTest(); - return; - } - err = TestThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Create new PIN credential and lock/unlock user\n"); + err = TestCreateNewPinCredentialAndLockUnlockUser_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads MinPINCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { - NextTest(); - return; - } - err = TestThReadsMinPINCodeLengthAndSavesForFutureUse_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Verify created PIN credential\n"); + err = TestVerifyCreatedPinCredential_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads MaxPINCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F00")) { + ChipLogProgress(chipTool, + " ***** Test Step 5 : Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write")) { NextTest(); return; } - err = TestThReadsMaxPINCodeLengthAndSavesForFutureUse_5(); + err = TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads MinRFIDCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A001a")) { + ChipLogProgress(chipTool, + " ***** Test Step 6 : Step 1: TH writes the RequirePINforRemoteOperation attribute value as False on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write")) { NextTest(); return; } - err = TestThReadsMinRFIDCodeLengthAndSavesForFutureUse_6(); + err = TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads MaxRFIDCodeLength and saves for future use.\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.A0019")) { + ChipLogProgress( + chipTool, " ***** Test Step 7 : Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { NextTest(); return; } - err = TestThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7(); + err = TestStep2ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : TH sends Set Credential Command to DUT with type PIN\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 3: TH sends Ubolt Door Command to the DUT without PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDutWithTypePin_8(); + err = TestStep3ThSendsUboltDoorCommandToTheDutWithoutPINCode_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : TH sends Set Credential Command to DUT with type RFID\n"); - if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 4: TH sends Ubolt Door Command to the DUT with PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDutWithTypeRfid_9(); + err = TestStep4ThSendsUboltDoorCommandToTheDutWithPINCode_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : TH sends Set Credential Command to DUT with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx")) { + ChipLogProgress(chipTool, + " ***** Test Step 10 : Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033.Write")) { NextTest(); return; } - err = TestThSendsSetCredentialCommandToDutWithTypeFingerVein_10(); + err = TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH sends Get Credential Status Command with type PIN\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, + " ***** Test Step 11 : Step 5: TH writes the RequirePINforRemoteOperation attribute value as true on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && !DRLK.S.A0033.Write")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypePin_11(); + err = TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : TH sends Get Credential Status Command with type RFID\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress( + chipTool, " ***** Test Step 12 : Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && DRLK.S.F07 && DRLK.S.F00 && DRLK.S.A0033")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypeRfid_12(); + err = TestStep6ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : TH sends Get Credential Status Command with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 13 : Step 7: TH sends Ubolt Door Command to the DUT with valid PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_13(); + err = TestStep7ThSendsUboltDoorCommandToTheDutWithValidPINCode_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : TH sends Clear Credential Command to DUT with type PIN\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { + ChipLogProgress( + chipTool, " ***** Test Step 14 : Step 8: TH sends Unbolt Door Command to the DUT with Invalid PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c")) { NextTest(); return; } - err = TestThSendsClearCredentialCommandToDutWithTypePin_14(); + err = TestStep8ThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : TH sends Get Credential Status Command with type RFID\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F01 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 9: TH sends Unbolt Door Command to the DUT without PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp && DRLK.S.F0c")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypeRfid_15(); + err = TestStep9ThSendsUnboltDoorCommandToTheDutWithoutPINCode_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : TH sends Get Credential Status Command with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress( + chipTool, " ***** Test Step 16 : Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030.Write")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_16(); + err = TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : TH sends Clear Credential Command to DUT with type RFID\n"); - if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { + ChipLogProgress( + chipTool, " ***** Test Step 17 : Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the DUT\n"); + if (ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0030.Write")) { NextTest(); return; } - err = TestThSendsClearCredentialCommandToDutWithTypeRfid_17(); + err = TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : TH sends Get Credential Status Command with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F08 && DRLK.S.F02 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress(chipTool, + " ***** Test Step 18 : Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT " + "and Verify that the DUT sends Success response\n"); + if (ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031.Write")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandWithTypeFingerVein_18(); + err = TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_18(); break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : TH sends Clear Credential Command to DUT with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C26.Rsp")) { + ChipLogProgress(chipTool, + " ***** Test Step 19 : Step 11: TH writes UserCodeTemporaryDisableTime attribute value as 15 Seconds on the DUT " + "and Verify that the DUT sends Success response\n"); + if (ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && !DRLK.S.A0031.Write")) { NextTest(); return; } - err = TestThSendsClearCredentialCommandToDutWithTypeFingerVein_19(); + err = TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_19(); break; case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : TH sends Get Credential Status Command to DUT with type PIN\n"); - if (ShouldSkip("DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress( + chipTool, " ***** Test Step 20 : Step 12a: TH sends Unbolt Door Command to the DUT with invalid PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandToDutWithTypePin_20(); + err = TestStep12aThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_20(); break; case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : TH sends Get Credential Status Command to DUT with type RFID\n"); - if (ShouldSkip("DRLK.S.F01 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + ChipLogProgress( + chipTool, " ***** Test Step 21 : Step 12b: TH sends Unbolt Door Command to the DUT with invalid PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandToDutWithTypeRfid_21(); + err = TestStep12bThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_21(); + break; + case 22: + ChipLogProgress( + chipTool, " ***** Test Step 22 : Step 12c: TH sends Unbolt Door Command to the DUT with invalid PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp")) { + NextTest(); + return; + } + err = TestStep12cThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Step 12d: TH sends Unbolt Door Command to the DUT with invalid PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp")) { + NextTest(); + return; + } + err = TestStep12dThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Step 13: TH reads UserCodedTemporaryDisableTime attribute from DUT\n"); + if (ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031")) { + NextTest(); + return; + } + err = TestStep13ThReadsUserCodedTemporaryDisableTimeAttributeFromDut_24(); + break; + case 25: + ChipLogProgress(chipTool, + " ***** Test Step 25 : Step 14: TH sends Unbolt Door Command to the DUT with valid PINCode before " + "UserCodeTemporaryDisableTime expires\n"); + if (ShouldSkip("DRLK.S.C27.Rsp")) { + NextTest(); + return; + } + err = TestStep14ThSendsUnboltDoorCommandToTheDutWithValidPINCodeBeforeUserCodeTemporaryDisableTimeExpires_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Wait for UserCodeTemporaryDisableTime expires\n"); + if (ShouldSkip("DRLK.S.F0c && ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0031")) { + NextTest(); + return; + } + err = TestWaitForUserCodeTemporaryDisableTimeExpires_26(); + break; + case 27: + ChipLogProgress( + chipTool, " ***** Test Step 27 : Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); + if (ShouldSkip("DRLK.S.A0023.Write && PICS_SDK_CI_ONLY")) { + NextTest(); + return; + } + err = TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_27(); + break; + case 28: + ChipLogProgress( + chipTool, " ***** Test Step 28 : Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); + if (ShouldSkip("DRLK.S.A0023.Write && PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_28(); + break; + case 29: + ChipLogProgress( + chipTool, " ***** Test Step 29 : Step 15: TH writes AutoRelockTime attribute value as 10 seconds on the DUT\n"); + if (ShouldSkip("PICS_SDK_CI_ONLY && !DRLK.S.A0023.Write")) { + NextTest(); + return; + } + err = TestStep15ThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_29(); + break; + case 30: + ChipLogProgress( + chipTool, " ***** Test Step 30 : Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP && !DRLK.S.A0023.Write")) { + NextTest(); + return; + } + err = TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : Step 16: TH reads the AutoRelockTime attribute from the DUT\n"); + if (ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY")) { + NextTest(); + return; + } + err = TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : Step 16: TH reads the AutoRelockTime attribute from the DUT\n"); + if (ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_32(); + break; + case 33: + ChipLogProgress( + chipTool, " ***** Test Step 33 : Step 17: TH sends the Unbolt Door command to the DUT with valid PINCode\n"); + if (ShouldSkip("DRLK.S.C27.Rsp")) { + NextTest(); + return; + } + err = TestStep17ThSendsTheUnboltDoorCommandToTheDutWithValidPINCode_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : Wait for AutoRelockTime Expires\n"); + if (ShouldSkip("DRLK.S.A0023 && PICS_SDK_CI_ONLY")) { + NextTest(); + return; + } + err = TestWaitForAutoRelockTimeExpires_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : Wait for AutoRelockTime Expires\n"); + if (ShouldSkip("DRLK.S.A0023 && PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestWaitForAutoRelockTimeExpires_35(); + break; + case 36: + ChipLogProgress(chipTool, " ***** Test Step 36 : Step 18: TH reads LockState attribute\n"); + if (ShouldSkip("DRLK.S.A0000 && DRLK.S.C01.Rsp")) { + NextTest(); + return; + } + err = TestStep18ThReadsLockStateAttribute_36(); + break; + case 37: + ChipLogProgress(chipTool, " ***** Test Step 37 : Cleanup the created user\n"); + err = TestCleanupTheCreatedUser_37(); break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : TH sends Get Credential Status Command to DUT with type FingerVein\n"); - if (ShouldSkip("DRLK.S.F02 && DRLK.S.F08 && DRLK.S.C24.Rsp && DRLK.S.C25.Tx")) { + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : Clean the created credential\n"); + if (ShouldSkip("DRLK.S.C26.Rsp")) { NextTest(); return; } - err = TestThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22(); + err = TestCleanTheCreatedCredential_38(); break; } @@ -156953,7 +161190,7 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 7: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -156968,7 +161205,7 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -156977,30 +161214,78 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; case 16: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); break; case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 38: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; } @@ -157016,14 +161301,11 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 23; + const uint16_t mTestCount = 39; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; - chip::Optional mPINCredentialData; - chip::Optional mRFIDCredentialData; - chip::Optional mFingerVeinCredentialData; chip::Optional mTimeout; CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() @@ -157034,7 +161316,7 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { return WaitForCommissionee("alpha", value); } - CHIP_ERROR TestCreateNewUserWithDefaultParameters_1() + CHIP_ERROR TestCreateNewUser_1() { MTRBaseDevice * device = GetDevice("alpha"); @@ -157051,7 +161333,7 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { params.credentialRule = [NSNumber numberWithUnsignedChar:0U]; [cluster setUserWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Create new user with default parameters Error: %@", err); + NSLog(@"Create new user Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -157140,83 +161422,171 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsNumberOfTotalUsersSupportedAndSavesForFutureUse_3() + CHIP_ERROR TestCreateNewPinCredentialAndLockUnlockUser_3() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads NumberOfTotalUsersSupported and saves for future use. Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; + params.operationType = [NSNumber numberWithUnsignedChar:0U]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + params.credentialData = [[NSData alloc] initWithBytes:"123456" length:6]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + params.userStatus = nil; + params.userType = nil; + [cluster + setCredentialWithParams:params + completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Create new PIN credential and lock/unlock user Error: %@", err); - VerifyOrReturn(CheckConstraintMinValue("numberOfTotalUsersSupported", [value unsignedShortValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("numberOfTotalUsersSupported", [value unsignedShortValue], 65535U)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); + VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsMinPINCodeLengthAndSavesForFutureUse_4() + CHIP_ERROR TestVerifyCreatedPinCredential_4() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MinPINCodeLength and saves for future use. Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + [cluster getCredentialStatusWithParams:params + completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, + NSError * _Nullable err) { + NSLog(@"Verify created PIN credential Error: %@", err); - VerifyOrReturn(CheckConstraintMinValue("minPINCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("minPINCodeLength", [value unsignedCharValue], 255U)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + { + id actualValue = values.credentialExists; + VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); + VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); + } + + { + id actualValue = values.creatorFabricIndex; + VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.lastModifiedFabricIndex; + VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); + VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); + } + + { + id actualValue = values.nextCredentialIndex; + VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsMaxPINCodeLengthAndSavesForFutureUse_5() + CHIP_ERROR TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_5() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MaxPINCodeLength and saves for future use. Error: %@", err); + id requirePINforRemoteOperationArgument; + requirePINforRemoteOperationArgument = [NSNumber numberWithBool:false]; + [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 1: TH writes the RequirePINforRemoteOperation attribute " + @"value as False on the DUT Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("maxPINCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("maxPINCodeLength", [value unsignedCharValue], 255U)); + NextTest(); + }]; - NextTest(); - }]; + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep1ThWritesTheRequirePINforRemoteOperationAttributeValueAsFalseOnTheDut_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id requirePINforRemoteOperationArgument; + requirePINforRemoteOperationArgument = [NSNumber numberWithBool:false]; + [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 1: TH writes the RequirePINforRemoteOperation attribute " + @"value as False on the DUT Error: %@", + err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsMinRFIDCodeLengthAndSavesForFutureUse_6() + CHIP_ERROR TestStep2ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_7() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MinRFIDCodeLength and saves for future use. Error: %@", err); + [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 2: TH reads the RequirePINforRemoteOperation attribute from the DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckConstraintMinValue("minRFIDCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("minRFIDCodeLength", [value unsignedCharValue], 255U)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("RequirePINforRemoteOperation", actualValue, false)); + } NextTest(); }]; @@ -157224,713 +161594,693 @@ class Test_TC_DRLK_2_11 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThReadsMaxRFIDCodeLengthAndSavesForFutureUse_7() + CHIP_ERROR TestStep3ThSendsUboltDoorCommandToTheDutWithoutPINCode_8() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMaxRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads MaxRFIDCodeLength and saves for future use. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + [cluster unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 3: TH sends Ubolt Door Command to the DUT without PINCode Error: %@", err); - VerifyOrReturn(CheckConstraintMinValue("maxRFIDCodeLength", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("maxRFIDCodeLength", [value unsignedCharValue], 255U)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDutWithTypePin_8() + CHIP_ERROR TestStep4ThSendsUboltDoorCommandToTheDutWithPINCode_9() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; + [cluster unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 4: TH sends Ubolt Door Command to the DUT with PINCode Error: %@", err); - params.credentialData = mPINCredentialData.HasValue() - ? [NSData dataWithBytes:mPINCredentialData.Value().data() length:mPINCredentialData.Value().size()] - : [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT with type PIN Error: %@", err); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + NextTest(); + }]; - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + CHIP_ERROR TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_10() + { - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - NextTest(); - }]; + id requirePINforRemoteOperationArgument; + requirePINforRemoteOperationArgument = [NSNumber numberWithBool:true]; + [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 5: TH writes the RequirePINforRemoteOperation attribute " + @"value as true on the DUT Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDutWithTypeRfid_9() + CHIP_ERROR TestStep5ThWritesTheRequirePINforRemoteOperationAttributeValueAsTrueOnTheDut_11() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + id requirePINforRemoteOperationArgument; + requirePINforRemoteOperationArgument = [NSNumber numberWithBool:true]; + [cluster writeAttributeRequirePINforRemoteOperationWithValue:requirePINforRemoteOperationArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 5: TH writes the RequirePINforRemoteOperation attribute " + @"value as true on the DUT Error: %@", + err); - params.credentialData = mRFIDCredentialData.HasValue() - ? [NSData dataWithBytes:mRFIDCredentialData.Value().data() length:mRFIDCredentialData.Value().size()] - : [[NSData alloc] initWithBytes:"RFIDTESTDATA" length:12]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT with type RFID Error: %@", err); + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + return CHIP_NO_ERROR; + } - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + CHIP_ERROR TestStep6ThReadsTheRequirePINforRemoteOperationAttributeFromTheDut_12() + { - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } + [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 6: TH reads the RequirePINforRemoteOperation attribute from the DUT Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("RequirePINforRemoteOperation", actualValue, true)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsSetCredentialCommandToDutWithTypeFingerVein_10() + CHIP_ERROR TestStep7ThSendsUboltDoorCommandToTheDutWithValidPINCode_13() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; - params.operationType = [NSNumber numberWithUnsignedChar:0U]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; + [cluster unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 7: TH sends Ubolt Door Command to the DUT with valid PINCode Error: %@", err); - params.credentialData = mFingerVeinCredentialData.HasValue() - ? [NSData dataWithBytes:mFingerVeinCredentialData.Value().data() length:mFingerVeinCredentialData.Value().size()] - : [[NSData alloc] initWithBytes:"123456" length:6]; - params.userIndex = [NSNumber numberWithUnsignedShort:1U]; - params.userStatus = nil; - params.userType = nil; - [cluster - setCredentialWithParams:params - completion:^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"TH sends Set Credential Command to DUT with type FingerVein Error: %@", err); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + NextTest(); + }]; - { - id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 0U)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + CHIP_ERROR TestStep8ThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_14() + { - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNonNull("NextCredentialIndex", actualValue)); - VerifyOrReturn(CheckValue("NextCredentialIndex", actualValue, 2U)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - NextTest(); - }]; + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + params.pinCode = [[NSData alloc] initWithBytes:"123458" length:6]; + [cluster + unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 8: TH sends Unbolt Door Command to the DUT with Invalid PINCode Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypePin_11() + CHIP_ERROR TestStep9ThSendsUnboltDoorCommandToTheDutWithoutPINCode_15() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command with type PIN Error: %@", err); + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + [cluster + unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 9: TH sends Unbolt Door Command to the DUT without PINCode Error: %@", err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } + return CHIP_NO_ERROR; + } - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + CHIP_ERROR TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_16() + { - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } + id wrongCodeEntryLimitArgument; + wrongCodeEntryLimitArgument = [NSNumber numberWithUnsignedChar:3U]; + [cluster writeAttributeWrongCodeEntryLimitWithValue:wrongCodeEntryLimitArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the " + @"DUT Error: %@", + err); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeRfid_12() + CHIP_ERROR TestStep10ThWritesWrongCodeEntryLimitAttributeValueAs3OnTheDut_17() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command with type RFID Error: %@", err); + id wrongCodeEntryLimitArgument; + wrongCodeEntryLimitArgument = [NSNumber numberWithUnsignedChar:3U]; + [cluster writeAttributeWrongCodeEntryLimitWithValue:wrongCodeEntryLimitArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 10: TH writes WrongCodeEntryLimit attribute value as 3 on the " + @"DUT Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } + return CHIP_NO_ERROR; + } - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + CHIP_ERROR + TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_18() + { - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } + id userCodeTemporaryDisableTimeArgument; + userCodeTemporaryDisableTimeArgument = [NSNumber numberWithUnsignedChar:15U]; + [cluster writeAttributeUserCodeTemporaryDisableTimeWithValue:userCodeTemporaryDisableTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 11: TH writes UserCodeTemporaryDisableTime attribute " + @"value as 15 Seconds on the DUT and Verify that the DUT sends " + @"Success response Error: %@", + err); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_13() + CHIP_ERROR + TestStep11ThWritesUserCodeTemporaryDisableTimeAttributeValueAs15SecondsOnTheDutAndVerifyThatTheDutSendsSuccessResponse_19() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command with type FingerVein Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id userCodeTemporaryDisableTimeArgument; + userCodeTemporaryDisableTimeArgument = [NSNumber numberWithUnsignedChar:15U]; + [cluster writeAttributeUserCodeTemporaryDisableTimeWithValue:userCodeTemporaryDisableTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 11: TH writes UserCodeTemporaryDisableTime attribute " + @"value as 15 Seconds on the DUT and Verify that the DUT sends " + @"Success response Error: %@", + err); - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + CHIP_ERROR TestStep12aThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_20() + { - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + params.pinCode = [[NSData alloc] initWithBytes:"123457" length:6]; + [cluster + unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 12a: TH sends Unbolt Door Command to the DUT with invalid PINCode Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearCredentialCommandToDutWithTypePin_14() + CHIP_ERROR TestStep12bThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_21() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + params.pinCode = [[NSData alloc] initWithBytes:"123458" length:6]; + [cluster + unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 12b: TH sends Unbolt Door Command to the DUT with invalid PINCode Error: %@", err); - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential Command to DUT with type PIN Error: %@", err); + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + return CHIP_NO_ERROR; + } - NextTest(); - }]; + CHIP_ERROR TestStep12cThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + params.pinCode = [[NSData alloc] initWithBytes:"123459" length:6]; + [cluster + unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 12c: TH sends Unbolt Door Command to the DUT with invalid PINCode Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeRfid_15() + CHIP_ERROR TestStep12dThSendsUnboltDoorCommandToTheDutWithInvalidPINCode_23() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + params.pinCode = [[NSData alloc] initWithBytes:"123460" length:6]; + [cluster + unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 12d: TH sends Unbolt Door Command to the DUT with invalid PINCode Error: %@", err); - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command with type RFID Error: %@", err); + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + return CHIP_NO_ERROR; + } - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } + CHIP_ERROR TestStep13ThReadsUserCodedTemporaryDisableTimeAttributeFromDut_24() + { - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + [cluster readAttributeUserCodeTemporaryDisableTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 13: TH reads UserCodedTemporaryDisableTime attribute from DUT Error: %@", err); - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + { + id actualValue = value; + VerifyOrReturn(CheckValue("UserCodeTemporaryDisableTime", actualValue, 15U)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_16() + CHIP_ERROR TestStep14ThSendsUnboltDoorCommandToTheDutWithValidPINCodeBeforeUserCodeTemporaryDisableTimeExpires_25() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; + [cluster + unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 14: TH sends Unbolt Door Command to the DUT with valid PINCode before " + @"UserCodeTemporaryDisableTime expires Error: %@", + err); - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command with type FingerVein Error: %@", err); + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_FAILURE)); + NextTest(); + }]; - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + return CHIP_NO_ERROR; + } - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } + CHIP_ERROR TestWaitForUserCodeTemporaryDisableTimeExpires_26() + { - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 15000UL; + return WaitForMs("alpha", value); + } - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_27() + { - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + id autoRelockTimeArgument; + autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; + [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT " + @"Error: %@", + err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearCredentialCommandToDutWithTypeRfid_17() + CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_28() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential Command to DUT with type RFID Error: %@", err); + id autoRelockTimeArgument; + autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:60UL]; + [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT " + @"Error: %@", + err); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandWithTypeFingerVein_18() + CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs10SecondsOnTheDut_29() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command with type FingerVein Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + id autoRelockTimeArgument; + autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:10UL]; + [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 15: TH writes AutoRelockTime attribute value as 10 seconds on the DUT " + @"Error: %@", + err); - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, true)); - } + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; - VerifyOrReturn(CheckConstraintType("credentialExists", "boolean", "boolean")); - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNonNull("UserIndex", actualValue)); - VerifyOrReturn(CheckValue("UserIndex", actualValue, 1U)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNonNull("CreatorFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("CreatorFabricIndex", actualValue, 1U)); - } + CHIP_ERROR TestStep15ThWritesAutoRelockTimeAttributeValueAs60SecondsOnTheDut_30() + { - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNonNull("LastModifiedFabricIndex", actualValue)); - VerifyOrReturn(CheckValue("LastModifiedFabricIndex", actualValue, 1U)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + id autoRelockTimeArgument; + autoRelockTimeArgument = [NSNumber numberWithUnsignedInt:60UL]; + [cluster writeAttributeAutoRelockTimeWithValue:autoRelockTimeArgument + completion:^(NSError * _Nullable err) { + NSLog(@"Step 15: TH writes AutoRelockTime attribute value as 60 seconds on the DUT " + @"Error: %@", + err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] + ? err.code + : EMBER_ZCL_STATUS_FAILURE) + : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsClearCredentialCommandToDutWithTypeFingerVein_19() + CHIP_ERROR TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_31() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster readAttributeAutoRelockTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 16: TH reads the AutoRelockTime attribute from the DUT Error: %@", err); - [cluster clearCredentialWithParams:params - completion:^(NSError * _Nullable err) { - NSLog(@"TH sends Clear Credential Command to DUT with type FingerVein Error: %@", err); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("AutoRelockTime", actualValue, 10UL)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypePin_20() + CHIP_ERROR TestStep16ThReadsTheAutoRelockTimeAttributeFromTheDut_32() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster readAttributeAutoRelockTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 16: TH reads the AutoRelockTime attribute from the DUT Error: %@", err); - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command to DUT with type PIN Error: %@", err); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("AutoRelockTime", actualValue, 60UL)); + } - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); - } + NextTest(); + }]; - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); - } + CHIP_ERROR TestStep17ThSendsTheUnboltDoorCommandToTheDutWithValidPINCode_33() + { - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; + params.pinCode = [[NSData alloc] initWithBytes:"123456" length:6]; + [cluster unboltDoorWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Step 17: TH sends the Unbolt Door command to the DUT with valid PINCode Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypeRfid_21() + CHIP_ERROR TestWaitForAutoRelockTimeExpires_34() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestWaitForAutoRelockTimeExpires_35() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 60000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestStep18ThReadsLockStateAttribute_36() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; - params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:2U]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Step 18: TH reads LockState attribute Error: %@", err); - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command to DUT with type RFID Error: %@", err); + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("LockState", actualValue)); + VerifyOrReturn(CheckValue("LockState", actualValue, 1U)); + } - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); - } + NextTest(); + }]; - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } + return CHIP_NO_ERROR; + } - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); - } + CHIP_ERROR TestCleanupTheCreatedUser_37() + { - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); - } + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; + params.userIndex = [NSNumber numberWithUnsignedShort:1U]; + [cluster clearUserWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Cleanup the created user Error: %@", err); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestThSendsGetCredentialStatusCommandToDutWithTypeFingerVein_22() + CHIP_ERROR TestCleanTheCreatedCredential_38() { MTRBaseDevice * device = GetDevice("alpha"); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; + __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; params.credential = [[MTRDoorLockClusterCredentialStruct alloc] init]; - ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:4U]; + ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialType = [NSNumber numberWithUnsignedChar:1U]; ((MTRDoorLockClusterCredentialStruct *) params.credential).credentialIndex = [NSNumber numberWithUnsignedShort:1U]; - [cluster getCredentialStatusWithParams:params - completion:^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, - NSError * _Nullable err) { - NSLog(@"TH sends Get Credential Status Command to DUT with type FingerVein Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = values.credentialExists; - VerifyOrReturn(CheckValue("CredentialExists", actualValue, false)); - } - - { - id actualValue = values.userIndex; - VerifyOrReturn(CheckValueNull("UserIndex", actualValue)); - } - - { - id actualValue = values.creatorFabricIndex; - VerifyOrReturn(CheckValueNull("CreatorFabricIndex", actualValue)); - } - - { - id actualValue = values.lastModifiedFabricIndex; - VerifyOrReturn(CheckValueNull("LastModifiedFabricIndex", actualValue)); - } + [cluster clearCredentialWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"Clean the created credential Error: %@", err); - { - id actualValue = values.nextCredentialIndex; - VerifyOrReturn(CheckValueNull("NextCredentialIndex", actualValue)); - } + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } @@ -163283,6 +167633,14 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -163301,6 +167659,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -163448,6 +167807,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), From c1581aa27cd46d985949f16bd839e7d8ef522902 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Tue, 20 Jun 2023 15:16:53 -0400 Subject: [PATCH 11/36] Reformatting README.me --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6c66045ce4cce3..814eb02d4f1532 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,13 @@ [![Builds](https://github.com/project-chip/connectedhomeip/workflows/Builds/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/build.yaml) -**Examples:** +**Builds** + +[![Android](https://github.com/project-chip/connectedhomeip/workflows/Android/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/android.yaml) [![Ameba](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Ameba/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-ameba.yaml) [![ASR](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20ASR/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-asr.yaml) [![BouffaloLab](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20BouffaloLab/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-bouffalolab.yaml) +[![Darwin](https://github.com/project-chip/connectedhomeip/workflows/Darwin/badge.svg)](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/darwin.yaml) [![TI CC26X2X7](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC26X2X7/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc13x2x7_26x2x7.yaml) [![TI CC32XX](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20TI%20CC32XX/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-cc32xx.yaml) [![EFR32](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20EFR32/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-efr32.yaml) @@ -24,19 +27,19 @@ [![Telink](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Telink/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-telink.yaml) [![Tizen](https://github.com/project-chip/connectedhomeip/workflows/Build%20example%20-%20Tizen/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/examples-tizen.yaml) -**Platforms:** -[![Android](https://github.com/project-chip/connectedhomeip/workflows/Android/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/android.yaml) -[![Darwin](https://github.com/project-chip/connectedhomeip/workflows/Darwin/badge.svg)](https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/darwin.yaml) +**Tests** + -**Tests:** [![Unit / Integration Tests](https://github.com/project-chip/connectedhomeip/workflows/Unit%20/%20Integration%20Tests/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/unit_integration_test.yaml) [![Cirque](https://github.com/project-chip/connectedhomeip/workflows/Cirque/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/cirque.yaml) [![QEMU](https://github.com/project-chip/connectedhomeip/workflows/QEMU/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/qemu.yaml) -**Tools:** +**Tools** + [![ZAP Templates](https://github.com/project-chip/connectedhomeip/workflows/ZAP/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/zap_templates.yaml) -**Documentation:** +**Documentation** + [![Documentation Build](https://github.com/project-chip/connectedhomeip/actions/workflows/docbuild.yaml/badge.svg)](https://github.com/project-chip/connectedhomeip/actions/workflows/docbuild.yaml) - [Matter SDK documentation page](https://project-chip.github.io/connectedhomeip-doc/index.html) From d7407b225fb572bec8bf9387108f17cb6013f1fe Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 20 Jun 2023 16:29:54 -0400 Subject: [PATCH 12/36] Fix the minLength/maxLength constraint checks on Darwin for nullables. (#27355) This is the darwin-framework-tool equivalent of https://github.com/project-chip/connectedhomeip/pull/27312 Also fixes a similar issue for minValue/maxValue. --- .../commands/tests/TestCommandBridge.h | 50 +++++++++++++++---- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h index 445758958fd169..b3d08ecf051774 100644 --- a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h +++ b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h @@ -396,25 +396,37 @@ class TestCommandBridge : public CHIPCommandBridge, using ConstraintsChecker::CheckConstraintMinLength; - bool CheckConstraintMinLength(const char * _Nonnull itemName, NSString * _Nonnull current, uint64_t expected) + bool CheckConstraintMinLength(const char * _Nonnull itemName, NSString * _Nullable current, uint64_t expected) { + if (current == nil) { + return true; + } return CheckConstraintMinLength(itemName, [current length], expected); } - bool CheckConstraintMinLength(const char * _Nonnull itemName, NSArray * _Nonnull current, uint64_t expected) + bool CheckConstraintMinLength(const char * _Nonnull itemName, NSArray * _Nullable current, uint64_t expected) { + if (current == nil) { + return true; + } return CheckConstraintMinLength(itemName, [current count], expected); } using ConstraintsChecker::CheckConstraintMaxLength; - bool CheckConstraintMaxLength(const char * _Nonnull itemName, NSString * _Nonnull current, uint64_t expected) + bool CheckConstraintMaxLength(const char * _Nonnull itemName, NSString * _Nullable current, uint64_t expected) { + if (current == nil) { + return true; + } return CheckConstraintMaxLength(itemName, [current length], expected); } - bool CheckConstraintMaxLength(const char * _Nonnull itemName, NSArray * _Nonnull current, uint64_t expected) + bool CheckConstraintMaxLength(const char * _Nonnull itemName, NSArray * _Nullable current, uint64_t expected) { + if (current == nil) { + return true; + } return CheckConstraintMaxLength(itemName, [current count], expected); } @@ -423,20 +435,29 @@ class TestCommandBridge : public CHIPCommandBridge, // Used when the minValue is a saved variable, since ConstraintsChecker does // not expect Core Foundation types. template ::value && std::is_signed::value, int> = 0> - bool CheckConstraintMinValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) + bool CheckConstraintMinValue(const char * _Nonnull itemName, T current, const NSNumber * _Nullable expected) { + if (expected == nil) { + return true; + } return ConstraintsChecker::CheckConstraintMinValue(itemName, current, [expected longLongValue]); } template ::value && !std::is_signed::value, int> = 0> - bool CheckConstraintMinValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) + bool CheckConstraintMinValue(const char * _Nonnull itemName, T current, const NSNumber * _Nullable expected) { + if (expected == nil) { + return true; + } return ConstraintsChecker::CheckConstraintMinValue(itemName, current, [expected unsignedLongLongValue]); } template ::value, int> = 0> - bool CheckConstraintMinValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) + bool CheckConstraintMinValue(const char * _Nonnull itemName, T current, const NSNumber * _Nullable expected) { + if (expected == nil) { + return true; + } return ConstraintsChecker::CheckConstraintMinValue(itemName, current, [expected doubleValue]); } @@ -445,20 +466,29 @@ class TestCommandBridge : public CHIPCommandBridge, // Used when the maxValue is a saved variable, since ConstraintsChecker does // not expect Core Foundation types. template ::value && std::is_signed::value, int> = 0> - bool CheckConstraintMaxValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) + bool CheckConstraintMaxValue(const char * _Nonnull itemName, T current, const NSNumber * _Nullable expected) { + if (expected == nil) { + return true; + } return ConstraintsChecker::CheckConstraintMaxValue(itemName, current, [expected longLongValue]); } template ::value && !std::is_signed::value, int> = 0> - bool CheckConstraintMaxValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) + bool CheckConstraintMaxValue(const char * _Nonnull itemName, T current, const NSNumber * _Nullable expected) { + if (expected == nil) { + return true; + } return ConstraintsChecker::CheckConstraintMaxValue(itemName, current, [expected unsignedLongLongValue]); } template ::value, int> = 0> - bool CheckConstraintMaxValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) + bool CheckConstraintMaxValue(const char * _Nonnull itemName, T current, const NSNumber * _Nullable expected) { + if (expected == nil) { + return true; + } return ConstraintsChecker::CheckConstraintMaxValue(itemName, current, [expected doubleValue]); } From 9344aa382e891afa0482c7b3a39ced07fb32ffcb Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Wed, 21 Jun 2023 00:16:42 -0400 Subject: [PATCH 13/36] Updating Wretry, and adding Wretry to build cache (#27356) --- .github/workflows/bloat_check.yaml | 2 +- .github/workflows/build.yaml | 100 +++++++++++------- .github/workflows/chef.yaml | 60 ++++++----- .github/workflows/cirque.yaml | 2 +- .github/workflows/darwin-tests.yaml | 20 ++-- .github/workflows/darwin.yaml | 20 ++-- .github/workflows/docker_img.yaml | 2 +- .github/workflows/examples-ameba.yaml | 20 ++-- .github/workflows/examples-asr.yaml | 20 ++-- .github/workflows/examples-bouffalolab.yaml | 2 +- .../workflows/examples-cc13x2x7_26x2x7.yaml | 20 ++-- .github/workflows/examples-cc32xx.yaml | 20 ++-- .github/workflows/examples-efr32.yaml | 2 +- .github/workflows/examples-esp32.yaml | 40 ++++--- .github/workflows/examples-infineon.yaml | 20 ++-- .github/workflows/examples-k32w.yaml | 20 ++-- .github/workflows/examples-linux-arm.yaml | 20 ++-- .github/workflows/examples-linux-imx.yaml | 20 ++-- .../workflows/examples-linux-standalone.yaml | 20 ++-- .github/workflows/examples-mbed.yaml | 20 ++-- .github/workflows/examples-mw320.yaml | 20 ++-- .github/workflows/examples-nrfconnect.yaml | 20 ++-- .github/workflows/examples-openiotsdk.yaml | 20 ++-- .github/workflows/examples-qpg.yaml | 20 ++-- .github/workflows/examples-telink.yaml | 20 ++-- .github/workflows/examples-tizen.yaml | 20 ++-- .github/workflows/fixit_rotation.yaml | 2 +- .github/workflows/full-android.yaml | 20 ++-- .github/workflows/fuzzing-build.yaml | 40 ++++--- .github/workflows/java-tests.yaml | 18 ++-- .github/workflows/lint.yml | 20 ++-- .github/workflows/qemu.yaml | 40 ++++--- .github/workflows/release_artifacts.yaml | 40 ++++--- .github/workflows/smoketest-android.yaml | 20 ++-- .github/workflows/smoketest-darwin.yaml | 20 ++-- .github/workflows/spell.yml | 4 +- .github/workflows/tests.yaml | 76 +++++++------ .github/workflows/todos.yaml | 2 +- .github/workflows/unit_integration_test.yaml | 2 +- .github/workflows/zap_regeneration.yaml | 20 ++-- .github/workflows/zap_templates.yaml | 20 ++-- examples/chef/README.md | 2 +- .../docker/images/chip-build/Dockerfile | 98 ++++++++--------- 43 files changed, 597 insertions(+), 417 deletions(-) diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index f68127b364711d..814403ff3a0d3c 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -36,7 +36,7 @@ jobs: image: connectedhomeip/chip-build:0.7.3 steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1d3f78f13539bc..95c51a8668785b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -53,7 +53,7 @@ jobs: env: CONCURRENCY_CONTEXT: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} run: echo "$CONCURRENCY_CONTEXT" - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -69,14 +69,18 @@ jobs: mkdir /tmp/cores || true sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh @@ -165,7 +169,7 @@ jobs: env: CONCURRENCY_CONTEXT: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} run: echo "$CONCURRENCY_CONTEXT" - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -186,14 +190,18 @@ jobs: mkdir /tmp/cores || true sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh @@ -337,7 +345,7 @@ jobs: env: CONCURRENCY_CONTEXT: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} run: echo "$CONCURRENCY_CONTEXT" - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -348,14 +356,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh @@ -388,7 +400,7 @@ jobs: if: github.actor != 'restyled-io[bot]' steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -407,14 +419,18 @@ jobs: run: | mkdir -p ~/Library/Logs/DiagnosticReports || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh @@ -496,7 +512,7 @@ jobs: net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -507,14 +523,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index 54e29b684e06cd..431c4a2094548e 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -39,7 +39,7 @@ jobs: options: --user root steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -49,14 +49,18 @@ jobs: attempt_delay: 2000 - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh @@ -75,7 +79,7 @@ jobs: options: --user root steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -85,14 +89,18 @@ jobs: attempt_delay: 2000 - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform esp32 - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh @@ -111,7 +119,7 @@ jobs: options: --user root steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -121,14 +129,18 @@ jobs: attempt_delay: 2000 - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform nrfconnect - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 65acf7398b3f57..5a05c8a1675162 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -54,7 +54,7 @@ jobs: # options: "--privileged" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 83edf05a47b82a..ec37ef972e3404 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -47,7 +47,7 @@ jobs: runs-on: macos-latest steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -68,14 +68,18 @@ jobs: mkdir -p ~/Library/Logs/DiagnosticReports || true mkdir objdir-clone || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index 51b8261e1fbb87..feffe54443535d 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -38,7 +38,7 @@ jobs: runs-on: macos-latest steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -51,14 +51,18 @@ jobs: - name: Setup Environment run: brew install python@3.9 - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/docker_img.yaml b/.github/workflows/docker_img.yaml index 776a9539579585..02df12d569d98f 100644 --- a/.github/workflows/docker_img.yaml +++ b/.github/workflows/docker_img.yaml @@ -59,7 +59,7 @@ jobs: # NOTE: vscode image consumes ~52 GB disk space but GitHub-hosted runners provide ~10 GB free disk space(https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources) #- "-vscode" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 245141b6faa359..3ae69f827eb5f2 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -42,7 +42,7 @@ jobs: options: --user root steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -52,14 +52,18 @@ jobs: attempt_delay: 2000 - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform ameba - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap run: bash scripts/bootstrap.sh - name: Build example Ameba All Clusters App diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index f0f72503534e58..74bd7a68fbbfa6 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -40,7 +40,7 @@ jobs: options: --user root steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -50,14 +50,18 @@ jobs: attempt_delay: 2000 - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform asr - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap run: bash scripts/bootstrap.sh - name: Build all ASR582X examples diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 580e3f5caffa21..06aa13a49bf8f5 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -42,7 +42,7 @@ jobs: volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 diff --git a/.github/workflows/examples-cc13x2x7_26x2x7.yaml b/.github/workflows/examples-cc13x2x7_26x2x7.yaml index 7f34d31ebe61e9..32392f09d53109 100644 --- a/.github/workflows/examples-cc13x2x7_26x2x7.yaml +++ b/.github/workflows/examples-cc13x2x7_26x2x7.yaml @@ -46,7 +46,7 @@ jobs: volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -62,14 +62,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index 4a941e17cb0aa5..a0faa39ca0802e 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -44,7 +44,7 @@ jobs: volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -60,14 +60,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index daf30304cd70ae..b1185a3ca29e48 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -45,7 +45,7 @@ jobs: volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index a448cd81d5553a..fef46bc9d12af0 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -42,7 +42,7 @@ jobs: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -59,14 +59,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh @@ -167,7 +171,7 @@ jobs: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -178,14 +182,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform esp32 - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index 27105ffc7a6407..4c8e50253c93fa 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -42,7 +42,7 @@ jobs: volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -59,14 +59,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml index 935b9a837dc22b..da9d09174bde5c 100644 --- a/.github/workflows/examples-k32w.yaml +++ b/.github/workflows/examples-k32w.yaml @@ -44,7 +44,7 @@ jobs: volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -61,14 +61,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index 2c6133227a4c36..b240d10a645cbe 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -42,7 +42,7 @@ jobs: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -59,14 +59,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 4b5bf670c463ea..1c0756692b4574 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -40,7 +40,7 @@ jobs: image: connectedhomeip/chip-build-imx:0.7.3 steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -51,14 +51,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index fd954ad63bb499..61c6b55e13b027 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -42,7 +42,7 @@ jobs: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -59,14 +59,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index 3d330fcd4cd848..2c8b4b95069543 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -48,7 +48,7 @@ jobs: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -75,14 +75,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 15a429e7bd087f..91e5b7a2b1c92c 100755 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -44,7 +44,7 @@ jobs: volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -61,14 +61,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 9b248461e5deeb..255aed2a97bc36 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -45,7 +45,7 @@ jobs: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -74,14 +74,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 74dcb2f1206848..2c373d457dfe20 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -47,7 +47,7 @@ jobs: options: --privileged steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -64,14 +64,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index 1be72db151799a..03af8dc153c044 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -44,7 +44,7 @@ jobs: volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -61,14 +61,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 3faeacb75057e1..b3c19c6791ef5b 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -43,7 +43,7 @@ jobs: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -60,14 +60,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 2931bd1ea4c001..23bfc59f4186d6 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -43,7 +43,7 @@ jobs: - "/tmp/output_binaries:/tmp/output_binaries" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -54,14 +54,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform tizen - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap run: bash scripts/bootstrap.sh diff --git a/.github/workflows/fixit_rotation.yaml b/.github/workflows/fixit_rotation.yaml index c7ffed5302fae3..dbf61582962a9d 100644 --- a/.github/workflows/fixit_rotation.yaml +++ b/.github/workflows/fixit_rotation.yaml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index adff0f36bad483..d187928969eb39 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -44,7 +44,7 @@ jobs: - "/tmp/log_output:/tmp/test_logs" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 if: ${{ !env.ACT }} name: Checkout with: @@ -65,14 +65,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform android - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 0441c68285f02a..270b48db6eddcd 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -41,7 +41,7 @@ jobs: - "/tmp/log_output:/tmp/test_logs" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -56,14 +56,18 @@ jobs: run: | mkdir objdir-clone || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh @@ -101,7 +105,7 @@ jobs: if: github.actor != 'restyled-io[bot]' steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -116,14 +120,18 @@ jobs: run: | mkdir objdir-clone || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index a2414e68d588b2..66564dbe449295 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -59,14 +59,18 @@ jobs: sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true mkdir objdir-clone || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4acf3be4de4d3b..cac9dce5481981 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,7 +36,7 @@ jobs: image: connectedhomeip/chip-build:0.6.47 steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 if: ${{ !env.ACT }} name: Checkout with: @@ -59,14 +59,18 @@ jobs: # to run - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index bb18146c47e0bc..ebbdeea2def32d 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -46,7 +46,7 @@ jobs: - "/tmp/log_output:/tmp/test_logs" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -57,14 +57,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform esp32 - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh @@ -110,7 +114,7 @@ jobs: - "/tmp/log_output:/tmp/test_logs" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -121,14 +125,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform tizen - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index e7fa612e92f1b4..a1edb67841efb4 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -37,7 +37,7 @@ jobs: image: connectedhomeip/chip-build-esp32:0.7.3 steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -48,14 +48,18 @@ jobs: attempt_delay: 2000 ref: "${{ github.event.inputs.releaseTag }}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh @@ -92,7 +96,7 @@ jobs: container: image: connectedhomeip/chip-build-efr32:0.7.3 steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -103,14 +107,18 @@ jobs: attempt_delay: 2000 ref: "${{ github.event.inputs.releaseTag }}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index bd4361e6667d65..ae1c79e392b310 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -45,7 +45,7 @@ jobs: - "/tmp/log_output:/tmp/test_logs" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -56,14 +56,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform android - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/smoketest-darwin.yaml b/.github/workflows/smoketest-darwin.yaml index 0c6409f8bfdd42..069d68b08b047c 100644 --- a/.github/workflows/smoketest-darwin.yaml +++ b/.github/workflows/smoketest-darwin.yaml @@ -38,7 +38,7 @@ jobs: runs-on: macos-latest steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -51,14 +51,18 @@ jobs: - name: Setup Environment run: brew install python@3.9 - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/spell.yml b/.github/workflows/spell.yml index 3de0afa566469d..80bd1ea666514c 100644 --- a/.github/workflows/spell.yml +++ b/.github/workflows/spell.yml @@ -29,7 +29,7 @@ jobs: name: Check Spelling - reviewdog runs-on: ubuntu-latest steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -44,7 +44,7 @@ jobs: name: Check Spelling - pyspelling runs-on: ubuntu-latest steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 2160399601c92d..a6168b684631b8 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -55,7 +55,7 @@ jobs: net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 if: ${{ !env.ACT }} name: Checkout with: @@ -82,14 +82,18 @@ jobs: sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true mkdir objdir-clone || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh @@ -331,7 +335,7 @@ jobs: runs-on: macos-latest steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -352,14 +356,18 @@ jobs: mkdir -p ~/Library/Logs/DiagnosticReports || true mkdir objdir-clone || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh @@ -475,14 +483,18 @@ jobs: sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true mkdir objdir-clone || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh @@ -568,14 +580,18 @@ jobs: mkdir -p ~/Library/Logs/DiagnosticReports || true mkdir objdir-clone || true - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/todos.yaml b/.github/workflows/todos.yaml index f7e82d5f217eca..2ef92eac1e87f7 100644 --- a/.github/workflows/todos.yaml +++ b/.github/workflows/todos.yaml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index 9a22f6bc0d6d71..98a486916692d1 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -44,7 +44,7 @@ jobs: options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index ce173fce271490..9de3f3fe6e749e 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -52,14 +52,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 9970300975771d..073cd422e2bb92 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3.5.2 @@ -53,14 +53,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 10 run: bash scripts/bootstrap.sh diff --git a/examples/chef/README.md b/examples/chef/README.md index da87ca307f847f..0b842b4a0377de 100644 --- a/examples/chef/README.md +++ b/examples/chef/README.md @@ -137,7 +137,7 @@ chef_$PLATFORM: options: --user root steps: - - uses: Wandalen/wretry.action@v1.0.36 + - uses: Wandalen/wretry.action@v1.0.41 name: Checkout with: action: actions/checkout@v3 diff --git a/integrations/docker/images/chip-build/Dockerfile b/integrations/docker/images/chip-build/Dockerfile index 64550e8aeb12bd..d92e9efb385636 100644 --- a/integrations/docker/images/chip-build/Dockerfile +++ b/integrations/docker/images/chip-build/Dockerfile @@ -7,22 +7,22 @@ ARG TARGETPLATFORM # Ensure TARGETPLATFORM is set RUN case ${TARGETPLATFORM} in \ - "linux/amd64") \ - echo "Building for linux/amd64" \ - ;; \ - "linux/arm64") \ - echo "Building for linux/arm64" \ - ;; \ - *) \ - if [ -z "$TARGETPLATFORM" ] ;\ - then \ - echo "TARGETPLATFORM not defined! Please run from buildkit (buildx)." \ - && return 1 ;\ - else \ - echo "Unsupported platform ${TARGETPLATFORM}." \ - && return 1 ;\ - fi \ - ;; \ + "linux/amd64") \ + echo "Building for linux/amd64" \ + ;; \ + "linux/arm64") \ + echo "Building for linux/arm64" \ + ;; \ + *) \ + if [ -z "$TARGETPLATFORM" ] ;\ + then \ + echo "TARGETPLATFORM not defined! Please run from buildkit (buildx)." \ + && return 1 ;\ + else \ + echo "Unsupported platform ${TARGETPLATFORM}." \ + && return 1 ;\ + fi \ + ;; \ esac @@ -100,13 +100,13 @@ RUN set -x \ # Cmake v3.23.1 ENV CMAKE_PLATFORM_VERSION= RUN case ${TARGETPLATFORM} in \ - "linux/amd64") CMAKE_PLATFORM_VERSION="x86_64";; \ - "linux/arm64") CMAKE_PLATFORM_VERSION="aarch64";; \ - *) \ - test -n "$TARGETPLATFORM" \ - echo "Unsupported platform ${TARGETPLATFORM}" \ - && return 1 ;\ - ;; \ + "linux/amd64") CMAKE_PLATFORM_VERSION="x86_64";; \ + "linux/arm64") CMAKE_PLATFORM_VERSION="aarch64";; \ + *) \ + test -n "$TARGETPLATFORM" \ + echo "Unsupported platform ${TARGETPLATFORM}" \ + && return 1 ;\ + ;; \ esac \ && set -x \ && (cd /tmp \ @@ -199,43 +199,43 @@ RUN set -x \ # a lot of threads-related APIs. ENV LD_LIBRARY_PATH_TSAN=/usr/lib/x86_64-linux-gnu-tsan RUN case ${TARGETPLATFORM} in \ - "linux/amd64") \ - set -x \ - && mkdir -p $LD_LIBRARY_PATH_TSAN \ - && export CCACHE_DISABLE=1 PYTHONDONTWRITEBYTECODE=1 \ - && GLIB_VERSION=$(pkg-config --modversion glib-2.0) \ - && git clone --depth=1 --branch=$GLIB_VERSION https://github.com/GNOME/glib.git \ - && CFLAGS="-O2 -g -fsanitize=thread" meson glib/build glib \ - && DESTDIR=../build-image ninja -C glib/build install \ - && mv glib/build-image/usr/local/lib/x86_64-linux-gnu/lib* $LD_LIBRARY_PATH_TSAN \ - && rm -rf glib \ - ;; \ - "linux/arm64") \ - echo "ARM64 unsupported with TSAN" \ - ;; \ - *) \ - echo "Unsupported platform ${TARGETPLATFORM}" \ - && return 1 ;\ - ;; \ + "linux/amd64") \ + set -x \ + && mkdir -p $LD_LIBRARY_PATH_TSAN \ + && export CCACHE_DISABLE=1 PYTHONDONTWRITEBYTECODE=1 \ + && GLIB_VERSION=$(pkg-config --modversion glib-2.0) \ + && git clone --depth=1 --branch=$GLIB_VERSION https://github.com/GNOME/glib.git \ + && CFLAGS="-O2 -g -fsanitize=thread" meson glib/build glib \ + && DESTDIR=../build-image ninja -C glib/build install \ + && mv glib/build-image/usr/local/lib/x86_64-linux-gnu/lib* $LD_LIBRARY_PATH_TSAN \ + && rm -rf glib \ + ;; \ + "linux/arm64") \ + echo "ARM64 unsupported with TSAN" \ + ;; \ + *) \ + echo "Unsupported platform ${TARGETPLATFORM}" \ + && return 1 ;\ + ;; \ esac # NodeJS: install a newer version than what apt-get would read # This installs the latest LTS version of nodejs # -# NodeJS is required by github actions, we use Wandalen/wretry.action@v1.0.36 +# NodeJS is required by github actions, we use Wandalen/wretry.action@v1.0.41 # and that seems to use the built-in node installation in the image # # This is not a CHIP dependency directly, but used by CI ENV CHIP_NODE_VERSION=v16.13.2 ENV NODE_PLATFORM_VERSION= RUN case ${TARGETPLATFORM} in \ - "linux/amd64") NODE_PLATFORM_VERSION=x64;; \ - "linux/arm64") NODE_PLATFORM_VERSION=arm64;; \ - *) \ - test -n "$TARGETPLATFORM" \ - echo "Unsupported platform ${TARGETPLATFORM}" \ - && return 1 ;\ - ;; \ + "linux/amd64") NODE_PLATFORM_VERSION=x64;; \ + "linux/arm64") NODE_PLATFORM_VERSION=arm64;; \ + *) \ + test -n "$TARGETPLATFORM" \ + echo "Unsupported platform ${TARGETPLATFORM}" \ + && return 1 ;\ + ;; \ esac \ && set -x \ && mkdir node_js \ From 874830c52a42d3c8450f6f114dcf80529b7f65b2 Mon Sep 17 00:00:00 2001 From: poyamini <108741504+poyamini@users.noreply.github.com> Date: Wed, 21 Jun 2023 10:53:45 +0530 Subject: [PATCH 14/36] [Silabs] Adds support for WPA3 transition mode for 917/916 NCP (#27334) * WPA3 transition support * WPA3 transition mode support * wpa3 transition name changes * Restyled by clang-format * adding the wpa3 transition support for 917 ncp * Restyled by whitespace * Restyled by clang-format * wpa3 transition name changes * wpa3 transition personal * removing wpa3 transition personal * changing comments --------- Co-authored-by: Restyled.io --- examples/platform/silabs/SiWx917/BUILD.gn | 6 ++--- .../platform/silabs/SiWx917/SiWx917/rsi_if.c | 18 ++++++++----- examples/platform/silabs/efr32/BUILD.gn | 7 +++--- .../platform/silabs/efr32/rs911x/rsi_if.c | 25 +++++++++++-------- .../silabs/efr32/rs911x/rsi_wlan_config.h | 18 ++++++------- scripts/examples/gn_silabs_example.sh | 4 +-- .../silabs/efr32/wifi/wfx_host_events.h | 2 +- 7 files changed, 44 insertions(+), 36 deletions(-) diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index beefb835d64172..2d8ec861663b3a 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -33,7 +33,7 @@ declare_args() { sl_wfx_config_scan = true # Argument to force enable WPA3 security on rs91x - rs91x_wpa3_only = false + rs91x_wpa3_transition = false # use commissionable data for SiWx917 siwx917_commissionable_data = false @@ -219,8 +219,8 @@ config("silabs-wifi-config") { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] } - if (rs91x_wpa3_only) { - defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] + if (rs91x_wpa3_transition) { + defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ] } } diff --git a/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c b/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c index 9dc57d81636733..6f9afa54e23f8b 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c +++ b/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c @@ -355,11 +355,11 @@ static void wfx_rsi_save_ap_info() /* * Scan is done - failed */ -#if WIFI_ENABLE_SECURITY_WPA3 +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION wfx_rsi.sec.security = WFX_SEC_WPA3; -#else /* !WIFI_ENABLE_SECURITY_WPA3 */ +#else /* !WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ wfx_rsi.sec.security = WFX_SEC_WPA2; -#endif /* WIFI_ENABLE_SECURITY_WPA3 */ +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ SILABS_LOG("%s: warn: failed with status: %02x", __func__, status); return; } @@ -386,9 +386,13 @@ static void wfx_rsi_save_ap_info() case SME_WEP: wfx_rsi.sec.security = WFX_SEC_WEP; break; - case SME_WPA3: case SME_WPA3_TRANSITION: - wfx_rsi.sec.security = WFX_SEC_WPA3; +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION + case SME_WPA3: + wfx_rsi.sec.security = RSI_WPA3; +#else + wfx_rsi.sec.security = WFX_SEC_WPA2; +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ break; default: wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; @@ -425,9 +429,11 @@ static void wfx_rsi_do_join(void) case WFX_SEC_WPA2: connect_security_mode = RSI_WPA_WPA2_MIXED; break; +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION case WFX_SEC_WPA3: - connect_security_mode = RSI_WPA3; + connect_security_mode = RSI_WPA3_TRANSITION; break; +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANS */ case WFX_SEC_NONE: connect_security_mode = RSI_OPEN; break; diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index 860800e7fb8d68..4a7119dbc5398b 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -31,7 +31,7 @@ declare_args() { sl_wfx_config_scan = true # Argument to force enable WPA3 security on rs91x - rs91x_wpa3_only = false + rs91x_wpa3_transition = false #default WiFi SSID chip_default_wifi_ssid = "" @@ -254,10 +254,9 @@ config("silabs-wifi-config") { if (chip_enable_wifi_ipv4) { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] } - - if (rs91x_wpa3_only) { + if (rs91x_wpa3_transition) { # TODO: Change this macro once WF200 support is provided - defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] + defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ] } } diff --git a/examples/platform/silabs/efr32/rs911x/rsi_if.c b/examples/platform/silabs/efr32/rs911x/rsi_if.c index f29cf010a79e73..d0d5844448d618 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_if.c +++ b/examples/platform/silabs/efr32/rs911x/rsi_if.c @@ -420,20 +420,17 @@ static void wfx_rsi_save_ap_info() // translation /* * Scan is done - failed */ -#if WIFI_ENABLE_SECURITY_WPA3 +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION wfx_rsi.sec.security = WFX_SEC_WPA3; -#else /* !WIFI_ENABLE_SECURITY_WPA3 */ +#else /* !WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ wfx_rsi.sec.security = WFX_SEC_WPA2; -#endif /* WIFI_ENABLE_SECURITY_WPA3 */ +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ SILABS_LOG("%s: warn: failed with status: %02x", __func__, status); return; } - else - { - wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; - wfx_rsi.ap_chan = rsp.scan_info->rf_channel; - memcpy(&wfx_rsi.ap_mac.octet[0], &rsp.scan_info->bssid[0], BSSID_MAX_STR_LEN); - } + wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; + wfx_rsi.ap_chan = rsp.scan_info->rf_channel; + memcpy(&wfx_rsi.ap_mac.octet[0], &rsp.scan_info->bssid[0], BSSID_MAX_STR_LEN); switch (rsp.scan_info->security_mode) { @@ -451,9 +448,13 @@ static void wfx_rsi_save_ap_info() // translation case SME_WEP: wfx_rsi.sec.security = WFX_SEC_WEP; break; - case SME_WPA3: case SME_WPA3_TRANSITION: +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION + case SME_WPA3: wfx_rsi.sec.security = WFX_SEC_WPA3; +#else + wfx_rsi.sec.security = WFX_SEC_WPA2; +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ break; default: wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; @@ -492,9 +493,11 @@ static void wfx_rsi_do_join(void) case WFX_SEC_WPA2: connect_security_mode = RSI_WPA_WPA2_MIXED; break; +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION case WFX_SEC_WPA3: - connect_security_mode = RSI_WPA3; + connect_security_mode = RSI_WPA3_TRANSITION; break; +#endif // WIFI_ENABLE_SECURITY_WPA3_TRANSITION case WFX_SEC_NONE: connect_security_mode = RSI_OPEN; break; diff --git a/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h b/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h index 9fb927adc5631e..96bd71bb80539a 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h +++ b/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h @@ -41,20 +41,20 @@ #define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_BYPASS /*| TCP_IP_FEAT_EXTENSION_VALID*/) //! To set Extended custom feature select bit map -#if WIFI_ENABLE_SECURITY_WPA3 +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION #ifdef CHIP_9117 #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP \ - (EXT_FEAT_448K_M4SS_256K | EXT_FEAT_IEEE_80211W | EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE) -#else + (EXT_FEAT_448K_M4SS_256K | EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE | EXT_FEAT_IEEE_80211W) +#else /* !CHIP_9117 */ #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (EXT_FEAT_384K_MODE | EXT_FEAT_IEEE_80211W) #endif /* CHIP_9117 */ -#else +#else /* !WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ #ifdef CHIP_9117 #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (EXT_FEAT_448K_M4SS_256K | EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE) -#else +#else /* !CHIP_9117 */ #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP EXT_FEAT_384K_MODE #endif /* CHIP_9117 */ -#endif /* WIFI_ENABLE_SECURITY_WPA3 */ +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ //! To set Extended TCPIP feature select bit map #define RSI_EXT_TCPIP_FEATURE_BITMAP (/*EXT_FEAT_HTTP_OTAF_SUPPORT |*/ EXT_TCP_IP_SSL_16K_RECORD) @@ -242,11 +242,11 @@ #define RSI_POWER_LEVEL RSI_POWER_LEVEL_HIGH //! RSI_JOIN_FEAT_STA_BG_ONLY_MODE_ENABLE or RSI_JOIN_FEAT_LISTEN_INTERVAL_VALID -#if WIFI_ENABLE_SECURITY_WPA3 -#define RSI_JOIN_FEAT_BIT_MAP RSI_JOIN_FEAT_MFP_CAPABLE_REQUIRED +#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION +#define RSI_JOIN_FEAT_BIT_MAP RSI_JOIN_FEAT_MFP_CAPABLE_ONLY #else #define RSI_JOIN_FEAT_BIT_MAP 0 -#endif +#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANS */ #define RSI_LISTEN_INTERVAL 0 diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index 25d181efe26a7d..06f6ee57599c23 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -96,8 +96,8 @@ if [ "$#" == "0" ]; then Use to build the example with pigweed RPC ota_periodic_query_timeout_sec Periodic query timeout variable for OTA in seconds - rs91x_wpa3_only - Support for WPA3 only mode on RS91x + rs91x_wpa3_transition + Support for WPA3 transition mode on RS91x sl_matter_version Use provided software version at build time sl_matter_version_str diff --git a/src/platform/silabs/efr32/wifi/wfx_host_events.h b/src/platform/silabs/efr32/wifi/wfx_host_events.h index c0724b7237e808..3c9d12be5dff6e 100644 --- a/src/platform/silabs/efr32/wifi/wfx_host_events.h +++ b/src/platform/silabs/efr32/wifi/wfx_host_events.h @@ -239,7 +239,7 @@ typedef enum WFX_SEC_WEP = 2, WFX_SEC_WPA = 3, WFX_SEC_WPA2 = 4, - WFX_SEC_WPA3 = 5 + WFX_SEC_WPA3 = 5, } wfx_sec_t; typedef struct From 534b6d9b653652a79b17c4f9fad8987702ec92ed Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Wed, 21 Jun 2023 02:32:54 -0400 Subject: [PATCH 15/36] Removing dead stuff, and collapasing darwin (#27360) --- .github/workflows/darwin.yaml | 5 ++ .github/workflows/fixit_rotation.yaml | 36 ----------- .github/workflows/smoketest-darwin.yaml | 81 ------------------------- scripts/fixit_rotation.py | 41 ------------- 4 files changed, 5 insertions(+), 158 deletions(-) delete mode 100644 .github/workflows/fixit_rotation.yaml delete mode 100644 .github/workflows/smoketest-darwin.yaml delete mode 100755 scripts/fixit_rotation.py diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index feffe54443535d..0d47fd3f166941 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -166,6 +166,11 @@ jobs: # but to instrument the code in the underlying libCHIP we need to pass CHIP_IS_TSAN=YES xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableThreadSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion -Wno-incomplete-umbrella -Wno-unguarded-availability-new' CHIP_IS_TSAN=YES > >(tee /tmp/darwin/framework-tests/darwin-tests-tsan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-tsan-err.log >&2) working-directory: src/darwin/Framework + - name: Build Matter TV Casting Bridge + timeout-minutes: 20 + run: | + xcodebuild -target "MatterTvCastingBridge" -sdk iphoneos + working-directory: examples/tv-casting-app/darwin/MatterTvCastingBridge - name: Uploading log files uses: actions/upload-artifact@v3 if: ${{ failure() && !env.ACT }} diff --git a/.github/workflows/fixit_rotation.yaml b/.github/workflows/fixit_rotation.yaml deleted file mode 100644 index dbf61582962a9d..00000000000000 --- a/.github/workflows/fixit_rotation.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) 2021 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: Pick Fixit Rotation - -on: - workflow_dispatch: - -jobs: - shuffle_names: - name: Shuffle names - runs-on: ubuntu-latest - - steps: - - uses: Wandalen/wretry.action@v1.0.41 - name: Checkout - with: - action: actions/checkout@v3.5.2 - with: | - submodules: true - token: ${{ github.token }} - attempt_limit: 3 - attempt_delay: 2000 - - name: Pick fixit rotation order - run: scripts/fixit_rotation.py diff --git a/.github/workflows/smoketest-darwin.yaml b/.github/workflows/smoketest-darwin.yaml deleted file mode 100644 index 069d68b08b047c..00000000000000 --- a/.github/workflows/smoketest-darwin.yaml +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (c) 2023 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: Smoke Test - Darwin - -on: - push: - pull_request: - merge_group: - workflow_dispatch: - -concurrency: - group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} - cancel-in-progress: true - -env: - CHIP_NO_LOG_TIMESTAMPS: true - # XXX: Workaround for https://github.com/actions/cache/issues/1141 - SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3 - -jobs: - darwin: - name: Smoke Run - Darwin - timeout-minutes: 60 - - if: github.actor != 'restyled-io[bot]' - runs-on: macos-latest - - steps: - - uses: Wandalen/wretry.action@v1.0.41 - name: Checkout - with: - action: actions/checkout@v3.5.2 - with: | - token: ${{ github.token }} - attempt_limit: 3 - attempt_delay: 2000 - - name: Checkout submodules - run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform darwin - - name: Setup Environment - run: brew install python@3.9 - - - uses: Wandalen/wretry.action@v1.0.41 - name: Bootstrap cache - timeout-minutes: 20 - with: - action: buildjet/cache@v3 - attempt_limit: 3 - attempt_delay: 2000 - with: | - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni - - name: Bootstrap - timeout-minutes: 25 - run: bash scripts/bootstrap.sh - - name: Uploading bootstrap logs - uses: actions/upload-artifact@v3 - if: ${{ always() && !env.ACT }} - with: - name: bootstrap-logs - path: | - .environment/gn_out/.ninja_log - .environment/pigweed-venv/*.log - - name: Build Matter TV Casting Bridge - timeout-minutes: 45 - run: | - xcodebuild -target "MatterTvCastingBridge" -sdk iphoneos - working-directory: examples/tv-casting-app/darwin/MatterTvCastingBridge diff --git a/scripts/fixit_rotation.py b/scripts/fixit_rotation.py deleted file mode 100755 index ed47ce3479693e..00000000000000 --- a/scripts/fixit_rotation.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -import random - -ROTATION_CHOICES = [ - 'Andrei (Google)', - 'Boris (Apple)', - 'Cecille (Google)', - 'Damian (Nordic)', - 'Etienne (Silabs)', - 'Junior (Silabs)', - 'Kamil (Nordic)', - 'Kevin (Google)', - # 'Martin (Google)', # TO be enabled July 2021 - 'Michael (Google)', - 'Mingjie (Google)', - 'Pankaj (Apple)', - 'Ricardo (Silabs)', - 'Rob (Google)', - 'Song (Google)', - 'Timothy (Qorvo)', - 'Victor (Samsung)', - 'Vivien (Apple)', - 'Yufeng (Google)', - 'Yunhan (Google)', -] - - -def main(): - """Main task if executed standalone.""" - print("Rolling dice....") - - results = ROTATION_CHOICES[:] - random.shuffle(results) - - print("Results: ") - for idx, name in enumerate(results): - print(" %2d: %s" % (idx + 1, name)) - - -if __name__ == "__main__": - main() From f79852db5bd28591504b4714c6dfc51180b4044e Mon Sep 17 00:00:00 2001 From: wyhong <30567533+wy-hh@users.noreply.github.com> Date: Wed, 21 Jun 2023 20:13:46 +0800 Subject: [PATCH 16/36] [Bouffalolab] Update Bouffalo Lab IOT SDK to 1.6.40-1278 (#27336) * update sdk to 1.6.40-1278 * fix restyle --- third_party/bouffalolab/bl602/bl_iot_sdk.gni | 2 ++ third_party/bouffalolab/bl702/bl_iot_sdk.gni | 2 ++ third_party/bouffalolab/repo | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/third_party/bouffalolab/bl602/bl_iot_sdk.gni b/third_party/bouffalolab/bl602/bl_iot_sdk.gni index b65371d55f88ac..cc7c075b01f769 100644 --- a/third_party/bouffalolab/bl602/bl_iot_sdk.gni +++ b/third_party/bouffalolab/bl602/bl_iot_sdk.gni @@ -856,6 +856,8 @@ template("bl_iot_sdk") { } source_set("${sdk_target_name}_lwip") { + include_dirs = [ "${bl_iot_sdk_root}/components/network/lwip_dhcpd" ] + sources = [ "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/ethernetif.c", "${bl_iot_sdk_root}/components/network/lwip/lwip-port/FreeRTOS/sys_arch.c", diff --git a/third_party/bouffalolab/bl702/bl_iot_sdk.gni b/third_party/bouffalolab/bl702/bl_iot_sdk.gni index 9783d77e6a732b..6d3bdcb825eb08 100644 --- a/third_party/bouffalolab/bl702/bl_iot_sdk.gni +++ b/third_party/bouffalolab/bl702/bl_iot_sdk.gni @@ -302,7 +302,9 @@ template("bl_iot_sdk") { "-Wno-stringop-overflow", "-Wno-format-truncation", "-Wno-shadow", + "-Wno-incompatible-pointer-types", ] + configs += [ ":${sdk_target_name}_config_soc", ":${sdk_target_name}_config_BSP_Driver", diff --git a/third_party/bouffalolab/repo b/third_party/bouffalolab/repo index 125a1237081749..31489e4c11dbe3 160000 --- a/third_party/bouffalolab/repo +++ b/third_party/bouffalolab/repo @@ -1 +1 @@ -Subproject commit 125a1237081749d5cc3ab5c1dc2017465960bba4 +Subproject commit 31489e4c11dbe341f7a38792efc6d7a95d1d48ea From f915236fc5b2243f2ebe5a16f7f604e1b89e1a22 Mon Sep 17 00:00:00 2001 From: Erwin Pan Date: Wed, 21 Jun 2023 20:33:50 +0800 Subject: [PATCH 17/36] Fix Chef build broken on nRFConnect(vscode docker) (#27317) Chef build broken on nRFConnect on dokcer image connectedhomeip/chip-build-vscode:0.7.16 The root cause is lacking of env `ZEPHYR_SDK_INSTALL_DIR` --- integrations/docker/images/chip-build-vscode/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/integrations/docker/images/chip-build-vscode/Dockerfile b/integrations/docker/images/chip-build-vscode/Dockerfile index 173ff4cef917b8..2420af69895577 100644 --- a/integrations/docker/images/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/chip-build-vscode/Dockerfile @@ -110,6 +110,7 @@ ENV TELINK_ZEPHYR_BASE=/opt/telink/zephyrproject/zephyr ENV TELINK_ZEPHYR_SDK_DIR=/opt/telink/zephyr-sdk-0.15.2 ENV TI_SYSCONFIG_ROOT=/opt/ti/sysconfig_1.13.0 ENV ZEPHYR_BASE=/opt/NordicSemiconductor/nrfconnect/zephyr +ENV ZEPHYR_SDK_INSTALL_DIR=/opt/NordicSemiconductor/nRF5_tools/zephyr-sdk-0.16.0 ENV ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb ENV TIZEN_VERSION 7.0 From 834663dafb46313aadff4a25486ee67f0c257e5e Mon Sep 17 00:00:00 2001 From: Artur Tynecki <77382963+ATmobica@users.noreply.github.com> Date: Wed, 21 Jun 2023 14:50:38 +0200 Subject: [PATCH 18/36] [OIS] Add PSA crypto backend support (#26994) This commit allows the selection of PSA as the cryptographic algorithm used when building Matter CryptoPAL with the Open IoT SDK. The GitHub CI workflow for the SDK examples/unit tests has been updated to add a matrix test setup which builds and runs the examples with both mbedtls and psa cryptographic algorithms. Add call to psa_crypto_init() The Matter PSA implementation still uses some underlying MbedTLS functions (including random number generation). To use these functions however a call to psa_crypto_init() is required. Extend Matter Python builder with crypto backend options. Enable ECP optimization. Signed-off-by: Anna Bridge --- .github/.wordlist.txt | 1 + .github/workflows/examples-openiotsdk.yaml | 11 ++-- .vscode/tasks.json | 9 ++++ config/openiotsdk/CMakeLists.txt | 1 + config/openiotsdk/chip-gn/args.gni | 1 - config/openiotsdk/cmake/chip.cmake | 11 +++- config/openiotsdk/cmake/sdk.cmake | 35 +++++++------ config/openiotsdk/lwip/user_lwipopts.h | 5 ++ config/openiotsdk/mbedtls/mbedtls_config.h | 6 +-- .../openiotsdk/mbedtls/mbedtls_config_psa.h | 6 +++ docs/guides/openiotsdk_examples.md | 52 ++++++++++++++++--- .../openiotsdk/app/openiotsdk_platform.cpp | 13 +++++ scripts/build/BUILD.gn | 4 +- scripts/build/build/targets.py | 6 ++- scripts/build/builders/openiotsdk.py | 20 ++++++- scripts/build/test.py | 4 +- .../build/testdata/all_targets_linux_x64.txt | 2 +- .../dry_run_openiotsdk-lock-mbedtls.txt | 8 +++ .../testdata/dry_run_openiotsdk-lock.txt | 8 --- .../dry_run_openiotsdk-shell-mbedtls.txt | 8 +++ .../testdata/dry_run_openiotsdk-shell.txt | 8 --- scripts/examples/openiotsdk_example.sh | 21 +++++++- 22 files changed, 183 insertions(+), 57 deletions(-) create mode 100644 config/openiotsdk/mbedtls/mbedtls_config_psa.h create mode 100644 scripts/build/testdata/dry_run_openiotsdk-lock-mbedtls.txt delete mode 100644 scripts/build/testdata/dry_run_openiotsdk-lock.txt create mode 100644 scripts/build/testdata/dry_run_openiotsdk-shell-mbedtls.txt delete mode 100644 scripts/build/testdata/dry_run_openiotsdk-shell.txt diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 04179cb874c403..ef5aa8fb290737 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -1071,6 +1071,7 @@ ProxyDiscovery ProxyValid ProxyView PRs +PSA PSCAN PSECT PSK diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 2c373d457dfe20..d706b8dbab9273 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -31,6 +31,11 @@ env: jobs: openiotsdk: + strategy: + fail-fast: false + matrix: + cryptoBackend: ["psa", "mbedtls"] + name: Open IoT SDK examples building timeout-minutes: 90 @@ -89,7 +94,7 @@ jobs: id: build_shell timeout-minutes: 10 run: | - scripts/examples/openiotsdk_example.sh shell + scripts/examples/openiotsdk_example.sh -b ${{ matrix.cryptoBackend }} shell .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ openiotsdk release shell \ examples/shell/openiotsdk/build/chip-openiotsdk-shell-example.elf \ @@ -99,7 +104,7 @@ jobs: id: build_lock_app timeout-minutes: 10 run: | - scripts/examples/openiotsdk_example.sh lock-app + scripts/examples/openiotsdk_example.sh -b ${{ matrix.cryptoBackend }} lock-app .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ openiotsdk release lock-app \ examples/lock-app/openiotsdk/build/chip-openiotsdk-lock-app-example.elf \ @@ -109,7 +114,7 @@ jobs: id: build_unit_tests timeout-minutes: 10 run: | - scripts/examples/openiotsdk_example.sh unit-tests + scripts/examples/openiotsdk_example.sh -b ${{ matrix.cryptoBackend }} unit-tests - name: "Test: shell example" if: steps.build_shell.outcome == 'success' diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 8516b5b12f2e5c..bb0c8ba01853ea 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -251,6 +251,7 @@ "-Cbuild", "-d${input:openiotsdkDebugMode}", "-l${input:openiotsdkLwipDebug}", + "-b${input:openiotsdkCryptoBackend}", "${input:openiotsdkExample}" ], "group": "build", @@ -271,6 +272,7 @@ "-Cbuild", "-d${input:openiotsdkDebugMode}", "-l${input:openiotsdkLwipDebug}", + "-b${input:openiotsdkCryptoBackend}", "unit-tests" ], "group": "build", @@ -480,6 +482,13 @@ "options": ["false", "true"], "default": "false" }, + { + "type": "pickString", + "id": "openiotsdkCryptoBackend", + "description": "Which Crypto algorithm do you wish to use?", + "options": ["mbedtls", "psa"], + "default": "mbedtls" + }, { "type": "command", "id": "openiotsdkExample", diff --git a/config/openiotsdk/CMakeLists.txt b/config/openiotsdk/CMakeLists.txt index 7f559587a88a66..43f9fca7b5dd9a 100644 --- a/config/openiotsdk/CMakeLists.txt +++ b/config/openiotsdk/CMakeLists.txt @@ -62,6 +62,7 @@ matter_add_gn_arg_bool ("chip_automation_logging" CONFIG_CHIP_AUTO matter_add_gn_arg_bool ("chip_error_logging" CONFIG_CHIP_ERROR_LOGGING) matter_add_gn_arg_bool ("chip_openiotsdk_use_tfm" TFM_SUPPORT) matter_add_gn_arg_bool ("chip_openiotsdk_use_psa_ps" CONFIG_CHIP_OPEN_IOT_SDK_USE_PSA_PS) +matter_add_gn_arg_string("chip_crypto" "${CONFIG_CHIP_CRYPTO}") if (TARGET cmsis-rtos-api) matter_add_gn_arg_string("target_os" "cmsis-rtos") endif() diff --git a/config/openiotsdk/chip-gn/args.gni b/config/openiotsdk/chip-gn/args.gni index fd9edf986f8ee7..12ffb66b844957 100644 --- a/config/openiotsdk/chip-gn/args.gni +++ b/config/openiotsdk/chip-gn/args.gni @@ -31,7 +31,6 @@ chip_system_config_use_lwip = true lwip_platform = "external" chip_system_config_use_sockets = false -chip_crypto = "mbedtls" chip_external_mbedtls = true custom_toolchain = "${chip_root}/config/openiotsdk/chip-gn/toolchain:openiotsdk" diff --git a/config/openiotsdk/cmake/chip.cmake b/config/openiotsdk/cmake/chip.cmake index bdef5870433d23..6e1a78bcb8debf 100644 --- a/config/openiotsdk/cmake/chip.cmake +++ b/config/openiotsdk/cmake/chip.cmake @@ -21,7 +21,7 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) -# Default CHIP build configuration +# Default CHIP build configuration set(CONFIG_CHIP_PROJECT_CONFIG "main/include/CHIPProjectConfig.h" CACHE STRING "") set(CONFIG_CHIP_LIB_TESTS NO CACHE BOOL "") set(CONFIG_CHIP_LIB_SHELL NO CACHE BOOL "") @@ -32,6 +32,7 @@ set(CONFIG_CHIP_AUTOMATION_LOGGING YES CACHE BOOL "Enable logging at automation set(CONFIG_CHIP_ERROR_LOGGING YES CACHE BOOL "Enable logging at error level") set(CONFIG_CHIP_OPEN_IOT_SDK_USE_PSA_PS NO CACHE BOOL "Enable using PSA Protected Storage") +set(CONFIG_CHIP_CRYPTO "mbedtls" CACHE STRING "Matter crypto backend. Mbedtls as default") if(CONFIG_CHIP_OPEN_IOT_SDK_USE_PSA_PS AND NOT TFM_SUPPORT) message( FATAL_ERROR "You can not use PSA Protected Storage without TF-M support" ) @@ -53,8 +54,14 @@ if(TFM_SUPPORT) add_dependencies(chip-gn tfm-ns-interface) endif() +if ("${CONFIG_CHIP_CRYPTO}" STREQUAL "psa") + target_compile_definitions(chip + INTERFACE + CONFIG_CHIP_CRYPTO_PSA) +endif() + function(chip_add_data_model target scope model_name) - target_include_directories(${target} + target_include_directories(${target} PUBLIC ${GEN_DIR}/app-common ${GEN_DIR}/${model_name}-app diff --git a/config/openiotsdk/cmake/sdk.cmake b/config/openiotsdk/cmake/sdk.cmake index 61cd704a030041..6f391bd235033f 100644 --- a/config/openiotsdk/cmake/sdk.cmake +++ b/config/openiotsdk/cmake/sdk.cmake @@ -27,7 +27,7 @@ get_filename_component(OPEN_IOT_SDK_STORAGE_SOURCE ${CHIP_ROOT}/third_party/open # Open IoT SDK targets passed to CHIP build list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS) -# Additional Open IoT SDK build configuration +# Additional Open IoT SDK build configuration set(TFM_SUPPORT NO CACHE BOOL "Add Trusted Firmware-M (TF-M) support to application") set(TFM_NS_APP_VERSION "0.0.0" CACHE STRING "TF-M non-secure application version (in the x.x.x format)") set(CONFIG_CHIP_OPEN_IOT_SDK_LWIP_DEBUG NO CACHE BOOL "Enable LwIP debug logs") @@ -82,7 +82,7 @@ if(TFM_SUPPORT) set(TFM_PLATFORM ${OPEN_IOT_SDK_EXAMPLE_COMMON}/tf-m/targets/an552) set(TFM_PSA_FIRMWARE_UPDATE ON) set(MCUBOOT_IMAGE_VERSION_NS ${TFM_NS_APP_VERSION}) - set(TFM_CMAKE_ARGS "-DCONFIG_TFM_ENABLE_FP=ON;-DTFM_PROFILE=profile_medium;-DTFM_EXCEPTION_INFO_DUMP=ON;-DCONFIG_TFM_HALT_ON_CORE_PANIC=ON;-DTFM_ISOLATION_LEVEL=1") + set(TFM_CMAKE_ARGS "-DCONFIG_TFM_ENABLE_FP=ON;-DTFM_PROFILE=profile_medium;-DTFM_EXCEPTION_INFO_DUMP=ON;-DCONFIG_TFM_HALT_ON_CORE_PANIC=ON;-DTFM_ISOLATION_LEVEL=1;-DTFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH=${OPEN_IOT_SDK_CONFIG}/mbedtls/mbedtls_config_psa.h;-DMBEDCRYPTO_BUILD_TYPE=${CMAKE_BUILD_TYPE};-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set(TFM_CMAKE_ARGS "${TFM_CMAKE_ARGS};-DMCUBOOT_LOG_LEVEL=INFO;-DTFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_DEBUG;-DTFM_PARTITION_LOG_LEVEL=TFM_PARTITION_LOG_LEVEL_INFO") else() @@ -117,24 +117,24 @@ endif() # Add RTOS configuration headers # Link cmsis-rtos-api against a concrete implementation if(TARGET cmsis-rtos-api) - target_include_directories(cmsis-core - INTERFACE + target_include_directories(cmsis-core + INTERFACE cmsis-config ) - + target_compile_definitions(cmsis-rtos-api PUBLIC DOMAIN_NS=$,1,0> ) if(TARGET freertos-kernel) - target_include_directories(freertos-kernel - PUBLIC + target_include_directories(freertos-kernel + PUBLIC freertos-config ) - target_link_libraries(freertos-kernel - PUBLIC + target_link_libraries(freertos-kernel + PUBLIC cmsis-core ) @@ -250,14 +250,6 @@ if("cmsis-freertos" IN_LIST IOTSDK_FETCH_LIST) ) endif() -if("mbedtls" IN_LIST IOTSDK_FETCH_LIST) - list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS - mbedtls - mbedtls-config - mbedtls-threading-cmsis-rtos - ) -endif() - if("lwip" IN_LIST IOTSDK_FETCH_LIST) list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS lwipcore @@ -282,6 +274,15 @@ if("trusted-firmware-m" IN_LIST IOTSDK_FETCH_LIST) ) endif() +# Note: Mbed TLS must appear after TF-M otherwise psa from mbed TLS is used +if("mbedtls" IN_LIST IOTSDK_FETCH_LIST) + list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS + mbedtls + mbedtls-config + mbedtls-threading-cmsis-rtos + ) +endif() + # Additional Open IoT SDK port components # Add Open IoT SDK storage source diff --git a/config/openiotsdk/lwip/user_lwipopts.h b/config/openiotsdk/lwip/user_lwipopts.h index 48d8d4aee81b21..1e02add588ca4c 100644 --- a/config/openiotsdk/lwip/user_lwipopts.h +++ b/config/openiotsdk/lwip/user_lwipopts.h @@ -49,6 +49,11 @@ */ #define LWIP_RAW (1) +/** + * Disable DHCP as the IP6 link local address can be used. + */ +#define LWIP_DHCP 0 + #ifdef LWIP_DEBUG // Debug Options diff --git a/config/openiotsdk/mbedtls/mbedtls_config.h b/config/openiotsdk/mbedtls/mbedtls_config.h index 316d43c67940d0..b5927a06b63383 100644 --- a/config/openiotsdk/mbedtls/mbedtls_config.h +++ b/config/openiotsdk/mbedtls/mbedtls_config.h @@ -2692,7 +2692,7 @@ * or MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG. * */ -#define MBEDTLS_PSA_CRYPTO_C +//#define MBEDTLS_PSA_CRYPTO_C /** * \def MBEDTLS_PSA_CRYPTO_SE_C @@ -3313,8 +3313,8 @@ //#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ /* ECP options */ -//#define MBEDTLS_ECP_WINDOW_SIZE 4 /**< Maximum window size used */ -//#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */ +#define MBEDTLS_ECP_WINDOW_SIZE 6 /**< Maximum window size used */ +#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */ /* Entropy options */ //#define MBEDTLS_ENTROPY_MAX_SOURCES 20 /**< Maximum number of sources supported */ diff --git a/config/openiotsdk/mbedtls/mbedtls_config_psa.h b/config/openiotsdk/mbedtls/mbedtls_config_psa.h new file mode 100644 index 00000000000000..c7241ba53228a5 --- /dev/null +++ b/config/openiotsdk/mbedtls/mbedtls_config_psa.h @@ -0,0 +1,6 @@ + +#define MBEDTLS_SHA1_C +#define PSA_WANT_ALG_SHA_1 +#define MBEDTLS_ECP_WINDOW_SIZE 6 /**< Maximum window size used */ +#undef MBEDTLS_ECP_FIXED_POINT_OPTIM +#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */ diff --git a/docs/guides/openiotsdk_examples.md b/docs/guides/openiotsdk_examples.md index 2de1915f3ecf43..add3313e1ae521 100644 --- a/docs/guides/openiotsdk_examples.md +++ b/docs/guides/openiotsdk_examples.md @@ -374,6 +374,42 @@ For `TF-M` protected storage use: [Open IoT SDK build script](../../scripts/examples/openiotsdk_example.sh) provides the `-K,--kvsfile` option to use the persistence options listed above. +### Crypto backend + +Open IoT SDK port supports two crypto backend implementations: + +- [Mbed TLS](../guides/openiotsdk_platform_overview.md#mbed-tls) - it's the + default option +- [PSA crypto service](https://tf-m-user-guide.trustedfirmware.org/integration_guide/services/tfm_crypto_integration_guide.html) + from the + [TrustedFirmware-M (TF-M)](../guides/openiotsdk_platform_overview.md#trusted-firmware-m) + component + +The CMake variable `CONFIG_CHIP_CRYPTO` controls how cryptographic operations +are implemented in Matter. It accepts two values: + +- `mbedtls`: use Mbed TLS for crypto operations. +- `psa`: use + [PSA Cryptography API](https://armmbed.github.io/mbed-crypto/html/) for + crypto operations. + +This variable can be set in the main application `CMakeLists.txt`: + +``` +set(CONFIG_CHIP_CRYPTO ) +``` + +The variable can also be defined with CMake CLI: + +``` +cmake -G <...> -DCONFIG_CHIP_CRYPTO= <...> +``` + +> 💡 **Notes**: +> +> The `TF-M PSA crypto` option requires enabling [TF-M](#trusted-firmware-m) +> support. + ## Building You can build examples using the dedicated VSCode task or by calling directly @@ -386,6 +422,7 @@ the build script from the command line. - Select `Build Open IoT SDK example` - Decide on debug mode support - Decide on LwIP debug logs support +- Choose crypto algorithm - Choose example name This will call the script with the selected parameters. @@ -568,12 +605,12 @@ telnet> close ## Specific examples -### Build lock-app example and run it in the network namespace +### Build lock-app example with PSA crypto backend support and run it in the network namespace **Using CLI** ``` -${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh lock-app +${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh -b psa lock-app export TEST_NETWORK_NAME=OIStest @@ -593,6 +630,7 @@ Build example: - Select `Build Open IoT SDK example` - Deny debug mode support `false` - Deny LwIP debug logs support `false` +- Choose crypto algorithm `psa` - Choose example name `lock-app` Setup network environment: @@ -614,12 +652,12 @@ Run example: The example output should be seen in the terminal window. -### Build lock-app example and execute its test in the network namespace +### Build lock-app example with mbedtls crypto backend support and execute its test in the network namespace **Using CLI** ``` -${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh lock-app +${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh -b mbedtls lock-app export TEST_NETWORK_NAME=OIStest @@ -639,6 +677,7 @@ Build example: - Select `Build Open IoT SDK example` - Deny debug mode support `false` - Deny LwIP debug logs support `false` +- Choose crypto algorithm `mbedtls` - Choose example name `lock-app` Setup network environment: @@ -658,7 +697,7 @@ Test example: - Enter network interface `OIStesttap` - Choose example name `lock-app` -### Build lock-app example in debug mode and debug it in the network namespace using the VSCode task +### Build lock-app example with mbedtls crypto backend support in debug mode and debug it in the network namespace using the VSCode task Build example: @@ -667,6 +706,7 @@ Build example: - Select `Build Open IoT SDK example` - Confirm debug mode support `true` - Deny LwIP debug logs support `false` +- Choose crypto algorithm `mbedtls` - Choose example name `lock-app` Setup network environment: @@ -757,7 +797,7 @@ Example: id: build_new_example timeout-minutes: 10 run: | - scripts/examples/openiotsdk_example.sh new-example + scripts/examples/openiotsdk_example.sh -b ${{ matrix.cryptoBackend }} new-example .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ openiotsdk release new-example \ examples/new-example/openiotsdk/build/chip-openiotsdk-new-example-example.elf \ diff --git a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp index 28b6da91f5c176..dff6a15e21cb93 100644 --- a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp +++ b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp @@ -27,6 +27,10 @@ #include "iotsdk/ip_network_api.h" #include "mbedtls/platform.h" +#ifdef CONFIG_CHIP_CRYPTO_PSA +#include "psa/crypto.h" +#endif + #include #include #include @@ -179,6 +183,15 @@ int openiotsdk_platform_init(void) return EXIT_FAILURE; } +#ifdef CONFIG_CHIP_CRYPTO_PSA + ret = psa_crypto_init(); + if (ret) + { + ChipLogError(NotSpecified, "PSA crypto initialization failed: %d", ret); + return EXIT_FAILURE; + } +#endif + #ifdef TFM_SUPPORT ret = get_psa_images_details(); if (ret != 0) diff --git a/scripts/build/BUILD.gn b/scripts/build/BUILD.gn index 11ea4e9b721e84..0e716ae7e9b390 100644 --- a/scripts/build/BUILD.gn +++ b/scripts/build/BUILD.gn @@ -31,8 +31,8 @@ pw_python_package("build_examples") { "testdata/dry_run_linux-arm64-ota-requestor-nodeps-ipv6only.txt", "testdata/dry_run_linux-x64-all-clusters-coverage.txt", "testdata/dry_run_nrf-nrf52840dk-pump.txt", - "testdata/dry_run_openiotsdk-lock.txt", - "testdata/dry_run_openiotsdk-shell.txt", + "testdata/dry_run_openiotsdk-lock-mbedtls.txt", + "testdata/dry_run_openiotsdk-shell-mbedtls.txt", ] sources = [ diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 279191e45d1bf9..43eed69236dcdf 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -28,7 +28,7 @@ from builders.mbed import MbedApp, MbedBoard, MbedBuilder, MbedProfile from builders.mw320 import MW320App, MW320Builder from builders.nrf import NrfApp, NrfBoard, NrfConnectBuilder -from builders.openiotsdk import OpenIotSdkApp, OpenIotSdkBuilder +from builders.openiotsdk import OpenIotSdkApp, OpenIotSdkBuilder, OpenIotSdkCryptoBackend from builders.qpg import QpgApp, QpgBoard, QpgBuilder from builders.telink import TelinkApp, TelinkBoard, TelinkBuilder from builders.ti import TIApp, TIBoard, TIBuilder @@ -679,6 +679,10 @@ def BuildOpenIotSdkTargets(): TargetPart('lock', app=OpenIotSdkApp.LOCK), ]) + # Modifiers + target.AppendModifier('mbedtls', crypto=OpenIotSdkCryptoBackend.MBEDTLS).ExceptIfRe('-(psa)') + target.AppendModifier('psa', crypto=OpenIotSdkCryptoBackend.PSA).ExceptIfRe('-(mbedtls)') + return target diff --git a/scripts/build/builders/openiotsdk.py b/scripts/build/builders/openiotsdk.py index 7f3cd682d86ba3..89aad6a59e9a16 100644 --- a/scripts/build/builders/openiotsdk.py +++ b/scripts/build/builders/openiotsdk.py @@ -42,13 +42,29 @@ def AppNamePrefix(self): raise Exception('Unknown app type: %r' % self) +class OpenIotSdkCryptoBackend(Enum): + PSA = auto() + MBEDTLS = auto() + + @property + def CryptoBackendName(self): + if self == OpenIotSdkCryptoBackend.PSA: + return 'psa' + elif self == OpenIotSdkCryptoBackend.MBEDTLS: + return 'mbedtls' + else: + raise Exception('Unknown crypto backend type: %r' % self) + + class OpenIotSdkBuilder(Builder): def __init__(self, root, runner, - app: OpenIotSdkApp = OpenIotSdkApp.SHELL): + app: OpenIotSdkApp = OpenIotSdkApp.SHELL, + crypto: OpenIotSdkCryptoBackend = OpenIotSdkCryptoBackend.MBEDTLS): super(OpenIotSdkBuilder, self).__init__(root, runner) self.app = app + self.crypto = crypto self.toolchain_path = os.path.join( 'toolchains', 'toolchain-arm-none-eabi-gcc.cmake') self.system_processor = 'cortex-m55' @@ -65,6 +81,8 @@ def generate(self): '-DCMAKE_SYSTEM_PROCESSOR={}'.format( self.system_processor), '-DCMAKE_BUILD_TYPE=Release', + '-DCONFIG_CHIP_CRYPTO={}'.format( + self.crypto.CryptoBackendName), ], title='Generating ' + self.identifier) def _build(self): diff --git a/scripts/build/test.py b/scripts/build/test.py index 70fca73f082f7b..c89a4d98109357 100644 --- a/scripts/build/test.py +++ b/scripts/build/test.py @@ -109,8 +109,8 @@ def test_general_dry_runs(self): 'android-arm64-chip-tool', 'nrf-nrf52840dk-pump', 'efr32-brd4161a-light-rpc-no-version', - 'openiotsdk-lock', - 'openiotsdk-shell' + 'openiotsdk-lock-mbedtls', + 'openiotsdk-shell-mbedtls' ] for target in TARGETS: diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 1b8c95d4c51c7d..5ef536ac1bbfdf 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -22,4 +22,4 @@ nrf-native-posix-64-tests qpg-qpg6105-{lock,light,shell,persistent-storage} tizen-arm-{all-clusters,all-clusters-minimal,chip-tool,light,tests}[-no-ble][-no-thread][-no-wifi][-asan][-ubsan] telink-tlsr9518adk80d-{all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,temperature-measurement,thermostat,window-covering}[-shell][-rpc][-factory-data] -openiotsdk-{shell,lock} +openiotsdk-{shell,lock}[-mbedtls][-psa] diff --git a/scripts/build/testdata/dry_run_openiotsdk-lock-mbedtls.txt b/scripts/build/testdata/dry_run_openiotsdk-lock-mbedtls.txt new file mode 100644 index 00000000000000..77816cf664190c --- /dev/null +++ b/scripts/build/testdata/dry_run_openiotsdk-lock-mbedtls.txt @@ -0,0 +1,8 @@ +# Commands will be run in CHIP project root. +cd "{root}" + +# Generating openiotsdk-lock-mbedtls +cmake -GNinja -S {root}/examples/lock-app/openiotsdk -B {out}/openiotsdk-lock-mbedtls --toolchain=toolchains/toolchain-arm-none-eabi-gcc.cmake -DCMAKE_SYSTEM_PROCESSOR=cortex-m55 -DCMAKE_BUILD_TYPE=Release -DCONFIG_CHIP_CRYPTO=mbedtls + +# Building openiotsdk-lock-mbedtls +cmake --build {out}/openiotsdk-lock-mbedtls diff --git a/scripts/build/testdata/dry_run_openiotsdk-lock.txt b/scripts/build/testdata/dry_run_openiotsdk-lock.txt deleted file mode 100644 index a0c36ee27f53ad..00000000000000 --- a/scripts/build/testdata/dry_run_openiotsdk-lock.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Commands will be run in CHIP project root. -cd "{root}" - -# Generating openiotsdk-lock -cmake -GNinja -S {root}/examples/lock-app/openiotsdk -B {out}/openiotsdk-lock --toolchain=toolchains/toolchain-arm-none-eabi-gcc.cmake -DCMAKE_SYSTEM_PROCESSOR=cortex-m55 -DCMAKE_BUILD_TYPE=Release - -# Building openiotsdk-lock -cmake --build {out}/openiotsdk-lock diff --git a/scripts/build/testdata/dry_run_openiotsdk-shell-mbedtls.txt b/scripts/build/testdata/dry_run_openiotsdk-shell-mbedtls.txt new file mode 100644 index 00000000000000..70438c5fe091bd --- /dev/null +++ b/scripts/build/testdata/dry_run_openiotsdk-shell-mbedtls.txt @@ -0,0 +1,8 @@ +# Commands will be run in CHIP project root. +cd "{root}" + +# Generating openiotsdk-shell-mbedtls +cmake -GNinja -S {root}/examples/shell/openiotsdk -B {out}/openiotsdk-shell-mbedtls --toolchain=toolchains/toolchain-arm-none-eabi-gcc.cmake -DCMAKE_SYSTEM_PROCESSOR=cortex-m55 -DCMAKE_BUILD_TYPE=Release -DCONFIG_CHIP_CRYPTO=mbedtls + +# Building openiotsdk-shell-mbedtls +cmake --build {out}/openiotsdk-shell-mbedtls diff --git a/scripts/build/testdata/dry_run_openiotsdk-shell.txt b/scripts/build/testdata/dry_run_openiotsdk-shell.txt deleted file mode 100644 index 6c7c63befb4e7a..00000000000000 --- a/scripts/build/testdata/dry_run_openiotsdk-shell.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Commands will be run in CHIP project root. -cd "{root}" - -# Generating openiotsdk-shell -cmake -GNinja -S {root}/examples/shell/openiotsdk -B {out}/openiotsdk-shell --toolchain=toolchains/toolchain-arm-none-eabi-gcc.cmake -DCMAKE_SYSTEM_PROCESSOR=cortex-m55 -DCMAKE_BUILD_TYPE=Release - -# Building openiotsdk-shell -cmake --build {out}/openiotsdk-shell diff --git a/scripts/examples/openiotsdk_example.sh b/scripts/examples/openiotsdk_example.sh index 6b19a8be7f04e7..1f3dcd1d8d11f1 100755 --- a/scripts/examples/openiotsdk_example.sh +++ b/scripts/examples/openiotsdk_example.sh @@ -43,6 +43,7 @@ IS_UNIT_TEST=0 FVP_NETWORK="user" KVS_STORAGE_TYPE="tdb" KVS_STORAGE_FILE="" +CRYPTO_BACKEND="mbedtls" declare -A tdb_storage_param=([instance]=sram [memspace]=0 [address]=0x0 [size]=0x100000) declare -A ps_storage_param=([instance]=qspi_sram [memspace]=0 [address]=0x660000 [size]=0x12000) @@ -66,6 +67,7 @@ Options: -d,--debug Build in debug mode -l,--lwipdebug Build with LwIP debug logs support -k,--kvsstore Select KVS storage type + -b,--backend -p,--path Build path -K,--kvsfile Path to KVS storage file which will be used to ensure persistence -n,--network FVP network interface name @@ -134,6 +136,8 @@ function build_with_cmake() { BUILD_OPTIONS+=(-DCONFIG_CHIP_OPEN_IOT_SDK_USE_PSA_PS=YES) fi + BUILD_OPTIONS+=(-DCONFIG_CHIP_CRYPTO="$CRYPTO_BACKEND") + cmake -G Ninja -S "$EXAMPLE_PATH" -B "$BUILD_PATH" --toolchain="$TOOLCHAIN_PATH" "${BUILD_OPTIONS[@]}" cmake --build "$BUILD_PATH" } @@ -268,8 +272,8 @@ function run_test() { fi } -SHORT=C:,p:,d:,l:,n:,k:,K:,c,s,h -LONG=command:,path:,debug:,lwipdebug:,network:,kvsstore:,kvsfile:,clean,scratch,help +SHORT=C:,p:,d:,l:,b:,n:,k:,K:,c,s,h +LONG=command:,path:,debug:,lwipdebug:,backend:,network:,kvsstore:,kvsfile:,clean,scratch,help OPTS=$(getopt -n build --options "$SHORT" --longoptions "$LONG" -- "$@") eval set -- "$OPTS" @@ -308,6 +312,10 @@ while :; do KVS_STORAGE_FILE=$2 shift 2 ;; + -b | --backend) + CRYPTO_BACKEND=$2 + shift 2 + ;; -p | --path) BUILD_PATH=$CHIP_ROOT/$2 shift 2 @@ -380,6 +388,15 @@ case "$KVS_STORAGE_TYPE" in ;; esac +case "$CRYPTO_BACKEND" in + psa | mbedtls) ;; + *) + echo "Wrong crypto type definition" + show_usage + exit 2 + ;; +esac + TOOLCHAIN_PATH="toolchains/toolchain-$TOOLCHAIN.cmake" if [ -z "$BUILD_PATH" ]; then From cc013a2c22b9a4c60c7e9b4b52b2cf8e3d145535 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 21 Jun 2023 09:33:16 -0400 Subject: [PATCH 19/36] Docker version update (#27383) * Docker version update * Undo submodule change --- integrations/docker/images/chip-build/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index 359ad5d0ec6c19..ac763ad69843b3 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.7.17 Version bump reason: Enable ARM64 build +0.7.18 Version bump reason: vscode ZEPHYR SDK env path update From ca91f2417e0332a2c5323c7ab4ab7ba2c6fc1070 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Wed, 21 Jun 2023 09:34:14 -0400 Subject: [PATCH 20/36] Adding docker label --- .github/labeler.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index 635acae0dbef2b..1062287b335043 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -44,6 +44,10 @@ integrations: - integrations/* - integrations/**/* +docker: + - integrations/docker/* + - integrations/docker/**/* + vscode: - .vscode/* - .vscode/**/* From d740355ed1c54589cd5c3aa63f2bce0560124b1e Mon Sep 17 00:00:00 2001 From: wyhong <30567533+wy-hh@users.noreply.github.com> Date: Wed, 21 Jun 2023 21:37:27 +0800 Subject: [PATCH 21/36] [Bouffalolab] Generate Bouffalolab format OTA image after compile done. (#27337) * generate bouffalolab format ota image after compile done * fix spell * fix restyle --- examples/lighting-app/bouffalolab/README.md | 25 +++++++++++++-------- scripts/build/builders/bouffalolab.py | 24 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/examples/lighting-app/bouffalolab/README.md b/examples/lighting-app/bouffalolab/README.md index 7e42d3bcc45b0a..3ce3cb46c98305 100644 --- a/examples/lighting-app/bouffalolab/README.md +++ b/examples/lighting-app/bouffalolab/README.md @@ -261,16 +261,23 @@ After successful commissioning, cluster commands available to control the board. Please take [guide](../../ota-provider-app/linux/README.md) for more detail on ota-provider-app build and usage. -### Create the Matter OTA with Bouffalolab OTA bin `FW_OTA.bin.xz.hash` +### Create the Matter OTA image with Bouffalolab OTA `bin.xz.hash` format image -- Build `Bouffalo Lab` OTA image as following execution using python script - `*.flash.py` under firmware build out folder, - ```shell - ./.flash.py --build - ``` - After script executed, a folder `ota_images` and an image - `FW_OTA.bin.xz.hash` will be generated. `FW_OTA.bin.xz.hash` is compressed - with hash verification for build out firmware. +- `Bouffalo Lab` OTA `bin.xz.hash` format image + + - Build `Bouffalo Lab` OTA image as following execution using python + script `*.flash.py` under firmware build out folder, + `shell ./.flash.py --build` After script executed, + a folder `ota_images` and an image `FW_OTA.bin.xz.hash` will be + generated. `FW_OTA.bin.xz.hash` is compressed with hash verification for + build out firmware. + + - `bin.xz.hash` image + + After compile done, the build script will call + `.flash.py` to generate `Bouffalo Lab` OTA format + image as above, and put it under out folder with name likes + `.bin.xz.hash` * Build Matter `*.ota` OTA image with `Bouffalo Lab` OTA image under **connectedhomeip** repo folder diff --git a/scripts/build/builders/bouffalolab.py b/scripts/build/builders/bouffalolab.py index 9646803828df72..cf4f09158fdbe7 100644 --- a/scripts/build/builders/bouffalolab.py +++ b/scripts/build/builders/bouffalolab.py @@ -141,3 +141,27 @@ def build_outputs(self): } return items + + def PostBuildCommand(self): + + # Generate Bouffalo Lab format OTA image for development purpose. + + ota_images_folder_path = self.output_dir + "/ota_images" + ota_images_dev_image = self.output_dir + "/" + self.app.AppNamePrefix(self.chip_name) + ".bin.xz.hash" + ota_images_image = self.output_dir + "/ota_images/FW_OTA.bin.xz.hash" + ota_images_firmware = self.output_dir + "/" + self.app.AppNamePrefix(self.chip_name) + ".bin" + + ota_images_flash_tool = self.output_dir + "/" + self.app.AppNamePrefix(self.chip_name) + ".flash.py" + + os.system("rm -rf " + ota_images_folder_path) + os.system("rm -rf " + ota_images_dev_image) + + if not os.path.isfile(ota_images_firmware): + return + + os.system("python " + ota_images_flash_tool + " --build") + + if not os.path.isfile(ota_images_image): + return + + os.system("cp " + ota_images_image + " " + ota_images_dev_image) From 45d946a0b3e3c63f061261630c2a4cbb8b6e5a2e Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Wed, 21 Jun 2023 19:56:17 +0530 Subject: [PATCH 22/36] [ESP32] Set the country code in esp_phy layer (#27365) * [ESP32] Set the country code in esp_phy layer * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/platform/ESP32/ConfigurationManagerImpl.cpp | 12 ++++++++++++ src/platform/ESP32/ConfigurationManagerImpl.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/platform/ESP32/ConfigurationManagerImpl.cpp b/src/platform/ESP32/ConfigurationManagerImpl.cpp index 889ccb8abdb776..8b4cb05e55e735 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.cpp +++ b/src/platform/ESP32/ConfigurationManagerImpl.cpp @@ -32,6 +32,7 @@ #include #include "esp_ota_ops.h" +#include "esp_phy_init.h" #include "esp_wifi.h" #include "nvs.h" #include "nvs_flash.h" @@ -236,6 +237,17 @@ CHIP_ERROR ConfigurationManagerImpl::GetLocationCapability(uint8_t & location) #endif } +CHIP_ERROR ConfigurationManagerImpl::StoreCountryCode(const char * code, size_t codeLen) +{ + // As per spec, codeLen has to be 2 + VerifyOrReturnError((code != nullptr) && (codeLen == 2), CHIP_ERROR_INVALID_ARGUMENT); + // Write CountryCode to esp_phy layer + ReturnErrorOnFailure(MapConfigError(esp_phy_update_country_info(code))); + // As we do not have API to read country code from esp_phy layer, we are writing to NVS and when client reads the + // CountryCode then we read from NVS + return GenericConfigurationManagerImpl::StoreCountryCode(code, codeLen); +} + CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf) { #if CHIP_DEVICE_CONFIG_ENABLE_WIFI diff --git a/src/platform/ESP32/ConfigurationManagerImpl.h b/src/platform/ESP32/ConfigurationManagerImpl.h index 7d86ebc8e51ca4..fce74d9307b823 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.h +++ b/src/platform/ESP32/ConfigurationManagerImpl.h @@ -58,6 +58,10 @@ class ConfigurationManagerImpl : public Internal::GenericConfigurationManagerImp CHIP_ERROR GetLocationCapability(uint8_t & location) override; static ConfigurationManagerImpl & GetDefaultInstance(); + // Set the country code to esp_phy layer and also store it to NVS + // GenericConfigurationManagerImpl::GetCountryCode() API already reads from the NVS so its not implemented here + CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen) override; + private: // ===== Members that implement the ConfigurationManager public interface. From 079f16d39f07e6bbeb1d69126e00123052b5a279 Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Wed, 21 Jun 2023 17:48:03 +0300 Subject: [PATCH 23/36] [Telink] Add RPC for ligt-switch app (#27381) --- .../light-switch-app/telink/CMakeLists.txt | 154 ++++++++++++++++++ examples/light-switch-app/telink/rpc.overlay | 47 ++++++ .../lighting-app/telink/include/AppTask.h | 18 -- examples/lighting-app/telink/src/AppTask.cpp | 26 --- .../telink/common/include/AppTaskCommon.h | 19 +++ .../telink/common/src/AppTaskCommon.cpp | 26 +++ 6 files changed, 246 insertions(+), 44 deletions(-) create mode 100644 examples/light-switch-app/telink/rpc.overlay diff --git a/examples/light-switch-app/telink/CMakeLists.txt b/examples/light-switch-app/telink/CMakeLists.txt index c7339e9f81b623..18a5f83ac1ebbf 100755 --- a/examples/light-switch-app/telink/CMakeLists.txt +++ b/examples/light-switch-app/telink/CMakeLists.txt @@ -86,3 +86,157 @@ chip_configure_data_model(app if(CONFIG_CHIP_OTA_REQUESTOR) target_sources(app PRIVATE ${TELINK_COMMON}/util/src/OTAUtil.cpp) endif() + +# Fix for unused swap parameter in: zephyr/include/zephyr/arch/riscv/irq.h:70 +add_compile_options(-Wno-error=unused-parameter) + +if (CONFIG_CHIP_PW_RPC) + +# Make all targets created below depend on zephyr_interface to inherit MCU-related compilation flags +link_libraries($) + +set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo") +include(${PIGWEED_ROOT}/pw_build/pigweed.cmake) +include(${PIGWEED_ROOT}/pw_protobuf_compiler/proto.cmake) + +include($ENV{PW_ROOT}/pw_assert/backend.cmake) +include($ENV{PW_ROOT}/pw_log/backend.cmake) +include($ENV{PW_ROOT}/pw_sys_io/backend.cmake) + +pw_set_module_config(pw_rpc_CONFIG pw_rpc.disable_global_mutex_config) +pw_set_backend(pw_log pw_log_basic) +pw_set_backend(pw_assert.check pw_assert_log.check_backend) +pw_set_backend(pw_assert.assert pw_assert.assert_compatibility_backend) +pw_set_backend(pw_sys_io pw_sys_io.telink) + +set(dir_pw_third_party_nanopb "${CHIP_ROOT}/third_party/nanopb/repo" CACHE STRING "" FORCE) + +add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo) +add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo) +add_subdirectory(third_party/connectedhomeip/examples/platform/telink/pw_sys_io) + +pw_proto_library(attributes_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.options + PREFIX + attributes_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(button_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/button_service.proto + PREFIX + button_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(descriptor_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/descriptor_service.proto + PREFIX + descriptor_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(device_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.options + PREFIX + device_service + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(lighting_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/lighting_service.proto + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + PREFIX + lighting_service + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(ot_cli_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/ot_cli_service.options + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + PREFIX + ot_cli_service + DEPS + pw_protobuf.common_proto +) + +pw_proto_library(thread_service + SOURCES + ${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.proto + INPUTS + ${CHIP_ROOT}/examples/common/pigweed/protos/thread_service.options + STRIP_PREFIX + ${CHIP_ROOT}/examples/common/pigweed/protos + PREFIX + thread_service + DEPS + pw_protobuf.common_proto +) + +target_sources(app PRIVATE + ../../common/pigweed/RpcService.cpp + ../../common/pigweed/telink/PigweedLoggerMutex.cpp + ${TELINK_COMMON}/Rpc.cpp + ${TELINK_COMMON}/util/src/PigweedLogger.cpp +) + +target_include_directories(app PRIVATE + ${PIGWEED_ROOT}/pw_sys_io/public + ${CHIP_ROOT}/src/lib/support + ${CHIP_ROOT}/src/system + ${TELINK_COMMON} + ../../common + ../../common/pigweed + ../../common/pigweed/telink) + +target_compile_options(app PRIVATE + "-DPW_RPC_ATTRIBUTE_SERVICE=1" + "-DPW_RPC_BUTTON_SERVICE=1" + "-DPW_RPC_DESCRIPTOR_SERVICE=1" + "-DPW_RPC_DEVICE_SERVICE=1" + "-DPW_RPC_LIGHTING_SERVICE=1" + "-DPW_RPC_THREAD_SERVICE=1") + +target_link_libraries(app PRIVATE + attributes_service.nanopb_rpc + button_service.nanopb_rpc + descriptor_service.nanopb_rpc + device_service.nanopb_rpc + lighting_service.nanopb_rpc + thread_service.nanopb_rpc + pw_checksum + pw_hdlc + pw_hdlc.pw_rpc + pw_log + pw_rpc.server + pw_sys_io +) + +endif(CONFIG_CHIP_PW_RPC) diff --git a/examples/light-switch-app/telink/rpc.overlay b/examples/light-switch-app/telink/rpc.overlay new file mode 100644 index 00000000000000..017c76b54c4e24 --- /dev/null +++ b/examples/light-switch-app/telink/rpc.overlay @@ -0,0 +1,47 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This file should be used as a configuration overlay to build Pigweed RPCs to +# light-switch-app. + +# Enable Pigweed RPC +CONFIG_CHIP_PW_RPC=y + +# Add support for C++17 to build Pigweed components +CONFIG_STD_CPP14=n +CONFIG_STD_CPP17=y + +# Add support for Zephyr console component to use it for Pigweed console purposes +CONFIG_CONSOLE_SUBSYS=y +CONFIG_CONSOLE_GETCHAR=y +CONFIG_CONSOLE_PUTCHAR_BUFSIZE=256 + +# Disable features which may interfere with Pigweed HDLC transport +CONFIG_SHELL=n +CONFIG_OPENTHREAD_SHELL=n +CONFIG_BOOT_BANNER=n + +# Configure Zephyr logger with defaults backends disabled as the app provides its own, +# based on Pigweed HDLC. +CONFIG_LOG=y +CONFIG_LOG_MODE_MINIMAL=n +CONFIG_LOG_MODE_IMMEDIATE=y +CONFIG_LOG_BACKEND_UART=n +CONFIG_LOG_BACKEND_RTT=n +CONFIG_LOG_OUTPUT=y + +# Increase zephyr tty rx buffer +CONFIG_CONSOLE_GETCHAR_BUFSIZE=128 diff --git a/examples/lighting-app/telink/include/AppTask.h b/examples/lighting-app/telink/include/AppTask.h index 7157b5a9d3601d..f1085763e74086 100644 --- a/examples/lighting-app/telink/include/AppTask.h +++ b/examples/lighting-app/telink/include/AppTask.h @@ -20,10 +20,6 @@ #include "AppTaskCommon.h" -#ifdef CONFIG_CHIP_PW_RPC -#include "Rpc.h" -#endif - class AppTask : public AppTaskCommon { public: @@ -31,21 +27,7 @@ class AppTask : public AppTaskCommon void UpdateClusterState(void); PWMDevice & GetPWMDevice(void) { return mPwmRgbBlueLed; } -#ifdef CONFIG_CHIP_PW_RPC - enum ButtonId_t - { - kButtonId_LightingAction = 1, - kButtonId_FactoryReset, - kButtonId_StartThread, - kButtonId_StartBleAdv - } ButtonId; -#endif - private: -#ifdef CONFIG_CHIP_PW_RPC - friend class chip::rpc::TelinkButton; - static void ButtonEventHandler(ButtonId_t btnId, bool btnPressed); -#endif friend AppTask & GetAppTask(void); friend class AppTaskCommon; diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index 6bee2963f81696..f875086b9d59c7 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -127,32 +127,6 @@ void AppTask::LightingActionEventHandler(AppEvent * aEvent) } } -#ifdef CONFIG_CHIP_PW_RPC -void AppTask::ButtonEventHandler(ButtonId_t btnId, bool btnPressed) -{ - if (!btnPressed) - { - return; - } - - switch (btnId) - { - case kButtonId_LightingAction: - ExampleActionButtonEventHandler(); - break; - case kButtonId_FactoryReset: - FactoryResetButtonEventHandler(); - break; - case kButtonId_StartThread: - StartThreadButtonEventHandler(); - break; - case kButtonId_StartBleAdv: - StartBleAdvButtonEventHandler(); - break; - } -} -#endif - void AppTask::ActionInitiated(PWMDevice::Action_t aAction, int32_t aActor) { if (aAction == PWMDevice::ON_ACTION) diff --git a/examples/platform/telink/common/include/AppTaskCommon.h b/examples/platform/telink/common/include/AppTaskCommon.h index 97b87f0d3e300d..fe1c400b22c448 100644 --- a/examples/platform/telink/common/include/AppTaskCommon.h +++ b/examples/platform/telink/common/include/AppTaskCommon.h @@ -39,6 +39,10 @@ #include #endif +#ifdef CONFIG_CHIP_PW_RPC +#include "Rpc.h" +#endif + #include #include @@ -64,6 +68,16 @@ class AppTaskCommon static void IdentifyEffectHandler(Clusters::Identify::EffectIdentifierEnum aEffect); +#ifdef CONFIG_CHIP_PW_RPC + enum ButtonId_t + { + kButtonId_ExampleAction = 1, + kButtonId_FactoryReset, + kButtonId_StartThread, + kButtonId_StartBleAdv + } ButtonId; +#endif + protected: CHIP_ERROR InitCommonParts(void); @@ -110,4 +124,9 @@ class AppTaskCommon #if CONFIG_CHIP_FACTORY_DATA chip::DeviceLayer::FactoryDataProvider mFactoryDataProvider; #endif + +#ifdef CONFIG_CHIP_PW_RPC + friend class chip::rpc::TelinkButton; + static void ButtonEventHandler(ButtonId_t btnId, bool btnPressed); +#endif }; diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index aa9b38bb7fdeb4..263f094b440ab4 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -342,6 +342,32 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void) return CHIP_NO_ERROR; } +#ifdef CONFIG_CHIP_PW_RPC +void AppTaskCommon::ButtonEventHandler(ButtonId_t btnId, bool btnPressed) +{ + if (!btnPressed) + { + return; + } + + switch (btnId) + { + case kButtonId_ExampleAction: + ExampleActionButtonEventHandler(); + break; + case kButtonId_FactoryReset: + FactoryResetButtonEventHandler(); + break; + case kButtonId_StartThread: + StartThreadButtonEventHandler(); + break; + case kButtonId_StartBleAdv: + StartBleAdvButtonEventHandler(); + break; + } +} +#endif + void AppTaskCommon::InitButtons(void) { #if CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE From 9ce8a6c82e97e07a8b4ab7e908dfb58befe21d1d Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven <67962328+jepenven-silabs@users.noreply.github.com> Date: Wed, 21 Jun 2023 10:52:18 -0400 Subject: [PATCH 24/36] [Silabs] CI Hotfix (#27382) --- .github/workflows/examples-efr32.yaml | 12 ++++++------ .../docker/images/chip-build-efr32/Dockerfile | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index b1185a3ca29e48..0cf3185f3152aa 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -84,12 +84,12 @@ jobs: path: | .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - - name: Test SLC gen - timeout-minutes: 30 - run: | - scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4187C --slc_generate --docker - scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4164A --slc_generate --docker - rm -rf ./out/ + # - name: Test SLC gen + # timeout-minutes: 30 + # run: | + # scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4187C --slc_generate --docker + # scripts/examples/gn_silabs_example.sh examples/lighting-app/silabs ./out/light-app BRD4164A --slc_generate --docker + # rm -rf ./out/ - name: Build some BRD4187C variants timeout-minutes: 90 run: | diff --git a/integrations/docker/images/chip-build-efr32/Dockerfile b/integrations/docker/images/chip-build-efr32/Dockerfile index bf35307d704f9b..3fa7a15500f435 100644 --- a/integrations/docker/images/chip-build-efr32/Dockerfile +++ b/integrations/docker/images/chip-build-efr32/Dockerfile @@ -29,8 +29,9 @@ RUN wget https://www.silabs.com/documents/login/software/slc_cli_linux.zip && \ ENV PATH="${PATH}:/slc_cli/" -RUN slc configuration --sdk="$GSDK_ROOT" && \ - slc signature trust --sdk "$GSDK_ROOT" +# TODO Fix me +# RUN slc configuration --sdk="$GSDK_ROOT" && \ +# slc signature trust --sdk "$GSDK_ROOT" RUN pip3 install lark jinja2 stringcase From 51889a6fed305d9b8ba3b98cbe38187defd12706 Mon Sep 17 00:00:00 2001 From: EricZijian_Siter Date: Thu, 22 Jun 2023 02:40:51 +1000 Subject: [PATCH 25/36] Add the ExpiryDate type to Smoke CO cluster (#27339) * Smoke/CO: Add the type of ExpiryDate * Smoke/CO: Regen zap --------- Co-authored-by: Hare --- .../chip/smoke-co-alarm-cluster.xml | 3 +- .../data_model/controller-clusters.matter | 1 + .../devicecontroller/ClusterIDMapping.java | 1 + .../devicecontroller/ClusterReadMapping.java | 11 +++ .../CHIPAttributeTLVValueDecoder.cpp | 15 ++++ .../chip/devicecontroller/ChipClusters.java | 19 +++++ .../chip/devicecontroller/ChipIdLookup.java | 3 + .../python/chip/clusters/CHIPClusters.py | 6 ++ .../python/chip/clusters/Objects.py | 18 +++++ .../MTRAttributeSpecifiedCheck.mm | 3 + .../MTRAttributeTLVValueDecoder.mm | 11 +++ .../CHIP/zap-generated/MTRBaseClusters.h | 12 +++ .../CHIP/zap-generated/MTRBaseClusters.mm | 43 +++++++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 1 + .../CHIP/zap-generated/MTRClusters.h | 2 + .../CHIP/zap-generated/MTRClusters.mm | 8 ++ .../zap-generated/attributes/Accessors.cpp | 31 ++++++++ .../zap-generated/attributes/Accessors.h | 5 ++ .../zap-generated/cluster-objects.cpp | 3 + .../zap-generated/cluster-objects.h | 13 ++++ .../app-common/zap-generated/ids/Attributes.h | 4 + .../zap-generated/cluster/Commands.h | 5 ++ .../cluster/logging/DataModelLogger.cpp | 5 ++ .../zap-generated/cluster/Commands.h | 73 +++++++++++++++++++ 24 files changed, 294 insertions(+), 2 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml index 97404c86a62a39..cf8bb144a8e103 100644 --- a/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml @@ -49,8 +49,7 @@ limitations under the License. InterconnectCOAlarm ContaminationState SensitivityLevel - - + ExpiryDate diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index a160909ea05ff4..f20671c20ca3f7 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -3245,6 +3245,7 @@ client cluster SmokeCoAlarm = 92 { readonly attribute optional AlarmStateEnum interconnectCOAlarm = 9; readonly attribute optional ContaminationStateEnum contaminationState = 10; attribute optional SensitivityEnum sensitivityLevel = 11; + readonly attribute optional epoch_s expiryDate = 12; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 3cd260b9e1aaf9..6d0a6c01a988ce 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -7379,6 +7379,7 @@ public enum Attribute { InterconnectCOAlarm(9L), ContaminationState(10L), SensitivityLevel(11L), + ExpiryDate(12L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 3faa2661db449f..c8237497332929 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -7182,6 +7182,17 @@ private static Map readSmokeCoAlarmInteractionInfo() { readSmokeCoAlarmSensitivityLevelCommandParams ); result.put("readSensitivityLevelAttribute", readSmokeCoAlarmSensitivityLevelAttributeInteractionInfo); + Map readSmokeCoAlarmExpiryDateCommandParams = new LinkedHashMap(); + InteractionInfo readSmokeCoAlarmExpiryDateAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.SmokeCoAlarmCluster) cluster).readExpiryDateAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readSmokeCoAlarmExpiryDateCommandParams + ); + result.put("readExpiryDateAttribute", readSmokeCoAlarmExpiryDateAttributeInteractionInfo); Map readSmokeCoAlarmGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readSmokeCoAlarmGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 12585d03b60a16..389c20d685f409 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -14630,6 +14630,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR static_cast(cppValue), value); return value; } + case Attributes::ExpiryDate::Id: { + using TypeInfo = Attributes::ExpiryDate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } case Attributes::GeneratedCommandList::Id: { using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 23ca8d6a4308bf..9eae83df98d089 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -16152,6 +16152,18 @@ public void subscribeSensitivityLevelAttribute( subscribeSensitivityLevelAttribute(chipClusterPtr, callback, minInterval, maxInterval); } + public void readExpiryDateAttribute( + LongAttributeCallback callback + ) { + readExpiryDateAttribute(chipClusterPtr, callback); + } + public void subscribeExpiryDateAttribute( + LongAttributeCallback callback +, + int minInterval, int maxInterval) { + subscribeExpiryDateAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback ) { @@ -16310,6 +16322,13 @@ private native void subscribeSensitivityLevelAttribute(long chipClusterPtr, IntegerAttributeCallback callback , int minInterval, int maxInterval); + private native void readExpiryDateAttribute(long chipClusterPtr, + LongAttributeCallback callback + ); + private native void subscribeExpiryDateAttribute(long chipClusterPtr, + LongAttributeCallback callback +, int minInterval, int maxInterval); + private native void readGeneratedCommandListAttribute(long chipClusterPtr, GeneratedCommandListAttributeCallback callback ); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java index 77bdd9bce58781..aceb25e2c4cfc6 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java @@ -2499,6 +2499,9 @@ public static String attributeIdToName(long clusterId, long attributeId) { if (attributeId == 11L) { return "SensitivityLevel"; } + if (attributeId == 12L) { + return "ExpiryDate"; + } if (attributeId == 65528L) { return "GeneratedCommandList"; } diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index ebcb10cbbb1287..a1ec35a1508b62 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -5091,6 +5091,12 @@ class ChipClusters: "reportable": True, "writable": True, }, + 0x0000000C: { + "attributeName": "ExpiryDate", + "attributeId": 0x0000000C, + "type": "int", + "reportable": True, + }, 0x0000FFF8: { "attributeName": "GeneratedCommandList", "attributeId": 0x0000FFF8, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index da33a4a753e694..dc93955c7146ee 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -17341,6 +17341,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="interconnectCOAlarm", Tag=0x00000009, Type=typing.Optional[SmokeCoAlarm.Enums.AlarmStateEnum]), ClusterObjectFieldDescriptor(Label="contaminationState", Tag=0x0000000A, Type=typing.Optional[SmokeCoAlarm.Enums.ContaminationStateEnum]), ClusterObjectFieldDescriptor(Label="sensitivityLevel", Tag=0x0000000B, Type=typing.Optional[SmokeCoAlarm.Enums.SensitivityEnum]), + ClusterObjectFieldDescriptor(Label="expiryDate", Tag=0x0000000C, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -17361,6 +17362,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: interconnectCOAlarm: 'typing.Optional[SmokeCoAlarm.Enums.AlarmStateEnum]' = None contaminationState: 'typing.Optional[SmokeCoAlarm.Enums.ContaminationStateEnum]' = None sensitivityLevel: 'typing.Optional[SmokeCoAlarm.Enums.SensitivityEnum]' = None + expiryDate: 'typing.Optional[uint]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -17646,6 +17648,22 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[SmokeCoAlarm.Enums.SensitivityEnum]' = None + @dataclass + class ExpiryDate(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x005C + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000C + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: 'typing.Optional[uint]' = None + @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 0920c65ca69499..5b5a8d674feef8 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -1950,6 +1950,9 @@ static BOOL AttributeIsSpecifiedInSmokeCOAlarmCluster(AttributeId aAttributeId) case Attributes::SensitivityLevel::Id: { return YES; } + case Attributes::ExpiryDate::Id: { + return YES; + } case Attributes::GeneratedCommandList::Id: { return YES; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 02563e2e41ee49..fe3d93e2df6ee4 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9923,6 +9923,17 @@ static id _Nullable DecodeAttributeValueForSmokeCOAlarmCluster( value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; return value; } + case Attributes::ExpiryDate::Id: { + using TypeInfo = Attributes::ExpiryDate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } case Attributes::GeneratedCommandList::Id: { using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index bf303f85568dca..cce1fa6ee2ef4c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -8450,6 +8450,18 @@ MTR_NEWLY_AVAILABLE completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; +- (void)readAttributeExpiryDateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; +- (void)subscribeAttributeExpiryDateWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler + MTR_NEWLY_AVAILABLE; ++ (void)readAttributeExpiryDateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion + MTR_NEWLY_AVAILABLE; + - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_NEWLY_AVAILABLE; - (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index cdf9f56791411a..dcbca92c2893a0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -49735,6 +49735,49 @@ + (void)readAttributeSensitivityLevelWithClusterStateCache:(MTRClusterStateCache }); } +- (void)readAttributeExpiryDateWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + MTRReadParams * params = [[MTRReadParams alloc] init]; + using TypeInfo = SmokeCoAlarm::Attributes::ExpiryDate::TypeInfo; + return MTRReadAttribute( + params, completion, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), TypeInfo::GetAttributeId()); +} + +- (void)subscribeAttributeExpiryDateWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = SmokeCoAlarm::Attributes::ExpiryDate::TypeInfo; + MTRSubscribeAttribute(params, + subscriptionEstablished, reportHandler, self.callbackQueue, self.device, self->_endpoint, TypeInfo::GetClusterId(), + TypeInfo::GetAttributeId()); +} + ++ (void)readAttributeExpiryDateWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + auto * bridge = new MTRInt32uAttributeCallbackBridge(queue, completion); + std::move(*bridge).DispatchLocalAction( + clusterStateCacheContainer.baseDevice, ^(Int32uAttributeCallback successCb, MTRErrorCallback failureCb) { + if (clusterStateCacheContainer.cppClusterStateCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = SmokeCoAlarm::Attributes::ExpiryDate::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = clusterStateCacheContainer.cppClusterStateCache->Get(path, value); + if (err == CHIP_NO_ERROR) { + successCb(bridge, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + - (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion { MTRReadParams * params = [[MTRReadParams alloc] init]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 0e06ba47e07b3f..22cf891d137b35 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -3794,6 +3794,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterSmokeCOAlarmAttributeInterconnectCOAlarmID MTR_NEWLY_AVAILABLE = 0x00000009, MTRAttributeIDTypeClusterSmokeCOAlarmAttributeContaminationStateID MTR_NEWLY_AVAILABLE = 0x0000000A, MTRAttributeIDTypeClusterSmokeCOAlarmAttributeSensitivityLevelID MTR_NEWLY_AVAILABLE = 0x0000000B, + MTRAttributeIDTypeClusterSmokeCOAlarmAttributeExpiryDateID MTR_NEWLY_AVAILABLE = 0x0000000C, MTRAttributeIDTypeClusterSmokeCOAlarmAttributeGeneratedCommandListID MTR_NEWLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterSmokeCOAlarmAttributeAcceptedCommandListID MTR_NEWLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index dcc4a1916f0fe1..6b5575ae7d7a8e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -2961,6 +2961,8 @@ MTR_NEWLY_AVAILABLE expectedValueInterval:(NSNumber *)expectedValueIntervalMs params:(MTRWriteParams * _Nullable)params MTR_NEWLY_AVAILABLE; +- (NSDictionary *)readAttributeExpiryDateWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; + - (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; - (NSDictionary *)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_NEWLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 2f1684e89b3480..2af744a894e0e3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -13446,6 +13446,14 @@ - (void)writeAttributeSensitivityLevelWithValue:(NSDictionary *) timedWriteTimeout:timedWriteTimeout]; } +- (NSDictionary *)readAttributeExpiryDateWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(_endpoint) + clusterID:@(MTRClusterIDTypeSmokeCOAlarmID) + attributeID:@(MTRAttributeIDTypeClusterSmokeCOAlarmAttributeExpiryDateID) + params:params]; +} + - (NSDictionary *)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:@(_endpoint) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index ef50827f38f950..09fb0643ff9688 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -9303,6 +9303,37 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::SmokeCoAlarm:: } // namespace SensitivityLevel +namespace ExpiryDate { + +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::SmokeCoAlarm::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::SmokeCoAlarm::Id, Id, writable, ZCL_EPOCH_S_ATTRIBUTE_TYPE); +} + +} // namespace ExpiryDate + namespace FeatureMap { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index dd71aa3fea6314..80d2f6a4dddf1a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -1744,6 +1744,11 @@ EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::SmokeCoAlarm:: EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::SmokeCoAlarm::SensitivityEnum value); } // namespace SensitivityLevel +namespace ExpiryDate { +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // epoch_s +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); +} // namespace ExpiryDate + namespace FeatureMap { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index d000e28af8987a..9fb3fd0ff82f4e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -12622,6 +12622,9 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre case Attributes::SensitivityLevel::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, sensitivityLevel)); break; + case Attributes::ExpiryDate::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, expiryDate)); + break; case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); break; diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 7d386143d47cf9..2337d70af2b895 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -16014,6 +16014,18 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace SensitivityLevel +namespace ExpiryDate { +struct TypeInfo +{ + using Type = uint32_t; + using DecodableType = uint32_t; + using DecodableArgType = uint32_t; + + static constexpr ClusterId GetClusterId() { return Clusters::SmokeCoAlarm::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ExpiryDate::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ExpiryDate namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -16080,6 +16092,7 @@ struct TypeInfo static_cast(0); Attributes::SensitivityLevel::TypeInfo::DecodableType sensitivityLevel = static_cast(0); + Attributes::ExpiryDate::TypeInfo::DecodableType expiryDate = static_cast(0); Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index a20b6cd0022bff..ac4a7532f1e8d8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -2920,6 +2920,10 @@ namespace SensitivityLevel { static constexpr AttributeId Id = 0x0000000B; } // namespace SensitivityLevel +namespace ExpiryDate { +static constexpr AttributeId Id = 0x0000000C; +} // namespace ExpiryDate + namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index bc33ea2a4d5c96..8b6994c1505de2 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -4470,6 +4470,7 @@ class DishwasherModeChangeToMode : public ClusterCommand | * InterconnectCOAlarm | 0x0009 | | * ContaminationState | 0x000A | | * SensitivityLevel | 0x000B | +| * ExpiryDate | 0x000C | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -15261,6 +15262,7 @@ void registerClusterSmokeCoAlarm(Commands & commands, CredentialIssuerCommands * make_unique(Id, "interconnect-coalarm", Attributes::InterconnectCOAlarm::Id, credsIssuerConfig), // make_unique(Id, "contamination-state", Attributes::ContaminationState::Id, credsIssuerConfig), // make_unique(Id, "sensitivity-level", Attributes::SensitivityLevel::Id, credsIssuerConfig), // + make_unique(Id, "expiry-date", Attributes::ExpiryDate::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // @@ -15298,6 +15300,8 @@ void registerClusterSmokeCoAlarm(Commands & commands, CredentialIssuerCommands * make_unique>( Id, "sensitivity-level", 0, UINT8_MAX, Attributes::SensitivityLevel::Id, WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>(Id, "expiry-date", 0, UINT32_MAX, Attributes::ExpiryDate::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -15325,6 +15329,7 @@ void registerClusterSmokeCoAlarm(Commands & commands, CredentialIssuerCommands * make_unique(Id, "interconnect-coalarm", Attributes::InterconnectCOAlarm::Id, credsIssuerConfig), // make_unique(Id, "contamination-state", Attributes::ContaminationState::Id, credsIssuerConfig), // make_unique(Id, "sensitivity-level", Attributes::SensitivityLevel::Id, credsIssuerConfig), // + make_unique(Id, "expiry-date", Attributes::ExpiryDate::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 071648f097ff34..9a73b13a7d1dfe 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -8450,6 +8450,11 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SensitivityLevel", 1, value); } + case SmokeCoAlarm::Attributes::ExpiryDate::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ExpiryDate", 1, value); + } case SmokeCoAlarm::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index 16b8371bd637f3..476299e289fbdd 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -42618,6 +42618,7 @@ class SubscribeAttributeAirQualityClusterRevision : public SubscribeAttribute { | * InterconnectCOAlarm | 0x0009 | | * ContaminationState | 0x000A | | * SensitivityLevel | 0x000B | +| * ExpiryDate | 0x000C | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -43562,6 +43563,76 @@ class SubscribeAttributeSmokeCoAlarmSensitivityLevel : public SubscribeAttribute } }; +/* + * Attribute ExpiryDate + */ +class ReadSmokeCoAlarmExpiryDate : public ReadAttribute { +public: + ReadSmokeCoAlarmExpiryDate() + : ReadAttribute("expiry-date") + { + } + + ~ReadSmokeCoAlarmExpiryDate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000005C) ReadAttribute (0x0000000C) on endpoint %u", endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + [cluster readAttributeExpiryDateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"SmokeCOAlarm.ExpiryDate response %@", [value description]); + if (error != nil) { + LogNSError("SmokeCOAlarm ExpiryDate read Error", error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeSmokeCoAlarmExpiryDate : public SubscribeAttribute { +public: + SubscribeAttributeSmokeCoAlarmExpiryDate() + : SubscribeAttribute("expiry-date") + { + } + + ~SubscribeAttributeSmokeCoAlarmExpiryDate() {} + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000005C) ReportAttribute (0x0000000C) on endpoint %u", endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device + endpointID:@(endpointId) + queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeExpiryDateWithParams:params + subscriptionEstablished:^() { + mSubscriptionEstablished = YES; + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"SmokeCOAlarm.ExpiryDate response %@", [value description]); + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + /* * Attribute GeneratedCommandList */ @@ -122532,6 +122603,8 @@ void registerClusterSmokeCoAlarm(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // From 90cfc5218f812e9267844eea41bffe25e59662f6 Mon Sep 17 00:00:00 2001 From: tianfeng-yang <130436698+tianfeng-yang@users.noreply.github.com> Date: Thu, 22 Jun 2023 00:42:23 +0800 Subject: [PATCH 26/36] [Python] export cluster status when sendCommand failed (#27335) --- .../python/chip/clusters/Command.py | 13 +++++++----- .../python/chip/interaction_model/__init__.py | 20 +++++++++++++++++-- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/controller/python/chip/clusters/Command.py b/src/controller/python/chip/clusters/Command.py index df2037192e24c3..5ce2f4c620db4a 100644 --- a/src/controller/python/chip/clusters/Command.py +++ b/src/controller/python/chip/clusters/Command.py @@ -64,7 +64,8 @@ def FindCommandClusterObject(isClientSideCommand: bool, path: CommandPath): if inspect.isclass(command): for name, field in inspect.getmembers(command): if ('__dataclass_fields__' in name): - if (field['cluster_id'].default == path.ClusterId) and (field['command_id'].default == path.CommandId) and (field['is_client'].default == isClientSideCommand): + if (field['cluster_id'].default == path.ClusterId) and (field['command_id'].default == + path.CommandId) and (field['is_client'].default == isClientSideCommand): return eval('chip.clusters.Objects.' + clusterName + '.Commands.' + commandName) return None @@ -105,11 +106,11 @@ def _handleError(self, imError: Status, chipError: PyChipError, exception: Excep else: try: self._future.set_exception( - chip.interaction_model.InteractionModelError(chip.interaction_model.Status(imError.IMStatus))) + chip.interaction_model.InteractionModelError(chip.interaction_model.Status(imError.IMStatus), imError.ClusterStatus)) except Exception as e2: logger.exception("Failed to map interaction model status received: %s. Remapping to Failure." % imError) self._future.set_exception(chip.interaction_model.InteractionModelError( - chip.interaction_model.Status.Failure)) + chip.interaction_model.Status.Failure, imError.ClusterStatus)) def handleError(self, status: Status, chipError: PyChipError): self._event_loop.call_soon_threadsafe( @@ -126,7 +127,8 @@ def handleError(self, status: Status, chipError: PyChipError): @_OnCommandSenderResponseCallbackFunct -def _OnCommandSenderResponseCallback(closure, endpoint: int, cluster: int, command: int, imStatus: int, clusterStatus: int, payload, size): +def _OnCommandSenderResponseCallback(closure, endpoint: int, cluster: int, command: int, + imStatus: int, clusterStatus: int, payload, size): data = ctypes.string_at(payload, size) closure.handleResponse(CommandPath(endpoint, cluster, command), Status( imStatus, clusterStatus), data[:]) @@ -142,7 +144,8 @@ def _OnCommandSenderDoneCallback(closure): ctypes.pythonapi.Py_DecRef(ctypes.py_object(closure)) -def SendCommand(future: Future, eventLoop, responseType: Type, device, commandPath: CommandPath, payload: ClusterCommand, timedRequestTimeoutMs: Union[None, int] = None, interactionTimeoutMs: Union[None, int] = None, busyWaitMs: Union[None, int] = None) -> PyChipError: +def SendCommand(future: Future, eventLoop, responseType: Type, device, commandPath: CommandPath, payload: ClusterCommand, + timedRequestTimeoutMs: Union[None, int] = None, interactionTimeoutMs: Union[None, int] = None, busyWaitMs: Union[None, int] = None) -> PyChipError: ''' Send a cluster-object encapsulated command to a device and does the following: - On receipt of a successful data response, returns the cluster-object equivalent through the provided future. - None (on a successful response containing no data) diff --git a/src/controller/python/chip/interaction_model/__init__.py b/src/controller/python/chip/interaction_model/__init__.py index 1b9fc2177e242e..a2c9e1479397fa 100644 --- a/src/controller/python/chip/interaction_model/__init__.py +++ b/src/controller/python/chip/interaction_model/__init__.py @@ -31,6 +31,10 @@ __all__ = ["Status", "InteractionModelError"] +# defined src/controller/python/chip/interaction_model/Delegate.h +kUndefinedClusterStatus: int = 0xFF + + class Status(enum.IntEnum): Success = 0x0 Failure = 0x01 @@ -79,12 +83,24 @@ class Status(enum.IntEnum): class InteractionModelError(ChipStackException): - def __init__(self, status: Status): + def __init__(self, status: Status, clusterStatus: int = kUndefinedClusterStatus): self._status = status + self._clusterStatus = clusterStatus def __str__(self): - return f"InteractionModelError: {self._status.name} (0x{self._status.value:x})" + if self.hasClusterStatus: + return f"InteractionModelError: {self._status.name} (0x{self._status.value:x}, clusterStatus: {self._clusterStatus})" + else: + return f"InteractionModelError: {self._status.name} (0x{self._status.value:x})" + + @property + def hasClusterStatus(self) -> bool: + return self._clusterStatus != kUndefinedClusterStatus @property def status(self) -> Status: return self._status + + @property + def clusterStatus(self) -> int: + return self._clusterStatus From 803c5aec97708292bf347e7f850657969bc9b0c3 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 21 Jun 2023 13:27:33 -0400 Subject: [PATCH 27/36] =?UTF-8?q?Add=20methods=20ExtendTimerTo=20and=20IsT?= =?UTF-8?q?imerActive=20to=20the=20SystemLayerTimer.=20=E2=80=A6=20(#27332?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add methods ExtendTimerTo and IsTimerActive to the SystemLayerTimer. Add tests for those new methods * correct spelling * Update src/system/SystemLayer.h Co-authored-by: Boris Zbarsky * Update src/system/SystemLayerImplSelect.cpp Co-authored-by: Boris Zbarsky * Apply comment, add a check in ExtendTimerTo. test that check in TestSystemTimer --------- Co-authored-by: Justin Wood Co-authored-by: Boris Zbarsky --- src/system/SystemLayer.h | 34 +++++++ src/system/SystemLayerImplFreeRTOS.cpp | 20 ++++ src/system/SystemLayerImplFreeRTOS.h | 2 + src/system/SystemLayerImplSelect.cpp | 40 ++++++++ src/system/SystemLayerImplSelect.h | 2 + src/system/SystemTimer.cpp | 18 ++++ src/system/SystemTimer.h | 7 ++ src/system/tests/TestSystemTimer.cpp | 132 +++++++++++++++++++++++++ 8 files changed, 255 insertions(+) diff --git a/src/system/SystemLayer.h b/src/system/SystemLayer.h index 279ac057b05ff7..566abb2a0a3378 100644 --- a/src/system/SystemLayer.h +++ b/src/system/SystemLayer.h @@ -116,6 +116,40 @@ class DLL_EXPORT Layer */ virtual CHIP_ERROR StartTimer(Clock::Timeout aDelay, TimerCompleteCallback aComplete, void * aAppState) = 0; + /** + * @brief + * This method extends the timer expiry to the provided aDelay. This method must be called while in the Matter context + * (from the Matter event loop, or while holding the Matter stack lock). + * aDelay is not added to the Remaining time of the timer. The finish line is pushed back to aDelay. + * + * @note The goal of this method is that the timer remaining time cannot be shrunk and only extended to a new time + * If the provided new Delay is smaller than the timer's remaining time, the timer is left untouched. + * In the other case the method acts like StartTimer + * + * @param[in] aDelay Time before this timer fires. + * @param[in] aComplete A pointer to the function called when timer expires. + * @param[in] aAppState A pointer to the application state object used when timer expires. + * + * @return CHIP_NO_ERROR On success. + * @return CHIP_ERROR_INVALID_ARGUMENT If the provided aDelay value is 0 + * @return CHIP_ERROR_NO_MEMORY If a timer cannot be allocated. + * @return Other Value indicating timer failed to start. + */ + virtual CHIP_ERROR ExtendTimerTo(Clock::Timeout aDelay, TimerCompleteCallback aComplete, void * aAppState) = 0; + + /** + * @brief + * This method searches for the timer matching the provided parameters. + * and returns whether it is still "running" and waiting to trigger or not. + * + * @param[in] onComplete A pointer to the function called when timer expires. + * @param[in] appState A pointer to the application state object used when timer expires. + * + * @return True if there is a current timer set to call, at some point in the future, the provided onComplete callback + * with the corresponding appState context. False otherwise. + */ + virtual bool IsTimerActive(TimerCompleteCallback onComplete, void * appState) = 0; + /** * @brief This method cancels a one-shot timer, started earlier through @p StartTimer(). This method must * be called while in the Matter context (from the Matter event loop, or while holding the Matter diff --git a/src/system/SystemLayerImplFreeRTOS.cpp b/src/system/SystemLayerImplFreeRTOS.cpp index ecc8d9504b0f14..cfc8e091208f86 100644 --- a/src/system/SystemLayerImplFreeRTOS.cpp +++ b/src/system/SystemLayerImplFreeRTOS.cpp @@ -76,6 +76,26 @@ CHIP_ERROR LayerImplFreeRTOS::StartTimer(Clock::Timeout delay, TimerCompleteCall return CHIP_NO_ERROR; } +CHIP_ERROR LayerImplFreeRTOS::ExtendTimerTo(Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) +{ + VerifyOrReturnError(delay.count() > 0, CHIP_ERROR_INVALID_ARGUMENT); + + assertChipStackLockedByCurrentThread(); + + Clock::Timeout remainingTime = mTimerList.GetRemainingTime(onComplete, appState); + if (remainingTime.count() < delay.count()) + { + return StartTimer(delay, onComplete, appState); + } + + return CHIP_NO_ERROR; +} + +bool LayerImplFreeRTOS::IsTimerActive(TimerCompleteCallback onComplete, void * appState) +{ + return (mTimerList.GetRemainingTime(onComplete, appState) > Clock::kZero); +} + void LayerImplFreeRTOS::CancelTimer(TimerCompleteCallback onComplete, void * appState) { assertChipStackLockedByCurrentThread(); diff --git a/src/system/SystemLayerImplFreeRTOS.h b/src/system/SystemLayerImplFreeRTOS.h index 846e17b21854db..2e7401dfce03ce 100644 --- a/src/system/SystemLayerImplFreeRTOS.h +++ b/src/system/SystemLayerImplFreeRTOS.h @@ -40,6 +40,8 @@ class LayerImplFreeRTOS : public LayerFreeRTOS void Shutdown() override; bool IsInitialized() const override { return mLayerState.IsInitialized(); } CHIP_ERROR StartTimer(Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) override; + CHIP_ERROR ExtendTimerTo(Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) override; + bool IsTimerActive(TimerCompleteCallback onComplete, void * appState) override; void CancelTimer(TimerCompleteCallback onComplete, void * appState) override; CHIP_ERROR ScheduleWork(TimerCompleteCallback onComplete, void * appState) override; diff --git a/src/system/SystemLayerImplSelect.cpp b/src/system/SystemLayerImplSelect.cpp index 513cfff4860f5a..9eb0b2ece2864b 100644 --- a/src/system/SystemLayerImplSelect.cpp +++ b/src/system/SystemLayerImplSelect.cpp @@ -200,6 +200,46 @@ CHIP_ERROR LayerImplSelect::StartTimer(Clock::Timeout delay, TimerCompleteCallba #endif // !CHIP_SYSTEM_CONFIG_USE_LIBEV } +CHIP_ERROR LayerImplSelect::ExtendTimerTo(Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) +{ + VerifyOrReturnError(delay.count() > 0, CHIP_ERROR_INVALID_ARGUMENT); + + assertChipStackLockedByCurrentThread(); + + Clock::Timeout remainingTime = mTimerList.GetRemainingTime(onComplete, appState); + if (remainingTime.count() < delay.count()) + { + if (remainingTime == Clock::kZero) + { + // If remaining time is Clock::kZero, it might possible that our timer is in + // the mExpiredTimers list and about to be fired. Remove it from that list, since we are extending it. + mExpiredTimers.Remove(onComplete, appState); + } + return StartTimer(delay, onComplete, appState); + } + + return CHIP_NO_ERROR; +} + +bool LayerImplSelect::IsTimerActive(TimerCompleteCallback onComplete, void * appState) +{ + bool timerIsActive = (mTimerList.GetRemainingTime(onComplete, appState) > Clock::kZero); + + if (!timerIsActive) + { + // check if the timer is in the mExpiredTimers list about to be fired. + for (TimerList::Node * timer = mExpiredTimers.Earliest(); timer != nullptr; timer = timer->mNextTimer) + { + if (timer->GetCallback().GetOnComplete() == onComplete && timer->GetCallback().GetAppState() == appState) + { + return true; + } + } + } + + return timerIsActive; +} + void LayerImplSelect::CancelTimer(TimerCompleteCallback onComplete, void * appState) { assertChipStackLockedByCurrentThread(); diff --git a/src/system/SystemLayerImplSelect.h b/src/system/SystemLayerImplSelect.h index 552e8d9e40163d..c835b8a76720c5 100644 --- a/src/system/SystemLayerImplSelect.h +++ b/src/system/SystemLayerImplSelect.h @@ -61,6 +61,8 @@ class LayerImplSelect : public LayerSocketsLoop void Shutdown() override; bool IsInitialized() const override { return mLayerState.IsInitialized(); } CHIP_ERROR StartTimer(Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) override; + CHIP_ERROR ExtendTimerTo(Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) override; + bool IsTimerActive(TimerCompleteCallback onComplete, void * appState) override; void CancelTimer(TimerCompleteCallback onComplete, void * appState) override; CHIP_ERROR ScheduleWork(TimerCompleteCallback onComplete, void * appState) override; diff --git a/src/system/SystemTimer.cpp b/src/system/SystemTimer.cpp index cb54d075ee23e1..3612b9c10461e2 100644 --- a/src/system/SystemTimer.cpp +++ b/src/system/SystemTimer.cpp @@ -160,5 +160,23 @@ TimerList TimerList::ExtractEarlier(Clock::Timestamp t) return out; } +Clock::Timeout TimerList::GetRemainingTime(TimerCompleteCallback aOnComplete, void * aAppState) +{ + for (TimerList::Node * timer = mEarliestTimer; timer != nullptr; timer = timer->mNextTimer) + { + if (timer->GetCallback().GetOnComplete() == aOnComplete && timer->GetCallback().GetAppState() == aAppState) + { + Clock::Timestamp currentTime = SystemClock().GetMonotonicTimestamp(); + + if (currentTime < timer->AwakenTime()) + { + return Clock::Timeout(timer->AwakenTime() - currentTime); + } + return Clock::kZero; + } + } + return Clock::kZero; +} + } // namespace System } // namespace chip diff --git a/src/system/SystemTimer.h b/src/system/SystemTimer.h index cd27fefcf11ef2..b8f727e566846e 100644 --- a/src/system/SystemTimer.h +++ b/src/system/SystemTimer.h @@ -179,6 +179,13 @@ class TimerList */ void Clear() { mEarliestTimer = nullptr; } + /** + * Find the timer with the given properties, if present, and return its remaining time + * + * @return The remaining time on this partifcular timer or 0 if not found. + */ + Clock::Timeout GetRemainingTime(TimerCompleteCallback aOnComplete, void * aAppState); + private: Node * mEarliestTimer; }; diff --git a/src/system/tests/TestSystemTimer.cpp b/src/system/tests/TestSystemTimer.cpp index bc5d3bc6206870..1648c700f46e37 100644 --- a/src/system/tests/TestSystemTimer.cpp +++ b/src/system/tests/TestSystemTimer.cpp @@ -580,6 +580,136 @@ void chip::System::TestTimer::CheckTimerPool(nlTestSuite * inSuite, void * aCont NL_TEST_ASSERT(suite, SYSTEM_STATS_TEST_HIGH_WATER_MARK(Stats::kSystemLayer_NumTimers, 4)); } +static void ExtendTimerToTest(nlTestSuite * inSuite, void * aContext) +{ + if (!LayerEvents::HasServiceEvents()) + return; + + TestContext & testContext = *static_cast(aContext); + Layer & systemLayer = *testContext.mLayer; + nlTestSuite * const suite = testContext.mTestSuite; + + struct TestState + { + void Record(char c) + { + size_t n = strlen(record); + if (n + 1 < sizeof(record)) + { + record[n++] = c; + record[n] = 0; + } + } + static void A(Layer * layer, void * state) { static_cast(state)->Record('A'); } + static void B(Layer * layer, void * state) { static_cast(state)->Record('B'); } + static void C(Layer * layer, void * state) { static_cast(state)->Record('C'); } + static void D(Layer * layer, void * state) { static_cast(state)->Record('D'); } + char record[5] = { 0 }; + }; + TestState testState; + NL_TEST_ASSERT(suite, testState.record[0] == 0); + + Clock::ClockBase * const savedClock = &SystemClock(); + Clock::Internal::MockClock mockClock; + Clock::Internal::SetSystemClockForTesting(&mockClock); + + using namespace Clock::Literals; + systemLayer.StartTimer(150_ms, TestState::B, &testState); + systemLayer.StartTimer(200_ms, TestState::C, &testState); + systemLayer.StartTimer(150_ms, TestState::D, &testState); + + // Timer wasn't started before. ExtendTimerTo will start it. + systemLayer.ExtendTimerTo(100_ms, TestState::A, &testState); + mockClock.AdvanceMonotonic(100_ms); + LayerEvents::ServiceEvents(systemLayer); + NL_TEST_ASSERT(suite, strcmp(testState.record, "A") == 0); + + // Timer B as 50ms remaining. ExtendTimerTo 25 should have no effect + // Timer C as 100ms remaining. ExtendTimerTo 75ms should have no effect + // Timer D as 50ms remaining. Timer should be extend to a duration of 75ms + systemLayer.ExtendTimerTo(25_ms, TestState::B, &testState); + systemLayer.ExtendTimerTo(75_ms, TestState::D, &testState); + systemLayer.ExtendTimerTo(75_ms, TestState::D, &testState); + + mockClock.AdvanceMonotonic(25_ms); + LayerEvents::ServiceEvents(systemLayer); + NL_TEST_ASSERT(suite, strcmp(testState.record, "A") == 0); + + mockClock.AdvanceMonotonic(25_ms); + LayerEvents::ServiceEvents(systemLayer); + NL_TEST_ASSERT(suite, strcmp(testState.record, "AB") == 0); + + // Timer D as 25ms remaining. Timer should be extend to a duration of 75ms + systemLayer.ExtendTimerTo(75_ms, TestState::D, &testState); + mockClock.AdvanceMonotonic(100_ms); + LayerEvents::ServiceEvents(systemLayer); + NL_TEST_ASSERT(suite, strcmp(testState.record, "ABCD") == 0); + + Clock::Internal::SetSystemClockForTesting(savedClock); + + // Extending a timer by 0 ms permitted + NL_TEST_ASSERT(suite, systemLayer.ExtendTimerTo(0_ms, TestState::A, &testState) == CHIP_ERROR_INVALID_ARGUMENT); +} + +static void IsTimerActiveTest(nlTestSuite * inSuite, void * aContext) +{ + if (!LayerEvents::HasServiceEvents()) + return; + + TestContext & testContext = *static_cast(aContext); + Layer & systemLayer = *testContext.mLayer; + nlTestSuite * const suite = testContext.mTestSuite; + + struct TestState + { + void Record(char c) + { + size_t n = strlen(record); + if (n + 1 < sizeof(record)) + { + record[n++] = c; + record[n] = 0; + } + } + static void A(Layer * layer, void * state) { static_cast(state)->Record('A'); } + static void B(Layer * layer, void * state) { static_cast(state)->Record('B'); } + static void C(Layer * layer, void * state) { static_cast(state)->Record('C'); } + char record[4] = { 0 }; + }; + TestState testState; + NL_TEST_ASSERT(suite, testState.record[0] == 0); + + Clock::ClockBase * const savedClock = &SystemClock(); + Clock::Internal::MockClock mockClock; + Clock::Internal::SetSystemClockForTesting(&mockClock); + + using namespace Clock::Literals; + systemLayer.StartTimer(100_ms, TestState::A, &testState); + systemLayer.StartTimer(200_ms, TestState::B, &testState); + systemLayer.StartTimer(300_ms, TestState::C, &testState); + + NL_TEST_ASSERT(suite, systemLayer.IsTimerActive(TestState::A, &testState)); + NL_TEST_ASSERT(suite, systemLayer.IsTimerActive(TestState::B, &testState)); + NL_TEST_ASSERT(suite, systemLayer.IsTimerActive(TestState::C, &testState)); + + mockClock.AdvanceMonotonic(100_ms); + LayerEvents::ServiceEvents(systemLayer); + NL_TEST_ASSERT(suite, systemLayer.IsTimerActive(TestState::A, &testState) == false); + NL_TEST_ASSERT(suite, systemLayer.IsTimerActive(TestState::B, &testState)); + NL_TEST_ASSERT(suite, systemLayer.IsTimerActive(TestState::C, &testState)); + + mockClock.AdvanceMonotonic(100_ms); + LayerEvents::ServiceEvents(systemLayer); + NL_TEST_ASSERT(suite, systemLayer.IsTimerActive(TestState::B, &testState) == false); + NL_TEST_ASSERT(suite, systemLayer.IsTimerActive(TestState::C, &testState)); + + mockClock.AdvanceMonotonic(100_ms); + LayerEvents::ServiceEvents(systemLayer); + NL_TEST_ASSERT(suite, systemLayer.IsTimerActive(TestState::C, &testState) == false); + + Clock::Internal::SetSystemClockForTesting(savedClock); +} + // Test Suite /** @@ -594,6 +724,8 @@ static const nlTest sTests[] = NL_TEST_DEF("Timer::TestTimerCancellation", CheckCancellation), NL_TEST_DEF("Timer::TestTimerPool", chip::System::TestTimer::CheckTimerPool), NL_TEST_DEF("Timer::TestCancelTimer", CancelTimerTest::Test), + NL_TEST_DEF("Timer::ExtendTimerTo", ExtendTimerToTest), + NL_TEST_DEF("Timer::TestIsTimerActive", IsTimerActiveTest), NL_TEST_SENTINEL() }; // clang-format on From a0397c2252662513069642793c4383ea2779974e Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Wed, 21 Jun 2023 13:36:31 -0400 Subject: [PATCH 28/36] Updating mergify (#27385) --- .mergify.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.mergify.yml b/.mergify.yml index a884d9b26d4d97..4213f1c933b007 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -4,6 +4,10 @@ pull_request_rules: - "#approved-reviews-by>=1" - "#review-threads-unresolved=0" - "-draft" + - "label!=docker" # Don't auto merge docker images + - "#check-failure=0" # Don't auto merge with a failure + - "#check-pending=0" # Don't auto merge with anything pending + - "check-success~=Build" # Don't auto merge unless a build has succeeded, needed because above is true on a fresh PR before builds - or: - "check-success=pullapprove" - "check-skipped=pullapprove" From 3706e0633f3494a34802b123bf5cf2b70a60616d Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Wed, 21 Jun 2023 14:35:15 -0400 Subject: [PATCH 29/36] Revert: "[OIS] Add PSA crypto backend support" (#27391) This reverts commit 834663dafb46313aadff4a25486ee67f0c257e5e. --- .github/.wordlist.txt | 1 - .github/workflows/examples-openiotsdk.yaml | 11 ++-- .vscode/tasks.json | 9 ---- config/openiotsdk/CMakeLists.txt | 1 - config/openiotsdk/chip-gn/args.gni | 1 + config/openiotsdk/cmake/chip.cmake | 11 +--- config/openiotsdk/cmake/sdk.cmake | 35 ++++++------- config/openiotsdk/lwip/user_lwipopts.h | 5 -- config/openiotsdk/mbedtls/mbedtls_config.h | 6 +-- .../openiotsdk/mbedtls/mbedtls_config_psa.h | 6 --- docs/guides/openiotsdk_examples.md | 52 +++---------------- .../openiotsdk/app/openiotsdk_platform.cpp | 13 ----- scripts/build/BUILD.gn | 4 +- scripts/build/build/targets.py | 6 +-- scripts/build/builders/openiotsdk.py | 20 +------ scripts/build/test.py | 4 +- .../build/testdata/all_targets_linux_x64.txt | 2 +- .../dry_run_openiotsdk-lock-mbedtls.txt | 8 --- .../testdata/dry_run_openiotsdk-lock.txt | 8 +++ .../dry_run_openiotsdk-shell-mbedtls.txt | 8 --- .../testdata/dry_run_openiotsdk-shell.txt | 8 +++ scripts/examples/openiotsdk_example.sh | 21 +------- 22 files changed, 57 insertions(+), 183 deletions(-) delete mode 100644 config/openiotsdk/mbedtls/mbedtls_config_psa.h delete mode 100644 scripts/build/testdata/dry_run_openiotsdk-lock-mbedtls.txt create mode 100644 scripts/build/testdata/dry_run_openiotsdk-lock.txt delete mode 100644 scripts/build/testdata/dry_run_openiotsdk-shell-mbedtls.txt create mode 100644 scripts/build/testdata/dry_run_openiotsdk-shell.txt diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index ef5aa8fb290737..04179cb874c403 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -1071,7 +1071,6 @@ ProxyDiscovery ProxyValid ProxyView PRs -PSA PSCAN PSECT PSK diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index d706b8dbab9273..2c373d457dfe20 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -31,11 +31,6 @@ env: jobs: openiotsdk: - strategy: - fail-fast: false - matrix: - cryptoBackend: ["psa", "mbedtls"] - name: Open IoT SDK examples building timeout-minutes: 90 @@ -94,7 +89,7 @@ jobs: id: build_shell timeout-minutes: 10 run: | - scripts/examples/openiotsdk_example.sh -b ${{ matrix.cryptoBackend }} shell + scripts/examples/openiotsdk_example.sh shell .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ openiotsdk release shell \ examples/shell/openiotsdk/build/chip-openiotsdk-shell-example.elf \ @@ -104,7 +99,7 @@ jobs: id: build_lock_app timeout-minutes: 10 run: | - scripts/examples/openiotsdk_example.sh -b ${{ matrix.cryptoBackend }} lock-app + scripts/examples/openiotsdk_example.sh lock-app .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ openiotsdk release lock-app \ examples/lock-app/openiotsdk/build/chip-openiotsdk-lock-app-example.elf \ @@ -114,7 +109,7 @@ jobs: id: build_unit_tests timeout-minutes: 10 run: | - scripts/examples/openiotsdk_example.sh -b ${{ matrix.cryptoBackend }} unit-tests + scripts/examples/openiotsdk_example.sh unit-tests - name: "Test: shell example" if: steps.build_shell.outcome == 'success' diff --git a/.vscode/tasks.json b/.vscode/tasks.json index bb0c8ba01853ea..8516b5b12f2e5c 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -251,7 +251,6 @@ "-Cbuild", "-d${input:openiotsdkDebugMode}", "-l${input:openiotsdkLwipDebug}", - "-b${input:openiotsdkCryptoBackend}", "${input:openiotsdkExample}" ], "group": "build", @@ -272,7 +271,6 @@ "-Cbuild", "-d${input:openiotsdkDebugMode}", "-l${input:openiotsdkLwipDebug}", - "-b${input:openiotsdkCryptoBackend}", "unit-tests" ], "group": "build", @@ -482,13 +480,6 @@ "options": ["false", "true"], "default": "false" }, - { - "type": "pickString", - "id": "openiotsdkCryptoBackend", - "description": "Which Crypto algorithm do you wish to use?", - "options": ["mbedtls", "psa"], - "default": "mbedtls" - }, { "type": "command", "id": "openiotsdkExample", diff --git a/config/openiotsdk/CMakeLists.txt b/config/openiotsdk/CMakeLists.txt index 43f9fca7b5dd9a..7f559587a88a66 100644 --- a/config/openiotsdk/CMakeLists.txt +++ b/config/openiotsdk/CMakeLists.txt @@ -62,7 +62,6 @@ matter_add_gn_arg_bool ("chip_automation_logging" CONFIG_CHIP_AUTO matter_add_gn_arg_bool ("chip_error_logging" CONFIG_CHIP_ERROR_LOGGING) matter_add_gn_arg_bool ("chip_openiotsdk_use_tfm" TFM_SUPPORT) matter_add_gn_arg_bool ("chip_openiotsdk_use_psa_ps" CONFIG_CHIP_OPEN_IOT_SDK_USE_PSA_PS) -matter_add_gn_arg_string("chip_crypto" "${CONFIG_CHIP_CRYPTO}") if (TARGET cmsis-rtos-api) matter_add_gn_arg_string("target_os" "cmsis-rtos") endif() diff --git a/config/openiotsdk/chip-gn/args.gni b/config/openiotsdk/chip-gn/args.gni index 12ffb66b844957..fd9edf986f8ee7 100644 --- a/config/openiotsdk/chip-gn/args.gni +++ b/config/openiotsdk/chip-gn/args.gni @@ -31,6 +31,7 @@ chip_system_config_use_lwip = true lwip_platform = "external" chip_system_config_use_sockets = false +chip_crypto = "mbedtls" chip_external_mbedtls = true custom_toolchain = "${chip_root}/config/openiotsdk/chip-gn/toolchain:openiotsdk" diff --git a/config/openiotsdk/cmake/chip.cmake b/config/openiotsdk/cmake/chip.cmake index 6e1a78bcb8debf..bdef5870433d23 100644 --- a/config/openiotsdk/cmake/chip.cmake +++ b/config/openiotsdk/cmake/chip.cmake @@ -21,7 +21,7 @@ get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) -# Default CHIP build configuration +# Default CHIP build configuration set(CONFIG_CHIP_PROJECT_CONFIG "main/include/CHIPProjectConfig.h" CACHE STRING "") set(CONFIG_CHIP_LIB_TESTS NO CACHE BOOL "") set(CONFIG_CHIP_LIB_SHELL NO CACHE BOOL "") @@ -32,7 +32,6 @@ set(CONFIG_CHIP_AUTOMATION_LOGGING YES CACHE BOOL "Enable logging at automation set(CONFIG_CHIP_ERROR_LOGGING YES CACHE BOOL "Enable logging at error level") set(CONFIG_CHIP_OPEN_IOT_SDK_USE_PSA_PS NO CACHE BOOL "Enable using PSA Protected Storage") -set(CONFIG_CHIP_CRYPTO "mbedtls" CACHE STRING "Matter crypto backend. Mbedtls as default") if(CONFIG_CHIP_OPEN_IOT_SDK_USE_PSA_PS AND NOT TFM_SUPPORT) message( FATAL_ERROR "You can not use PSA Protected Storage without TF-M support" ) @@ -54,14 +53,8 @@ if(TFM_SUPPORT) add_dependencies(chip-gn tfm-ns-interface) endif() -if ("${CONFIG_CHIP_CRYPTO}" STREQUAL "psa") - target_compile_definitions(chip - INTERFACE - CONFIG_CHIP_CRYPTO_PSA) -endif() - function(chip_add_data_model target scope model_name) - target_include_directories(${target} + target_include_directories(${target} PUBLIC ${GEN_DIR}/app-common ${GEN_DIR}/${model_name}-app diff --git a/config/openiotsdk/cmake/sdk.cmake b/config/openiotsdk/cmake/sdk.cmake index 6f391bd235033f..61cd704a030041 100644 --- a/config/openiotsdk/cmake/sdk.cmake +++ b/config/openiotsdk/cmake/sdk.cmake @@ -27,7 +27,7 @@ get_filename_component(OPEN_IOT_SDK_STORAGE_SOURCE ${CHIP_ROOT}/third_party/open # Open IoT SDK targets passed to CHIP build list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS) -# Additional Open IoT SDK build configuration +# Additional Open IoT SDK build configuration set(TFM_SUPPORT NO CACHE BOOL "Add Trusted Firmware-M (TF-M) support to application") set(TFM_NS_APP_VERSION "0.0.0" CACHE STRING "TF-M non-secure application version (in the x.x.x format)") set(CONFIG_CHIP_OPEN_IOT_SDK_LWIP_DEBUG NO CACHE BOOL "Enable LwIP debug logs") @@ -82,7 +82,7 @@ if(TFM_SUPPORT) set(TFM_PLATFORM ${OPEN_IOT_SDK_EXAMPLE_COMMON}/tf-m/targets/an552) set(TFM_PSA_FIRMWARE_UPDATE ON) set(MCUBOOT_IMAGE_VERSION_NS ${TFM_NS_APP_VERSION}) - set(TFM_CMAKE_ARGS "-DCONFIG_TFM_ENABLE_FP=ON;-DTFM_PROFILE=profile_medium;-DTFM_EXCEPTION_INFO_DUMP=ON;-DCONFIG_TFM_HALT_ON_CORE_PANIC=ON;-DTFM_ISOLATION_LEVEL=1;-DTFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH=${OPEN_IOT_SDK_CONFIG}/mbedtls/mbedtls_config_psa.h;-DMBEDCRYPTO_BUILD_TYPE=${CMAKE_BUILD_TYPE};-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") + set(TFM_CMAKE_ARGS "-DCONFIG_TFM_ENABLE_FP=ON;-DTFM_PROFILE=profile_medium;-DTFM_EXCEPTION_INFO_DUMP=ON;-DCONFIG_TFM_HALT_ON_CORE_PANIC=ON;-DTFM_ISOLATION_LEVEL=1") if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set(TFM_CMAKE_ARGS "${TFM_CMAKE_ARGS};-DMCUBOOT_LOG_LEVEL=INFO;-DTFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_DEBUG;-DTFM_PARTITION_LOG_LEVEL=TFM_PARTITION_LOG_LEVEL_INFO") else() @@ -117,24 +117,24 @@ endif() # Add RTOS configuration headers # Link cmsis-rtos-api against a concrete implementation if(TARGET cmsis-rtos-api) - target_include_directories(cmsis-core - INTERFACE + target_include_directories(cmsis-core + INTERFACE cmsis-config ) - + target_compile_definitions(cmsis-rtos-api PUBLIC DOMAIN_NS=$,1,0> ) if(TARGET freertos-kernel) - target_include_directories(freertos-kernel - PUBLIC + target_include_directories(freertos-kernel + PUBLIC freertos-config ) - target_link_libraries(freertos-kernel - PUBLIC + target_link_libraries(freertos-kernel + PUBLIC cmsis-core ) @@ -250,6 +250,14 @@ if("cmsis-freertos" IN_LIST IOTSDK_FETCH_LIST) ) endif() +if("mbedtls" IN_LIST IOTSDK_FETCH_LIST) + list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS + mbedtls + mbedtls-config + mbedtls-threading-cmsis-rtos + ) +endif() + if("lwip" IN_LIST IOTSDK_FETCH_LIST) list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS lwipcore @@ -274,15 +282,6 @@ if("trusted-firmware-m" IN_LIST IOTSDK_FETCH_LIST) ) endif() -# Note: Mbed TLS must appear after TF-M otherwise psa from mbed TLS is used -if("mbedtls" IN_LIST IOTSDK_FETCH_LIST) - list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS - mbedtls - mbedtls-config - mbedtls-threading-cmsis-rtos - ) -endif() - # Additional Open IoT SDK port components # Add Open IoT SDK storage source diff --git a/config/openiotsdk/lwip/user_lwipopts.h b/config/openiotsdk/lwip/user_lwipopts.h index 1e02add588ca4c..48d8d4aee81b21 100644 --- a/config/openiotsdk/lwip/user_lwipopts.h +++ b/config/openiotsdk/lwip/user_lwipopts.h @@ -49,11 +49,6 @@ */ #define LWIP_RAW (1) -/** - * Disable DHCP as the IP6 link local address can be used. - */ -#define LWIP_DHCP 0 - #ifdef LWIP_DEBUG // Debug Options diff --git a/config/openiotsdk/mbedtls/mbedtls_config.h b/config/openiotsdk/mbedtls/mbedtls_config.h index b5927a06b63383..316d43c67940d0 100644 --- a/config/openiotsdk/mbedtls/mbedtls_config.h +++ b/config/openiotsdk/mbedtls/mbedtls_config.h @@ -2692,7 +2692,7 @@ * or MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG. * */ -//#define MBEDTLS_PSA_CRYPTO_C +#define MBEDTLS_PSA_CRYPTO_C /** * \def MBEDTLS_PSA_CRYPTO_SE_C @@ -3313,8 +3313,8 @@ //#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ /* ECP options */ -#define MBEDTLS_ECP_WINDOW_SIZE 6 /**< Maximum window size used */ -#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */ +//#define MBEDTLS_ECP_WINDOW_SIZE 4 /**< Maximum window size used */ +//#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */ /* Entropy options */ //#define MBEDTLS_ENTROPY_MAX_SOURCES 20 /**< Maximum number of sources supported */ diff --git a/config/openiotsdk/mbedtls/mbedtls_config_psa.h b/config/openiotsdk/mbedtls/mbedtls_config_psa.h deleted file mode 100644 index c7241ba53228a5..00000000000000 --- a/config/openiotsdk/mbedtls/mbedtls_config_psa.h +++ /dev/null @@ -1,6 +0,0 @@ - -#define MBEDTLS_SHA1_C -#define PSA_WANT_ALG_SHA_1 -#define MBEDTLS_ECP_WINDOW_SIZE 6 /**< Maximum window size used */ -#undef MBEDTLS_ECP_FIXED_POINT_OPTIM -#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */ diff --git a/docs/guides/openiotsdk_examples.md b/docs/guides/openiotsdk_examples.md index add3313e1ae521..2de1915f3ecf43 100644 --- a/docs/guides/openiotsdk_examples.md +++ b/docs/guides/openiotsdk_examples.md @@ -374,42 +374,6 @@ For `TF-M` protected storage use: [Open IoT SDK build script](../../scripts/examples/openiotsdk_example.sh) provides the `-K,--kvsfile` option to use the persistence options listed above. -### Crypto backend - -Open IoT SDK port supports two crypto backend implementations: - -- [Mbed TLS](../guides/openiotsdk_platform_overview.md#mbed-tls) - it's the - default option -- [PSA crypto service](https://tf-m-user-guide.trustedfirmware.org/integration_guide/services/tfm_crypto_integration_guide.html) - from the - [TrustedFirmware-M (TF-M)](../guides/openiotsdk_platform_overview.md#trusted-firmware-m) - component - -The CMake variable `CONFIG_CHIP_CRYPTO` controls how cryptographic operations -are implemented in Matter. It accepts two values: - -- `mbedtls`: use Mbed TLS for crypto operations. -- `psa`: use - [PSA Cryptography API](https://armmbed.github.io/mbed-crypto/html/) for - crypto operations. - -This variable can be set in the main application `CMakeLists.txt`: - -``` -set(CONFIG_CHIP_CRYPTO ) -``` - -The variable can also be defined with CMake CLI: - -``` -cmake -G <...> -DCONFIG_CHIP_CRYPTO= <...> -``` - -> 💡 **Notes**: -> -> The `TF-M PSA crypto` option requires enabling [TF-M](#trusted-firmware-m) -> support. - ## Building You can build examples using the dedicated VSCode task or by calling directly @@ -422,7 +386,6 @@ the build script from the command line. - Select `Build Open IoT SDK example` - Decide on debug mode support - Decide on LwIP debug logs support -- Choose crypto algorithm - Choose example name This will call the script with the selected parameters. @@ -605,12 +568,12 @@ telnet> close ## Specific examples -### Build lock-app example with PSA crypto backend support and run it in the network namespace +### Build lock-app example and run it in the network namespace **Using CLI** ``` -${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh -b psa lock-app +${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh lock-app export TEST_NETWORK_NAME=OIStest @@ -630,7 +593,6 @@ Build example: - Select `Build Open IoT SDK example` - Deny debug mode support `false` - Deny LwIP debug logs support `false` -- Choose crypto algorithm `psa` - Choose example name `lock-app` Setup network environment: @@ -652,12 +614,12 @@ Run example: The example output should be seen in the terminal window. -### Build lock-app example with mbedtls crypto backend support and execute its test in the network namespace +### Build lock-app example and execute its test in the network namespace **Using CLI** ``` -${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh -b mbedtls lock-app +${MATTER_ROOT}/scripts/examples/openiotsdk_example.sh lock-app export TEST_NETWORK_NAME=OIStest @@ -677,7 +639,6 @@ Build example: - Select `Build Open IoT SDK example` - Deny debug mode support `false` - Deny LwIP debug logs support `false` -- Choose crypto algorithm `mbedtls` - Choose example name `lock-app` Setup network environment: @@ -697,7 +658,7 @@ Test example: - Enter network interface `OIStesttap` - Choose example name `lock-app` -### Build lock-app example with mbedtls crypto backend support in debug mode and debug it in the network namespace using the VSCode task +### Build lock-app example in debug mode and debug it in the network namespace using the VSCode task Build example: @@ -706,7 +667,6 @@ Build example: - Select `Build Open IoT SDK example` - Confirm debug mode support `true` - Deny LwIP debug logs support `false` -- Choose crypto algorithm `mbedtls` - Choose example name `lock-app` Setup network environment: @@ -797,7 +757,7 @@ Example: id: build_new_example timeout-minutes: 10 run: | - scripts/examples/openiotsdk_example.sh -b ${{ matrix.cryptoBackend }} new-example + scripts/examples/openiotsdk_example.sh new-example .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ openiotsdk release new-example \ examples/new-example/openiotsdk/build/chip-openiotsdk-new-example-example.elf \ diff --git a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp index dff6a15e21cb93..28b6da91f5c176 100644 --- a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp +++ b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp @@ -27,10 +27,6 @@ #include "iotsdk/ip_network_api.h" #include "mbedtls/platform.h" -#ifdef CONFIG_CHIP_CRYPTO_PSA -#include "psa/crypto.h" -#endif - #include #include #include @@ -183,15 +179,6 @@ int openiotsdk_platform_init(void) return EXIT_FAILURE; } -#ifdef CONFIG_CHIP_CRYPTO_PSA - ret = psa_crypto_init(); - if (ret) - { - ChipLogError(NotSpecified, "PSA crypto initialization failed: %d", ret); - return EXIT_FAILURE; - } -#endif - #ifdef TFM_SUPPORT ret = get_psa_images_details(); if (ret != 0) diff --git a/scripts/build/BUILD.gn b/scripts/build/BUILD.gn index 0e716ae7e9b390..11ea4e9b721e84 100644 --- a/scripts/build/BUILD.gn +++ b/scripts/build/BUILD.gn @@ -31,8 +31,8 @@ pw_python_package("build_examples") { "testdata/dry_run_linux-arm64-ota-requestor-nodeps-ipv6only.txt", "testdata/dry_run_linux-x64-all-clusters-coverage.txt", "testdata/dry_run_nrf-nrf52840dk-pump.txt", - "testdata/dry_run_openiotsdk-lock-mbedtls.txt", - "testdata/dry_run_openiotsdk-shell-mbedtls.txt", + "testdata/dry_run_openiotsdk-lock.txt", + "testdata/dry_run_openiotsdk-shell.txt", ] sources = [ diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 43eed69236dcdf..279191e45d1bf9 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -28,7 +28,7 @@ from builders.mbed import MbedApp, MbedBoard, MbedBuilder, MbedProfile from builders.mw320 import MW320App, MW320Builder from builders.nrf import NrfApp, NrfBoard, NrfConnectBuilder -from builders.openiotsdk import OpenIotSdkApp, OpenIotSdkBuilder, OpenIotSdkCryptoBackend +from builders.openiotsdk import OpenIotSdkApp, OpenIotSdkBuilder from builders.qpg import QpgApp, QpgBoard, QpgBuilder from builders.telink import TelinkApp, TelinkBoard, TelinkBuilder from builders.ti import TIApp, TIBoard, TIBuilder @@ -679,10 +679,6 @@ def BuildOpenIotSdkTargets(): TargetPart('lock', app=OpenIotSdkApp.LOCK), ]) - # Modifiers - target.AppendModifier('mbedtls', crypto=OpenIotSdkCryptoBackend.MBEDTLS).ExceptIfRe('-(psa)') - target.AppendModifier('psa', crypto=OpenIotSdkCryptoBackend.PSA).ExceptIfRe('-(mbedtls)') - return target diff --git a/scripts/build/builders/openiotsdk.py b/scripts/build/builders/openiotsdk.py index 89aad6a59e9a16..7f3cd682d86ba3 100644 --- a/scripts/build/builders/openiotsdk.py +++ b/scripts/build/builders/openiotsdk.py @@ -42,29 +42,13 @@ def AppNamePrefix(self): raise Exception('Unknown app type: %r' % self) -class OpenIotSdkCryptoBackend(Enum): - PSA = auto() - MBEDTLS = auto() - - @property - def CryptoBackendName(self): - if self == OpenIotSdkCryptoBackend.PSA: - return 'psa' - elif self == OpenIotSdkCryptoBackend.MBEDTLS: - return 'mbedtls' - else: - raise Exception('Unknown crypto backend type: %r' % self) - - class OpenIotSdkBuilder(Builder): def __init__(self, root, runner, - app: OpenIotSdkApp = OpenIotSdkApp.SHELL, - crypto: OpenIotSdkCryptoBackend = OpenIotSdkCryptoBackend.MBEDTLS): + app: OpenIotSdkApp = OpenIotSdkApp.SHELL): super(OpenIotSdkBuilder, self).__init__(root, runner) self.app = app - self.crypto = crypto self.toolchain_path = os.path.join( 'toolchains', 'toolchain-arm-none-eabi-gcc.cmake') self.system_processor = 'cortex-m55' @@ -81,8 +65,6 @@ def generate(self): '-DCMAKE_SYSTEM_PROCESSOR={}'.format( self.system_processor), '-DCMAKE_BUILD_TYPE=Release', - '-DCONFIG_CHIP_CRYPTO={}'.format( - self.crypto.CryptoBackendName), ], title='Generating ' + self.identifier) def _build(self): diff --git a/scripts/build/test.py b/scripts/build/test.py index c89a4d98109357..70fca73f082f7b 100644 --- a/scripts/build/test.py +++ b/scripts/build/test.py @@ -109,8 +109,8 @@ def test_general_dry_runs(self): 'android-arm64-chip-tool', 'nrf-nrf52840dk-pump', 'efr32-brd4161a-light-rpc-no-version', - 'openiotsdk-lock-mbedtls', - 'openiotsdk-shell-mbedtls' + 'openiotsdk-lock', + 'openiotsdk-shell' ] for target in TARGETS: diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 5ef536ac1bbfdf..1b8c95d4c51c7d 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -22,4 +22,4 @@ nrf-native-posix-64-tests qpg-qpg6105-{lock,light,shell,persistent-storage} tizen-arm-{all-clusters,all-clusters-minimal,chip-tool,light,tests}[-no-ble][-no-thread][-no-wifi][-asan][-ubsan] telink-tlsr9518adk80d-{all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,temperature-measurement,thermostat,window-covering}[-shell][-rpc][-factory-data] -openiotsdk-{shell,lock}[-mbedtls][-psa] +openiotsdk-{shell,lock} diff --git a/scripts/build/testdata/dry_run_openiotsdk-lock-mbedtls.txt b/scripts/build/testdata/dry_run_openiotsdk-lock-mbedtls.txt deleted file mode 100644 index 77816cf664190c..00000000000000 --- a/scripts/build/testdata/dry_run_openiotsdk-lock-mbedtls.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Commands will be run in CHIP project root. -cd "{root}" - -# Generating openiotsdk-lock-mbedtls -cmake -GNinja -S {root}/examples/lock-app/openiotsdk -B {out}/openiotsdk-lock-mbedtls --toolchain=toolchains/toolchain-arm-none-eabi-gcc.cmake -DCMAKE_SYSTEM_PROCESSOR=cortex-m55 -DCMAKE_BUILD_TYPE=Release -DCONFIG_CHIP_CRYPTO=mbedtls - -# Building openiotsdk-lock-mbedtls -cmake --build {out}/openiotsdk-lock-mbedtls diff --git a/scripts/build/testdata/dry_run_openiotsdk-lock.txt b/scripts/build/testdata/dry_run_openiotsdk-lock.txt new file mode 100644 index 00000000000000..a0c36ee27f53ad --- /dev/null +++ b/scripts/build/testdata/dry_run_openiotsdk-lock.txt @@ -0,0 +1,8 @@ +# Commands will be run in CHIP project root. +cd "{root}" + +# Generating openiotsdk-lock +cmake -GNinja -S {root}/examples/lock-app/openiotsdk -B {out}/openiotsdk-lock --toolchain=toolchains/toolchain-arm-none-eabi-gcc.cmake -DCMAKE_SYSTEM_PROCESSOR=cortex-m55 -DCMAKE_BUILD_TYPE=Release + +# Building openiotsdk-lock +cmake --build {out}/openiotsdk-lock diff --git a/scripts/build/testdata/dry_run_openiotsdk-shell-mbedtls.txt b/scripts/build/testdata/dry_run_openiotsdk-shell-mbedtls.txt deleted file mode 100644 index 70438c5fe091bd..00000000000000 --- a/scripts/build/testdata/dry_run_openiotsdk-shell-mbedtls.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Commands will be run in CHIP project root. -cd "{root}" - -# Generating openiotsdk-shell-mbedtls -cmake -GNinja -S {root}/examples/shell/openiotsdk -B {out}/openiotsdk-shell-mbedtls --toolchain=toolchains/toolchain-arm-none-eabi-gcc.cmake -DCMAKE_SYSTEM_PROCESSOR=cortex-m55 -DCMAKE_BUILD_TYPE=Release -DCONFIG_CHIP_CRYPTO=mbedtls - -# Building openiotsdk-shell-mbedtls -cmake --build {out}/openiotsdk-shell-mbedtls diff --git a/scripts/build/testdata/dry_run_openiotsdk-shell.txt b/scripts/build/testdata/dry_run_openiotsdk-shell.txt new file mode 100644 index 00000000000000..6c7c63befb4e7a --- /dev/null +++ b/scripts/build/testdata/dry_run_openiotsdk-shell.txt @@ -0,0 +1,8 @@ +# Commands will be run in CHIP project root. +cd "{root}" + +# Generating openiotsdk-shell +cmake -GNinja -S {root}/examples/shell/openiotsdk -B {out}/openiotsdk-shell --toolchain=toolchains/toolchain-arm-none-eabi-gcc.cmake -DCMAKE_SYSTEM_PROCESSOR=cortex-m55 -DCMAKE_BUILD_TYPE=Release + +# Building openiotsdk-shell +cmake --build {out}/openiotsdk-shell diff --git a/scripts/examples/openiotsdk_example.sh b/scripts/examples/openiotsdk_example.sh index 1f3dcd1d8d11f1..6b19a8be7f04e7 100755 --- a/scripts/examples/openiotsdk_example.sh +++ b/scripts/examples/openiotsdk_example.sh @@ -43,7 +43,6 @@ IS_UNIT_TEST=0 FVP_NETWORK="user" KVS_STORAGE_TYPE="tdb" KVS_STORAGE_FILE="" -CRYPTO_BACKEND="mbedtls" declare -A tdb_storage_param=([instance]=sram [memspace]=0 [address]=0x0 [size]=0x100000) declare -A ps_storage_param=([instance]=qspi_sram [memspace]=0 [address]=0x660000 [size]=0x12000) @@ -67,7 +66,6 @@ Options: -d,--debug Build in debug mode -l,--lwipdebug Build with LwIP debug logs support -k,--kvsstore Select KVS storage type - -b,--backend -p,--path Build path -K,--kvsfile Path to KVS storage file which will be used to ensure persistence -n,--network FVP network interface name @@ -136,8 +134,6 @@ function build_with_cmake() { BUILD_OPTIONS+=(-DCONFIG_CHIP_OPEN_IOT_SDK_USE_PSA_PS=YES) fi - BUILD_OPTIONS+=(-DCONFIG_CHIP_CRYPTO="$CRYPTO_BACKEND") - cmake -G Ninja -S "$EXAMPLE_PATH" -B "$BUILD_PATH" --toolchain="$TOOLCHAIN_PATH" "${BUILD_OPTIONS[@]}" cmake --build "$BUILD_PATH" } @@ -272,8 +268,8 @@ function run_test() { fi } -SHORT=C:,p:,d:,l:,b:,n:,k:,K:,c,s,h -LONG=command:,path:,debug:,lwipdebug:,backend:,network:,kvsstore:,kvsfile:,clean,scratch,help +SHORT=C:,p:,d:,l:,n:,k:,K:,c,s,h +LONG=command:,path:,debug:,lwipdebug:,network:,kvsstore:,kvsfile:,clean,scratch,help OPTS=$(getopt -n build --options "$SHORT" --longoptions "$LONG" -- "$@") eval set -- "$OPTS" @@ -312,10 +308,6 @@ while :; do KVS_STORAGE_FILE=$2 shift 2 ;; - -b | --backend) - CRYPTO_BACKEND=$2 - shift 2 - ;; -p | --path) BUILD_PATH=$CHIP_ROOT/$2 shift 2 @@ -388,15 +380,6 @@ case "$KVS_STORAGE_TYPE" in ;; esac -case "$CRYPTO_BACKEND" in - psa | mbedtls) ;; - *) - echo "Wrong crypto type definition" - show_usage - exit 2 - ;; -esac - TOOLCHAIN_PATH="toolchains/toolchain-$TOOLCHAIN.cmake" if [ -z "$BUILD_PATH" ]; then From e73ed3a241b72448a4bbfd5373d28159482806d1 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Wed, 21 Jun 2023 15:14:41 -0400 Subject: [PATCH 30/36] Missed adding retries to 4 spots, spotted failures (#27397) * Updating retry, and adding a retry to start * Pinning * Adding retries to them all * Trying to roll this back, it keeps failing... * Reverting to the newer one * Missed 4 caches, which are failing :) --- .github/workflows/cirque.yaml | 29 +++++++++++++-------- .github/workflows/examples-bouffalolab.yaml | 18 ++++++++----- .github/workflows/examples-efr32.yaml | 18 ++++++++----- 3 files changed, 40 insertions(+), 25 deletions(-) diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 5a05c8a1675162..680c246e644654 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -65,15 +65,18 @@ jobs: - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 - if: ${{ !env.ACT }} + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 15 run: | @@ -87,11 +90,15 @@ jobs: - name: Get Cirque Bootstrap cache key id: cirque-bootstrap-cache-key run: echo "val=$(scripts/tests/cirque_tests.sh cachekeyhash)" >> $GITHUB_OUTPUT - - name: Cirque Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Cirque Bootstrap cache if: ${{ !env.ACT }} + timeout-minutes: 20 with: + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | key: ${{ runner.os }}-cirque-${{ steps.cirque-bootstrap-cache-key.outputs.val }} restore-keys: ${{ runner.os }}-cirque- path: ${{ env.GITHUB_CACHE_PATH }} diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 06aa13a49bf8f5..c93c0103b07723 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -59,14 +59,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 0cf3185f3152aa..459fa53f25c4aa 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -65,14 +65,18 @@ jobs: GH_CONTEXT: ${{ toJson(github) }} run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}" - - name: Bootstrap cache - uses: buildjet/cache@v3 - timeout-minutes: 10 + - uses: Wandalen/wretry.action@v1.0.41 + name: Bootstrap cache + timeout-minutes: 20 with: - key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} - path: | - .environment - build_overrides/pigweed_environment.gni + action: buildjet/cache@v3 + attempt_limit: 3 + attempt_delay: 2000 + with: | + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni - name: Bootstrap timeout-minutes: 25 run: bash scripts/bootstrap.sh From 9cf7d369baf9f34f98652e1eac1b5a59cfa0d60a Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Wed, 21 Jun 2023 15:21:10 -0400 Subject: [PATCH 31/36] Disable flaky test found here: https://github.com/project-chip/connectedhomeip/issues/27361 (#27395) --- .github/workflows/java-tests.yaml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index 66564dbe449295..e26f3281a6b352 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -200,18 +200,19 @@ jobs: --tool-args "already-discovered --nodeid 1 --setup-pin-code 20202021 --address ::1 --port 5540 -t 1000" \ --factoryreset \ ' - - name: Run Pairing Address-PaseOnly Test - timeout-minutes: 25 - run: | - scripts/run_in_build_env.sh \ - './scripts/tests/run_java_test.py \ - --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ - --app-args "--discriminator 3840 --interface-id -1" \ - --tool-path out/linux-x64-java-matter-controller \ - --tool-cluster "pairing" \ - --tool-args "address-paseonly --nodeid 1 --setup-pin-code 20202021 --address ::1 --port 5540 -t 1000" \ - --factoryreset \ - ' + # Disabled due to failure: https://github.com/project-chip/connectedhomeip/issues/27361 + # - name: Run Pairing Address-PaseOnly Test + # timeout-minutes: 25 + # run: | + # scripts/run_in_build_env.sh \ + # './scripts/tests/run_java_test.py \ + # --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \ + # --app-args "--discriminator 3840 --interface-id -1" \ + # --tool-path out/linux-x64-java-matter-controller \ + # --tool-cluster "pairing" \ + # --tool-args "address-paseonly --nodeid 1 --setup-pin-code 20202021 --address ::1 --port 5540 -t 1000" \ + # --factoryreset \ + # ' - name: Run Pairing SetupQRCode Test timeout-minutes: 25 run: | From 9d20e295ea3a346485016a223d463756a374c14d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 21 Jun 2023 18:47:13 -0400 Subject: [PATCH 32/36] Update Darwin availability annotations for MTRDeviceAttestationDeviceInfo. (#27393) These properties are going into a known release. --- src/darwin/Framework/CHIP/MTRDeviceAttestationDelegate.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceAttestationDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceAttestationDelegate.h index 889ba88096e69e..fb456d2ac0f8ed 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceAttestationDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceAttestationDelegate.h @@ -42,14 +42,15 @@ NS_ASSUME_NONNULL_BEGIN * for device attestation. If attestation succeeds, this must match the vendor * ID from the certification declaration. */ -@property (nonatomic, readonly) NSNumber * basicInformationVendorID MTR_NEWLY_AVAILABLE; +@property (nonatomic, readonly) NSNumber * basicInformationVendorID API_AVAILABLE(ios(16.6), macos(13.5), watchos(9.6), tvos(16.6)); /** * The product ID value from the device's Basic Information cluster that was * used for device attestation. If attestation succeeds, this must match one of * the product IDs from the certification declaration. */ -@property (nonatomic, readonly) NSNumber * basicInformationProductID MTR_NEWLY_AVAILABLE; +@property (nonatomic, readonly) NSNumber * basicInformationProductID API_AVAILABLE(ios(16.6), macos(13.5), watchos(9.6), tvos(16.6)) + ; @property (nonatomic, readonly) MTRCertificateDERBytes dacCertificate; @property (nonatomic, readonly) MTRCertificateDERBytes dacPAICertificate; From 509a55cb5d711fa0df339fe135f426190ea0b00d Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 21 Jun 2023 19:13:31 -0400 Subject: [PATCH 33/36] Make bootstrap.sh more friendly to other shells. (#27392) * Make bootstrap.sh more friendly to other shells. I found some CI systems trying to use dash, and that does not seem to work at all due to it not understanding '<<<' or `[[`. Dash is still not ok because overall because arguments to `.` do not get passed along, however it would work as a default. Changes: - loop using IFS (and set sh_word_split for ZSH) - replaced `[[` tests with `[` * Restyle * Remove quoting logic that breaks execution * Stop restyling bootstrap.sh * Fix path * Do not permanently alter zsh options, use local_options * update sh_word_split to shwordsplit. Both seem to work, the non-underscore seems more common in docs --- .restyled.yaml | 1 + scripts/setup/bootstrap.sh | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.restyled.yaml b/.restyled.yaml index a57f9ce75a838a..32a77fee6fe5f9 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -80,6 +80,7 @@ exclude: - "zzz_generated/**/*" # already clang-formatted by our zap tooling - "src/controller/java/generated/java/**/*" # not formatted: generated files - "src/controller/java/zap-generated/**/*" # not formatted: generated files + - "scripts/setup/bootstrap.sh" # tries to quote loop variable changed_paths: diff --git a/scripts/setup/bootstrap.sh b/scripts/setup/bootstrap.sh index 925183b9e3f353..2fea8adc8f702d 100644 --- a/scripts/setup/bootstrap.sh +++ b/scripts/setup/bootstrap.sh @@ -19,7 +19,7 @@ _install_additional_pip_requirements() { shift # figure out additional pip install items - while [[ $# -gt 0 ]]; do + while [ $# -gt 0 ]; do case $1 in -p | --platform) _SETUP_PLATFORM=$2 @@ -32,13 +32,14 @@ _install_additional_pip_requirements() { esac done - if ! [ -z "$_SETUP_PLATFORM" ]; then + if [ -n "$_SETUP_PLATFORM" ]; then + _OLD_IFS=$IFS + IFS="," if [ -n "$ZSH_VERSION" ]; then - IFS="," read -r -A _PLATFORMS <<<"$_SETUP_PLATFORM" - else - IFS="," read -r -a _PLATFORMS <<<"$_SETUP_PLATFORM" + setopt local_options shwordsplit fi - for platform in "${_PLATFORMS[@]}"; do + + for platform in ${_SETUP_PLATFORM}; do # Allow none as an alias of nothing extra installed (like -p none) if [ "$platform" != "none" ]; then echo "Installing pip requirements for $platform..." @@ -47,6 +48,8 @@ _install_additional_pip_requirements() { -c "$_CHIP_ROOT/scripts/setup/constraints.txt" fi done + IFS=$_OLD_IFS + unset _OLD_IFS unset _PLATFORMS fi From a816538e932cfa1d13891d7f103b6c2dd23a28ff Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Wed, 21 Jun 2023 21:27:33 -0400 Subject: [PATCH 34/36] =?UTF-8?q?Updating=20our=20issue=20template=20to=20?= =?UTF-8?q?add=20build=20issue,=20and=20fancier=20emoji!=20=F0=9F=A7=99?= =?UTF-8?q?=F0=9F=8F=BB=20(#27404)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/002-1.0-issue.yaml | 2 +- .github/ISSUE_TEMPLATE/003-1.1-issue.yaml | 2 +- .github/ISSUE_TEMPLATE/004-1.2-issue.yaml | 2 +- .github/ISSUE_TEMPLATE/005-1.3-issue.yaml | 2 +- .github/ISSUE_TEMPLATE/050-tooling-fix.yaml | 2 +- .github/ISSUE_TEMPLATE/060-platform-fix.yaml | 2 +- .github/ISSUE_TEMPLATE/091-cert-blocker.yaml | 2 +- .github/ISSUE_TEMPLATE/098-build-issue.yaml | 59 ++++++++++++++++++++ 8 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/098-build-issue.yaml diff --git a/.github/ISSUE_TEMPLATE/002-1.0-issue.yaml b/.github/ISSUE_TEMPLATE/002-1.0-issue.yaml index 78c0e9cf10a766..10551fef60fe44 100644 --- a/.github/ISSUE_TEMPLATE/002-1.0-issue.yaml +++ b/.github/ISSUE_TEMPLATE/002-1.0-issue.yaml @@ -1,4 +1,4 @@ -name: "\U0001F680 1.0 Issue" +name: "\u0030\u20e3 1.0 Issue" description: Create an issue that is required for Matter 1.0 release title: "[1.0] " labels: [bug, "V1.0", "needs triage"] diff --git a/.github/ISSUE_TEMPLATE/003-1.1-issue.yaml b/.github/ISSUE_TEMPLATE/003-1.1-issue.yaml index cd6179d91fe6c7..50db3e80a95c33 100644 --- a/.github/ISSUE_TEMPLATE/003-1.1-issue.yaml +++ b/.github/ISSUE_TEMPLATE/003-1.1-issue.yaml @@ -1,4 +1,4 @@ -name: "\U0001F680 1.1 Issue" +name: "\u0031\u20e3 1.1 Issue" description: Create an issue that is required for Matter 1.1 release title: "[1.1] " labels: [bug, "V1.1", "needs triage"] diff --git a/.github/ISSUE_TEMPLATE/004-1.2-issue.yaml b/.github/ISSUE_TEMPLATE/004-1.2-issue.yaml index dd67cd7addbdea..81b641a52e45ef 100644 --- a/.github/ISSUE_TEMPLATE/004-1.2-issue.yaml +++ b/.github/ISSUE_TEMPLATE/004-1.2-issue.yaml @@ -1,4 +1,4 @@ -name: "\U0001F680 1.2 Issue" +name: "\u0032\u20e3 1.2 Issue" description: Create an issue that is required for Matter 1.2 release title: "[1.2] " labels: [bug, "V1.2", "needs triage"] diff --git a/.github/ISSUE_TEMPLATE/005-1.3-issue.yaml b/.github/ISSUE_TEMPLATE/005-1.3-issue.yaml index a904231a9e6020..5c91f91e75b3be 100644 --- a/.github/ISSUE_TEMPLATE/005-1.3-issue.yaml +++ b/.github/ISSUE_TEMPLATE/005-1.3-issue.yaml @@ -1,4 +1,4 @@ -name: "\U0001F680 1.3 Issue" +name: "\u0033\u20e3 1.3 Issue" description: Create an issue that is required for Matter 1.3 release title: "[1.3] " labels: [bug, "V1.3", "needs triage"] diff --git a/.github/ISSUE_TEMPLATE/050-tooling-fix.yaml b/.github/ISSUE_TEMPLATE/050-tooling-fix.yaml index 667c8946b2804e..0d775a61ef119d 100644 --- a/.github/ISSUE_TEMPLATE/050-tooling-fix.yaml +++ b/.github/ISSUE_TEMPLATE/050-tooling-fix.yaml @@ -1,4 +1,4 @@ -name: "\U0001F3C3 Tooling Fix/Feature" +name: "\U0001F9F0 Tooling Fix/Feature" description: Create an issue for a tooling specific fix/feature title: "[Tooling] " labels: ["tools", "needs triage"] diff --git a/.github/ISSUE_TEMPLATE/060-platform-fix.yaml b/.github/ISSUE_TEMPLATE/060-platform-fix.yaml index 691a5cedc6f604..fdb8b76d88f2ec 100644 --- a/.github/ISSUE_TEMPLATE/060-platform-fix.yaml +++ b/.github/ISSUE_TEMPLATE/060-platform-fix.yaml @@ -1,4 +1,4 @@ -name: "\U0001F9F0 Platform Fix" +name: "\U0001F3D7 Platform Fix" description: Create an issue for a platform specific fix title: "[Platform] " labels: ["platform", "needs triage"] diff --git a/.github/ISSUE_TEMPLATE/091-cert-blocker.yaml b/.github/ISSUE_TEMPLATE/091-cert-blocker.yaml index bf24349cd393be..d0d6aa6f90b307 100644 --- a/.github/ISSUE_TEMPLATE/091-cert-blocker.yaml +++ b/.github/ISSUE_TEMPLATE/091-cert-blocker.yaml @@ -1,4 +1,4 @@ -name: "\U0001F41B Cert Blocker" +name: "\U0001F4DC Cert Blocker" description: Create a report to identify matter certification blockers title: "[CERT-BLOCKER] " labels: [bug, "cert blocker", "needs triage"] diff --git a/.github/ISSUE_TEMPLATE/098-build-issue.yaml b/.github/ISSUE_TEMPLATE/098-build-issue.yaml new file mode 100644 index 00000000000000..5d1adb35548657 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/098-build-issue.yaml @@ -0,0 +1,59 @@ +name: "\U0001F6E0 Build Issue" +description: Build issue +title: "[Build] " +labels: ["build issue", "needs triage"] +body: + - type: markdown + attributes: + value: | + Thanks for reporting an issue against the Matter SDK's builds! We need information about the bug report to follow up, so please help us out by filling out this information. + - type: textarea + id: repro + attributes: + label: Build issue(s) + description: "What are the build issues? Please include links to failed jobs if possible." + value: | + 1. + 2. + 3. + ... + validations: + required: true + - type: dropdown + attributes: + label: Platform + description: What platforms are affected? + multiple: true + options: + - ameba + - android + - cc13x2_cc26x2 + - darwin + - efr32 + - esp32 + - freeRTOS + - IMX8 + - k32w + - nrf connect + - nrf + - python + - raspi + - vscode + - windows + - other + - core (please add to version below) + - all + validations: + required: false + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false + - type: markdown + attributes: + value: "Thanks for helping improve our builds" From 71d7a957ae033dd25a99dae9bdcce61dd2160a47 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav <69809379+jadhavrohit924@users.noreply.github.com> Date: Thu, 22 Jun 2023 13:16:53 +0530 Subject: [PATCH 35/36] [ESP32] Add API to create user defined size of endpoint array (#27341) * [ESP32] Add API to create user defined size of endpoint array * Restyled by clang-format * Address review comments * Update comment Co-authored-by: Boris Zbarsky --------- Co-authored-by: Restyled.io Co-authored-by: Boris Zbarsky --- examples/all-clusters-app/esp32/main/main.cpp | 7 ++++++ .../static-supported-modes-manager.cpp | 23 ++++++++++++++---- .../static-supported-modes-manager.h | 24 ++++++++++++++----- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index 4f4450c882767c..f3a593c2c53144 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #if CONFIG_HAVE_DISPLAY @@ -127,6 +128,12 @@ static void InitServer(intptr_t context) #if CONFIG_DEVICE_TYPE_M5STACK SetupPretendDevices(); #endif + err = app::Clusters::ModeSelect::StaticSupportedModesManager::getStaticSupportedModesManagerInstance().InitEndpointArray( + FIXED_ENDPOINT_COUNT); + if (err != CHIP_NO_ERROR) + { + ESP_LOGE(TAG, "Failed to initialize endpoint array for supported-modes, err:%" CHIP_ERROR_FORMAT, err.Format()); + } } extern "C" void app_main() diff --git a/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp b/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp index ed85f1068661f8..d06a8b8b7dc809 100644 --- a/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp +++ b/examples/platform/esp32/mode-support/static-supported-modes-manager.cpp @@ -31,16 +31,31 @@ using SemanticTag = Structs::SemanticTagStruct::Type; template using List = app::DataModel::List; +SupportedModesManager::ModeOptionsProvider * StaticSupportedModesManager::epModeOptionsProviderList = nullptr; + const StaticSupportedModesManager StaticSupportedModesManager::instance = StaticSupportedModesManager(); -SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::epModeOptionsProviderList[FIXED_ENDPOINT_COUNT]; +int StaticSupportedModesManager::mSize = 0; -void StaticSupportedModesManager::InitEndpointArray() +CHIP_ERROR StaticSupportedModesManager::InitEndpointArray(int size) { - for (int i = 0; i < FIXED_ENDPOINT_COUNT; i++) + if (epModeOptionsProviderList != nullptr) + { + ChipLogError(Zcl, "Cannot allocate epModeOptionsProviderList"); + return CHIP_ERROR_INCORRECT_STATE; + } + mSize = size; + epModeOptionsProviderList = new SupportedModesManager::ModeOptionsProvider[mSize]; + if (epModeOptionsProviderList == nullptr) + { + ChipLogError(Zcl, "Failed to allocate memory to epModeOptionsProviderList"); + return CHIP_ERROR_NO_MEMORY; + } + for (int i = 0; i < mSize; i++) { epModeOptionsProviderList[i] = ModeOptionsProvider(); } + return CHIP_NO_ERROR; } SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::getModeOptionsProvider(EndpointId endpointId) const @@ -181,7 +196,7 @@ Status StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointI const ModeSelect::SupportedModesManager * ModeSelect::getSupportedModesManager() { - return &StaticSupportedModesManager::instance; + return &StaticSupportedModesManager::getStaticSupportedModesManagerInstance(); } void StaticSupportedModesManager::FreeSupportedModes(EndpointId endpointId) const diff --git a/examples/platform/esp32/mode-support/static-supported-modes-manager.h b/examples/platform/esp32/mode-support/static-supported-modes-manager.h index 689c9d059f4ab7..985fb805cf682f 100644 --- a/examples/platform/esp32/mode-support/static-supported-modes-manager.h +++ b/examples/platform/esp32/mode-support/static-supported-modes-manager.h @@ -31,16 +31,28 @@ class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::Supp private: using ModeOptionStructType = Structs::ModeOptionStruct::Type; using SemanticTag = Structs::SemanticTagStruct::Type; + static int mSize; - static ModeOptionsProvider epModeOptionsProviderList[FIXED_ENDPOINT_COUNT]; - - void InitEndpointArray(); + static ModeOptionsProvider * epModeOptionsProviderList; void FreeSupportedModes(EndpointId endpointId) const; -public: static const StaticSupportedModesManager instance; +public: + // InitEndpointArray should be called only once in the application. Memory allocated to the + // epModeOptionsProviderList will be needed for the lifetime of the program, so it's never deallocated. + static CHIP_ERROR InitEndpointArray(int size); + + // DeInitEndpointArray should be called only when application need to reallocate memory of + // epModeOptionsProviderList ( Eg. Bridges ). + static void DeInitEndpointArray() + { + delete[] epModeOptionsProviderList; + epModeOptionsProviderList = nullptr; + mSize = 0; + } + SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override; Protocols::InteractionModel::Status getModeOptionByMode(EndpointId endpointId, uint8_t mode, @@ -48,11 +60,11 @@ class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::Supp void CleanUp(EndpointId endpointId) const; - StaticSupportedModesManager() { InitEndpointArray(); } + StaticSupportedModesManager() {} ~StaticSupportedModesManager() { - for (int i = 0; i < FIXED_ENDPOINT_COUNT; i++) + for (int i = 0; i < mSize; i++) { FreeSupportedModes(i); } From c2629281badbe28a78730d9b7d9c4743574b3485 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Thu, 22 Jun 2023 05:09:29 -0400 Subject: [PATCH 36/36] Fixing iMX Build (#27402) --- .github/workflows/docker_img.yaml | 3 --- .github/workflows/examples-linux-imx.yaml | 2 +- integrations/docker/images/chip-build-imx/Dockerfile | 5 +++++ integrations/docker/images/chip-build/version | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker_img.yaml b/.github/workflows/docker_img.yaml index 02df12d569d98f..1f4e270cd20a4c 100644 --- a/.github/workflows/docker_img.yaml +++ b/.github/workflows/docker_img.yaml @@ -43,10 +43,7 @@ jobs: - "-esp32-qemu" - "-infineon" # NOTE: imx image requires too much space for GitHub-hosted runners. It fails with: - # ``` - # .... # ApplyLayer exit status 1 stdout: stderr: write /opt/fsl-imx-xwayland/5.15-kirkstone/sysroots/armv8a-poky-linux/opt/ltp/testcases/bin/fanotify15: no space left on device - # ``` # - "-imx" - "-k32w" - "-mbed-os" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 1c0756692b4574..d13c181853a1f7 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-imx:0.7.3 + image: connectedhomeip/chip-build-imx:0.7.19.1 steps: - uses: Wandalen/wretry.action@v1.0.41 diff --git a/integrations/docker/images/chip-build-imx/Dockerfile b/integrations/docker/images/chip-build-imx/Dockerfile index 815d3512d907e9..ab2f826d981578 100644 --- a/integrations/docker/images/chip-build-imx/Dockerfile +++ b/integrations/docker/images/chip-build-imx/Dockerfile @@ -14,6 +14,11 @@ RUN set -x \ && ./fsl-imx-xwayland-glibc-x86_64-imx-image-multimedia-armv8a-imx8mmevk-toolchain-5.15-kirkstone.sh -y \ && rm -rf fsl-imx-xwayland-glibc-x86_64-imx-image-multimedia-armv8a-imx8mmevk-toolchain-5.15-kirkstone.sh \ && : # last line +RUN set -x \ + && cd /opt/fsl-imx-xwayland \ + # && find . -iname debug -exec rm -rf "{}" + || true \ + && find . -iname ".debug" -exec rm -rf "{}" + || true \ + && : # last line FROM connectedhomeip/chip-build:${VERSION} diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index ac763ad69843b3..598aa9e3ce84d8 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.7.18 Version bump reason: vscode ZEPHYR SDK env path update +0.7.19.1 Version bump reason: Reducing size of imx