diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index 6c90152405e60e..fd06d7f93632a6 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -209,23 +209,20 @@ def target_for_name(name: str): return TestTarget.ALL_CLUSTERS -def tests_with_command(chip_tool: str, is_manual: bool, is_chip_tool_python_only: bool = False): +def tests_with_command(chip_tool: str, is_manual: bool): """Executes `chip_tool` binary to see what tests are available, using cmd to get the list. """ cmd = "list" if is_manual: cmd += "-manual" - elif is_chip_tool_python_only: - cmd += "-python-runner-only" result = subprocess.run([chip_tool, "tests", cmd], capture_output=True) + result.check_returncode() test_tags = set() if is_manual: test_tags.add(TestTag.MANUAL) - if is_chip_tool_python_only: - test_tags.add(TestTag.CHIP_TOOL_PYTHON_ONLY) in_development_tests = [s.replace(".yaml", "") for s in _GetInDevelopmentTests()] @@ -243,9 +240,7 @@ def tests_with_command(chip_tool: str, is_manual: bool, is_chip_tool_python_only ) -# TODO We will move away from hardcoded list of yamltests to run all file when yamltests -# parser/runner reaches parity with the code gen version. -def _hardcoded_python_yaml_tests(): +def _AllFoundYamlTests(treat_repl_unsupported_as_in_development: bool): manual_tests = _GetManualTests() flaky_tests = _GetFlakyTests() slow_tests = _GetSlowTests() @@ -269,7 +264,7 @@ def _hardcoded_python_yaml_tests(): if path.name in in_development_tests: tags.add(TestTag.IN_DEVELOPMENT) - if path.name in chip_repl_unsupported_tests: + if treat_repl_unsupported_as_in_development and path.name in chip_repl_unsupported_tests: tags.add(TestTag.IN_DEVELOPMENT) yield TestDefinition( @@ -280,8 +275,13 @@ def _hardcoded_python_yaml_tests(): ) -def AllYamlTests(): - for test in _hardcoded_python_yaml_tests(): +def AllReplYamlTests(): + for test in _AllFoundYamlTests(treat_repl_unsupported_as_in_development=True): + yield test + + +def AllChipToolYamlTests(): + for test in _AllFoundYamlTests(treat_repl_unsupported_as_in_development=False): yield test @@ -292,9 +292,6 @@ def AllChipToolTests(chip_tool: str): for test in tests_with_command(chip_tool, is_manual=True): yield test - for test in tests_with_command(chip_tool, is_manual=False, is_chip_tool_python_only=True): - yield test - __all__ = [ "TestTarget", diff --git a/scripts/tests/run_test_suite.py b/scripts/tests/run_test_suite.py index 7493539e2c2e4c..dc126b4e471314 100755 --- a/scripts/tests/run_test_suite.py +++ b/scripts/tests/run_test_suite.py @@ -159,7 +159,9 @@ def main(context, dry_run, log_level, target, target_glob, target_skip_glob, # Figures out selected test that match the given name(s) if runtime == TestRunTime.CHIP_REPL_PYTHON: - all_tests = [test for test in chiptest.AllYamlTests()] + all_tests = [test for test in chiptest.AllReplYamlTests()] + elif runtime == TestRunTime.CHIP_TOOL_PYTHON: + all_tests = [test for test in chiptest.AllChipToolYamlTests()] else: all_tests = [test for test in chiptest.AllChipToolTests(chip_tool)] diff --git a/src/app/tests/suites/pythonRunnerOnlyTests.json b/src/app/tests/suites/pythonRunnerOnlyTests.json deleted file mode 100644 index 64c8257e2862d0..00000000000000 --- a/src/app/tests/suites/pythonRunnerOnlyTests.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "Groups": ["TestGroupKeyManagementCluster"], - "Others": ["TestEqualities"], - "collection": ["Groups", "Others"] -} diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h deleted file mode 100644 index 2a9d7e662791ea..00000000000000 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ /dev/null @@ -1,144272 +0,0 @@ -/* - * - * Copyright (c) 2022 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 IS GENERATED BY ZAP - -#pragma once - -#if CONFIG_ENABLE_YAML_TESTS - -#include -#include -#include -#include -#include - -#include // For INFINITY - -class TestList : public Command -{ -public: - TestList() : Command("list"){}; - CHIP_ERROR Run() override - { - printf("TestAccessControlCluster\n"); - printf("Test_TC_ACL_1_1\n"); - printf("Test_TC_ACL_2_1\n"); - printf("Test_TC_ACL_2_3\n"); - printf("Test_TC_ACL_2_4\n"); - printf("Test_TC_ACL_2_5\n"); - printf("Test_TC_ACL_2_6\n"); - printf("Test_TC_ACL_2_7\n"); - printf("Test_TC_ACL_2_8\n"); - printf("Test_TC_ACL_2_9\n"); - printf("Test_TC_ACL_2_10\n"); - printf("Test_TC_ACE_1_1\n"); - printf("Test_TC_ACE_1_5\n"); - printf("Test_TC_AIRQUAL_1_1\n"); - printf("Test_TC_AIRQUAL_2_1\n"); - printf("Test_TC_BOOL_1_1\n"); - printf("Test_TC_BOOL_2_1\n"); - printf("Test_TC_BRBINFO_1_1\n"); - printf("Test_TC_ACT_1_1\n"); - printf("Test_TC_BIND_1_1\n"); - printf("Test_TC_CC_1_1\n"); - printf("Test_TC_CC_2_1\n"); - printf("Test_TC_CC_3_2\n"); - printf("Test_TC_CC_3_3\n"); - printf("Test_TC_CC_4_1\n"); - printf("Test_TC_CC_4_2\n"); - printf("Test_TC_CC_4_3\n"); - printf("Test_TC_CC_4_4\n"); - printf("Test_TC_CC_5_1\n"); - printf("Test_TC_CC_5_2\n"); - printf("Test_TC_CC_5_3\n"); - printf("Test_TC_CC_6_1\n"); - printf("Test_TC_CC_6_2\n"); - printf("Test_TC_CC_6_3\n"); - printf("Test_TC_CC_6_5\n"); - printf("Test_TC_CC_7_2\n"); - printf("Test_TC_CC_7_3\n"); - printf("Test_TC_CC_7_4\n"); - printf("Test_TC_CC_8_1\n"); - printf("TestColorControl_9_1\n"); - printf("TestColorControl_9_2\n"); - printf("Test_TC_CDOCONC_1_1\n"); - printf("Test_TC_CDOCONC_2_1\n"); - printf("Test_TC_CMOCONC_1_1\n"); - printf("Test_TC_CMOCONC_2_1\n"); - printf("Test_TC_FLDCONC_1_1\n"); - printf("Test_TC_FLDCONC_2_1\n"); - printf("Test_TC_NDOCONC_1_1\n"); - printf("Test_TC_NDOCONC_2_1\n"); - printf("Test_TC_OZCONC_1_1\n"); - printf("Test_TC_OZCONC_2_1\n"); - printf("Test_TC_PMHCONC_1_1\n"); - printf("Test_TC_PMHCONC_2_1\n"); - printf("Test_TC_PMICONC_1_1\n"); - printf("Test_TC_PMICONC_2_1\n"); - printf("Test_TC_PMKCONC_1_1\n"); - printf("Test_TC_PMKCONC_2_1\n"); - printf("Test_TC_RNCONC_1_1\n"); - printf("Test_TC_RNCONC_2_1\n"); - printf("Test_TC_TVOCCONC_1_1\n"); - printf("Test_TC_TVOCCONC_2_1\n"); - printf("TestIcdManagementCluster\n"); - printf("Test_TC_OPCREDS_1_2\n"); - printf("Test_TC_BINFO_1_1\n"); - printf("Test_TC_BINFO_2_1\n"); - printf("Test_TC_BINFO_2_2\n"); - printf("Test_TC_CNET_1_3\n"); - printf("Test_TC_DESC_1_1\n"); - printf("Test_TC_DLOG_1_1\n"); - printf("Test_TC_DGETH_1_1\n"); - printf("Test_TC_DGETH_2_1\n"); - printf("Test_TC_DGETH_2_2\n"); - printf("Test_TC_FLW_1_1\n"); - 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_6\n"); - printf("Test_TC_CGEN_1_1\n"); - printf("Test_TC_CGEN_2_1\n"); - printf("Test_TC_DGGEN_1_1\n"); - printf("Test_TC_GRPKEY_1_1\n"); - printf("Test_TC_GRPKEY_2_2\n"); - printf("Test_TC_ICDM_1_1\n"); - printf("Test_TC_ICDM_2_1\n"); - printf("Test_TC_I_1_1\n"); - printf("Test_TC_I_2_1\n"); - printf("Test_TC_I_2_2\n"); - printf("Test_TC_I_2_3\n"); - printf("Test_TC_ILL_1_1\n"); - printf("Test_TC_ILL_2_1\n"); - printf("Test_TC_ILL_2_2\n"); - printf("Test_TC_LVL_1_1\n"); - printf("Test_TC_LVL_2_1\n"); - printf("Test_TC_LVL_2_2\n"); - printf("Test_TC_LVL_3_1\n"); - 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"); - printf("Test_TC_LTIME_1_2\n"); - printf("Test_TC_LTIME_3_1\n"); - printf("Test_TC_LWM_1_1\n"); - printf("Test_TC_LWM_2_1\n"); - printf("Test_TC_LOWPOWER_1_1\n"); - printf("Test_TC_KEYPADINPUT_1_2\n"); - printf("Test_TC_APPLAUNCHER_1_3\n"); - printf("Test_TC_MEDIAINPUT_1_4\n"); - printf("Test_TC_WAKEONLAN_1_5\n"); - printf("Test_TC_CHANNEL_1_6\n"); - printf("Test_TC_MEDIAPLAYBACK_1_7\n"); - printf("Test_TC_AUDIOOUTPUT_1_8\n"); - printf("Test_TC_TGTNAV_1_9\n"); - printf("Test_TC_APBSC_1_10\n"); - printf("Test_TC_CONTENTLAUNCHER_1_11\n"); - printf("Test_TC_ALOGIN_1_12\n"); - printf("Test_TC_LOWPOWER_2_1\n"); - printf("Test_TC_KEYPADINPUT_3_2\n"); - printf("Test_TC_KEYPADINPUT_3_3\n"); - printf("Test_TC_APPLAUNCHER_3_5\n"); - printf("Test_TC_APPLAUNCHER_3_6\n"); - printf("Test_TC_APPLAUNCHER_3_7\n"); - printf("Test_TC_MEDIAINPUT_3_10\n"); - printf("Test_TC_MEDIAINPUT_3_11\n"); - printf("Test_TC_MEDIAINPUT_3_12\n"); - printf("Test_TC_MEDIAINPUT_3_13\n"); - printf("Test_TC_CHANNEL_5_1\n"); - printf("Test_TC_CHANNEL_5_2\n"); - printf("Test_TC_CHANNEL_5_3\n"); - printf("Test_TC_MEDIAPLAYBACK_6_1\n"); - printf("Test_TC_MEDIAPLAYBACK_6_2\n"); - printf("Test_TC_MEDIAPLAYBACK_6_3\n"); - printf("Test_TC_MEDIAPLAYBACK_6_4\n"); - printf("Test_TC_AUDIOOUTPUT_7_1\n"); - printf("Test_TC_AUDIOOUTPUT_7_2\n"); - printf("Test_TC_TGTNAV_8_1\n"); - printf("Test_TC_APBSC_9_1\n"); - printf("Test_TC_CONTENTLAUNCHER_10_1\n"); - printf("Test_TC_WAKEONLAN_4_1\n"); - printf("Test_TC_ALOGIN_12_1\n"); - printf("Test_TC_CONTENTLAUNCHER_10_3\n"); - printf("Test_TC_CONTENTLAUNCHER_10_5\n"); - printf("Test_TC_CONTENTLAUNCHER_10_7\n"); - printf("Test_TC_MOD_1_1\n"); - printf("OTA_SuccessfulTransfer\n"); - printf("Test_TC_OCC_1_1\n"); - printf("Test_TC_OCC_2_1\n"); - printf("Test_TC_OCC_2_3\n"); - printf("Test_TC_OO_1_1\n"); - printf("Test_TC_OO_2_1\n"); - printf("Test_TC_OO_2_2\n"); - printf("Test_TC_OO_2_4\n"); - printf("Test_TC_OPSTATE_1_1\n"); - printf("Test_TC_OPSTATE_2_4\n"); - printf("Test_TC_PS_1_1\n"); - printf("Test_TC_PS_2_1\n"); - printf("Test_TC_PRS_1_1\n"); - printf("Test_TC_PRS_2_1\n"); - printf("Test_TC_PRS_2_2\n"); - printf("Test_TC_PCC_1_1\n"); - printf("Test_TC_PCC_2_1\n"); - printf("Test_TC_PCC_2_2\n"); - printf("Test_TC_PCC_2_3\n"); - printf("Test_TC_PCC_2_4\n"); - printf("Test_TC_PSCFG_1_1\n"); - printf("Test_TC_PSCFG_2_1\n"); - printf("Test_TC_REFALM_1_1\n"); - printf("Test_TC_RH_1_1\n"); - printf("Test_TC_RH_2_1\n"); - printf("Test_TC_SMOKECO_1_1\n"); - printf("Test_TC_SMOKECO_2_1\n"); - printf("Test_TC_SMOKECO_2_2\n"); - printf("Test_TC_SMOKECO_2_3\n"); - printf("Test_TC_SMOKECO_2_4\n"); - printf("Test_TC_SMOKECO_2_5\n"); - printf("Test_TC_SMOKECO_2_6\n"); - printf("Test_TC_SWTCH_1_1\n"); - printf("Test_TC_SWTCH_2_1\n"); - printf("Test_TC_RVCOPSTATE_1_1\n"); - printf("Test_TC_TCCM_1_1\n"); - printf("Test_TC_TCTL_1_1\n"); - printf("Test_TC_TMP_1_1\n"); - printf("Test_TC_TMP_2_1\n"); - printf("Test_TC_TSTAT_1_1\n"); - printf("Test_TC_TSTAT_2_1\n"); - printf("Test_TC_TSUIC_1_1\n"); - printf("Test_TC_TSUIC_2_1\n"); - printf("Test_TC_TSUIC_2_2\n"); - printf("Test_TC_DGTHREAD_1_1\n"); - printf("Test_TC_DGTHREAD_2_1\n"); - printf("Test_TC_DGTHREAD_2_2\n"); - printf("Test_TC_DGTHREAD_2_3\n"); - printf("Test_TC_DGTHREAD_2_4\n"); - printf("Test_TC_TIMESYNC_1_1\n"); - printf("Test_TC_TIMESYNC_2_3\n"); - printf("Test_TC_ULABEL_1_1\n"); - printf("Test_TC_ULABEL_2_1\n"); - printf("Test_TC_ULABEL_2_2\n"); - printf("Test_TC_ULABEL_2_3\n"); - printf("Test_TC_ULABEL_2_4\n"); - printf("Test_TC_DGWIFI_1_1\n"); - printf("Test_TC_DGWIFI_2_1\n"); - printf("Test_TC_DGWIFI_2_3\n"); - printf("Test_TC_WNCV_1_1\n"); - printf("Test_TC_WNCV_2_1\n"); - printf("Test_TC_WNCV_2_2\n"); - printf("Test_TC_WNCV_2_3\n"); - printf("Test_TC_WNCV_2_5\n"); - printf("Test_TC_WNCV_3_1\n"); - printf("Test_TC_WNCV_3_2\n"); - printf("Test_TC_WNCV_3_3\n"); - printf("Test_TC_WNCV_3_4\n"); - printf("Test_TC_WNCV_3_5\n"); - printf("Test_TC_WNCV_4_1\n"); - printf("Test_TC_WNCV_4_2\n"); - printf("Test_TC_WNCV_4_3\n"); - printf("Test_TC_WNCV_4_4\n"); - printf("Test_TC_WNCV_4_5\n"); - printf("TV_TargetNavigatorCluster\n"); - printf("TV_AudioOutputCluster\n"); - printf("TV_ApplicationLauncherCluster\n"); - printf("TV_KeypadInputCluster\n"); - printf("TV_AccountLoginCluster\n"); - printf("TV_WakeOnLanCluster\n"); - printf("TV_ApplicationBasicCluster\n"); - printf("TV_MediaPlaybackCluster\n"); - printf("TV_ChannelCluster\n"); - printf("TV_LowPowerCluster\n"); - printf("TV_ContentLauncherCluster\n"); - printf("TV_MediaInputCluster\n"); - printf("TestCASERecovery\n"); - printf("TestCluster\n"); - printf("TestClusterComplexTypes\n"); - printf("TestConstraints\n"); - printf("TestDelayCommands\n"); - printf("TestEvents\n"); - printf("TestDiscovery\n"); - printf("TestLogCommands\n"); - printf("TestSaveAs\n"); - printf("TestConfigVariables\n"); - printf("TestDescriptorCluster\n"); - printf("TestBasicInformation\n"); - printf("TestFabricRemovalWhileSubscribed\n"); - printf("TestGeneralCommissioning\n"); - printf("TestIdentifyCluster\n"); - printf("TestOperationalCredentialsCluster\n"); - printf("TestModeSelectCluster\n"); - printf("TestTemperatureControl\n"); - printf("TestSelfFabricRemoval\n"); - printf("TestSystemCommands\n"); - printf("TestBinding\n"); - printf("TestUserLabelCluster\n"); - printf("TestUserLabelClusterConstraints\n"); - printf("TestArmFailSafe\n"); - printf("TestFanControl\n"); - printf("TestAccessControlConstraints\n"); - printf("TestLevelControlWithOnOffDependency\n"); - printf("TestCommissioningWindow\n"); - printf("TestCommissionerNodeId\n"); - printf("TestTimeSynchronization\n"); - printf("TestOperationalState\n"); - printf("TestRVCOperationalState\n"); - printf("TestDishwasherAlarm\n"); - printf("TestMultiAdmin\n"); - printf("Test_TC_DGSW_1_1\n"); - printf("TestSubscribe_OnOff\n"); - printf("TestSubscribe_AdministratorCommissioning\n"); - printf("DL_UsersAndCredentials\n"); - printf("DL_LockUnlock\n"); - printf("DL_Schedules\n"); - printf("Test_TC_DRLK_1_1\n"); - printf("Test_TC_DRLK_2_4\n"); - printf("Test_TC_DRLK_2_5\n"); - printf("Test_TC_DRLK_2_6\n"); - printf("Test_TC_DRLK_2_7\n"); - printf("Test_TC_DRLK_2_8\n"); - printf("Test_TC_DRLK_2_11\n"); - printf("TestGroupMessaging\n"); - printf("TestGroupsCluster\n"); - printf("Test_TC_G_1_1\n"); - printf("Test_TC_G_2_1\n"); - printf("TestActivatedCarbonFilterMonitoring\n"); - printf("TestHepaFilterMonitoring\n"); - printf("Test_TC_ACFREMON_1_1\n"); - printf("Test_TC_ACFREMON_2_1\n"); - printf("Test_TC_HEPAFREMON_1_1\n"); - printf("Test_TC_HEPAFREMON_2_1\n"); - - return CHIP_NO_ERROR; - } -}; - -class ManualTestList : public Command -{ -public: - ManualTestList() : Command("list-manual"){}; - CHIP_ERROR Run() override - { - printf("Test_TC_DD_1_5\n"); - printf("Test_TC_DD_1_6\n"); - printf("Test_TC_DD_1_7\n"); - printf("Test_TC_DD_1_8\n"); - printf("Test_TC_DD_1_9\n"); - printf("Test_TC_DD_1_10\n"); - printf("Test_TC_DD_1_11\n"); - printf("Test_TC_DD_1_12\n"); - printf("Test_TC_DD_1_13\n"); - printf("Test_TC_DD_1_14\n"); - printf("Test_TC_DD_1_15\n"); - printf("Test_TC_DD_2_1\n"); - printf("Test_TC_DD_2_2\n"); - printf("Test_TC_DD_3_1\n"); - printf("Test_TC_DD_3_2\n"); - printf("Test_TC_DD_3_3\n"); - printf("Test_TC_DD_3_4\n"); - printf("Test_TC_DD_3_5\n"); - printf("Test_TC_DD_3_6\n"); - printf("Test_TC_DD_3_7\n"); - printf("Test_TC_DD_3_8\n"); - printf("Test_TC_DD_3_9\n"); - printf("Test_TC_DD_3_10\n"); - printf("Test_TC_DD_3_11\n"); - printf("Test_TC_DD_3_12\n"); - printf("Test_TC_DD_3_13\n"); - printf("Test_TC_DD_3_14\n"); - printf("Test_TC_DD_3_15\n"); - printf("Test_TC_DD_3_16\n"); - printf("Test_TC_DD_3_17\n"); - printf("Test_TC_DD_3_18\n"); - printf("Test_TC_DD_3_19\n"); - printf("Test_TC_DD_3_20\n"); - printf("Test_TC_DD_3_21\n"); - printf("TestGroupDemoCommand\n"); - printf("TestGroupDemoConfig\n"); - printf("Test_TC_G_2_2\n"); - printf("Test_TC_G_2_3\n"); - printf("Test_TC_G_2_4\n"); - printf("Test_TC_G_3_2\n"); - printf("Test_TC_BDX_1_1\n"); - printf("Test_TC_BDX_1_2\n"); - printf("Test_TC_BDX_1_3\n"); - printf("Test_TC_BDX_1_4\n"); - printf("Test_TC_BDX_1_5\n"); - printf("Test_TC_BDX_1_6\n"); - printf("Test_TC_BDX_2_1\n"); - printf("Test_TC_BDX_2_2\n"); - printf("Test_TC_BDX_2_3\n"); - printf("Test_TC_BDX_2_4\n"); - printf("Test_TC_BDX_2_5\n"); - printf("Test_TC_BR_1\n"); - printf("Test_TC_BR_2\n"); - printf("Test_TC_BR_3\n"); - printf("Test_TC_BR_4\n"); - printf("Test_TC_DA_1_1\n"); - printf("Test_TC_DA_1_3\n"); - printf("Test_TC_DA_1_4\n"); - printf("Test_TC_DA_1_6\n"); - printf("Test_TC_DA_1_8\n"); - printf("Test_TC_BINFO_3_1\n"); - printf("Test_TC_OPCREDS_3_1\n"); - printf("Test_TC_OPCREDS_3_2\n"); - printf("Test_TC_OPCREDS_3_3\n"); - printf("Test_TC_OPCREDS_3_4\n"); - printf("Test_TC_OPCREDS_3_5\n"); - printf("Test_TC_OPCREDS_3_6\n"); - printf("Test_TC_CNET_4_1\n"); - printf("Test_TC_CNET_4_2\n"); - printf("Test_TC_CNET_4_3\n"); - printf("Test_TC_CNET_4_4\n"); - printf("Test_TC_CNET_4_5\n"); - printf("Test_TC_CNET_4_6\n"); - printf("Test_TC_CNET_4_9\n"); - printf("Test_TC_CNET_4_10\n"); - printf("Test_TC_CNET_4_11\n"); - printf("Test_TC_CNET_4_12\n"); - printf("Test_TC_CNET_4_13\n"); - printf("Test_TC_CNET_4_14\n"); - printf("Test_TC_CNET_4_15\n"); - printf("Test_TC_CNET_4_16\n"); - printf("Test_TC_CNET_4_20\n"); - printf("Test_TC_CNET_4_21\n"); - printf("Test_TC_CNET_4_22\n"); - printf("Test_TC_DLOG_2_1\n"); - printf("Test_TC_DLOG_2_2\n"); - printf("Test_TC_DLOG_3_1\n"); - printf("Test_TC_DISHALM_1_1\n"); - printf("Test_TC_DISHALM_2_1\n"); - printf("Test_TC_DISHALM_3_1\n"); - printf("Test_TC_DISHALM_3_2\n"); - printf("Test_TC_DISHALM_3_3\n"); - printf("Test_TC_DISHALM_3_4\n"); - printf("Test_TC_DISHALM_3_5\n"); - printf("Test_TC_DISHALM_3_6\n"); - printf("Test_TC_DISHM_1_1\n"); - printf("Test_TC_DISHM_1_2\n"); - printf("Test_TC_DISHM_2_1\n"); - printf("Test_TC_DISHM_3_1\n"); - printf("Test_TC_DISHM_3_2\n"); - printf("Test_TC_DISHM_3_3\n"); - printf("Test_TC_DESC_2_1\n"); - printf("Test_TC_CGEN_2_2\n"); - printf("Test_TC_DGGEN_2_2\n"); - printf("Test_TC_ICDM_2_2\n"); - printf("Test_TC_ICDM_2_3\n"); - printf("Test_TC_I_3_2\n"); - printf("Test_TC_IDM_1_1\n"); - printf("Test_TC_IDM_2_1\n"); - printf("Test_TC_IDM_2_2\n"); - printf("Test_TC_IDM_3_1\n"); - printf("Test_TC_IDM_3_2\n"); - printf("Test_TC_IDM_4_1\n"); - printf("Test_TC_IDM_4_2\n"); - printf("Test_TC_IDM_4_3\n"); - printf("Test_TC_IDM_4_4\n"); - printf("Test_TC_IDM_5_1\n"); - printf("Test_TC_IDM_5_2\n"); - printf("Test_TC_IDM_6_1\n"); - printf("Test_TC_IDM_6_2\n"); - printf("Test_TC_IDM_6_3\n"); - printf("Test_TC_IDM_6_4\n"); - printf("Test_TC_IDM_7_1\n"); - printf("Test_TC_IDM_8_1\n"); - printf("Test_TC_IDM_10_1\n"); - printf("Test_TC_IDM_11_1\n"); - printf("Test_TC_LOWPOWER_2_2\n"); - printf("Test_TC_APPLAUNCHER_3_7_1\n"); - printf("Test_TC_APPLAUNCHER_3_8_1\n"); - printf("Test_TC_APPLAUNCHER_3_9_1\n"); - printf("Test_TC_MEDIAINPUT_3_14\n"); - printf("Test_TC_MEDIAINPUT_3_15\n"); - printf("Test_TC_MEDIAINPUT_3_16\n"); - printf("Test_TC_MEDIAINPUT_3_17\n"); - printf("Test_TC_CHANNEL_5_4\n"); - printf("Test_TC_CHANNEL_5_5\n"); - printf("Test_TC_CHANNEL_5_6\n"); - printf("Test_TC_KEYPADINPUT_3_1\n"); - printf("Test_TC_MEDIAPLAYBACK_6_5\n"); - printf("Test_TC_MEDIAPLAYBACK_6_7\n"); - printf("Test_TC_AUDIOOUTPUT_7_3\n"); - printf("Test_TC_AUDIOOUTPUT_7_4\n"); - printf("Test_TC_CONTENTLAUNCHER_10_4\n"); - printf("Test_TC_MC_11_1\n"); - printf("Test_TC_MC_11_2\n"); - printf("Test_TC_ALOGIN_12_2\n"); - printf("Test_TC_TGTNAV_8_2\n"); - printf("Test_TC_CADMIN_1_1\n"); - printf("Test_TC_CADMIN_1_2\n"); - printf("Test_TC_CADMIN_1_7\n"); - printf("Test_TC_CADMIN_1_8\n"); - printf("Test_TC_CADMIN_1_11\n"); - printf("Test_TC_CADMIN_1_12\n"); - printf("Test_TC_CADMIN_1_14\n"); - printf("Test_TC_CADMIN_1_15\n"); - printf("Test_TC_CADMIN_1_16\n"); - printf("Test_TC_CADMIN_1_17\n"); - printf("Test_TC_CADMIN_1_18\n"); - printf("Test_TC_CADMIN_1_19\n"); - printf("Test_TC_CADMIN_1_20\n"); - printf("Test_TC_CADMIN_1_21\n"); - printf("Test_TC_CADMIN_1_22\n"); - printf("Test_TC_CADMIN_1_3\n"); - printf("Test_TC_CADMIN_1_4\n"); - printf("Test_TC_CADMIN_1_5\n"); - printf("Test_TC_CADMIN_1_6\n"); - printf("Test_TC_CADMIN_1_9\n"); - printf("Test_TC_CADMIN_1_10\n"); - printf("Test_TC_CADMIN_1_13\n"); - printf("Test_TC_CADMIN_1_23\n"); - printf("Test_TC_CADMIN_1_24\n"); - printf("Test_TC_CADMIN_1_25\n"); - printf("Test_TC_CADMIN_1_26\n"); - printf("Test_TC_MOD_1_2\n"); - printf("Test_TC_MOD_1_3\n"); - printf("Test_TC_MOD_2_2\n"); - printf("Test_TC_SU_1_1\n"); - printf("Test_TC_SU_2_1\n"); - printf("Test_TC_SU_2_2\n"); - printf("Test_TC_SU_2_3\n"); - printf("Test_TC_SU_2_4\n"); - printf("Test_TC_SU_2_5\n"); - printf("Test_TC_SU_2_6\n"); - printf("Test_TC_SU_2_7\n"); - printf("Test_TC_SU_2_8\n"); - printf("Test_TC_SU_3_1\n"); - printf("Test_TC_SU_3_2\n"); - printf("Test_TC_SU_3_3\n"); - printf("Test_TC_SU_3_4\n"); - printf("Test_TC_SU_4_1\n"); - printf("Test_TC_SU_4_2\n"); - printf("Test_TC_PSCFG_2_2\n"); - printf("Test_TC_SC_1_1\n"); - printf("Test_TC_SC_1_2\n"); - printf("Test_TC_SC_1_3\n"); - printf("Test_TC_SC_1_4\n"); - printf("Test_TC_SC_2_1\n"); - printf("Test_TC_SC_2_2\n"); - printf("Test_TC_SC_2_3\n"); - printf("Test_TC_SC_2_4\n"); - printf("Test_TC_SC_3_1\n"); - printf("Test_TC_SC_3_2\n"); - printf("Test_TC_SC_3_3\n"); - printf("Test_TC_SC_3_4\n"); - printf("Test_TC_SC_4_1\n"); - printf("Test_TC_SC_4_2\n"); - printf("Test_TC_SC_4_3\n"); - printf("Test_TC_SC_4_4\n"); - printf("Test_TC_SC_4_5\n"); - printf("Test_TC_SC_4_6\n"); - printf("Test_TC_SC_4_7\n"); - printf("Test_TC_SC_4_8\n"); - printf("Test_TC_SC_4_9\n"); - printf("Test_TC_SC_4_10\n"); - printf("Test_TC_SC_5_3\n"); - printf("Test_TC_SC_6_1\n"); - printf("Test_TC_DGSW_2_1\n"); - printf("Test_TC_DGSW_2_2\n"); - printf("Test_TC_DGSW_2_3\n"); - printf("Test_TC_DGWIFI_2_2\n"); - printf("Test_TC_FLW_2_2\n"); - printf("Test_TC_OCC_3_1\n"); - printf("Test_TC_PS_2_2\n"); - printf("Test_TC_PS_3_1\n"); - printf("Test_TC_BOOL_2_2\n"); - printf("Test_TC_CC_3_1\n"); - printf("Test_TC_CC_7_1\n"); - printf("Test_TC_CC_9_1\n"); - printf("Test_TC_CC_9_2\n"); - printf("Test_TC_CC_9_3\n"); - printf("Test_TC_DRLK_2_10\n"); - printf("Test_TC_DRLK_3_2\n"); - printf("Test_TC_LWM_1_2\n"); - printf("Test_TC_LWM_3_2\n"); - printf("Test_TC_OO_2_3\n"); - printf("Test_TC_OPSTATE_2_1\n"); - printf("Test_TC_OPSTATE_2_2\n"); - printf("Test_TC_OPSTATE_2_3\n"); - printf("Test_TC_RH_2_2\n"); - printf("Test_TC_REFALM_2_1\n"); - printf("Test_TC_REFALM_2_2\n"); - printf("Test_TC_REFALM_2_3\n"); - printf("Test_TC_RVCCLEANM_3_3\n"); - printf("Test_TC_RVCOPSTATE_2_2\n"); - printf("Test_TC_RVCRUNM_1_1\n"); - printf("Test_TC_RVCRUNM_3_1\n"); - printf("Test_TC_RVCRUNM_3_3\n"); - printf("Test_TC_SWTCH_2_2\n"); - printf("Test_TC_SWTCH_3_2\n"); - printf("Test_TC_TCCM_1_2\n"); - printf("Test_TC_TCCM_2_1\n"); - printf("Test_TC_TCCM_3_1\n"); - printf("Test_TC_TCCM_3_2\n"); - printf("Test_TC_TCCM_3_3\n"); - printf("Test_TC_TCTL_2_1\n"); - printf("Test_TC_TCTL_2_2\n"); - printf("Test_TC_TCTL_2_3\n"); - printf("Test_TC_TCTL_3_2\n"); - printf("Test_TC_TCTL_3_3\n"); - printf("Test_TC_TMP_2_2\n"); - printf("Test_TC_TSTAT_3_2\n"); - printf("Test_TC_DGTHREAD_2_5\n"); - printf("Test_TC_ACT_2_1\n"); - printf("Test_TC_ACT_2_2\n"); - printf("Test_TC_ACT_3_2\n"); - printf("Test_TC_BIND_2_1\n"); - printf("Test_TC_BIND_2_2\n"); - printf("Test_TC_BIND_2_3\n"); - printf("Test_TC_S_1_1\n"); - printf("Test_TC_S_2_1\n"); - printf("Test_TC_S_2_5\n"); - printf("Test_TC_S_2_6\n"); - printf("Test_TC_BRBINFO_2_2\n"); - printf("Test_TC_BRBINFO_3_1\n"); - printf("Test_TC_WASHERCTRL_1_1\n"); - printf("Test_TC_WASHERCTRL_2_1\n"); - printf("Test_TC_WASHERCTRL_2_2\n"); - printf("Test_TC_WASHERCTRL_3_1\n"); - printf("Test_TC_WASHERCTRL_3_2\n"); - - return CHIP_NO_ERROR; - } -}; - -class PythonRunnerOnlyTestList : public Command -{ -public: - PythonRunnerOnlyTestList() : Command("list-python-runner-only"){}; - CHIP_ERROR Run() override - { - printf("TestGroupKeyManagementCluster\n"); - printf("TestEqualities\n"); - - return CHIP_NO_ERROR; - } -}; - -class TestAccessControlClusterSuite : public TestCommand -{ -public: - TestAccessControlClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestAccessControlCluster", 24, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestAccessControlClusterSuite() {} - - 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::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[0].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 0U)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[0].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 1UL)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].targets.Value()", iter_3, 2)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[2].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[0].targets.Value()[2].cluster.Value()", iter_3.GetValue().cluster.Value(), 2UL)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[2].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[0].targets.Value()[2].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 3U)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[2].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[0].targets.Value()", iter_3, 3)); - } - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_3.GetValue(), 4ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_3.GetValue(), 5ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_3.GetValue(), 6ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_3.GetValue(), 7ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[1].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[1].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 8U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 9UL)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 2)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[2].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[2].cluster.Value()", iter_3.GetValue().cluster.Value(), 10UL)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[2].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[2].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 11U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[2].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[1].targets.Value()", iter_3, 3)); - } - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); - VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 3U)); - VerifyOrReturn(CheckValueNonNull("acl[2].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[0]", iter_3.GetValue(), 12ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[1]", iter_3.GetValue(), 13ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[2]", iter_3.GetValue(), 14ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[3]", iter_3.GetValue(), 15ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[2].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[2].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 16U)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 17UL)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 2)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[2].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[2].cluster.Value()", iter_3.GetValue().cluster.Value(), 18UL)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[2].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[2].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 19U)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[2].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[2].targets.Value()", iter_3, 3)); - } - VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 3)); - VerifyOrReturn(CheckValue("acl[3].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[3].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[3].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[3].subjects.Value()[0]", iter_3.GetValue(), 20ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[3].subjects.Value()[1]", iter_3.GetValue(), 21ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[3].subjects.Value()[2]", iter_3.GetValue(), 22ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[3].subjects.Value()[3]", iter_3.GetValue(), 23ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[3].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[3].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNull("acl[3].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[3].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[3].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 24U)); - VerifyOrReturn(CheckValueNull("acl[3].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[3].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[3].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 25UL)); - VerifyOrReturn(CheckValueNull("acl[3].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[3].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].targets.Value()", iter_3, 2)); - VerifyOrReturn(CheckValueNonNull("acl[3].targets.Value()[2].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[3].targets.Value()[2].cluster.Value()", iter_3.GetValue().cluster.Value(), 26UL)); - VerifyOrReturn(CheckValueNonNull("acl[3].targets.Value()[2].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[3].targets.Value()[2].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 27U)); - VerifyOrReturn(CheckValueNull("acl[3].targets.Value()[2].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[3].targets.Value()", iter_3, 3)); - } - VerifyOrReturn(CheckValue("acl[3].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 4)); - } - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[1].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 2)); - } - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - 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)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[0].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 0U)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[0].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 1UL)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].targets.Value()", iter_3, 2)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[2].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[0].targets.Value()[2].cluster.Value()", iter_3.GetValue().cluster.Value(), 2UL)); - VerifyOrReturn(CheckValueNonNull("acl[0].targets.Value()[2].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[0].targets.Value()[2].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 3U)); - VerifyOrReturn(CheckValueNull("acl[0].targets.Value()[2].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[0].targets.Value()", iter_3, 3)); - } - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_3.GetValue(), 4ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_3.GetValue(), 5ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_3.GetValue(), 6ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_3.GetValue(), 7ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[1].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[1].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 8U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 9UL)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 2)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[2].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[2].cluster.Value()", iter_3.GetValue().cluster.Value(), 10UL)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[2].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[2].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 11U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[2].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[1].targets.Value()", iter_3, 3)); - } - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); - VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 3U)); - VerifyOrReturn(CheckValueNonNull("acl[2].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[0]", iter_3.GetValue(), 12ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[1]", iter_3.GetValue(), 13ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[2]", iter_3.GetValue(), 14ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[3]", iter_3.GetValue(), 15ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[2].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[2].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 16U)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 17UL)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 2)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[2].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[2].cluster.Value()", iter_3.GetValue().cluster.Value(), 18UL)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[2].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[2].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 19U)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[2].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[2].targets.Value()", iter_3, 3)); - } - VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 3)); - VerifyOrReturn(CheckValue("acl[3].privilege", iter_0.GetValue().privilege, 1U)); - VerifyOrReturn(CheckValue("acl[3].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[3].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[3].subjects.Value()[0]", iter_3.GetValue(), 20ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[3].subjects.Value()[1]", iter_3.GetValue(), 21ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[3].subjects.Value()[2]", iter_3.GetValue(), 22ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[3].subjects.Value()[3]", iter_3.GetValue(), 23ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[3].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[3].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNull("acl[3].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn(CheckValueNonNull("acl[3].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[3].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 24U)); - VerifyOrReturn(CheckValueNull("acl[3].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[3].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[3].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 25UL)); - VerifyOrReturn(CheckValueNull("acl[3].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNull("acl[3].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[3].targets.Value()", iter_3, 2)); - VerifyOrReturn(CheckValueNonNull("acl[3].targets.Value()[2].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[3].targets.Value()[2].cluster.Value()", iter_3.GetValue().cluster.Value(), 26UL)); - VerifyOrReturn(CheckValueNonNull("acl[3].targets.Value()[2].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[3].targets.Value()[2].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 27U)); - VerifyOrReturn(CheckValueNull("acl[3].targets.Value()[2].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[3].targets.Value()", iter_3, 3)); - } - VerifyOrReturn(CheckValue("acl[3].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 4)); - } - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[0].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 3U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); - } - 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 commissionee"); - 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, "Write entries"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(4); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 1UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 2UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 3U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 3); - } - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 4ULL; - listHolder_3->mList[1] = 5ULL; - listHolder_3->mList[2] = 6ULL; - listHolder_3->mList[3] = 7ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 8U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 9UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 10UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 11U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 3); - } - listHolder_0->mList[1].fabricIndex = 0U; - - listHolder_0->mList[2].privilege = - static_cast(3); - listHolder_0->mList[2].authMode = - static_cast(3); - listHolder_0->mList[2].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 12ULL; - listHolder_3->mList[1] = 13ULL; - listHolder_3->mList[2] = 14ULL; - listHolder_3->mList[3] = 15ULL; - listHolder_0->mList[2].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[2].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 16U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 17UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 18UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 19U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[2].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 3); - } - listHolder_0->mList[2].fabricIndex = 0U; - - listHolder_0->mList[3].privilege = - static_cast(3); - listHolder_0->mList[3].authMode = - static_cast(2); - listHolder_0->mList[3].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 20ULL; - listHolder_3->mList[1] = 21ULL; - listHolder_3->mList[2] = 22ULL; - listHolder_3->mList[3] = 23ULL; - listHolder_0->mList[3].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[3].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 24U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 25UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 26UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 27U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[3].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 3); - } - listHolder_0->mList[3].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 4); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Verify"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Write entries empty lists"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(); - listHolder_0->mList[1].targets.SetNonNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List(); - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Verify"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Write entry invalid privilege"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(5); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Verify"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Write entry invalid auth mode"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(1); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 8: { - LogStep(8, "Verify"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Write entry invalid subject"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 0ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 10: { - LogStep(10, "Verify"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Write entry invalid target"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNull(); - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 12: { - LogStep(12, "Verify"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Write entry too many subjects"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(20); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 1ULL; - listHolder_3->mList[1] = 2ULL; - listHolder_3->mList[2] = 3ULL; - listHolder_3->mList[3] = 4ULL; - listHolder_3->mList[4] = 5ULL; - listHolder_3->mList[5] = 6ULL; - listHolder_3->mList[6] = 7ULL; - listHolder_3->mList[7] = 8ULL; - listHolder_3->mList[8] = 9ULL; - listHolder_3->mList[9] = 10ULL; - listHolder_3->mList[10] = 11ULL; - listHolder_3->mList[11] = 12ULL; - listHolder_3->mList[12] = 13ULL; - listHolder_3->mList[13] = 14ULL; - listHolder_3->mList[14] = 15ULL; - listHolder_3->mList[15] = 16ULL; - listHolder_3->mList[16] = 17ULL; - listHolder_3->mList[17] = 18ULL; - listHolder_3->mList[18] = 19ULL; - listHolder_3->mList[19] = 20ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 20); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 14: { - LogStep(14, "Verify"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Write entry too many targets"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(20); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 1U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNull(); - listHolder_3->mList[1].endpoint.SetNonNull(); - listHolder_3->mList[1].endpoint.Value() = 2U; - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNull(); - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 3U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_3->mList[3].cluster.SetNull(); - listHolder_3->mList[3].endpoint.SetNonNull(); - listHolder_3->mList[3].endpoint.Value() = 4U; - listHolder_3->mList[3].deviceType.SetNull(); - - listHolder_3->mList[4].cluster.SetNull(); - listHolder_3->mList[4].endpoint.SetNonNull(); - listHolder_3->mList[4].endpoint.Value() = 5U; - listHolder_3->mList[4].deviceType.SetNull(); - - listHolder_3->mList[5].cluster.SetNull(); - listHolder_3->mList[5].endpoint.SetNonNull(); - listHolder_3->mList[5].endpoint.Value() = 6U; - listHolder_3->mList[5].deviceType.SetNull(); - - listHolder_3->mList[6].cluster.SetNull(); - listHolder_3->mList[6].endpoint.SetNonNull(); - listHolder_3->mList[6].endpoint.Value() = 7U; - listHolder_3->mList[6].deviceType.SetNull(); - - listHolder_3->mList[7].cluster.SetNull(); - listHolder_3->mList[7].endpoint.SetNonNull(); - listHolder_3->mList[7].endpoint.Value() = 8U; - listHolder_3->mList[7].deviceType.SetNull(); - - listHolder_3->mList[8].cluster.SetNull(); - listHolder_3->mList[8].endpoint.SetNonNull(); - listHolder_3->mList[8].endpoint.Value() = 9U; - listHolder_3->mList[8].deviceType.SetNull(); - - listHolder_3->mList[9].cluster.SetNull(); - listHolder_3->mList[9].endpoint.SetNonNull(); - listHolder_3->mList[9].endpoint.Value() = 10U; - listHolder_3->mList[9].deviceType.SetNull(); - - listHolder_3->mList[10].cluster.SetNull(); - listHolder_3->mList[10].endpoint.SetNonNull(); - listHolder_3->mList[10].endpoint.Value() = 11U; - listHolder_3->mList[10].deviceType.SetNull(); - - listHolder_3->mList[11].cluster.SetNull(); - listHolder_3->mList[11].endpoint.SetNonNull(); - listHolder_3->mList[11].endpoint.Value() = 12U; - listHolder_3->mList[11].deviceType.SetNull(); - - listHolder_3->mList[12].cluster.SetNull(); - listHolder_3->mList[12].endpoint.SetNonNull(); - listHolder_3->mList[12].endpoint.Value() = 13U; - listHolder_3->mList[12].deviceType.SetNull(); - - listHolder_3->mList[13].cluster.SetNull(); - listHolder_3->mList[13].endpoint.SetNonNull(); - listHolder_3->mList[13].endpoint.Value() = 14U; - listHolder_3->mList[13].deviceType.SetNull(); - - listHolder_3->mList[14].cluster.SetNull(); - listHolder_3->mList[14].endpoint.SetNonNull(); - listHolder_3->mList[14].endpoint.Value() = 15U; - listHolder_3->mList[14].deviceType.SetNull(); - - listHolder_3->mList[15].cluster.SetNull(); - listHolder_3->mList[15].endpoint.SetNonNull(); - listHolder_3->mList[15].endpoint.Value() = 16U; - listHolder_3->mList[15].deviceType.SetNull(); - - listHolder_3->mList[16].cluster.SetNull(); - listHolder_3->mList[16].endpoint.SetNonNull(); - listHolder_3->mList[16].endpoint.Value() = 17U; - listHolder_3->mList[16].deviceType.SetNull(); - - listHolder_3->mList[17].cluster.SetNull(); - listHolder_3->mList[17].endpoint.SetNonNull(); - listHolder_3->mList[17].endpoint.Value() = 18U; - listHolder_3->mList[17].deviceType.SetNull(); - - listHolder_3->mList[18].cluster.SetNull(); - listHolder_3->mList[18].endpoint.SetNonNull(); - listHolder_3->mList[18].endpoint.Value() = 19U; - listHolder_3->mList[18].deviceType.SetNull(); - - listHolder_3->mList[19].cluster.SetNull(); - listHolder_3->mList[19].endpoint.SetNonNull(); - listHolder_3->mList[19].endpoint.Value() = 20U; - listHolder_3->mList[19].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 20); - } - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 16: { - LogStep(16, "Verify"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Write too many entries"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(5); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 1UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 2UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 3U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 3); - } - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 4ULL; - listHolder_3->mList[1] = 5ULL; - listHolder_3->mList[2] = 6ULL; - listHolder_3->mList[3] = 7ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 8U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 9UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 10UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 11U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 3); - } - listHolder_0->mList[1].fabricIndex = 0U; - - listHolder_0->mList[2].privilege = - static_cast(3); - listHolder_0->mList[2].authMode = - static_cast(3); - listHolder_0->mList[2].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 12ULL; - listHolder_3->mList[1] = 13ULL; - listHolder_3->mList[2] = 14ULL; - listHolder_3->mList[3] = 15ULL; - listHolder_0->mList[2].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[2].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 16U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 17UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 18UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 19U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[2].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 3); - } - listHolder_0->mList[2].fabricIndex = 0U; - - listHolder_0->mList[3].privilege = - static_cast(1); - listHolder_0->mList[3].authMode = - static_cast(2); - listHolder_0->mList[3].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 20ULL; - listHolder_3->mList[1] = 21ULL; - listHolder_3->mList[2] = 22ULL; - listHolder_3->mList[3] = 23ULL; - listHolder_0->mList[3].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[3].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 24U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 25UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 26UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 27U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[3].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 3); - } - listHolder_0->mList[3].fabricIndex = 0U; - - listHolder_0->mList[4].privilege = - static_cast(3); - listHolder_0->mList[4].authMode = - static_cast(2); - listHolder_0->mList[4].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 28ULL; - listHolder_3->mList[1] = 29ULL; - listHolder_3->mList[2] = 30ULL; - listHolder_3->mList[3] = 31ULL; - listHolder_0->mList[4].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[4].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(3); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 32U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 33UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNull(); - - listHolder_3->mList[2].cluster.SetNonNull(); - listHolder_3->mList[2].cluster.Value() = 34UL; - listHolder_3->mList[2].endpoint.SetNonNull(); - listHolder_3->mList[2].endpoint.Value() = 35U; - listHolder_3->mList[2].deviceType.SetNull(); - - listHolder_0->mList[4].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 3); - } - listHolder_0->mList[4].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 5); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 18: { - LogStep(18, "Verify"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Restore ACL"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 20: { - LogStep(20, "Verify"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "Validate resource minima (SubjectsPerAccessControlEntry)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::SubjectsPerAccessControlEntry::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Validate resource minima (TargetsPerAccessControlEntry)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::TargetsPerAccessControlEntry::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Validate resource minima (AccessControlEntriesPerFabric)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::AccessControlEntriesPerFabric::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACL_1_1Suite : public TestCommand -{ -public: - Test_TC_ACL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACL_1_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACL_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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - 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, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 1UL)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - 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)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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 reads ClusterRevision attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::ClusterRevision::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads FeatureMap attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TH reads AttributeList attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList attribute from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: TH reads optional attribute (Extension) in AttributeList"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 4c: 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)"); - 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 7: { - LogStep(7, "Step 5a: TH reads EventList attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 5b: TH reads EventList 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 9: { - LogStep(9, - "Step 6: TH reads AcceptedCommandList 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)"); - 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 10: { - LogStep(10, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACL_2_1Suite : public TestCommand -{ -public: - Test_TC_ACL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACL_2_1", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACL_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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 2: - 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, 3U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 3: - 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, 3U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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 reads SubjectsPerAccessControlEntry attribute from DUT"); - VerifyOrDo(!ShouldSkip("ACL.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::SubjectsPerAccessControlEntry::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads TargetsPerAccessControlEntry attribute from DUT"); - VerifyOrDo(!ShouldSkip("ACL.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::TargetsPerAccessControlEntry::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads AccessControlEntriesPerFabric attribute from DUT"); - VerifyOrDo(!ShouldSkip("ACL.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::AccessControlEntriesPerFabric::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACL_2_3Suite : public TestCommand -{ -public: - Test_TC_ACL_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACL_2_3", 20, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("D_OK_EMPTY", &mDOkEmpty); - AddArgument("D_OK_SINGLE", &mDOkSingle); - AddArgument("D_OK_FULL", &mDOkFull); - AddArgument("D_BAD_LENGTH", &mDBadLength); - AddArgument("D_BAD_STRUCT", &mDBadStruct); - AddArgument("D_BAD_LIST", &mDBadList); - AddArgument("D_BAD_ELEM", &mDBadElem); - AddArgument("D_BAD_OVERFLOW", &mDBadOverflow); - AddArgument("D_BAD_UNDERFLOW", &mDBadUnderflow); - AddArgument("D_BAD_NONE", &mDBadNone); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACL_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 mDOkEmpty; - chip::Optional mDOkSingle; - chip::Optional mDOkFull; - chip::Optional mDBadLength; - chip::Optional mDBadStruct; - chip::Optional mDBadList; - chip::Optional mDBadElem; - chip::Optional mDBadOverflow; - chip::Optional mDBadUnderflow; - chip::Optional mDBadNone; - chip::Optional mTimeout; - - uint8_t CurrentFabricIndex; - - 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))); - CurrentFabricIndex = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 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)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("extension", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "extension[0].data", iter_0.GetValue().data, - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2))); - VerifyOrReturn(CheckValue("extension[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 1)); - } - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("extension", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "extension[0].data", iter_0.GetValue().data, - mDOkSingle.HasValue() - ? mDOkSingle.Value() - : chip::ByteSpan(chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64" - "\x2E\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65" - "\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63" - "\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 71))); - VerifyOrReturn(CheckValue("extension[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 1)); - } - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("extension", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "extension[0].data", iter_0.GetValue().data, - mDOkFull.HasValue() - ? mDOkFull.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54" - "\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74" - "\x20\x6C\x69\x76\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67" - "\x00\xD0\x00\x00\xF1\xFF\x02\x00\x31\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54" - "\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74" - "\x20\x61\x67\x61\x69\x6E\x2E\x2E\x2E\x2E\x2E\x00\x18"), - 128))); - VerifyOrReturn(CheckValue("extension[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 1)); - } - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("extension", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "extension[0].data", iter_0.GetValue().data, - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2))); - VerifyOrReturn(CheckValue("extension[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 1)); - } - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 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, "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: TH1 reads DUT Endpoint 0 OperationalCredentials cluster CurrentFabricIndex attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, - "Step 4: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1. struct: Data field: D_OK_EMPTY : 1718"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 6: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1.struct Data field: D_OK_SINGLE " - ":17D00000F1FF01003D48656C6C6F20576F726C642E205468697320697320612073696E676C6520656C656D656E74206C6976696E67206" - "17320612063686172737472696E670018"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDOkSingle.HasValue() - ? mDOkSingle.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68\x69" - "\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76" - "\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 71); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, - "Step 8: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1.struct Data field: D_OK_FULL " - ":17D00000F1FF01003D48656C6C6F20576F726C642E205468697320697320612073696E676C6520656C656D656E74206C6976696E67206" - "17320612063686172737472696E6700D00000F1FF02003148656C6C6F20576F726C642E205468697320697320612073696E676C6520656" - "C656D656E7420616761696E2E2E2E2E2E0018"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDOkFull.HasValue() - ? mDOkFull.Value() - : chip::ByteSpan(chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20" - "\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65" - "\x6E\x74\x20\x6C\x69\x76\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72" - "\x69\x6E\x67\x00\xD0\x00\x00\xF1\xFF\x02\x00\x31\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C" - "\x64\x2E\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C" - "\x65\x6D\x65\x6E\x74\x20\x61\x67\x61\x69\x6E\x2E\x2E\x2E\x2E\x2E\x00\x18"), - 128); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, - "Step 10: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1 .struct Data field: D_BAD_LENGTH " - ":17D00000F1FF01003D48656C6C6F20576F726C642E205468697320697320612073696E676C6520656C656D656E74206C6976696E67206" - "17320612063686172737472696E6700D00000F1FF02003248656C6C6F20576F726C642E205468697320697320612073696E676C6520656" - "C656D656E7420616761696E2E2E2E2E2E2E0018"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDBadLength.HasValue() - ? mDBadLength.Value() - : chip::ByteSpan(chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20" - "\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65" - "\x6E\x74\x20\x6C\x69\x76\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72" - "\x69\x6E\x67\x00\xD0\x00\x00\xF1\xFF\x02\x00\x32\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C" - "\x64\x2E\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C" - "\x65\x6D\x65\x6E\x74\x20\x61\x67\x61\x69\x6E\x2E\x2E\x2E\x2E\x2E\x2E\x00\x18"), - 129); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 11: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1. struct Data field: D_BAD_STRUCT : 1518"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = - mDBadStruct.HasValue() ? mDBadStruct.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x15\x18"), 2); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 12: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1. struct Data field: D_BAD_LIST " - ":3701D00000F1FF01003D48656C6C6F20576F726C642E205468697320697320612073696E676C6520656C656D656E74206C6976696E672" - "0617320612063686172737472696E670018"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDBadList.HasValue() - ? mDBadList.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x37\x01\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68" - "\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69" - "\x76\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 72); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 13: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1. struct Data field: D_BAD_ELEM " - ":17103D48656C6C6F20576F726C642E205468697320697320612073696E676C6520656C656D656E74206C6976696E67206173206120636" - "86172737472696E670018"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDBadElem.HasValue() - ? mDBadElem.Value() - : chip::ByteSpan(chip::Uint8::from_const_char( - "\x17\x10\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68\x69\x73\x20\x69" - "\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76" - "\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 65); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, - "Step 14: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1 .struct Data field: D_BAD_OVERFLOW : " - "17D00000F1FF01003D48656C6C6F20576F726C642E205468697320697320612073696E676C6520656C656D656E74206C6976696E672061" - "7320612063686172737472696E670018FF"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDBadOverflow.HasValue() - ? mDBadOverflow.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68\x69" - "\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76" - "\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18\xFF"), - 72); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 15: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1. struct Data field: D_BAD_UNDERFLOW " - ":17D00000F1FF01003D48656C6C6F20576F726C642E205468697320697320612073696E676C6520656C656D656E74206C6976696E67206" - "17320612063686172737472696E6700"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDBadUnderflow.HasValue() - ? mDBadUnderflow.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68\x69" - "\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76" - "\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00"), - 70); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 15: { - LogStep(15, - "Step 16: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1.struct Data field: D_BAD_NONE"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = - mDBadNone.HasValue() ? mDBadNone.Value() : chip::ByteSpan(chip::Uint8::from_const_char(""), 0); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 16: { - LogStep( - 16, - "Step 17: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 2 elements . value is list of AccessControlExtensionStruct containing 2 " - "elements . first element contains Data field: D_OK_EMPTY 1718 . second element contains Data field: D_OK_SINGLE " - "17D00000F1FF01003D48656C6C6F20576F726C642E205468697320697320612073696E676C6520656C656D656E74206C6976696E6720617320" - "612063686172737472696E670018"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].data = mDOkSingle.HasValue() - ? mDOkSingle.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68\x69" - "\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76" - "\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 71); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 18: TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Step 19: TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is an empty list"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - value = chip::app::DataModel::List(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 20: TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACL_2_4Suite : public TestCommand -{ -public: - Test_TC_ACL_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACL_2_4", 45, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("CAT1", 0, UINT64_MAX, &mCat1); - AddArgument("CAT2", 0, UINT64_MAX, &mCat2); - AddArgument("CAT3", 0, UINT64_MAX, &mCat3); - AddArgument("CAT4", 0, UINT64_MAX, &mCat4); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACL_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 mCat1; - chip::Optional mCat2; - chip::Optional mCat3; - chip::Optional mCat4; - chip::Optional mTimeout; - - chip::NodeId CommissionerNodeId; - uint8_t CurrentFabricIndex; - uint16_t MAXSUBJECTS; - uint16_t TargetsPerAccessControlEntry; - uint16_t MAXENTRIES; - - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CommissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CurrentFabricIndex = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - 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::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 3U)); - VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_3.GetValue(), 111ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_3.GetValue(), 222ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_3.GetValue(), 333ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_3.GetValue(), 444ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[1].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[1].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[0].cluster.Value()", iter_3.GetValue().cluster.Value(), 11UL)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 22U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[1].targets.Value()", iter_3, 1)); - } - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); - VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 3U)); - VerifyOrReturn(CheckValueNonNull("acl[2].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[0]", iter_3.GetValue(), 555ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[1]", iter_3.GetValue(), 666ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[2]", iter_3.GetValue(), 777ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[3]", iter_3.GetValue(), 888ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[2].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[2].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[0].cluster.Value()", iter_3.GetValue().cluster.Value(), 55UL)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 66U)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[2].targets.Value()", iter_3, 1)); - } - VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 3)); - } - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 4U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 3U)); - VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_3.GetValue(), 444ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_3.GetValue(), 333ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_3.GetValue(), 222ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_3.GetValue(), 111ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[1].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[1].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[0].cluster.Value()", iter_3.GetValue().cluster.Value(), 44UL)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 33U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[1].targets.Value()", iter_3, 1)); - } - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); - VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[2].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[0]", iter_3.GetValue(), 888ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[1]", iter_3.GetValue(), 777ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[2]", iter_3.GetValue(), 666ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[3]", iter_3.GetValue(), 555ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[2].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[2].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[0].cluster.Value()", iter_3.GetValue().cluster.Value(), 88UL)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 77U)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckNoMoreListItems("acl[2].targets.Value()", iter_3, 1)); - } - VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 3)); - } - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_3.GetValue(), 111ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_3.GetValue(), 222ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_3.GetValue(), 333ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_3.GetValue(), 444ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[1].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[1].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[0].cluster.Value()", iter_3.GetValue().cluster.Value(), 11UL)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 22U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 33UL)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[1].deviceType.Value()", iter_3.GetValue().deviceType.Value(), 44UL)); - VerifyOrReturn( - CheckNoMoreListItems("acl[1].targets.Value()", iter_3, 2)); - } - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); - VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 3U)); - VerifyOrReturn(CheckValueNonNull("acl[2].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[0]", iter_3.GetValue(), 555ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[1]", iter_3.GetValue(), 666ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[2]", iter_3.GetValue(), 777ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[3]", iter_3.GetValue(), 888ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[2].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNonNull("acl[2].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[0].cluster.Value()", iter_3.GetValue().cluster.Value(), 55UL)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 66U)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 77UL)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[1].deviceType.Value()", iter_3.GetValue().deviceType.Value(), 88UL)); - VerifyOrReturn( - CheckNoMoreListItems("acl[2].targets.Value()", iter_3, 2)); - } - VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 3)); - } - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[1].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[0].cluster.Value()", iter_3.GetValue().cluster.Value(), 11UL)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 22U)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 33UL)); - VerifyOrReturn(CheckValueNull("acl[1].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNonNull("acl[1].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckValue("acl[1].targets.Value()[1].deviceType.Value()", iter_3.GetValue().deviceType.Value(), 44UL)); - VerifyOrReturn( - CheckNoMoreListItems("acl[1].targets.Value()", iter_3, 2)); - } - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); - VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 3U)); - VerifyOrReturn(CheckValueNull("acl[2].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets", iter_0.GetValue().targets)); - { - auto iter_3 = iter_0.GetValue().targets.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 0)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[0].cluster.Value()", iter_3.GetValue().cluster.Value(), 55UL)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[0].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[0].endpoint.Value()", iter_3.GetValue().endpoint.Value(), 66U)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[0].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].targets.Value()", iter_3, 1)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[1].cluster", iter_3.GetValue().cluster)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[1].cluster.Value()", iter_3.GetValue().cluster.Value(), 77UL)); - VerifyOrReturn(CheckValueNull("acl[2].targets.Value()[1].endpoint", iter_3.GetValue().endpoint)); - VerifyOrReturn(CheckValueNonNull("acl[2].targets.Value()[1].deviceType", iter_3.GetValue().deviceType)); - VerifyOrReturn( - CheckValue("acl[2].targets.Value()[1].deviceType.Value()", iter_3.GetValue().deviceType.Value(), 88UL)); - VerifyOrReturn( - CheckNoMoreListItems("acl[2].targets.Value()", iter_3, 2)); - } - VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 3)); - } - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 1U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_3.GetValue(), 111ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_3.GetValue(), 222ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_3.GetValue(), 333ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_3.GetValue(), 444ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[1].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); - VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 3U)); - VerifyOrReturn(CheckValueNonNull("acl[2].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[0]", iter_3.GetValue(), 555ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[1]", iter_3.GetValue(), 666ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[2]", iter_3.GetValue(), 777ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[2].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[2].subjects.Value()[3]", iter_3.GetValue(), 888ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[2].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNull("acl[2].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 3)); - } - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 3U)); - VerifyOrReturn(CheckValueNull("acl[1].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 2)); - } - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 2U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[1].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 2)); - } - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - MAXSUBJECTS = value; - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_3.GetValue(), - mCat1.HasValue() ? mCat1.Value() : 65520ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[1]", iter_3.GetValue(), - mCat2.HasValue() ? mCat2.Value() : 65521ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 2)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[2]", iter_3.GetValue(), - mCat3.HasValue() ? mCat3.Value() : 65522ULL)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 3)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[3]", iter_3.GetValue(), - mCat4.HasValue() ? mCat4.Value() : 65523ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[1].subjects.Value()", - iter_3, 4)); - } - VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 2)); - } - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TargetsPerAccessControlEntry = value; - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - MAXENTRIES = value; - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[1].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 2)); - VerifyOrReturn(CheckValue("acl[2].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[2].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNull("acl[2].subjects", iter_0.GetValue().subjects)); - VerifyOrReturn(CheckValueNull("acl[2].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[2].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 3)); - } - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 44: - 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, "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, "Read the commissioner node ID"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 2:TH1 reads DUT Endpoint 0 OperationalCredentials cluster CurrentFabricIndex attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3:TH1 reads DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 4: { - LogStep( - 4, - "Step 4:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of AccessControlEntryStruct " - "containing 3 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE (2) Subjects field: [N1] " - "Targets field: null 2 . struct Privilege field: View (1) AuthMode field: CASE (3) Subjects field: [111, 222, 333, " - "444] Targets field: [{Cluster: 11}, {Endpoint: 22}] 3..struct Privilege field: Operate (3) AuthMode field: Group " - "(3) Subjects field: [555, 666, 777, 888] Targets field: [{Cluster: 55}, {Endpoint: 66}]"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(3); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 111ULL; - listHolder_3->mList[1] = 222ULL; - listHolder_3->mList[2] = 333ULL; - listHolder_3->mList[3] = 444ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 11UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 22U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[2].privilege = - static_cast(3); - listHolder_0->mList[2].authMode = - static_cast(3); - listHolder_0->mList[2].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 555ULL; - listHolder_3->mList[1] = 666ULL; - listHolder_3->mList[2] = 777ULL; - listHolder_3->mList[3] = 888ULL; - listHolder_0->mList[2].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[2].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 55UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 66U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[2].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[2].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 3); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5:TH1 reads DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 6: { - LogStep( - 6, - "Step 6:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of AccessControlEntryStruct " - "containing 3 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE (2) Subjects field: [N1] " - "Targets field: null 2.struct Privilege field: Manage (4) AuthMode field: Group (3) Subjects field: [444, 333, " - "222, 111] Targets field: [{Cluster: 44}, {Endpoint: 33}] 3.struct Privilege field: Administer (5) AuthMode field: " - "CASE (2) Subjects field: [888, 777, 666, 555] Targets field: [{Cluster: 88}, {Endpoint: 77}]"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(3); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(4); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 444ULL; - listHolder_3->mList[1] = 333ULL; - listHolder_3->mList[2] = 222ULL; - listHolder_3->mList[3] = 111ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 44UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 33U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[2].privilege = - static_cast(5); - listHolder_0->mList[2].authMode = - static_cast(2); - listHolder_0->mList[2].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 888ULL; - listHolder_3->mList[1] = 777ULL; - listHolder_3->mList[2] = 666ULL; - listHolder_3->mList[3] = 555ULL; - listHolder_0->mList[2].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[2].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 88UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 77U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[2].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[2].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 3); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7:TH1 reads DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 8:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 3 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: View (1) AuthMode field: CASE (2) " - "Subjects field: [111, 222, 333, 444] Targets field: [{Cluster: 11, Endpoint: 22}, {Cluster: 33, DeviceType: " - "44}] 3.struct Privilege field: Operate (3) AuthMode field: Group (3) Subjects field: [555, 666, 777, 888] " - "Targets field: [{Cluster: 55, Endpoint: 66}, {Cluster: 77, DeviceType: 88}]"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(3); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 111ULL; - listHolder_3->mList[1] = 222ULL; - listHolder_3->mList[2] = 333ULL; - listHolder_3->mList[3] = 444ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(2); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 11UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 22U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 33UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNonNull(); - listHolder_3->mList[1].deviceType.Value() = 44UL; - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 2); - } - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[2].privilege = - static_cast(3); - listHolder_0->mList[2].authMode = - static_cast(3); - listHolder_0->mList[2].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 555ULL; - listHolder_3->mList[1] = 666ULL; - listHolder_3->mList[2] = 777ULL; - listHolder_3->mList[3] = 888ULL; - listHolder_0->mList[2].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[2].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(2); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 55UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 66U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 77UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNonNull(); - listHolder_3->mList[1].deviceType.Value() = 88UL; - - listHolder_0->mList[2].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 2); - } - listHolder_0->mList[2].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 3); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 9:TH1 reads AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 10:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 3 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: View (1) AuthMode field: CASE (2) " - "Subjects field: null Targets field: [{Cluster: 11, Endpoint: 22}, {Cluster: 33, DeviceType: 44}] 3.struct " - "Privilege field: Operate (3) AuthMode field: Group (3) Subjects field: null Targets field: [{Cluster: 55, " - "Endpoint: 66}, {Cluster: 77, DeviceType: 88}]"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(3); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(2); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 11UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 22U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 33UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNonNull(); - listHolder_3->mList[1].deviceType.Value() = 44UL; - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 2); - } - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[2].privilege = - static_cast(3); - listHolder_0->mList[2].authMode = - static_cast(3); - listHolder_0->mList[2].subjects.SetNull(); - listHolder_0->mList[2].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(2); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 55UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 66U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_3->mList[1].cluster.SetNonNull(); - listHolder_3->mList[1].cluster.Value() = 77UL; - listHolder_3->mList[1].endpoint.SetNull(); - listHolder_3->mList[1].deviceType.SetNonNull(); - listHolder_3->mList[1].deviceType.Value() = 88UL; - - listHolder_0->mList[2].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 2); - } - listHolder_0->mList[2].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 3); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 11:TH1 reads AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 12:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 3 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: View (1) AuthMode field: CASE (2) " - "Subjects field: [111, 222, 333, 444] Targets field: null 3.struct Privilege field: Operate (3) AuthMode " - "field: Group (3) Subjects field: [555, 666, 777, 888] Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(3); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 111ULL; - listHolder_3->mList[1] = 222ULL; - listHolder_3->mList[2] = 333ULL; - listHolder_3->mList[3] = 444ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[2].privilege = - static_cast(3); - listHolder_0->mList[2].authMode = - static_cast(3); - listHolder_0->mList[2].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 555ULL; - listHolder_3->mList[1] = 666ULL; - listHolder_3->mList[2] = 777ULL; - listHolder_3->mList[3] = 888ULL; - listHolder_0->mList[2].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[2].targets.SetNull(); - listHolder_0->mList[2].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 3); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 13:TH1 reads AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 14:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: Group (3) " - "Subjects field: null Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 15:TH1 reads AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, - "Step 16:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: ProxyView (2) AuthMode field: CASE (2) " - "Subjects field: null Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(2); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 17:TH1 reads AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Step 18:TH1 reads DUT AccessControl cluster SubjectsPerAccessControlEntry attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::SubjectsPerAccessControlEntry::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 19:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field: list of MAXSUBJECTS random node IDs (stored as SUBJECTS) Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 20:TH1 reads AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 21: { - LogStep(21, - "Step 21:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field: [CAT1, CAT2, CAT3, CAT4] Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(4); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = mCat1.HasValue() ? mCat1.Value() : 65520ULL; - listHolder_3->mList[1] = mCat2.HasValue() ? mCat2.Value() : 65521ULL; - listHolder_3->mList[2] = mCat3.HasValue() ? mCat3.Value() : 65522ULL; - listHolder_3->mList[3] = mCat4.HasValue() ? mCat4.Value() : 65523ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 4); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 22:TH1 reads AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 23: { - LogStep(23, "Step 23:TH1 reads AccessControl cluster TargetsPerAccessControlEntry attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::TargetsPerAccessControlEntry::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 24:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field:null Targets field: list of MAXTARGETS targets {Cluster: random} (stored as TARGETS)"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 25: { - LogStep(25, "Step 25:TH1 reads AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 26: { - LogStep(26, "Step 26:TH1 reads AccessControl cluster AccessControlEntriesPerFabric attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::AccessControlEntriesPerFabric::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 27:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing MAXENTRIES elements 1.struct Privilege field: Administer (5) AuthMode " - "field: CASE (2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode " - "field: CASE (2) Subjects field: null Targets field: null subsequent elements same as second element"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(3); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[2].privilege = - static_cast(3); - listHolder_0->mList[2].authMode = - static_cast(2); - listHolder_0->mList[2].subjects.SetNull(); - listHolder_0->mList[2].targets.SetNull(); - listHolder_0->mList[2].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 3); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 28: { - LogStep(28, "Step 28:TH1 reads AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 29:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: PASE (1) " - "Subjects field: null Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(1); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 30: { - LogStep(30, "Step 30:TH1 reads AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 31:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Administer (5) AuthMode field: Group " - "(3) Subjects field: null Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(5); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 32: { - LogStep(32, - "Step 32:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: invalid value (not 1-5) AuthMode " - "field: CASE (2) Subjects field: null Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(6); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 33:TH1 writes AccessControl cluster ACL attribute, value is list of AccessControlEntryStruct containing " - "2 elements"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(6); - listHolder_0->mList[1].authMode = - static_cast(4); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 34: { - LogStep(34, - "Step 34:TH1 writes AccessControl cluster ACL attribute, value is list of AccessControlEntryStruct containing " - "2 elements"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 0ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 35: { - LogStep(35, - "Step 35:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field: [0xFFFFFFFFFFFFFFFF] Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 18446744073709551615ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 36: { - LogStep(36, - "Step 36:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field: [0xFFFFFFFD00000000] Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 18446744060824649728ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 37: { - LogStep(37, - "Step 37:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute value is list of " - "AccessControlEntryStruct containing 2 elements struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field: [0xFFFFFFFFFFFF0000] Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 18446744073709486080ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 38: { - LogStep(38, - "Step 38:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field: null Targets field: [{}]"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNull(); - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 39: { - LogStep(39, - "Step 39:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field: null Targets field: [{Cluster: 0xFFFFFFFF}]"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 4294967295UL; - listHolder_3->mList[0].endpoint.SetNull(); - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 40: { - LogStep(40, - "Step 40:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute value is list of " - "AccessControlEntryStruct containing 2 elements 1. struct Privilege field: Administer (5) AuthMode field: " - "CASE (2) Subjects field: [N1] Targets field: null 2. struct Privilege field: Operate (3) AuthMode field: " - "CASE (2) Subjects field: null Targets field: [{Endpoint: 65535}]"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 65535U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 41: { - LogStep(41, - "Step 41:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field: null Targets field: [{DeviceType: 0xFFFFFFFF}]"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNull(); - listHolder_3->mList[0].deviceType.SetNonNull(); - listHolder_3->mList[0].deviceType.Value() = 4294967295UL; - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 42: { - LogStep(42, - "Step 42:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field: null Targets field: [{Endpoint: 22, DeviceType: 33}]"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 22U; - listHolder_3->mList[0].deviceType.SetNonNull(); - listHolder_3->mList[0].deviceType.Value() = 33UL; - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 43: { - LogStep(43, - "Step 43:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2.struct Privilege field: Operate (3) AuthMode field: CASE (2) " - "Subjects field: null Targets field: [{Cluster: 11, Endpoint: 22, DeviceType: 33}]"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 11UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 22U; - listHolder_3->mList[0].deviceType.SetNonNull(); - listHolder_3->mList[0].deviceType.Value() = 33UL; - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 44: { - LogStep(44, "Step 44:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute value is an empty list"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACL_2_5Suite : public TestCommand -{ -public: - Test_TC_ACL_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACL_2_5", 14, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("D_OK_EMPTY", &mDOkEmpty); - AddArgument("D_OK_SINGLE", &mDOkSingle); - AddArgument("D_BAD_LENGTH", &mDBadLength); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACL_2_5Suite() {} - - 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 mDOkEmpty; - chip::Optional mDOkSingle; - chip::Optional mDBadLength; - chip::Optional mTimeout; - - chip::NodeId CommissionerNodeId; - uint8_t CurrentFabricIndex; - - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CommissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CurrentFabricIndex = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccessControl::Events::AccessControlExtensionChanged::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("accessControlExtensionChanged.adminNodeID", value.adminNodeID)); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.adminNodeID.Value()", value.adminNodeID.Value(), - CommissionerNodeId)); - VerifyOrReturn(CheckValueNull("accessControlExtensionChanged.adminPasscodeID", value.adminPasscodeID)); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.changeType", value.changeType, 1U)); - VerifyOrReturn(CheckValueNonNull("accessControlExtensionChanged.latestValue", value.latestValue)); - VerifyOrReturn(CheckValueAsString( - "accessControlExtensionChanged.latestValue.Value().data", value.latestValue.Value().data, - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2))); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.latestValue.Value().fabricIndex", - value.latestValue.Value().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.fabricIndex", value.fabricIndex, CurrentFabricIndex)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - 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), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - 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), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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; - 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: TH commissions DUT using admin node ID N1"); - 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 commissioner node ID"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 2: TH reads DUT Endpoint 0 OperationalCredentials cluster CurrentFabricIndex attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: TH reads DUT Endpoint 0 AccessControl cluster AccessControlExtensionChanged event"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 4: { - LogStep(4, - "Step 4: TH writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element struct Data field: D_OK_EMPTY"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: TH reads DUT Endpoint 0 AccessControl cluster AccessControlExtensionChanged event"); - VerifyOrDo(!ShouldSkip("ACL.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Events::AccessControlExtensionChanged::Id, false, chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 6: TH writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element struct Data field: D_OK_SINGLE"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDOkSingle.HasValue() - ? mDOkSingle.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68\x69" - "\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76" - "\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 71); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: TH reads DUT Endpoint 0 AccessControl cluster AccessControlExtensionChanged event"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 8: { - LogStep(8, - "Step 8: TH writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element struct Data field: D_BAD_LENGTH"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDBadLength.HasValue() - ? mDBadLength.Value() - : chip::ByteSpan(chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20" - "\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65" - "\x6E\x74\x20\x6C\x69\x76\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72" - "\x69\x6E\x67\x00\xD0\x00\x00\xF1\xFF\x02\x00\x32\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C" - "\x64\x2E\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C" - "\x65\x6D\x65\x6E\x74\x20\x61\x67\x61\x69\x6E\x2E\x2E\x2E\x2E\x2E\x2E\x00\x18"), - 129); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 9: TH reads DUT Endpoint 0 AccessControl cluster AccessControlExtensionChanged event"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 10: { - LogStep( - 10, - "Step 10: TH writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 2 elements struct Data field: D_OK_EMPTY struct Data field: D_OK_SINGLE"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].data = mDOkSingle.HasValue() - ? mDOkSingle.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68\x69" - "\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76" - "\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 71); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 11: TH reads DUT Endpoint 0 AccessControl cluster AccessControlExtensionChanged event"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Step 12: TH writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is an empty list"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - value = chip::app::DataModel::List(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 13: TH reads DUT Endpoint 0 AccessControl cluster AccessControlExtensionChanged event"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACL_2_6Suite : public TestCommand -{ -public: - Test_TC_ACL_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACL_2_6", 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_ACL_2_6Suite() {} - - 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::NodeId CommissionerNodeId; - uint8_t CurrentFabricIndex; - - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CommissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CurrentFabricIndex = value; - } - break; - case 3: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("accessControlEntryChanged.adminNodeID", value.adminNodeID)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.adminPasscodeID", value.adminPasscodeID)); - VerifyOrReturn( - CheckValue("accessControlEntryChanged.adminPasscodeID.Value()", value.adminPasscodeID.Value(), 0U)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.changeType", value.changeType, 1U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue", value.latestValue)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().privilege", - value.latestValue.Value().privilege, 5U)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().authMode", - value.latestValue.Value().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue.Value().subjects", - value.latestValue.Value().subjects)); - { - auto iter_4 = value.latestValue.Value().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 0)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().subjects.Value()[0]", - iter_4.GetValue(), CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 1)); - } - VerifyOrReturn( - CheckValueNull("accessControlEntryChanged.latestValue.Value().targets", value.latestValue.Value().targets)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().fabricIndex", - value.latestValue.Value().fabricIndex, CurrentFabricIndex)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.fabricIndex", value.fabricIndex, CurrentFabricIndex)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - 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), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: TH commissions DUT using admin node ID N1"); - 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 commissioner node ID"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 2: TH reads DUT Endpoint 0 OperationalCredentials cluster CurrentFabricIndex attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: TH reads DUT Endpoint 0 AccessControl cluster AccessControlEntryChanged event"); - VerifyOrDo(!ShouldSkip("ACL.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Events::AccessControlEntryChanged::Id, false, chip::NullOptional); - } - case 4: { - LogStep(4, - "Step 4: TH writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of " - "AccessControlEntryStruct containing 2 elements 1.struct Privilege field: Administer (5) AuthMode field: CASE " - "(2) Subjects field: [N1] Targets field: null 2struct Privilege field: Operate (3) AuthMode field: Group (3) " - "Subjects field: null Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: TH reads DUT Endpoint 0 AccessControl cluster AccessControlEntryChanged event"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 6: { - LogStep( - 6, - "Step 6: TH writes DUT Endpoint 0 AccessControl cluster ACL attribute, value is list of AccessControlEntryStruct " - "containing 2 elements. The first item is valid, the second item is invalid due to group ID 0 being used, which is " - "illegal. 1.struct Privilege field: Administer (5) AuthMode field: CASE (2) Subjects field: [N1] Targets field: " - "null 2.struct Privilege field: Operate (3) AuthMode field: Group (3) Subjects field: [0] Targets field: null"); - VerifyOrDo(!ShouldSkip("ACL.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 0ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: TH reads DUT Endpoint 0 AccessControl cluster AccessControlEntryChanged event"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACL_2_7Suite : public TestCommand -{ -public: - Test_TC_ACL_2_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACL_2_7", 25, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("payload", &mPayload); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("waitAfterCommissioning", 0, UINT16_MAX, &mWaitAfterCommissioning); - AddArgument("PakeVerifier", &mPakeVerifier); - AddArgument("D_OK_EMPTY", &mDOkEmpty); - AddArgument("D_OK_SINGLE", &mDOkSingle); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACL_2_7Suite() {} - - 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 mNodeId2; - chip::Optional mPayload; - chip::Optional mDiscriminator; - chip::Optional mWaitAfterCommissioning; - chip::Optional mPakeVerifier; - chip::Optional mDOkEmpty; - chip::Optional mDOkSingle; - chip::Optional mTimeout; - - chip::NodeId TH1CommissionerNodeId; - uint8_t TH1FabricIndex; - chip::NodeId TH2CommissionerNodeId; - uint8_t TH2FabricIndex; - - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH1CommissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH1FabricIndex = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH2CommissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH2FabricIndex = value; - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("extension", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "extension[0].data", iter_0.GetValue().data, - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2))); - VerifyOrReturn(CheckValue("extension[0].fabricIndex", iter_0.GetValue().fabricIndex, TH1FabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 1)); - } - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("extension", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "extension[0].data", iter_0.GetValue().data, - mDOkSingle.HasValue() - ? mDOkSingle.Value() - : chip::ByteSpan(chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64" - "\x2E\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65" - "\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63" - "\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 71))); - VerifyOrReturn(CheckValue("extension[0].fabricIndex", iter_0.GetValue().fabricIndex, TH2FabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 1)); - } - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 17: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccessControl::Events::AccessControlExtensionChanged::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("accessControlExtensionChanged.adminNodeID", value.adminNodeID)); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.adminNodeID.Value()", value.adminNodeID.Value(), - TH1CommissionerNodeId)); - VerifyOrReturn(CheckValueNull("accessControlExtensionChanged.adminPasscodeID", value.adminPasscodeID)); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.changeType", value.changeType, 1U)); - VerifyOrReturn(CheckValueNonNull("accessControlExtensionChanged.latestValue", value.latestValue)); - VerifyOrReturn(CheckValueAsString( - "accessControlExtensionChanged.latestValue.Value().data", value.latestValue.Value().data, - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2))); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.latestValue.Value().fabricIndex", - value.latestValue.Value().fabricIndex, TH1FabricIndex)); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.fabricIndex", value.fabricIndex, TH1FabricIndex)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 18: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccessControl::Events::AccessControlExtensionChanged::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("accessControlExtensionChanged.adminNodeID", value.adminNodeID)); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.adminNodeID.Value()", value.adminNodeID.Value(), - TH2CommissionerNodeId)); - VerifyOrReturn(CheckValueNull("accessControlExtensionChanged.adminPasscodeID", value.adminPasscodeID)); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.changeType", value.changeType, 1U)); - VerifyOrReturn(CheckValueNonNull("accessControlExtensionChanged.latestValue", value.latestValue)); - VerifyOrReturn(CheckValueAsString( - "accessControlExtensionChanged.latestValue.Value().data", value.latestValue.Value().data, - mDOkSingle.HasValue() - ? mDOkSingle.Value() - : chip::ByteSpan(chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64" - "\x2E\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65" - "\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63" - "\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 71))); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.latestValue.Value().fabricIndex", - value.latestValue.Value().fabricIndex, TH2FabricIndex)); - VerifyOrReturn(CheckValue("accessControlExtensionChanged.fabricIndex", value.fabricIndex, TH2FabricIndex)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - 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)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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, "Read the TH1 commissioner node ID"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 2:TH1 reads OperationalCredentials cluster CurrentFabricIndex attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3:TH1 puts DUT into commissioning mode"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - value.PAKEPasscodeVerifier = mPakeVerifier.HasValue() - ? mPakeVerifier.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\xb9\x61\x70\xaa\xe8\x03\x34\x68\x84\x72\x4f\xe9\xa3\xb2\x87\xc3\x03\x30\xc2\xa6\x60\x37\x5d\x17\xbb\x20" - "\x5a\x8c\xf1\xae\xcb\x35\x04\x57\xf8\xab\x79\xee\x25\x3a\xb6\xa8\xe4\x6b\xb0\x9e\x54\x3a\xe4\x22\x73\x6d" - "\xe5\x01\xe3\xdb\x37\xd4\x41\xfe\x34\x49\x20\xd0\x95\x48\xe4\xc1\x82\x40\x63\x0c\x4f\xf4\x91\x3c\x53\x51" - "\x38\x39\xb7\xc0\x7f\xcc\x06\x27\xa1\xb8\x57\x3a\x14\x9f\xcd\x1f\xa4\x66\xcf"), - 97); - value.discriminator = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - value.iterations = 1000UL; - value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 3 & 4: TH1 puts DUT into commissioning mode, TH2 commissions DUT using admin node ID N2"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Waiting after opening commissioning window"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 4:TH2 starts a commissioning process with DUT"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 7: { - LogStep(7, "DUT is commissioned by TH2 on Fabric ID2 "); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 8: { - LogStep(8, "Read the TH2 commissioner node ID"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityBeta, value); - } - case 9: { - LogStep(9, "Step 5:TH2 reads OperationalCredentials cluster CurrentFabricIndex attribute"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 5:TH2 reads OperationalCredentials cluster CurrentFabricIndex attribute"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 11: { - LogStep(11, - "Step 6:TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2); - listHolder_0->mList[0].fabricIndex = TH1FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 7:TH2 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDOkSingle.HasValue() - ? mDOkSingle.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68\x69" - "\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76" - "\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 71); - listHolder_0->mList[0].fabricIndex = TH2FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, - "Step 7:TH2 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 8:TH1 reads AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 9:TH2 reads AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 9:TH2 reads AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Step 10:TH1 reads DUT Endpoint 0 AccessControl cluster AccessControlExtensionChanged event"); - VerifyOrDo(!ShouldSkip("ACL.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Events::AccessControlExtensionChanged::Id, false, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 11:TH2 reads DUT Endpoint 0 AccessControl cluster AccessControlExtensionChanged event"); - VerifyOrDo(!ShouldSkip("ACL.S.E01 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityBeta, GetEndpoint(0), AccessControl::Id, - AccessControl::Events::AccessControlExtensionChanged::Id, false, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 11:TH2 reads DUT Endpoint 0 AccessControl cluster AccessControlExtensionChanged event"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "TH1 writes Extension attribute value as empty list"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - value = chip::app::DataModel::List(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 21: { - LogStep(21, "TH2 writes Extension attribute value as empty list"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - value = chip::app::DataModel::List(); - return WriteAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 22: { - LogStep(22, "TH2 writes Extension attribute value as empty list"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Remove TH2 FabricIndex"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = TH2FabricIndex; - return SendCommand(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::Optional(10000), - chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Remove TH2 FabricIndex"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACL_2_8Suite : public TestCommand -{ -public: - Test_TC_ACL_2_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACL_2_8", 25, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("waitAfterCommissioning", 0, UINT16_MAX, &mWaitAfterCommissioning); - AddArgument("payload", &mPayload); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("PakeVerifier", &mPakeVerifier); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACL_2_8Suite() {} - - 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 mNodeId2; - chip::Optional mWaitAfterCommissioning; - chip::Optional mPayload; - chip::Optional mDiscriminator; - chip::Optional mPakeVerifier; - chip::Optional mTimeout; - - chip::NodeId TH1CommissionerNodeId; - uint8_t TH1FabricIndex; - chip::NodeId TH2CommissionerNodeId; - uint8_t TH2FabricIndex; - - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH1CommissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH1FabricIndex = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH2CommissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH2FabricIndex = value; - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), TH1CommissionerNodeId)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[1]", iter_3.GetValue(), 1111ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 2)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, TH1FabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), TH2CommissionerNodeId)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[1]", iter_3.GetValue(), 2222ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 2)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, TH2FabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 17: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("accessControlEntryChanged.adminNodeID", value.adminNodeID)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.adminPasscodeID", value.adminPasscodeID)); - VerifyOrReturn( - CheckValue("accessControlEntryChanged.adminPasscodeID.Value()", value.adminPasscodeID.Value(), 0U)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.changeType", value.changeType, 1U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue", value.latestValue)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().privilege", - value.latestValue.Value().privilege, 5U)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().authMode", - value.latestValue.Value().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue.Value().subjects", - value.latestValue.Value().subjects)); - { - auto iter_4 = value.latestValue.Value().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 0)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().subjects.Value()[0]", - iter_4.GetValue(), TH1CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 1)); - } - VerifyOrReturn( - CheckValueNull("accessControlEntryChanged.latestValue.Value().targets", value.latestValue.Value().targets)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().fabricIndex", - value.latestValue.Value().fabricIndex, TH1FabricIndex)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.fabricIndex", value.fabricIndex, TH1FabricIndex)); - } - mTestSubStepIndex++; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.adminNodeID", value.adminNodeID)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.adminNodeID.Value()", value.adminNodeID.Value(), - TH1CommissionerNodeId)); - VerifyOrReturn(CheckValueNull("accessControlEntryChanged.adminPasscodeID", value.adminPasscodeID)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.changeType", value.changeType, 2U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue", value.latestValue)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().privilege", - value.latestValue.Value().privilege, 5U)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().authMode", - value.latestValue.Value().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue.Value().subjects", - value.latestValue.Value().subjects)); - { - auto iter_4 = value.latestValue.Value().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 0)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().subjects.Value()[0]", - iter_4.GetValue(), TH1CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 1)); - } - VerifyOrReturn( - CheckValueNull("accessControlEntryChanged.latestValue.Value().targets", value.latestValue.Value().targets)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().fabricIndex", - value.latestValue.Value().fabricIndex, TH1FabricIndex)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.fabricIndex", value.fabricIndex, TH1FabricIndex)); - } - mTestSubStepIndex++; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.adminNodeID", value.adminNodeID)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.adminNodeID.Value()", value.adminNodeID.Value(), - TH1CommissionerNodeId)); - VerifyOrReturn(CheckValueNull("accessControlEntryChanged.adminPasscodeID", value.adminPasscodeID)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.changeType", value.changeType, 1U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue", value.latestValue)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().privilege", - value.latestValue.Value().privilege, 5U)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().authMode", - value.latestValue.Value().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue.Value().subjects", - value.latestValue.Value().subjects)); - { - auto iter_4 = value.latestValue.Value().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 0)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().subjects.Value()[0]", - iter_4.GetValue(), TH1CommissionerNodeId)); - VerifyOrReturn(CheckNextListItemDecodes( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 1)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().subjects.Value()[1]", - iter_4.GetValue(), 1111ULL)); - VerifyOrReturn(CheckNoMoreListItems( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 2)); - } - VerifyOrReturn( - CheckValueNull("accessControlEntryChanged.latestValue.Value().targets", value.latestValue.Value().targets)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().fabricIndex", - value.latestValue.Value().fabricIndex, TH1FabricIndex)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.fabricIndex", value.fabricIndex, TH1FabricIndex)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 18: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("accessControlEntryChanged.adminNodeID", value.adminNodeID)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.adminPasscodeID", value.adminPasscodeID)); - VerifyOrReturn( - CheckValue("accessControlEntryChanged.adminPasscodeID.Value()", value.adminPasscodeID.Value(), 0U)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.changeType", value.changeType, 1U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue", value.latestValue)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().privilege", - value.latestValue.Value().privilege, 5U)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().authMode", - value.latestValue.Value().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue.Value().subjects", - value.latestValue.Value().subjects)); - { - auto iter_4 = value.latestValue.Value().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 0)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().subjects.Value()[0]", - iter_4.GetValue(), TH2CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 1)); - } - VerifyOrReturn( - CheckValueNull("accessControlEntryChanged.latestValue.Value().targets", value.latestValue.Value().targets)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().fabricIndex", - value.latestValue.Value().fabricIndex, TH2FabricIndex)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.fabricIndex", value.fabricIndex, TH2FabricIndex)); - } - mTestSubStepIndex++; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.adminNodeID", value.adminNodeID)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.adminNodeID.Value()", value.adminNodeID.Value(), - TH2CommissionerNodeId)); - VerifyOrReturn(CheckValueNull("accessControlEntryChanged.adminPasscodeID", value.adminPasscodeID)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.changeType", value.changeType, 2U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue", value.latestValue)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().privilege", - value.latestValue.Value().privilege, 5U)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().authMode", - value.latestValue.Value().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue.Value().subjects", - value.latestValue.Value().subjects)); - { - auto iter_4 = value.latestValue.Value().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 0)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().subjects.Value()[0]", - iter_4.GetValue(), TH2CommissionerNodeId)); - VerifyOrReturn(CheckNoMoreListItems( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 1)); - } - VerifyOrReturn( - CheckValueNull("accessControlEntryChanged.latestValue.Value().targets", value.latestValue.Value().targets)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().fabricIndex", - value.latestValue.Value().fabricIndex, TH2FabricIndex)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.fabricIndex", value.fabricIndex, TH2FabricIndex)); - } - mTestSubStepIndex++; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccessControl::Events::AccessControlEntryChanged::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.adminNodeID", value.adminNodeID)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.adminNodeID.Value()", value.adminNodeID.Value(), - TH2CommissionerNodeId)); - VerifyOrReturn(CheckValueNull("accessControlEntryChanged.adminPasscodeID", value.adminPasscodeID)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.changeType", value.changeType, 1U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue", value.latestValue)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().privilege", - value.latestValue.Value().privilege, 5U)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().authMode", - value.latestValue.Value().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("accessControlEntryChanged.latestValue.Value().subjects", - value.latestValue.Value().subjects)); - { - auto iter_4 = value.latestValue.Value().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 0)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().subjects.Value()[0]", - iter_4.GetValue(), TH2CommissionerNodeId)); - VerifyOrReturn(CheckNextListItemDecodes( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 1)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().subjects.Value()[1]", - iter_4.GetValue(), 2222ULL)); - VerifyOrReturn(CheckNoMoreListItems( - "accessControlEntryChanged.latestValue.Value().subjects.Value()", iter_4, 2)); - } - VerifyOrReturn( - CheckValueNull("accessControlEntryChanged.latestValue.Value().targets", value.latestValue.Value().targets)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.latestValue.Value().fabricIndex", - value.latestValue.Value().fabricIndex, TH2FabricIndex)); - VerifyOrReturn(CheckValue("accessControlEntryChanged.fabricIndex", value.fabricIndex, TH2FabricIndex)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - 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)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 TH1 commissioner node ID"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "TH1 reads OperationalCredentials cluster CurrentFabricIndex attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "TH1 puts DUT into commissioning mode"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - value.PAKEPasscodeVerifier = mPakeVerifier.HasValue() - ? mPakeVerifier.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\xb9\x61\x70\xaa\xe8\x03\x34\x68\x84\x72\x4f\xe9\xa3\xb2\x87\xc3\x03\x30\xc2\xa6\x60\x37\x5d\x17\xbb\x20" - "\x5a\x8c\xf1\xae\xcb\x35\x04\x57\xf8\xab\x79\xee\x25\x3a\xb6\xa8\xe4\x6b\xb0\x9e\x54\x3a\xe4\x22\x73\x6d" - "\xe5\x01\xe3\xdb\x37\xd4\x41\xfe\x34\x49\x20\xd0\x95\x48\xe4\xc1\x82\x40\x63\x0c\x4f\xf4\x91\x3c\x53\x51" - "\x38\x39\xb7\xc0\x7f\xcc\x06\x27\xa1\xb8\x57\x3a\x14\x9f\xcd\x1f\xa4\x66\xcf"), - 97); - value.discriminator = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - value.iterations = 1000UL; - value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Waiting after opening commissioning window"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "TH1 puts DUT into commissioning mode, TH2 commissions DUT using admin node ID N2"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "TH2 starts a commissioning process with DUT"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 7: { - LogStep(7, "DUT is commissioned by TH2 on Fabric ID2 "); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 8: { - LogStep(8, "Read the TH2 commissioner node ID"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityBeta, value); - } - case 9: { - LogStep(9, "TH2 reads OperationalCredentials cluster CurrentFabricIndex attribute"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "TH2 reads OperationalCredentials cluster CurrentFabricIndex attribute"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(2); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = TH1CommissionerNodeId; - listHolder_3->mList[1] = 1111ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 2); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = TH1FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 12: { - LogStep(12, "TH2 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(2); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = TH2CommissionerNodeId; - listHolder_3->mList[1] = 2222ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 2); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = TH2FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "TH2 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "TH1 reads DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "TH2 reads DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "TH2 reads DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "TH1 reads DUT Endpoint 0 AccessControl cluster AccessControlEntryChanged event"); - VerifyOrDo(!ShouldSkip("ACL.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 3; - return ReadEvent(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Events::AccessControlEntryChanged::Id, false, chip::NullOptional); - } - case 18: { - LogStep(18, "TH2 reads DUT Endpoint 0 AccessControl cluster AccessControlEntryChanged event"); - VerifyOrDo(!ShouldSkip("ACL.S.E00 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 3; - return ReadEvent(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Events::AccessControlEntryChanged::Id, - false, chip::NullOptional); - } - case 19: { - LogStep(19, "TH2 reads DUT Endpoint 0 AccessControl cluster AccessControlEntryChanged event"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "TH1 writes ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = TH1CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 21: { - LogStep(21, "TH2 writes ACL attribute default value"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = TH2CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 22: { - LogStep(22, "TH2 writes ACL attribute default value"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Remove TH2 FabricIndex"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = TH2FabricIndex; - return SendCommand(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::Optional(10000), - chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Remove TH2 FabricIndex"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACL_2_9Suite : public TestCommand -{ -public: - Test_TC_ACL_2_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACL_2_9", 15, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACL_2_9Suite() {} - - 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 mNodeId2; - chip::Optional mPayload; - chip::Optional mTimeout; - - chip::NodeId CommissionerNodeId; - uint8_t CurrentFabricIndex; - - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CommissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CurrentFabricIndex = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 3U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); - } - break; - case 11: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 12: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - 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)); - shouldContinue = true; - 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, "Read the commissioner node ID"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "TH1 reads OperationalCredentials cluster CurrentFabricIndex attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(4); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3:TH1 reads DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = CurrentFabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5:TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 6:TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - value = chip::app::DataModel::List(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 7:TH1 reads DUT Endpoint 0 AccessControl cluster SubjectsPerAccessControlEntry attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::SubjectsPerAccessControlEntry::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 8:TH1 reads DUT Endpoint 0 AccessControl cluster TargetsPerAccessControlEntry attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::TargetsPerAccessControlEntry::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 9:TH1 reads DUT Endpoint 0 AccessControl cluster AccessControlEntriesPerFabric attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Attributes::AccessControlEntriesPerFabric::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 10:TH1 reads DUT Endpoint 0 AccessControl cluster AccessControlEntryChanged event"); - VerifyOrDo(!ShouldSkip("ACL.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Events::AccessControlEntryChanged::Id, false, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 11:TH1 reads DUT Endpoint 0 AccessControl cluster AccessControlExtensionChanged event"); - VerifyOrDo(!ShouldSkip("ACL.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, - AccessControl::Events::AccessControlExtensionChanged::Id, false, chip::NullOptional); - } - case 13: { - LogStep(13, "Test cleanup: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - return FactoryReset(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Test cleanup: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Factory Reset the DUT and enter 'y' after successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACL_2_10Suite : public TestCommand -{ -public: - Test_TC_ACL_2_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACL_2_10", 35, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("waitAfterCommissioning", 0, UINT16_MAX, &mWaitAfterCommissioning); - AddArgument("payload", &mPayload); - AddArgument("PakeVerifier", &mPakeVerifier); - AddArgument("D_OK_EMPTY", &mDOkEmpty); - AddArgument("D_OK_SINGLE", &mDOkSingle); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACL_2_10Suite() {} - - 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 mNodeId2; - chip::Optional mDiscriminator; - chip::Optional mWaitAfterCommissioning; - chip::Optional mPayload; - chip::Optional mPakeVerifier; - chip::Optional mDOkEmpty; - chip::Optional mDOkSingle; - chip::Optional mTimeout; - - chip::NodeId TH1CommissionerNodeId; - uint8_t TH1FabricIndex; - chip::NodeId TH2CommissionerNodeId; - uint8_t TH2FabricIndex; - - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH1CommissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH1FabricIndex = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH2CommissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH2FabricIndex = value; - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("extension", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "extension[0].data", iter_0.GetValue().data, - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2))); - VerifyOrReturn(CheckValue("extension[0].fabricIndex", iter_0.GetValue().fabricIndex, TH1FabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 1)); - } - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), TH2CommissionerNodeId)); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 1)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[1]", iter_3.GetValue(), 2222ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 2)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, TH2FabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 1)); - VerifyOrReturn(CheckValue("acl[1].privilege", iter_0.GetValue().privilege, 3U)); - VerifyOrReturn(CheckValue("acl[1].authMode", iter_0.GetValue().authMode, 3U)); - VerifyOrReturn(CheckValueNonNull("acl[1].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[1].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[1].subjects.Value()[0]", iter_3.GetValue(), 4444ULL)); - VerifyOrReturn(CheckNoMoreListItems("acl[1].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[1].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[1].fabricIndex", iter_0.GetValue().fabricIndex, TH2FabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 2)); - } - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - shouldContinue = true; - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlExtensionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("extension", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "extension[0].data", iter_0.GetValue().data, - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2))); - VerifyOrReturn(CheckValue("extension[0].fabricIndex", iter_0.GetValue().fabricIndex, TH1FabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("extension", iter_0, 1)); - } - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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; - 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, "Read the TH1 commissioner node ID"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 2:TH1 reads OperationalCredentials cluster CurrentFabricIndex attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3:TH1 puts DUT into commissioning mode"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - value.PAKEPasscodeVerifier = mPakeVerifier.HasValue() - ? mPakeVerifier.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\xb9\x61\x70\xaa\xe8\x03\x34\x68\x84\x72\x4f\xe9\xa3\xb2\x87\xc3\x03\x30\xc2\xa6\x60\x37\x5d\x17\xbb\x20" - "\x5a\x8c\xf1\xae\xcb\x35\x04\x57\xf8\xab\x79\xee\x25\x3a\xb6\xa8\xe4\x6b\xb0\x9e\x54\x3a\xe4\x22\x73\x6d" - "\xe5\x01\xe3\xdb\x37\xd4\x41\xfe\x34\x49\x20\xd0\x95\x48\xe4\xc1\x82\x40\x63\x0c\x4f\xf4\x91\x3c\x53\x51" - "\x38\x39\xb7\xc0\x7f\xcc\x06\x27\xa1\xb8\x57\x3a\x14\x9f\xcd\x1f\xa4\x66\xcf"), - 97); - value.discriminator = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - value.iterations = 1000UL; - value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Waiting after opening commissioning window"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "TH1 puts DUT into commissioning mode, TH2 commissions DUT using admin node ID N2"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "TH2 starts a commissioning process with DUT"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 7: { - LogStep(7, "DUT is commissioned by TH2 on Fabric ID2"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 8: { - LogStep(8, "Read the TH2 commissioner node ID"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityBeta, value); - } - case 9: { - LogStep(9, "Step 4:TH2 reads OperationalCredentials cluster CurrentFabricIndex attribute"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4:TH2 reads OperationalCredentials cluster CurrentFabricIndex attribute"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 5:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(2); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = TH1CommissionerNodeId; - listHolder_3->mList[1] = 1111ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 2); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = TH1FabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 3333ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = TH1FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 6:TH2 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(2); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = TH2CommissionerNodeId; - listHolder_3->mList[1] = 2222ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 2); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = TH2FabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 4444ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = TH2FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 6:TH2 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 14: { - LogStep(14, - "Step 7:TH1 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1.struct, Data field: D_OK_EMPTY"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = - mDOkEmpty.HasValue() ? mDOkEmpty.Value() : chip::ByteSpan(chip::Uint8::from_const_char("\x17\x18"), 2); - listHolder_0->mList[0].fabricIndex = TH1FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 15: { - LogStep(15, - "Step 8:TH2 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1.struct, Data field: D_OK_SINGLE"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDOkSingle.HasValue() - ? mDOkSingle.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68\x69" - "\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76" - "\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 71); - listHolder_0->mList[0].fabricIndex = TH2FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 16: { - LogStep(16, - "Step 8:TH2 writes DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element 1.struct, Data field: D_OK_SINGLE"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Step 9: Reboot DUT"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 9: Reboot DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Reboot the DUT and enter 'y' after successgarbage: not in length on purpose", 42); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "TH1 Connects to the device again"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "TH2 Connects to the device again"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 21: { - LogStep(21, "Step 10:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(2); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = TH1CommissionerNodeId; - listHolder_3->mList[1] = 1111ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 2); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = TH1FabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 3333ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = TH1FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 11:TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - case 23: { - LogStep(23, "Step 12:TH2 reads DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, "Step 12:TH2 reads DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 25: { - LogStep(25, "Step 13:TH2 reads DUT Endpoint 0 AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001 && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].data = mDOkSingle.HasValue() - ? mDOkSingle.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\x17\xD0\x00\x00\xF1\xFF\x01\x00\x3D\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x2E\x20\x54\x68\x69" - "\x73\x20\x69\x73\x20\x61\x20\x73\x69\x6E\x67\x6C\x65\x20\x65\x6C\x65\x6D\x65\x6E\x74\x20\x6C\x69\x76" - "\x69\x6E\x67\x20\x61\x73\x20\x61\x20\x63\x68\x61\x72\x73\x74\x72\x69\x6E\x67\x00\x18"), - 71); - listHolder_0->mList[0].fabricIndex = TH2FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 13:TH2 reads DUT Endpoint 0 AccessControl cluster Extension attribute"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 27: { - LogStep(27, "Step 14: If DUT is an app on host, examine persistent storage in /tmp/chip_kvs text file"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 28: { - LogStep(28, "Step 15:TH1 removes fabric F2 from DUT"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.C0a.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = TH2FabricIndex; - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::Optional(10000), - chip::NullOptional - - ); - } - case 29: { - LogStep(29, "Step 15:TH1 removes fabric F2 from DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && OPCREDS.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 30: { - LogStep(30, "Step 16:TH1 writes DUT Endpoint 0 AccessControl cluster ACL attribute"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(2); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = TH1CommissionerNodeId; - listHolder_3->mList[1] = 1111ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 2); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = TH1FabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 3333ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = TH1FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 17:TH1 reads DUT Endpoint 0 AccessControl cluster Extension attribute, value is list of " - "AccessControlExtensionStruct containing 1 element"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Step 18: If DUT is an app on host, examine persistent storage in /tmp/chip_kvs text file"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 33: { - LogStep(33, "TH1 writes Extension attribute value as empty list"); - VerifyOrDo(!ShouldSkip("ACL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - value = chip::app::DataModel::List(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Extension::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 34: { - LogStep(34, "TH1 writes ACL attribute value is an empty list"); - VerifyOrDo(!ShouldSkip("ACL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = TH1CommissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACE_1_1Suite : public TestCommand -{ -public: - Test_TC_ACE_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACE_1_1", 38, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACE_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::NodeId commissionerNodeId; - - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - commissionerNodeId = value.nodeId; - } - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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(CheckConstraintMinLength("value", value, 1)); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 1)); - } - 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::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - 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_CONSTRAINT_ERROR)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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_ACCESS)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 37: - 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, "Read the commissioner node ID"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "TP2 - Write ACL giving admin privilege on all EP0"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[0].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 3: { - LogStep(3, "TP3 - Read the NOC attribute (Node operational credentials - requires administer)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::NOCs::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "TP4 - Write the location attribute (Basic - requires administer)"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("XXgarbage: not in length on purpose", 2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "TP5 - Send the UpdateFabricLabel command (Node operational credentials - requires administer)"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type value; - value.label = chip::Span("TestFabricgarbage: not in length on purpose", 10); - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::UpdateFabricLabel::Id, value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, "TP6 - Write NodeLabel attribute (Basic - requires manage)"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("TestNodegarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "TP7 - Send TestEventTrigger (General Diagnostics - requires manage)"); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = chip::ByteSpan(chip::Uint8::from_const_char("0garbage: not in length on purpose"), 1); - value.eventTrigger = 0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "TP8 - Tead the VendorID attribute (Basic - requires view)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "TP9 - Write ACL giving admin privilege ACL, manage for rest of EP0"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 31UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(4); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeId; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 10: { - LogStep(10, "TP10 - Read the NOC attribute (Node operational credentials - requires administer)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::NOCs::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "TP11 - Write the location attribute (Basic - requires administer)"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("XXgarbage: not in length on purpose", 2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 12: { - LogStep(12, "TP12 - Send the UpdateFabricLabel command (Node operational credentials - requires administer)"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type value; - value.label = chip::Span("TestFabricgarbage: not in length on purpose", 10); - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::UpdateFabricLabel::Id, value, chip::NullOptional - - ); - } - case 13: { - LogStep(13, "TP13(6) - Write NodeLabel attribute (Basic - requires manage)"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("TestNodegarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 14: { - LogStep(14, "TP13(7) - Send TestEventTrigger (General Diagnostics - requires manage)"); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = chip::ByteSpan(chip::Uint8::from_const_char("0garbage: not in length on purpose"), 1); - value.eventTrigger = 0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 15: { - LogStep(15, "TP13(8) - Tead the VendorID attribute (Basic - requires view)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "TP14 - Write ACL giving admin privilege ACL, operate for rest of EP0"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 31UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeId; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 17: { - LogStep(17, "TP15(10) - Read the NOC attribute (Node operational credentials - requires administer)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::NOCs::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "TP15(11) - Write the location attribute (Basic - requires administer)"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("XXgarbage: not in length on purpose", 2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 19: { - LogStep(19, "TP15(12) - Send the UpdateFabricLabel command (Node operational credentials - requires administer)"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type value; - value.label = chip::Span("TestFabricgarbage: not in length on purpose", 10); - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::UpdateFabricLabel::Id, value, chip::NullOptional - - ); - } - case 20: { - LogStep(20, "TP16 - Write NodeLabel attribute (Basic - requires manage)"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("TestNodegarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 21: { - LogStep(21, "TP17 - Send TestEventTrigger (General Diagnostics - requires manage)"); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = chip::ByteSpan(chip::Uint8::from_const_char("0garbage: not in length on purpose"), 1); - value.eventTrigger = 0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 22: { - LogStep(22, "TP18(8) - Tead the VendorID attribute (Basic - requires view)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 23: { - LogStep(23, "TP19 - Write ACL giving admin privilege ACL, operate for rest of EP0"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 31UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeId; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 24: { - LogStep(24, "TP20(10) - Read the NOC attribute (Node operational credentials - requires administer)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::NOCs::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "TP20(11) - Write the location attribute (Basic - requires administer)"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("XXgarbage: not in length on purpose", 2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 26: { - LogStep(26, "TP20(12) - Send the UpdateFabricLabel command (Node operational credentials - requires administer)"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type value; - value.label = chip::Span("TestFabricgarbage: not in length on purpose", 10); - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::UpdateFabricLabel::Id, value, chip::NullOptional - - ); - } - case 27: { - LogStep(27, "TP21(16) - Write NodeLabel attribute (Basic - requires manage)"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("TestNodegarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 28: { - LogStep(28, "TP21(17) - Send TestEventTrigger (General Diagnostics - requires manage)"); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = chip::ByteSpan(chip::Uint8::from_const_char("0garbage: not in length on purpose"), 1); - value.eventTrigger = 0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 29: { - LogStep(29, "TP22(8) - Tead the VendorID attribute (Basic - requires view)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 30: { - LogStep(30, "TP23 - Write ACL giving only admin privilege ACL cluster"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 31UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[0].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 31: { - LogStep(31, "TP24(10) - Read the NOC attribute (Node operational credentials - requires administer)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::NOCs::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, "TP24(11) - Write the location attribute (Basic - requires administer)"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("XXgarbage: not in length on purpose", 2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 33: { - LogStep(33, "TP24(12) - Send the UpdateFabricLabel command (Node operational credentials - requires administer)"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type value; - value.label = chip::Span("TestFabricgarbage: not in length on purpose", 10); - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::UpdateFabricLabel::Id, value, chip::NullOptional - - ); - } - case 34: { - LogStep(34, "TP25(16) - Write NodeLabel attribute (Basic - requires manage)"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("TestNodegarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 35: { - LogStep(35, "TP25(17) - Send TestEventTrigger (General Diagnostics - requires manage)"); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = chip::ByteSpan(chip::Uint8::from_const_char("0garbage: not in length on purpose"), 1); - value.eventTrigger = 0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 36: { - LogStep(36, "TP26 - Tead the VendorID attribute (Basic - requires view)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 37: { - LogStep(37, "TP27 - Write ACL to restore full access"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeId; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACE_1_5Suite : public TestCommand -{ -public: - Test_TC_ACE_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACE_1_5", 23, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("payload", &mPayload); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("waitAfterCommissioning", 0, UINT16_MAX, &mWaitAfterCommissioning); - AddArgument("PakeVerifier", &mPakeVerifier); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACE_1_5Suite() {} - - 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 mPayload; - chip::Optional mDiscriminator; - chip::Optional mWaitAfterCommissioning; - chip::Optional mPakeVerifier; - chip::Optional mTimeout; - - uint8_t th1FabricIndex; - uint8_t th2FabricIndex; - chip::NodeId commissionerNodeIdAlpha; - chip::NodeId commissionerNodeIdBeta; - - 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))); - th1FabricIndex = value; - } - 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)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - th2FabricIndex = value; - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - commissionerNodeIdAlpha = value.nodeId; - } - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - commissionerNodeIdBeta = value.nodeId; - } - shouldContinue = true; - 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::DataModel::DecodableList - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 for TH1"); - 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 fabric index"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2 & 3: TH1 puts DUT into commissioning mode, TH2 commissions DUT using admin node ID N2"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2: Open Commissioning Window from alpha"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - value.PAKEPasscodeVerifier = mPakeVerifier.HasValue() - ? mPakeVerifier.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\xb9\x61\x70\xaa\xe8\x03\x34\x68\x84\x72\x4f\xe9\xa3\xb2\x87\xc3\x03\x30\xc2\xa6\x60\x37\x5d\x17\xbb\x20" - "\x5a\x8c\xf1\xae\xcb\x35\x04\x57\xf8\xab\x79\xee\x25\x3a\xb6\xa8\xe4\x6b\xb0\x9e\x54\x3a\xe4\x22\x73\x6d" - "\xe5\x01\xe3\xdb\x37\xd4\x41\xfe\x34\x49\x20\xd0\x95\x48\xe4\xc1\x82\x40\x63\x0c\x4f\xf4\x91\x3c\x53\x51" - "\x38\x39\xb7\xc0\x7f\xcc\x06\x27\xa1\xb8\x57\x3a\x14\x9f\xcd\x1f\xa4\x66\xcf"), - 97); - value.discriminator = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - value.iterations = 1000UL; - value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Waiting after opening commissioning window"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 3: Commission from TH2"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 6: { - LogStep(6, "Wait for the commissioned device to be retrieved for TH2"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 7: { - LogStep(7, "Step 4: TH2 reads the fabric index"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4: TH2 reads the fabric index"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Read the commissioner node ID from the alpha fabric"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 5: TH1 writes ACL giving view privilege for descriptor cluster"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeIdAlpha; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 31UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[0].fabricIndex = th1FabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 29UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = th1FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 11: { - LogStep(11, "Read the commissioner node ID from the beta fabric"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityBeta, value); - } - case 12: { - LogStep(12, "Step 6: TH2 writes ACL giving view privilge for basic cluster"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeIdBeta; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 31UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[0].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[0].fabricIndex = th2FabricIndex; - - listHolder_0->mList[1].privilege = - static_cast(1); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 40UL; - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 0U; - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = th2FabricIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 6: TH2 writes ACL giving view privilge for basic cluster"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 7: TH1 reads descriptor cluster - expect SUCCESS"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::DeviceTypeList::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 8: TH1 reads basic cluster - expect UNSUPPORTED_ACCESS"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 9: TH2 reads descriptor cluster - expect UNSUPPORTED_ACCESS"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::DeviceTypeList::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Step 9: TH2 reads descriptor cluster - expect UNSUPPORTED_ACCESS"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 10: TH2 reads basic cluster - expect SUCCESS"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 10: TH2 reads basic cluster - expect SUCCESS"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 11: TH1 resets ACL to default"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeIdAlpha; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 12: TH1 sends RemoveFabric command for TH2"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = th2FabricIndex; - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Step 12: TH1 sends RemoveFabric command for TH2"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_AIRQUAL_1_1Suite : public TestCommand -{ -public: - Test_TC_AIRQUAL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_AIRQUAL_1_1", 16, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_AIRQUAL_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)); - { - 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)); - { - 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, 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 8: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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::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 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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")); - } - 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::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip("!AIRQUAL.S.F00 && !AIRQUAL.S.F01 && !AIRQUAL.S.F02 && !AIRQUAL.S.F03"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given AIRQUAL.S.F00(Fair) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("AIRQUAL.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given AIRQUAL.S.F01(Moderate) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("AIRQUAL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given AIRQUAL.S.F02(VeryPoor) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("AIRQUAL.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given AIRQUAL.S.F03(ExtremelyPoor) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("AIRQUAL.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 9: { - LogStep( - 9, - "Step 4b: TH reads from the DUT the AttributeList attribute. 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)"); - 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 10: { - LogStep(10, "Step 5a: TH reads EventList attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 12: { - LogStep(12, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 13: { - LogStep( - 13, - "Step 6b: TH reads from the DUT the AcceptedCommandList attribute. 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)"); - 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 14: { - LogStep(14, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 15: { - LogStep( - 15, - "Step 7b: TH reads from the DUT the GeneratedCommandList attribute. 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_AIRQUAL_2_1Suite : public TestCommand -{ -public: - Test_TC_AIRQUAL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_AIRQUAL_2_1", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_AIRQUAL_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)); - { - chip::app::Clusters::AirQuality::AirQualityEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 6U)); - } - 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 reads from the DUT the AirQuality attribute."); - VerifyOrDo(!ShouldSkip("AIRQUAL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AirQuality::Id, AirQuality::Attributes::AirQuality::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_BOOL_1_1Suite : public TestCommand -{ -public: - Test_TC_BOOL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BOOL_1_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BOOL_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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 7: - 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(CheckNextListItemDecodes("eventList", iter_0, 0)); - VerifyOrReturn(CheckValue("eventList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 8: - 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; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::ClusterRevision::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, - BooleanState::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, - BooleanState::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("BOOL.S.E00 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 7: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip(" !BOOL.S.E00 && PICS_EVENT_LIST_ENABLED "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::EventList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_BOOL_2_1Suite : public TestCommand -{ -public: - Test_TC_BOOL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BOOL_2_1", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BOOL_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)); - { - 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, "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: Read mandatory non-global attribute: StateValue"); - VerifyOrDo(!ShouldSkip("BOOL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), BooleanState::Id, BooleanState::Attributes::StateValue::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_BRBINFO_1_1Suite : public TestCommand -{ -public: - Test_TC_BRBINFO_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BRBINFO_1_1", 28, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BRBINFO_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)); - shouldContinue = true; - 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, 17UL)); - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 17UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 1UL)); - } - 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, 2UL)); - } - break; - case 7: - 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, 3UL)); - } - break; - case 8: - 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, 5UL)); - } - break; - case 9: - 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)); - } - break; - case 10: - 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, 8UL)); - } - break; - 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, 9UL)); - } - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 12UL)); - } - break; - 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, 13UL)); - } - break; - case 16: - 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, 14UL)); - } - break; - case 17: - 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, 15UL)); - } - break; - case 18: - 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, 18UL)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - 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)); - } - break; - case 21: - 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)); - } - break; - case 22: - 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, 2UL)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - 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")); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision from DUT"); - 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, "Step 3: TH reads the FeatureMap from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip(" !PICS_EVENT_LIST_ENABLED "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: TH reads optional attribute(VendorName) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4c: TH reads optional attribute(VendorID) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4d: TH reads optional attribute(ProductName) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4e: TH reads optional attribute(NodeLabel) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4f: TH reads optional attribute(HardwareVersion) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4g: TH reads optional attribute(HardwareVersionString) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4h: TH reads optional attribute(SoftwareVersion) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4i: TH reads optional attribute(SoftwareVersionString) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 4j: TH reads optional attribute(ManufacturingDate) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 4k: TH reads optional attribute(PartNumber) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4l: TH reads optional attribute(ProductURL) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A000d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4m: TH reads optional attribute(ProductLabel) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4n: TH reads optional attribute(SerialNumber) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4o: TH reads optional attribute(UniqueID) in AttributeList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4p: 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)"); - 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 20: { - LogStep(20, "Step 5a: TH reads optional event(StartUp) in EventList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.E00 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::EventList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 5b: TH reads optional attribute(ShutDown) in EventList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.E01 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::EventList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 5c: TH reads optional attribute(Leave) in EventList"); - VerifyOrDo(!ShouldSkip("BRBINFO.S.E02 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::EventList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 5d: TH reads EventList 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 24: { - LogStep(24, "Step 6a: TH1 reads AcceptedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 26: { - LogStep(26, "Step 7a: TH1 reads GeneratedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), BridgedDeviceBasicInformation::Id, - BridgedDeviceBasicInformation::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 7b: TH1 reads GeneratedCommandList 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACT_1_1Suite : public TestCommand -{ -public: - Test_TC_ACT_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACT_1_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACT_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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 2UL)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - 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(CheckConstraintMaxLength("value", value, 11)); - } - break; - case 8: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Actions::Id, Actions::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Actions::Id, Actions::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Actions::Id, Actions::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Actions::Id, Actions::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: Read the optional attribute(SetupURL) in AttributeList"); - VerifyOrDo(!ShouldSkip("ACT.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Actions::Id, Actions::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5: TH reads EventList attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 7: { - LogStep(7, "Step 6: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Actions::Id, Actions::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 7: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Actions::Id, Actions::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_BIND_1_1Suite : public TestCommand -{ -public: - Test_TC_BIND_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BIND_1_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BIND_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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 4b: 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)"); - 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 6: { - LogStep(6, - "Step 5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 7: { - LogStep(7, - "Step 6: TH reads AcceptedCommandList 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)"); - 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 8: { - LogStep(8, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CC_1_1Suite : public TestCommand -{ -public: - Test_TC_CC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_1_1", 79, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_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)); - shouldContinue = true; - 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)); - { - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 15UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 16385UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 16394UL)); - 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 9: - 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, 8UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 15UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 16385UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 16394UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 10: - 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)); - } - break; - 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, 1UL)); - } - 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, 2UL)); - } - 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, 3UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - 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, 5UL)); - } - break; - case 16: - 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, 6UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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, 16UL)); - } - break; - case 19: - 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, 17UL)); - } - break; - case 20: - 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, 18UL)); - } - break; - case 21: - 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, 19UL)); - } - break; - case 22: - 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, 21UL)); - } - break; - case 23: - 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, 22UL)); - } - break; - case 24: - 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, 23UL)); - } - break; - case 25: - 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, 25UL)); - } - break; - case 26: - 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, 26UL)); - } - break; - case 27: - 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, 27UL)); - } - break; - case 28: - 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, 32UL)); - } - break; - case 29: - 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, 33UL)); - } - break; - case 30: - 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, 34UL)); - } - break; - case 31: - 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, 36UL)); - } - break; - case 32: - 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, 37UL)); - } - break; - case 33: - 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, 38UL)); - } - break; - case 34: - 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, 40UL)); - } - break; - case 35: - 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, 41UL)); - } - break; - case 36: - 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, 42UL)); - } - break; - case 37: - 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, 48UL)); - } - break; - case 38: - 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, 49UL)); - } - break; - case 39: - 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, 50UL)); - } - break; - case 40: - 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, 51UL)); - } - break; - case 41: - 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, 52UL)); - } - break; - case 42: - 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, 54UL)); - } - break; - case 43: - 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, 55UL)); - } - break; - case 44: - 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, 56UL)); - } - break; - case 45: - 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, 58UL)); - } - break; - case 46: - 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, 59UL)); - } - break; - case 47: - 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, 60UL)); - } - break; - case 48: - 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, 16384UL)); - } - break; - case 49: - 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, 16386UL)); - } - break; - case 50: - 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, 16387UL)); - } - break; - case 51: - 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, 16388UL)); - } - break; - case 52: - 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, 16389UL)); - } - break; - case 53: - 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, 16390UL)); - } - break; - case 54: - 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, 16395UL)); - } - break; - case 55: - 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, 16396UL)); - } - break; - case 56: - 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, 16397UL)); - } - break; - case 57: - 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, 16400UL)); - } - break; - case 58: - 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 59: - 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)); - } - break; - case 60: - 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)); - } - break; - case 61: - 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, 2UL)); - } - break; - case 62: - 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, 3UL)); - } - break; - case 63: - 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, 4UL)); - } - break; - case 64: - 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, 5UL)); - } - break; - case 65: - 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, 6UL)); - } - break; - case 66: - 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)); - } - break; - case 67: - 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, 8UL)); - } - break; - case 68: - 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)); - } - break; - case 69: - 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, 10UL)); - } - break; - case 70: - 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, 64UL)); - } - break; - case 71: - 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, 65UL)); - } - break; - case 72: - 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, 66UL)); - } - break; - case 73: - 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, 67UL)); - } - break; - case 74: - 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, 68UL)); - } - break; - case 75: - 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, 71UL)); - } - break; - case 76: - 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, 75UL)); - } - break; - case 77: - 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, 76UL)); - } - break; - case 78: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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: read the global attribute: ClusterRevision"); - 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, "Step 3a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip("( !CC.S.F00 && !CC.S.F01 && !CC.S.F02 && !CC.S.F03 && !CC.S.F04 )"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given CC.S.F00(HS) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given CC.S.F01(EHue) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given CC.S.F02(CL) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given CC.S.F03(XY) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given CC.S.F04(CT) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4b: Read the optional attribute(CurrentHue) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4c: Read the optional attribute(CurrentSaturation) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4d: Read the optional attribute(RemainingTime) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 4e: Read the optional attribute(CurrentX) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 4f: Read the optional attribute(CurrentY) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4g: Read the optional attribute(DriftCompensation) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4h: Read the optional attribute(CompensationText) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4i: Read the optional attribute(ColorTemperatureMireds) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4j: Read the optional attribute(NumberOfPrimaries) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 4k: Read the optional attribute(Primary1X) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 4l: Read the optional attribute(Primary1Y) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 4m: Read the optional attribute(Primary1Intensity) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 4n: Read the optional attribute(Primary2X) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 4o: Read the optional attribute(Primary2Y) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0016"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 4p: Read the optional attribute(Primary2Intensity) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4q: Read the optional attribute(Primary3X) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0019"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4r: Read the optional attribute(Primary3Y) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 4s: Read the optional attribute(Primary3Intensity) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A001b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 28: { - LogStep(28, "Step 4t: Read the optional attribute(Primary4X) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0020"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 4u: Read the optional attribute(Primary4Y) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 30: { - LogStep(30, "Step 4v: Read the optional attribute(Primary4Intensity) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0022"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 31: { - LogStep(31, "Step 4w: Read the optional attribute(Primary5X) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0024"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 32: { - LogStep(32, "Step 4x: Read the optional attribute(Primary5Y) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0025"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 33: { - LogStep(33, "Step 4y: Read the optional attribute(Primary5Intensity) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0026"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 34: { - LogStep(34, "Step 4z: Read the optional attribute(Primary6X) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0028"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 35: { - LogStep(35, "Step 4a1: Read the optional attribute(Primary6Y) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0029"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 36: { - LogStep(36, "Step 4a2: Read the optional attribute(Primary6Intensity) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A002a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 37: { - LogStep(37, "Step 4a3: Read the optional attribute(WhitePointX) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 38: { - LogStep(38, "Step 4a4: Read the optional attribute(WhitePointY) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 39: { - LogStep(39, "Step 4a5: Read the optional attribute(ColorPointRX) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0032"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 40: { - LogStep(40, "Step 4a6: Read the optional attribute(ColorPointRY) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 41: { - LogStep(41, "Step 4a7: Read the optional attribute(ColorPointRIntensity) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0034"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 42: { - LogStep(42, "Step 4a8: Read the optional attribute(ColorPointGX) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0036"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 43: { - LogStep(43, "Step 4a9: Read the optional attribute(ColorPointGY) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0037"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 44: { - LogStep(44, "Step 4a10: Read the optional attribute(ColorPointGIntensity) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A0038"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 45: { - LogStep(45, "Step 4a11: Read the optional attribute(ColorPointBX) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A003a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 46: { - LogStep(46, "Step 4a12: Read the optional attribute(ColorPointBY) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A003b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 47: { - LogStep(47, "Step 4a13: Read the optional attribute(ColorPointBIntensity) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A003c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 48: { - LogStep(48, "Step 4a14: Read the optional attribute(EnhancedCurrentHue) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 49: { - LogStep(49, "Step 4a15: Read the optional attribute(ColorLoopActive) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A4002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 50: { - LogStep(50, "Step 4a16: Read the optional attribute(ColorLoopDirection) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A4003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 51: { - LogStep(51, "Step 4a17: Read the optional attribute(ColorLoopTime) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A4004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 52: { - LogStep(52, "Step 4a18: Read the optional attribute(ColorLoopStartEnhancedHue) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A4005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 53: { - LogStep(53, "Step 4a19: Read the optional attribute(ColorLoopStoredEnhancedHue) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A4006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 54: { - LogStep(54, "Step 4a20: Read the optional attribute(ColorTempPhysicalMinMireds) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A400b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 55: { - LogStep(55, "Step 4a21: Read the optional attribute(ColorTempPhysicalMaxMireds) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A400c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 56: { - LogStep(56, "Step 4a22: Read the optional attribute(CoupleColorTempToLevelMinMireds) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A400d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 57: { - LogStep(57, "Step 4a23: Read the optional attribute(StartUpColorTemperatureMireds) in AttributeList"); - VerifyOrDo(!ShouldSkip("CC.S.A4010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 58: { - LogStep(58, "Step 5: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 59: { - LogStep(59, "Step 6a: Read the optional command(MoveToHue) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 60: { - LogStep(60, "Step 6b: Read the optional command(MoveHue) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 61: { - LogStep(61, "Step 6c: Read the optional command(StepHue) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 62: { - LogStep(62, "Step 6d: Read the optional command(MoveToSaturation) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 63: { - LogStep(63, "Step 6e: Read the optional command(MoveSaturation) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 64: { - LogStep(64, "Step 6f: Read the optional command(StepSaturation) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 65: { - LogStep(65, "Step 6g: Read the optional command(MoveToHueAndSaturation) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 66: { - LogStep(66, "Step 6h: Read the optional command(MoveToColor) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 67: { - LogStep(67, "Step 6i: Read the optional command(MoveColor) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 68: { - LogStep(68, "Step 6j: Read the optional command(StepColor) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C09.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 69: { - LogStep(69, "Step 6k: Read the optional command(MoveToColorTemperature) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 70: { - LogStep(70, "Step 6l: Read the optional command(EnhancedMoveToHue) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 71: { - LogStep(71, "Step 6m: Read the optional command(EnhancedMoveHue) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 72: { - LogStep(72, "Step 6n: Read the optional command(EnhancedStepHue) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 73: { - LogStep(73, "Step 6o: Read the optional command(EnhancedMoveToHueAndSaturation) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C43.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 74: { - LogStep(74, "Step 6p: Read the optional command(ColorLoopSet) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 75: { - LogStep(75, "Step 6q: Read the optional command(StopMoveStep) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C47.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 76: { - LogStep(76, "Step 6r: Read the optional command(MoveColorTemperature) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 77: { - LogStep(77, "Step 6s: Read the optional command(StepColorTemperature) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CC.S.C4c.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 78: { - LogStep(78, "Step 7: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CC_2_1Suite : public TestCommand -{ -public: - Test_TC_CC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_2_1", 54, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_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; - - uint32_t FeatureMapValue; - - 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, 254U)); - } - 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", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - break; - case 3: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 5: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 254)); - } - break; - case 8: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - 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")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 13: - 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)); - } - break; - case 14: - 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)); - } - break; - case 15: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - } - break; - case 16: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 17: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - FeatureMapValue = value; - } - 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("colorCapabilities", value, FeatureMapValue)); - VerifyOrReturn(CheckConstraintType("value", "bitmap16", "bitmap16")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 31U)); - } - break; - case 20: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 21: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 22: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 23: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 24: - 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, 6U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 43: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 44: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 45: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 46: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 47: - 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, 255U)); - } - break; - case 48: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 49: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 50: - 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, 255U)); - } - break; - case 51: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 52: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 53: - 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, 255U)); - } - 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 reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads RemainingTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::RemainingTime::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads DriftCompensation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::DriftCompensation::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads CompensationText attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CompensationText::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads ColorTemperatureMireds attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads Options attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 12: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 13: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 14: TH reads ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 15: TH reads ColorLoopDirection attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 16: TH reads ColorLoopTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 17: TH reads ColorLoopStartEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 18: TH reads ColorLoopStoredEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 18a: Saving for comparision in step 19 reads FeatureMap attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Step 19: TH reads ColorCapabilities attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A400a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorCapabilities::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 20: TH reads ColorTempPhysicalMinMireds attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A400b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMinMireds::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 21: TH reads ColorTempPhysicalMaxMireds attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A400c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 22: TH reads CoupleColorTempToLevelMinMireds attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A400d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 23: TH reads StartUpColorTemperatureMireds attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::StartUpColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 24: TH reads NumberOfPrimaries attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::NumberOfPrimaries::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, - "Step 25: TH reads Primary1X attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 1 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0011"), 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 26: { - LogStep(26, - "Step 26: TH reads Primary1Y attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 1 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0012"), 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 27: { - LogStep(27, - "Step 27: TH reads Primary1Intensity attribute from DUT and Verify that the DUT response contains an uint8 if " - "NumberOfPrimaries is 1 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0013"), 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 28: { - LogStep(28, - "Step 28: TH reads Primary2X attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 2 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0015"), 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 29: { - LogStep(29, - "Step 29: TH reads Primary2Y attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 2 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0016"), 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 30: { - LogStep(30, - "Step 30: TH reads Primary2Intensity attribute from DUT and Verify that the DUT response contains an uint8 if " - "NumberOfPrimaries is 2 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0017"), 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 31: { - LogStep(31, - "Step 31: TH reads Primary3X attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 3 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0019"), 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 32: { - LogStep(32, - "Step 32: TH reads Primary3Y attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 3 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A001a"), 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 33: { - LogStep(33, - "Step 33: TH reads Primary3Intensity attribute from DUT and Verify that the DUT response contains an uint8 if " - "NumberOfPrimaries is 3 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A001b"), 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 34: { - LogStep(34, - "Step 34: TH reads Primary4X attribute from DUT Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 4 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0020"), 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 35: { - LogStep(35, - "Step 35: TH reads Primary4Y attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 4 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0021"), 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 36: { - LogStep(36, - "Step 36: TH reads Primary4Intensity attribute from DUT and Verify that the DUT response contains an uint8 if " - "NumberOfPrimaries is 4 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0022"), 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 37: { - LogStep(37, - "Step 37: TH reads Primary5X attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 5 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0024"), 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 38: { - LogStep(38, - "Step 38: TH reads Primary5Y attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 5 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0025"), 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 39: { - LogStep(39, - "Step 39: TH reads Primary5Intensity attribute from DUT and Verify that the DUT response contains an uint8 if " - "NumberOfPrimaries is 5 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0026"), 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 40: { - LogStep(40, - "Step 40: TH reads Primary6X attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 6 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0028"), 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 41: { - LogStep(41, - "Step 41: TH reads Primary6Y attribute from DUT and Verify that the DUT response contains an uint16 [Min:0 " - "Max:0xfeff] if NumberOfPrimaries is 6 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A0029"), 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 42: { - LogStep(42, - "Step 42: TH reads Primary6Intensity attribute from DUT and Verify that the DUT response contains an uint8 if " - "NumberOfPrimaries is 6 or more"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CC.S.A002a"), 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 43: { - LogStep(43, "Step 43: TH reads WhitePointX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::WhitePointX::Id, true, - chip::NullOptional); - } - case 44: { - LogStep(44, "Step 44: TH reads WhitePointY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::WhitePointY::Id, true, - chip::NullOptional); - } - case 45: { - LogStep(45, "Step 45: TH reads ColorPointRX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0032"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointRX::Id, true, - chip::NullOptional); - } - case 46: { - LogStep(46, "Step 46: TH reads ColorPointRY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointRY::Id, true, - chip::NullOptional); - } - case 47: { - LogStep(47, "Step 47: TH reads ColorPointRIntensity attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0034"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorPointRIntensity::Id, true, chip::NullOptional); - } - case 48: { - LogStep(48, "Step 48: TH reads ColorPointGX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0036"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointGX::Id, true, - chip::NullOptional); - } - case 49: { - LogStep(49, "Step 49: TH reads ColorPointGY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0037"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointGY::Id, true, - chip::NullOptional); - } - case 50: { - LogStep(50, "Step 50: TH reads ColorPointGIntensity attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0038"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorPointGIntensity::Id, true, chip::NullOptional); - } - case 51: { - LogStep(51, "Step 51: TH reads ColorPointBX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A003a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointBX::Id, true, - chip::NullOptional); - } - case 52: { - LogStep(52, "Step 52: TH reads ColorPointBY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A003b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorPointBY::Id, true, - chip::NullOptional); - } - case 53: { - LogStep(53, "Step 53: TH reads ColorPointBIntensity attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A003c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorPointBIntensity::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CC_3_2Suite : public TestCommand -{ -public: - Test_TC_CC_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_3_2", 31, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_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 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 215U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 38U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 52U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 80U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 110U)); - } - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 80U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 110U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 16U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 183U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 247U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 140U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 190U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 140U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 190U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - 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, "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 1a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: 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 3: { - LogStep(3, - "Step 2a: TH sends MoveToHue command to DUT with Hue=200, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 200U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2b: TH sends MoveHue command to DUT with MoveMode=0x01 (up) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveHue::Type value; - value.moveMode = static_cast(1); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveHue::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 2d: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2e: TH sends MoveHue command to DUT with MoveMode=0x00 (stop) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveHue::Type value; - value.moveMode = static_cast(0); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveHue::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Step 2f: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Wait 2s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 2g: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, - "Step 3a: TH sends MoveToHue command to DUT with Hue=60, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 60U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Step 3b: TH sends MoveHue command to DUT with MoveMode=0x03 (down) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveHue::Type value; - value.moveMode = static_cast(3); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveHue::Id, value, - chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 3c: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Step 3d: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Step 3e: TH sends MoveHue command to DUT with MoveMode=0x00 (stop) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveHue::Type value; - value.moveMode = static_cast(0); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveHue::Id, value, - chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Step 3f: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 25: { - LogStep(25, "Wait 2s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 26: { - LogStep(26, "Step 3g: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 27: { - LogStep(27, "Step 4a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 28: { - LogStep(28, "Step 4b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 29: { - LogStep(29, "Turn off light that we turned on"); - 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 30: { - LogStep(30, "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_CC_3_3Suite : public TestCommand -{ -public: - Test_TC_CC_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_3_3", 25, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_3_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)); - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 195U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 6U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 6U)); - } - 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)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 17U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 23U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 208U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 208U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - 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, "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 1a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: 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 3: { - LogStep(3, - "Step 2a: TH sends MoveToHue command to DUT with Hue=200, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 200U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 2b: TH sends StepHue command to DUT with StepMode=0x01 (up), StepSize=60 and TransitionTime=200 (20s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StepHue::Type value; - value.stepMode = static_cast(1); - value.stepSize = 60U; - value.transitionTime = 200U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepHue::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 2d: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2e: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 3a: TH sends MoveToHue command to DUT with Hue=50, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 50U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, - "Step 3b: TH sends StepHue command to DUT with StepMode=0x03 (down), StepSize=60 and TransitionTime=200 (20s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StepHue::Type value; - value.stepMode = static_cast(3); - value.stepSize = 60U; - value.transitionTime = 200U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepHue::Id, value, - chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 16: { - LogStep(16, "Step 3c: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 3d: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 3e: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "Step 4a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Step 4b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 23: { - LogStep(23, "Turn off light that we turned on"); - 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 24: { - LogStep(24, "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_CC_4_1Suite : public TestCommand -{ -public: - Test_TC_CC_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_4_1", 18, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("SaturationConfigValue", 0, UINT8_MAX, &mSaturationConfigValue); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_4_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 mSaturationConfigValue; - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 68U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 92U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 80U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 115U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 102U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 138U)); - } - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 102U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 138U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - 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, "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 1a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: 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 3: { - LogStep(3, "Step 2a: TH sends MoveToSaturation command to DUT with Saturation=60 and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type value; - value.saturation = 60U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToSaturation::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2b: TH sends MoveToSaturation command to DUT with Saturation=120 and TransitionTime=300 (30s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type value; - value.saturation = 120U; - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToSaturation::Id, - value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 2d: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2e: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 2f: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 3b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Turn off light that we turned on"); - 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 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CC_4_2Suite : public TestCommand -{ -public: - Test_TC_CC_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_4_2", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_4_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; - - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 216U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 216U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - 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)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 59U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 81U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 5U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 35U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 33: - 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, "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 1a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: 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 3: { - LogStep(3, "Step 2a: TH sends MoveToSaturation command to DUT with Saturation=150 and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type value; - value.saturation = 150U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToSaturation::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2b: TH sends MoveSaturation command to DUT with MoveMode=0x01 (up) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; - value.moveMode = static_cast(1); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 2d: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2e: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3a: TH sends MoveToSaturation command to DUT with Saturation=120 and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type value; - value.saturation = 120U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToSaturation::Id, - value, chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 3b: TH sends MoveSaturation command to DUT with MoveMode=0x03 (down) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; - value.moveMode = static_cast(3); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value, - chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 16: { - LogStep(16, "Step 3c: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 3d: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 3e: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 4a: TH sends MoveToSaturation command to DUT with Saturation=150 and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type value; - value.saturation = 150U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToSaturation::Id, - value, chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Step 4b: TH sends MoveSaturation command to DUT with MoveMode=0x01 (up) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; - value.moveMode = static_cast(1); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value, - chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 25: { - LogStep(25, "Step 4c: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4d: TH sends MoveSaturation command to DUT with MoveMode=0x00 (stop) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; - value.moveMode = static_cast(0); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value, - chip::NullOptional - - ); - } - case 27: { - LogStep(27, "Step 4e: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 28: { - LogStep(28, "Wait 2s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 29: { - LogStep(29, "Step 4f: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 30: { - LogStep(30, "Step 5a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 31: { - LogStep(31, "Step 5b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 32: { - LogStep(32, "Turn off light that we turned on"); - 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 33: { - LogStep(33, "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_CC_4_3Suite : public TestCommand -{ -public: - Test_TC_CC_4_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_4_3", 31, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_4_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)); - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 187U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 253U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 204U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 204U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 216U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 25U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 35U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 8U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 12U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 8U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 12U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentSaturation", value, 0U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - 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, "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 1a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: 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 3: { - LogStep(3, "Step 2a: TH sends MoveToSaturation command to DUT with Saturation=200 and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type value; - value.saturation = 200U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToSaturation::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 2b: TH sends StepSaturation command to DUT with StepMode=0x01 (up), StepSize=40 and TransitionTime=200 " - "(20s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StepSaturation::Type value; - value.stepMode = static_cast(1); - value.stepSize = 40U; - value.transitionTime = 200U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepSaturation::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 2d: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2e: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 2f: TH sends StepSaturation command to DUT with StepMode=0x01 (up), StepSize=20 and TransitionTime=100 " - "(10s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StepSaturation::Type value; - value.stepMode = static_cast(1); - value.stepSize = 20U; - value.transitionTime = 100U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepSaturation::Id, value, - chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 2g: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 3a: TH sends MoveToSaturation command to DUT with Saturation=50 and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type value; - value.saturation = 50U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToSaturation::Id, - value, chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, - "Step 3b: TH sends StepSaturation command to DUT with StepMode=0x03 (down), StepSize=40 and TransitionTime=200 " - "(20s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StepSaturation::Type value; - value.stepMode = static_cast(3); - value.stepSize = 40U; - value.transitionTime = 200U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepSaturation::Id, value, - chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 3c: H reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Step 3d: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 22: { - LogStep(22, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Step 3e: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 3f: TH sends StepSaturation command to DUT with StepMode=0x03 (down), StepSize=20 and TransitionTime=100 " - "(10 s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StepSaturation::Type value; - value.stepMode = static_cast(3); - value.stepSize = 20U; - value.transitionTime = 100U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepSaturation::Id, value, - chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 26: { - LogStep(26, "Step 3g: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 4a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 28: { - LogStep(28, "Step 4b: H reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 29: { - LogStep(29, "Turn off light that we turned on"); - 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 30: { - LogStep(30, "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_CC_4_4Suite : public TestCommand -{ -public: - Test_TC_CC_4_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_4_4", 21, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_4_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)); - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 42U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 58U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 160U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 200U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 50U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 80U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 135U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 185U)); - } - break; - case 13: - 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, 68U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 92U)); - } - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 135U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 185U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 68U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 92U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - 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, "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 1a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: 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 3: { - LogStep(3, - "Step 2a: TH sends MoveToHueAndSaturation command to DUT with Hue=200, Saturation=50 and TransitionTime=0 " - "(immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type value; - value.hue = 200U; - value.saturation = 50U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHueAndSaturation::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2b: TH reads CurrentHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000 && CC.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 2b1: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 7: { - LogStep( - 7, - "Step 3a: TH sends MoveToHueAndSaturation command to DUT with Hue=160, Saturation=80 and TransitionTime=200 (20s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type value; - value.hue = 160U; - value.saturation = 80U; - value.transitionTime = 200U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHueAndSaturation::Id, - value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 3b: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3b1: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Step 3c: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3c1: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "Step 3d: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 3d1: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Turn off light that we turned on"); - 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 20: { - LogStep(20, "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_CC_5_1Suite : public TestCommand -{ -public: - Test_TC_CC_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_5_1", 61, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_5_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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 27853U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 37683U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 16711U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 22609U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 13107U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32768U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 13107U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 19660U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 11141U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 15073U)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 11141U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 15073U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 11141U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 15073U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 11141U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 15073U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("options", value, 0U)); - } - 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; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 27853U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 37683U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 16711U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 22609U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentX", value, 32768U)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentY", value, 19660U)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentX", value, 32768U)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentY", value, 19660U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 22282U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 30146U)); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 27853U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 37683U)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("options", value, 1U)); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 27853U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 37683U)); - } - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 16711U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 22609U)); - } - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 11141U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 15073U)); - } - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 11141U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 15073U)); - } - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentX", value, 13107U)); - } - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentY", value, 13107U)); - } - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 22282U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 30146U)); - } - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 27853U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 37683U)); - } - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 1U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 1U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 60: - 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, "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 1a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: 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 3: { - LogStep(3, - "Step 2a: TH sends MoveToColor command to DUT, with ColorX = 32768/0x8000 ColorY = 19660/0x4CCC TransitionTime " - "= 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 32768U; - value.colorY = 19660U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2b: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 2b1: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, - "Step 3a: TH sends MoveToColor command to DUT, with ColorX = 13107/0x3333 ColorY = 13107/0x3333 TransitionTime " - "= 200 (20s)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 13107U; - value.colorY = 13107U; - value.transitionTime = 200U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 3b: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3b: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Step 3c: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3c: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "Step 3d: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 3d: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4b: TH read Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Step 4c: 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 20: { - LogStep(20, - "Step 4d: TH sends a MoveToColor command to the DUT with ColorX = 32768/0x8000 (x=0.5) (purple) ColorY = " - "19660/0x4CCC (y=0.3) TransitionTime = 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 32768U; - value.colorY = 19660U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 22: { - LogStep(22, "Step 4e: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 23: { - LogStep(23, "Step 4e: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, "Step 4f: TH sends Off command to DUT"); - 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 25: { - LogStep(25, - "Step 4g: TH sends MoveToColor command to DUT, with ColorX = 13107/0x3333 ColorY = 13107/0x3333 TransitionTime " - "= 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 13107U; - value.colorY = 13107U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 27: { - LogStep(27, "Step 4h: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 28: { - LogStep(28, "Step 4h: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 4i: TH sends MoveToColor command to DUT, with ColorX = 13107/0x3333 ColorY = 32768/0x8000 TransitionTime " - "= 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 13107U; - value.colorY = 32768U; - value.transitionTime = 0U; - value.optionsMask = 1U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 30: { - LogStep(30, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 31: { - LogStep(31, "Step 4j: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Step 4j: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 4k: TH sends MoveToColor command to DUT, with ColorX = 26214/0x6666 ColorY = 32768/0x8000 TransitionTime " - "= 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 26214U; - value.colorY = 32768U; - value.transitionTime = 0U; - value.optionsMask = 1U; - value.optionsOverride = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 34: { - LogStep(34, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 35: { - LogStep(35, "Step 4i: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 36: { - LogStep(36, "Step 4i: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 37: { - LogStep(37, "Step 5a: TH writes 1 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 1U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 38: { - LogStep(38, "Step 5b: TH read Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, true, - chip::NullOptional); - } - case 39: { - LogStep(39, "Step 5c: 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 40: { - LogStep(40, - "Step 5d: TH sends MoveToColor command to DUT, with ColorX = 32768/0x8000 ColorY = 19660/0x4CCC TransitionTime " - "= 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 32768U; - value.colorY = 19660U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 41: { - LogStep(41, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 42: { - LogStep(42, "Step 5e: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 43: { - LogStep(43, "Step 5e: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 44: { - LogStep(44, "Step 5f: TH sends Off command to DUT"); - 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 45: { - LogStep(45, - "Step 5g: TH sends MoveToColor command to DUT, with ColorX = 13107/0x3333 ColorY = 13107/0x3333 TransitionTime " - "= 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 13107U; - value.colorY = 13107U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 46: { - LogStep(46, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 47: { - LogStep(47, "Step 5h: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 48: { - LogStep(48, "Step 5h: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 49: { - LogStep(49, - "Step 5i: TH sends MoveToColor command to DUT, with ColorX = 13107/0x3333 ColorY = 32768/0x8000 TransitionTime " - "= 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 13107U; - value.colorY = 32768U; - value.transitionTime = 0U; - value.optionsMask = 1U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 50: { - LogStep(50, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 51: { - LogStep(51, "Step 5j: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 52: { - LogStep(52, "Step 5j: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 53: { - LogStep(53, - "Step 5k: TH sends MoveToColor command to DUT, with ColorX = 26214/0x6666 ColorY = 32768/0x8000 TransitionTime " - "= 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 26214U; - value.colorY = 32768U; - value.transitionTime = 0U; - value.optionsMask = 1U; - value.optionsOverride = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 54: { - LogStep(54, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 55: { - LogStep(55, "Step 5l: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 56: { - LogStep(56, "Step 5l: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 57: { - LogStep(57, "Step 6a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 58: { - LogStep(58, "Step 6b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 59: { - LogStep(59, "Turn off light that we turned on"); - 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 60: { - LogStep(60, "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_CC_5_2Suite : public TestCommand -{ -public: - Test_TC_CC_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_5_2", 22, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_5_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; - - uint16_t CurrentXValue; - uint16_t CurrentYValue; - - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 27200U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 36800U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 22900U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 31100U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 26350U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 35650U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 23800U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32200U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 25500U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 34500U)); - CurrentXValue = value; - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 24650U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 33350U)); - CurrentYValue = value; - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 25500U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 34500U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 24650U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 33350U)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 1U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 1U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep( - 3, - "Step 1a: TH sends MoveToColor command to DUT, with ColorX = 33000 ColorY = 26000 TransitionTime = 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 33000U; - value.colorY = 26000U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2a: TH sends MoveColor command to DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveColor::Type value; - value.rateX = -100; - value.rateY = 100; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColor::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2b: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 2b: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 2c: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 2c: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 2d: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Step 2d: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 3a: TH sends StopMoveStep command to DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C47.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type value; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StopMoveStep::Id, value, - chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Step 3b: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Step 3b: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Step 4b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "Turn off light that we turned on"); - 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 21: { - LogStep(21, "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_CC_5_3Suite : public TestCommand -{ -public: - Test_TC_CC_5_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_5_3", 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_CC_5_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)); - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 13000U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 33000U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 14000U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 20000U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 11050U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 14950U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 11900U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 16100U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 11050U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 14950U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 11900U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 16100U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 1U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 1U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - 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, "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 1a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: 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 3: { - LogStep( - 3, - "Step 2a: TH sends MoveToColor command to DUT, with ColorX = 33000 ColorY = 20000 TransitionTime = 0 (immediate)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColor::Type value; - value.colorX = 33000U; - value.colorY = 20000U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColor::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 3a: TH sends StepColor command to DUT, with StepX = -20000, StepY = -6000, TransitionTime = 200 (20s)"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.C09.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StepColor::Type value; - value.stepX = -20000; - value.stepY = -6000; - value.transitionTime = 200U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepColor::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 3b: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3b: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 3c: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3c: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 3d: TH reads CurrentX attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0003 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentX::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3d: TH reads CurrentY attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0004 && CC.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentY::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F03 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Turn off light that we turned on"); - 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 18: { - LogStep(18, "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_CC_6_1Suite : public TestCommand -{ -public: - Test_TC_CC_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_1", 22, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("ConfigWait", 0, UINT16_MAX, &mConfigWait); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_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 mConfigWait; - chip::Optional mTimeout; - - uint16_t ColorTempPhysicalMinMiredsValue; - uint16_t ColorTempPhysicalMaxMiredsValue; - - 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)); - { - 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, 65279U)); - ColorTempPhysicalMinMiredsValue = value; - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - ColorTempPhysicalMaxMiredsValue = value; - } - break; - case 5: - 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, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 246U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 334U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 230U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 310U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 212U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 288U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 212U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 288U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 2U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 2U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 1a: H reads ColorTempPhysicalMinMireds attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A400b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMinMireds::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 1b: TH reads ColorTempPhysicalMaxMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A400c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 1c: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 2a: TH sends MoveToColorTemperature command to DUT with ColorTemperatureMireds=310 and TransitionTime=0 " - "(immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type value; - value.colorTemperatureMireds = 310U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 8: { - LogStep(8, - "Step 2b: TH sends MoveToColorTemperatur command to DUT with ColorTemperatureMireds=250 and TransitionTime=300 " - "(30s)."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type value; - value.colorTemperatureMireds = 250U; - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 2c: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Step 2d: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 2e: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 16: { - LogStep(16, "Step 2f: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 3a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Step 3b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Turn Off light that we turned on"); - 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 20: { - LogStep(20, "Wait to turn Off light"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mConfigWait.HasValue() ? mConfigWait.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "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_CC_6_2Suite : public TestCommand -{ -public: - Test_TC_CC_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_2", 33, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("ConfigWait", 0, UINT16_MAX, &mConfigWait); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_6_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 mConfigWait; - chip::Optional mTimeout; - - uint16_t ColorTempPhysicalMinMiredsValue; - uint16_t ColorTempPhysicalMaxMiredsValue; - - 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)); - { - 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, 65279U)); - ColorTempPhysicalMinMiredsValue = value; - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - ColorTempPhysicalMaxMiredsValue = value; - } - break; - case 5: - 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, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorTemperatureMireds", value, ColorTempPhysicalMaxMiredsValue)); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - 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(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorTemperatureMireds", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 2U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 2U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 1a: TH reads ColorTempPhysicalMinMireds attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A400b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMinMireds::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 1b: TH reads ColorTempPhysicalMaxMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A400c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 1c: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 6: { - LogStep( - 6, - "Step 2a: TH sends MoveToColorTemperature command to DUT with ColorTemperatureMireds=(ColorTempPhysicalMinMireds + " - "ColorTempPhysicalMaxMireds)/2 and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type value; - value.colorTemperatureMireds = - static_cast((ColorTempPhysicalMinMiredsValue + ColorTempPhysicalMaxMiredsValue) / 2); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 8: { - LogStep(8, - "Step 2b: TH sends MoveColorTemperature command to DUT with MoveMode = 0x01 (up), Rate = " - "(ColorTempPhysicalMaxMireds - ColorTempPhysicalMinMireds)/40"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; - value.moveMode = static_cast(1); - value.rate = static_cast((ColorTempPhysicalMaxMiredsValue - ColorTempPhysicalMinMiredsValue) / 40); - value.colorTemperatureMinimumMireds = ColorTempPhysicalMinMiredsValue; - value.colorTemperatureMaximumMireds = ColorTempPhysicalMaxMiredsValue; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 2c: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Step 2d: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 2e: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, - "Step 3a: TH sends MoveColorTemperature command to DUT with MoveMode = 0x03(down), Rate = " - "(ColorTempPhysicalMaxMireds - ColorTempPhysicalMinMireds)/20"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; - value.moveMode = static_cast(3); - value.rate = static_cast((ColorTempPhysicalMaxMiredsValue - ColorTempPhysicalMinMiredsValue) / 20); - value.colorTemperatureMinimumMireds = ColorTempPhysicalMinMiredsValue; - value.colorTemperatureMaximumMireds = ColorTempPhysicalMaxMiredsValue; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), 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, "Step 3b: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 3c: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Step 3d: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4a: TH sends MoveColorTemperature command to DUT with MoveMode = 0x01(up), Rate = " - "(ColorTempPhysicalMaxMireds - ColorTempPhysicalMinMireds)/20"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; - value.moveMode = static_cast(1); - value.rate = static_cast((ColorTempPhysicalMaxMiredsValue - ColorTempPhysicalMinMiredsValue) / 20); - value.colorTemperatureMinimumMireds = ColorTempPhysicalMinMiredsValue; - value.colorTemperatureMaximumMireds = ColorTempPhysicalMaxMiredsValue; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 23: { - LogStep(23, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 24: { - LogStep(24, - "Step 4b: After 10 seconds, TH sends MoveColorTemperature command to DUT with MoveMode = 0x00(stop), Rate = " - "(ColorTempPhysicalMaxMireds - ColorTempPhysicalMinMireds)/20"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; - value.moveMode = static_cast(0); - value.rate = static_cast((ColorTempPhysicalMaxMiredsValue - ColorTempPhysicalMinMiredsValue) / 20); - value.colorTemperatureMinimumMireds = ColorTempPhysicalMinMiredsValue; - value.colorTemperatureMaximumMireds = ColorTempPhysicalMaxMiredsValue; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Step 4c: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Wait 2s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 27: { - LogStep(27, "Step 4d: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 28: { - LogStep(28, "Step 5a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 29: { - LogStep(29, "Step 5b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 30: { - LogStep(30, "Turn off light that we turned on"); - 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 31: { - LogStep(31, "Wait to turn Off light"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mConfigWait.HasValue() ? mConfigWait.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 32: { - LogStep(32, "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_CC_6_3Suite : public TestCommand -{ -public: - Test_TC_CC_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_3", 27, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("ConfigWait", 0, UINT16_MAX, &mConfigWait); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_6_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 mConfigWait; - chip::Optional mTimeout; - - uint16_t ColorTempPhysicalMinMiredsValue; - uint16_t ColorTempPhysicalMaxMiredsValue; - - 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)); - { - 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, 65279U)); - ColorTempPhysicalMinMiredsValue = value; - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - ColorTempPhysicalMaxMiredsValue = value; - } - break; - case 5: - 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, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMaxMiredsValue - 1)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - 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(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorTemperatureMireds", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMiredsValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMiredsValue)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 2U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 2U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 1a: TH reads ColorTempPhysicalMinMireds attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A400b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMinMireds::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 1b: TH reads ColorTempPhysicalMaxMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A400c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 1c: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 6: { - LogStep( - 6, - "Step 2a: TH sends MoveToColorTemperature command to DUT with ColorTemperatureMireds=(ColorTempPhysicalMinMireds + " - "ColorTempPhysicalMaxMireds)/2 and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type value; - value.colorTemperatureMireds = - static_cast((ColorTempPhysicalMinMiredsValue + ColorTempPhysicalMaxMiredsValue) / 2); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 8: { - LogStep(8, - "Step 2b: TH sends StepColorTemperature command to DUT with StepMode = 0x01 (up), StepSize = " - "(ColorTempPhysicalMaxMireds - ColorTempPhysicalMinMireds)/2 and TransitionTime = 200 (20s)."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.C4c.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type value; - value.stepMode = static_cast(1); - value.stepSize = static_cast((ColorTempPhysicalMaxMiredsValue - ColorTempPhysicalMinMiredsValue) / 2); - value.transitionTime = 200U; - value.colorTemperatureMinimumMireds = ColorTempPhysicalMinMiredsValue; - value.colorTemperatureMaximumMireds = ColorTempPhysicalMaxMiredsValue; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 2c: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Step 2d: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 2e: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp && PICS_SKIP_SAMPLE_APP"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, - "Step 3a: TH sends StepColorTemperature command to DUT with StepMode = 0x03 (down), StepSize = " - "(ColorTempPhysicalMaxMireds - ColorTempPhysicalMinMireds) and TransitionTime = 200 (20s)."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.C4c.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type value; - value.stepMode = static_cast(3); - value.stepSize = static_cast(ColorTempPhysicalMaxMiredsValue - ColorTempPhysicalMinMiredsValue); - value.transitionTime = 200U; - value.colorTemperatureMinimumMireds = ColorTempPhysicalMinMiredsValue; - value.colorTemperatureMaximumMireds = ColorTempPhysicalMaxMiredsValue; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StepColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), 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, "Step 3b: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 3c: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Step 3d: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007 && CC.S.C4c.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 4a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 23: { - LogStep(23, "Step 4b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 24: { - LogStep(24, "Turn Off light that we turned on"); - 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 25: { - LogStep(25, "Wait to turn Off light"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mConfigWait.HasValue() ? mConfigWait.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 26: { - LogStep(26, "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_CC_6_5Suite : public TestCommand -{ -public: - Test_TC_CC_6_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_6_5", 20, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("ConfigWait", 0, UINT16_MAX, &mConfigWait); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_6_5Suite() {} - - 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 mConfigWait; - chip::Optional mTimeout; - - chip::app::DataModel::Nullable StartUpColorTemperatureMiredsValue; - - 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)); - { - 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, 65279U)); - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - break; - case 5: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - StartUpColorTemperatureMiredsValue = value; - } - 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)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (StartUpColorTemperatureMiredsValue.IsNull()) - { - VerifyOrReturn(CheckValueNull("startUpColorTemperatureMireds", value)); - } - else - { - VerifyOrReturn(CheckValueNonNull("startUpColorTemperatureMireds", value)); - VerifyOrReturn(CheckValue("startUpColorTemperatureMireds.Value()", value.Value(), - StartUpColorTemperatureMiredsValue.Value())); - } - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorTemperatureMireds", value, StartUpColorTemperatureMiredsValue)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 2U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 2U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - { - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 0b: TH sends On command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C01.Rsp && CC.S.F04"), 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 3: { - LogStep(3, "Step 0c: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 0d: TH reads ColorTempPhysicalMinMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A400b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMinMireds::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 0e: TH reads ColorTempPhysicalMaxMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A400c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 1: TH reads from the DUT the StartUpColorTemperatureMireds attribute"); - VerifyOrDo(!ShouldSkip("CC.S.A4010 && CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::StartUpColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2a: TH writes to StartUpColorTemperatureMireds attribute with value StartUpColorTemperatureMireds"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && CC.S.A4010 && CC.S.F04"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 2b: TH reads StartUpColorTemperatureMireds attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4010 && CC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::StartUpColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, - "Step 2b: Verify that the DUT response contains StartUpColorTemperatureMireds that matches the " - "StartUpColorTemperatureMireds set in Step 2a"); - VerifyOrDo(!ShouldSkip("CC.S.A4010 && CC.S.F04 && PICS_SKIP_SAMPLE_APP"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 3a: Reboot target device"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 3b: Reboot target device(DUT)"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - 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(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "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 13: { - LogStep(13, "Step 4a: TH reads from the DUT the StartUpColorTemperatureMireds attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A4010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::StartUpColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 4b: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 5a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 5b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F04 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Turn Off light that we turned on"); - 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 18: { - LogStep(18, "Wait to turn Off light"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mConfigWait.HasValue() ? mConfigWait.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "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_CC_7_2Suite : public TestCommand -{ -public: - Test_TC_CC_7_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_7_2", 31, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_7_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; - - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 21250U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 28750U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 25500U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 34500U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 29750U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 40250U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 29750U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 40250U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - 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(CheckConstraintMinValue("value", value, 17000U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 23000U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 12750U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 17250U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 8500U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 11500U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 8500U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 11500U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 3U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, - "Step 2a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=20000, Direction=0x00 (shortest distance) " - "and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 20000U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2b: TH sends EnhancedMoveHue command to DUT with MoveMode=0x01 (up) and Rate=500 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type value; - value.moveMode = static_cast(1); - value.rate = 500U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveHue::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 2d: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2e: TH sends EnhancedMoveHue command to DUT with MoveMode=0x00 (stop) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type value; - value.moveMode = static_cast(0); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveHue::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Step 2f: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "Wait 2s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 2g: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, - "Step 3a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=25000, Direction=0x00 (shortest distance) " - "and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 25000U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Step 3b: TH sends EnhancedMoveHue command to DUT with MoveMode=0x03 (down) and Rate=500 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type value; - value.moveMode = static_cast(3); - value.rate = 500U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveHue::Id, value, - chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 3c: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Step 3d: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 22: { - LogStep(22, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Step 3e: TH sends EnhancedMoveHue command to DUT with MoveMode=0x00 (stop) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type value; - value.moveMode = static_cast(0); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveHue::Id, value, - chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Step 3f: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, "Wait 2s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 26: { - LogStep(26, "Step 3g: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 4a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 28: { - LogStep(28, "Step 4b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 29: { - LogStep(29, "Turn Off light that we turned on"); - 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 30: { - LogStep(30, "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_CC_7_3Suite : public TestCommand -{ -public: - Test_TC_CC_7_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_7_3", 29, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_7_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)); - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 6800U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9200U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 8500U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 11500U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 10200U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 13800U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 10200U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 13800U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 8500U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 11500U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 6800U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9200U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 5100U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 6900U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 5100U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 6900U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 3U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, - "Step 2a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=6000, Direction=0x00 (shortest distance) " - "and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 6000U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 2b: TH sends EnhancedStepHue command to DUT with StepMode=0x01 (up), StepSize=6000 and " - "TransitionTime=300 (30s)."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type value; - value.stepMode = static_cast(1); - value.stepSize = 6000U; - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedStepHue::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 2d: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2e: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 2f: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 5a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=12000, Direction=0x00 (shortest distance) " - "and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 12000U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 16: { - LogStep(16, - "Step 5b: TH sends EnhancedStepHue command to DUT with StepMode=0x03 (down), StepSize=6000 and " - "TransitionTime=300 (30s)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type value; - value.stepMode = static_cast(3); - value.stepSize = 6000U; - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedStepHue::Id, value, - chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 5c: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 2d: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 21: { - LogStep(21, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 22: { - LogStep(22, "Step 2e: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 23: { - LogStep(23, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 24: { - LogStep(24, "Step 2f: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 6a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 26: { - LogStep(26, "Step 6b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 27: { - LogStep(27, "Turn Off light that we turned on"); - 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 28: { - LogStep(28, "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_CC_7_4Suite : public TestCommand -{ -public: - Test_TC_CC_7_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_7_4", 21, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_7_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)); - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 17000U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 23000U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 42U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 58U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - 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, 16000U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 20000U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 50U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 80U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - 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, 13600U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 18400U)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 68U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 92U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, 16000U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentSaturation", value, 80U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 3U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - 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, "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 1a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: 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 3: { - LogStep(3, - "Step 2a: TH sends EnhancedMoveToHueAndSaturation command to DUT with EnhancedHue=20000, Saturation=50 and " - "TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C43.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::Type value; - value.enhancedHue = 20000U; - value.saturation = 50U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Commands::EnhancedMoveToHueAndSaturation::Id, value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2b: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, - "Step 3a: TH sends EnhancedMoveToHueAndSaturation command to DUT with EnhancedHue=16000, Saturation=80 and " - "TransitionTime=200 (20s)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C43.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::Type value; - value.enhancedHue = 16000U; - value.saturation = 80U; - value.transitionTime = 200U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Commands::EnhancedMoveToHueAndSaturation::Id, value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 3b: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3b: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Step 3c: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3c: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "Step 3d: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 3d: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Turn Off light that we turned on"); - 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 20: { - LogStep(20, "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_CC_8_1Suite : public TestCommand -{ -public: - Test_TC_CC_8_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_8_1", 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_CC_8_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; - - uint16_t ColorTempPhysicalMinMireds; - uint16_t ColorTempPhysicalMaxMireds; - - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 216U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - 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(CheckConstraintMinValue("value", value, 216U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - 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)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 19: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - ColorTempPhysicalMinMireds = value; - } - break; - case 20: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65279U)); - ColorTempPhysicalMaxMireds = value; - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMireds)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMireds)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorTempPhysicalMinMireds)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, ColorTempPhysicalMaxMireds)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 21250U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 28750U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 21250U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 28750U)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 38: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, - "Step 2a: H sends MoveToHue command to DUT with Hue=200, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 200U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2b: TH sends MoveHue command to DUT with MoveMode=0x01 (up) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveHue::Type value; - value.moveMode = static_cast(1); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveHue::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH sends StopMoveStep command to DUT"); - VerifyOrDo(!ShouldSkip("CC.S.C47.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type value; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StopMoveStep::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 2d: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0000 && CC.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Wait 2s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 2e: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0000 && CC.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3a: TH sends MoveToSaturation command to DUT with Saturation=150 and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type value; - value.saturation = 150U; - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToSaturation::Id, - value, chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 3b: TH sends MoveSaturation command to DUT with MoveMode=0x01 (up) and Rate=5 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type value; - value.moveMode = static_cast(1); - value.rate = 5U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveSaturation::Id, value, - 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, "Step 3c: TH sends StopMoveStep command to DUT"); - VerifyOrDo(!ShouldSkip("CC.S.C47.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type value; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StopMoveStep::Id, value, - chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Step 3d: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Wait 2s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 3e: TH reads CurrentSaturation attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentSaturation::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 4a: TH reads ColorTempPhysicalMinMireds attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A400b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMinMireds::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 4b: TH reads ColorTempPhysicalMaxMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.A400c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4c: TH sends MoveToColorTemperature command to DUT with ColorTemperatureMireds= " - "ColorTempPhysicalMaxMireds / 2 and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type value; - value.colorTemperatureMireds = static_cast((ColorTempPhysicalMinMireds + ColorTempPhysicalMaxMireds) / 2); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 23: { - LogStep(23, - "Step 4d: TH sends MoveColorTemperature command to DUT with MoveMode = 0x01 (up), Rate = " - "(ColorTempPhysicalMaxMireds - ColorTempPhysicalMinMireds)/40"); - VerifyOrDo(!ShouldSkip("CC.S.C4b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type value; - value.moveMode = static_cast(1); - value.rate = static_cast((ColorTempPhysicalMaxMireds - ColorTempPhysicalMinMireds) / 40); - value.colorTemperatureMinimumMireds = ColorTempPhysicalMinMireds; - value.colorTemperatureMaximumMireds = ColorTempPhysicalMaxMireds; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveColorTemperature::Id, - value, chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Wait 10s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 25: { - LogStep(25, "Step 4e: TH sends StopMoveStep command to DUT"); - VerifyOrDo(!ShouldSkip("CC.S.C4b.Rsp && CC.S.C47.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type value; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StopMoveStep::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Step 4f: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.A0007 && CC.S.C4b.Rsp && CC.S.C47.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "Wait 2s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 28: { - LogStep(28, "Step 4g: TH reads ColorTemperatureMireds attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.A0007 && CC.S.C4b.Rsp && CC.S.C47.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorTemperatureMireds::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=20000, Direction=0x00 (shortest distance) " - "and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 20000U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 30: { - LogStep(30, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 31: { - LogStep(31, "Step 5b: TH sends EnhancedMoveHue command to DUT with MoveMode=0x01 (up) and Rate=500 (units/s)"); - VerifyOrDo(!ShouldSkip("CC.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type value; - value.moveMode = static_cast(1); - value.rate = 500U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveHue::Id, value, - chip::NullOptional - - ); - } - case 32: { - LogStep(32, "Wait 10s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 33: { - LogStep(33, "Step 5c: TH sends StopMoveStep command to DUT"); - VerifyOrDo(!ShouldSkip("CC.S.C47.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type value; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::StopMoveStep::Id, value, - chip::NullOptional - - ); - } - case 34: { - LogStep(34, "Step 5d: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4000 && CC.S.C47.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 35: { - LogStep(35, "Wait 10s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 36: { - LogStep(36, "Step 5e: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.A4000 && CC.S.C47.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 37: { - LogStep(37, "Turn Off light that we turned on"); - 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 38: { - LogStep(38, "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 TestColorControl_9_1Suite : public TestCommand -{ -public: - TestColorControl_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestColorControl_9_1", 72, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - } - - ~TestColorControl_9_1Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(400)); } - -private: - chip::Optional mNodeId; - chip::Optional mTimeout; - chip::Optional mCluster; - chip::Optional mEndpoint; - - uint16_t ColorLoopStartEnhancedHueStep5d; - uint16_t ColorLoopStoredEnhancedHueStep6c; - uint16_t ColorLoopStartEnhancedHueStep8d; - uint16_t ColorLoopStoredEnhancedHueStep9c; - uint16_t ColorLoopStartEnhancedHueStep12d; - uint16_t ColorLoopStoredEnhancedHueStep13c; - uint16_t ColorLoopStartEnhancedHueStep15d; - uint16_t ColorLoopStoredEnhancedHueStep16b; - - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopDirection", value, 0U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopTime", value, 5U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 160U)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueStep5d = value; - } - break; - case 18: - 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, ColorLoopStartEnhancedHueStep5d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - 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, ColorLoopStartEnhancedHueStep5d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueStep6c = value; - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep6c)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopDirection", value, 1U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueStep8d = value; - } - break; - case 32: - 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, ColorLoopStartEnhancedHueStep8d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 34: - 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, ColorLoopStartEnhancedHueStep8d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueStep9c = value; - } - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep9c)); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, 16384U)); - } - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopDirection", value, 0U)); - } - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueStep12d = value; - } - break; - case 49: - 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, ColorLoopStartEnhancedHueStep12d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 51: - 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, ColorLoopStartEnhancedHueStep12d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueStep13c = value; - } - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep13c)); - } - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopDirection", value, 1U)); - } - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 60: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - break; - case 61: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 62: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueStep15d = value; - } - break; - case 63: - 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, ColorLoopStartEnhancedHueStep15d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 64: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 65: - 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, ColorLoopStartEnhancedHueStep15d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 66: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 67: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 68: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueStep16b = value; - } - break; - case 69: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep16b)); - } - break; - case 70: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 71: - 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, "TH writes 0 to the Options attribute"); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "TH sends On command to DUT"); - 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 3: { - LogStep(3, - "TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 16384U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait for 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " - "(De-activate) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction attribute " - "to 0x0 (decrement hue) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(2U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Read ColorLoopDirection attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x4 (UpdateTime) and Time attribute to 5 (5s " - "for one loop) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(4U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 5U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Read ColorLoopTime attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x8 (UpdateStartHue) and StartHue attribute to " - "0x00A0 to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(8U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 160U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Read ColorLoopStartEnhancedHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x1 " - "(start from ColorLoopStartEnhancedHue) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(1); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Read ColorLoopStoredEnhancedHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Saving value for comparison in step 8d read ColorLoopStartEnhancedHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 21: { - LogStep(21, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " - "(De-activate) to DUT"); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 23: { - LogStep(23, "Saving value for comparison in step 6c read ColorLoopStoredEnhancedHue attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction attribute " - "to 0x1 (increment hue) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(2U); - value.action = static_cast(0); - value.direction = static_cast(1); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Read ColorLoopDirection attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 27: { - LogStep(27, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x1 " - "(start from ColorLoopStartEnhancedHue) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(1); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 28: { - LogStep(28, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 29: { - LogStep(29, "Read ColorLoopStoredEnhancedHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 30: { - LogStep(30, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 31: { - LogStep(31, "Saving value for comparision in step 8d read ColorLoopStartEnhancedHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 33: { - LogStep(33, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 34: { - LogStep(34, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 35: { - LogStep(35, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " - "(De-activate) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 36: { - LogStep(36, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 37: { - LogStep(37, "Saving value for comparision in step 9c read ColorLoopStoredEnhancedHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 38: { - LogStep(38, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 39: { - LogStep(39, - "TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 16384U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 40: { - LogStep(40, "Wait 10ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10UL; - return WaitForMs(kIdentityAlpha, value); - } - case 41: { - LogStep(41, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 42: { - LogStep(42, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction attribute " - "to 0x0 (decrement hue) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(2U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 43: { - LogStep(43, "Read ColorLoopDirection attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 44: { - LogStep(44, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x2 " - "(start from EnhancedCurrentHue) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(2); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 45: { - LogStep(45, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 46: { - LogStep(46, "Read ColorLoopStoredEnhancedHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 47: { - LogStep(47, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 48: { - LogStep(48, "Saving value for comparision in step 12d read ColorLoopStartEnhancedHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 49: { - LogStep(49, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 50: { - LogStep(50, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 51: { - LogStep(51, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 52: { - LogStep(52, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " - "(De-activate) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 53: { - LogStep(53, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 54: { - LogStep(54, "Saving value for comparision in step 13c read ColorLoopStoredEnhancedHue attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 55: { - LogStep(55, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 56: { - LogStep(56, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction attribute " - "to 0x1 (increment hue) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(2U); - value.action = static_cast(0); - value.direction = static_cast(1); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 57: { - LogStep(57, "Read ColorLoopDirection attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 58: { - LogStep(58, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x2 " - "(start from EnhancedCurrentHue) to DUT"); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(2); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 59: { - LogStep(59, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 60: { - LogStep(60, "Read ColorLoopStoredEnhancedHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 61: { - LogStep(61, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 62: { - LogStep(62, "Saving value for comparision in step 15d read ColorLoopStartEnhancedHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 63: { - LogStep(63, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 64: { - LogStep(64, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 65: { - LogStep(65, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 66: { - LogStep(66, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " - "(De-activate) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 67: { - LogStep(67, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 68: { - LogStep(68, "Saving value for comparision in step 16b read ColorLoopStoredEnhancedHue attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 69: { - LogStep(69, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 70: { - LogStep(70, "Turn Off light for color control tests"); - 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 71: { - LogStep(71, "Check on/off attribute value is false after off command"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestColorControl_9_2Suite : public TestCommand -{ -public: - TestColorControl_9_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestColorControl_9_2", 31, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestColorControl_9_2Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(400)); } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint16_t ColorLoopStartEnhancedHueValue; - uint16_t ColorLoopStartEnhancedHue; - uint16_t ColorLoopStoredEnhancedHueValue; - - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", 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("colorLoopDirection", value, 0U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopTime", value, 5U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 160U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueValue = value; - } - break; - case 15: - 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, ColorLoopStartEnhancedHueValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopDirection", value, 1U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHue = value; - } - break; - case 22: - 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, ColorLoopStartEnhancedHue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - 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, ColorLoopStartEnhancedHue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueValue = value; - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueValue)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - 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, "TH writes 0 to the Options attribute"); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "TH sends On command to DUT"); - 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 3: { - LogStep(3, - "TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 16384U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait for 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0xF, Action attribute to 0x0 (De-activate), " - "Direction attribute to 0x0 (decrement hue), Time attribute to 30, and StartHue attribute to 0x00A0 to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(15U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 5U; - value.startHue = 160U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Read ColorLoopDirection attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Read ColorLoopTime attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Read ColorLoopStartEnhancedHue attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x1 " - "(start from ColorLoopStartEnhancedHue) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(1); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Read ColorLoopActive attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Read ColorLoopStoredEnhancedHue attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction attribute " - "to 0x1 (increment hue) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(2U); - value.action = static_cast(0); - value.direction = static_cast(1); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 19: { - LogStep(19, "Read ColorLoopDirection attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 23: { - LogStep(23, "Wait for 5S"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 24: { - LogStep(24, "Read EnhancedCurrentHue attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, - "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " - "(De-activate) to DUT."); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Read ColorLoopActive attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 27: { - LogStep(27, "Saving value for comparision read ColorLoopStoredEnhancedHue attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 28: { - LogStep(28, "Read EnhancedCurrentHue attribute from DUT."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 29: { - LogStep(29, "Turn off light for color control tests"); - 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 30: { - LogStep(30, "Check on/off attribute value is false after off command"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CDOCONC_1_1Suite : public TestCommand -{ -public: - Test_TC_CDOCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CDOCONC_1_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CDOCONC_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, 3U)); - 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)); - { - 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(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); - } - break; - case 9: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - break; - case 10: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); - } - break; - case 11: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 12: - 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(CheckConstraintHasMasksClear("value", value, 16UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); - } - break; - case 13: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 14: - 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(CheckConstraintHasMasksClear("value", value, 32UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); - } - break; - 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, 9UL)); - 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 16: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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(CheckConstraintExcludes("value", value, 7UL)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - } - break; - case 21: - 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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 22: - 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(CheckConstraintExcludes("value", value, 3UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 23: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 24: - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - } - break; - case 25: - 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, 10UL)); - } - break; - case 26: - 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(CheckConstraintExcludes("value", value, 10UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - 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")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap and check for either bit 0 or 1 set"); - VerifyOrDo( - !ShouldSkip( - " !CDOCONC.S.F00 && !CDOCONC.S.F01 && !CDOCONC.S.F02 && !CDOCONC.S.F03 && !CDOCONC.S.F04 && !CDOCONC.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given CDOCONC.S.F00(MEA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given CDOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given CDOCONC.S.F01(LEV) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given CDOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given CDOCONC.S.F02(MED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.F02 && CDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given CDOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.F02 && !CDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given CDOCONC.S.F03(CRI) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.F03 && CDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given CDOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.F03 && !CDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given CDOCONC.S.F04(PEA) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.F04 && CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given CDOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.F04 && !CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given CDOCONC.S.F05(AVG) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.F05 && CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3m: Given CDOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.F05 && !CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip(" !PICS_EVENT_LIST_ENABLED "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4b: Read the optional attribute Uncertainty in AttributeList"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A0007 && CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep( - 18, - "Step 4c: Check the optional attribute Uncertainty is excluded from AttributeList when CDOCONC.S.A0007 is not set"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.A0007 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4d: Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue " - "and Measurement Unit in AttributeList"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 4e: Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are " - "excluded from AttributeList when CDOCONC.S.F00 (MEA) is not set"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4f: Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4g: Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " - "CDOCONC.S.F04 (PEA) is not set"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.F04 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 4h: Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4i: Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " - "CDOCONC.S.F05 (AVG) is not set"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.F05 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4j: Read the optional, feature dependent attribute LevelValue in AttributeList"); - VerifyOrDo(!ShouldSkip("CDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4k: Check that LevelValue is excluded from AttributeList when CDOCONC.S.F01 (LEV) is not set"); - VerifyOrDo(!ShouldSkip(" !CDOCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 4l: 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)"); - 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 28: { - LogStep(28, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5b: TH reads EventList 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 30: { - LogStep(30, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 32: { - LogStep(32, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CDOCONC_2_1Suite : public TestCommand -{ -public: - Test_TC_CDOCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CDOCONC_2_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CDOCONC_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); - MinMeasuredValue = 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CarbonDioxideConcentrationMeasurement::MeasurementUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CarbonDioxideConcentrationMeasurement::MeasurementMediumEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CarbonDioxideConcentrationMeasurement::LevelValueEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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 reads from the DUT the MinMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the MaxMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the MeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the PeakMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the PeakMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the AverageMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the AverageMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads from the DUT the MeasurementUnit attribute."); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the MeasurementMedium attribute."); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads from the DUT the LevelValue attribute."); - VerifyOrDo(!ShouldSkip("CDOCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, - CarbonDioxideConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CMOCONC_1_1Suite : public TestCommand -{ -public: - Test_TC_CMOCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CMOCONC_1_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CMOCONC_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, 3U)); - 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)); - { - 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(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - } - break; - case 9: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - break; - case 10: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - } - break; - case 11: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 12: - 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(CheckConstraintHasMasksClear("value", value, 16UL)); - } - break; - case 13: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 14: - 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(CheckConstraintHasMasksClear("value", value, 32UL)); - } - break; - 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, 9UL)); - 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 16: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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(CheckConstraintExcludes("value", value, 7UL)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - } - break; - case 21: - 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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 22: - 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(CheckConstraintExcludes("value", value, 3UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 23: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 24: - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - } - break; - case 25: - 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, 10UL)); - } - break; - case 26: - 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(CheckConstraintExcludes("value", value, 10UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - 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")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap and check for either bit 0 or 1 set"); - VerifyOrDo( - !ShouldSkip( - " !CMOCONC.S.F00 && !CMOCONC.S.F01 && !CMOCONC.S.F02 && !CMOCONC.S.F03 && !CMOCONC.S.F04 && !CMOCONC.S.F05 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given CMOCONC.S.F00(MEA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given CMOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given CMOCONC.S.F01(LEV) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given CMOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given CMOCONC.S.F02(MED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.F02 && CMOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given CMOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.F02 && !CMOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given CMOCONC.S.F03(CRI) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.F03 && CMOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given CMOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.F03 && !CMOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given CMOCONC.S.F04(PEA) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.F04 && CMOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given CMOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.F04 && !CMOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given CMOCONC.S.F05(AVG) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.F05 && CMOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3m: Given CMOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.F05 && !CMOCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4b: Read the optional attribute Uncertainty in AttributeList"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A0007 && CMOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep( - 18, - "Step 4c: Check the optional attribute Uncertainty is excluded from AttributeList when CMOCONC.S.A0007 is not set"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.A0007 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4d: Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue " - "and Measurement Unit in AttributeList"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 4e: Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are " - "excluded from AttributeList when CMOCONC.S.F00 (MEA) is not set"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4f: Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4g: Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " - "CMOCONC.S.F04 (PEA) is not set"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.F04 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 4h: Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4i: Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " - "CMOCONC.S.F05 (AVG) is not set"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.F05 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4j: Read the optional, feature dependent attribute LevelValue in AttributeList"); - VerifyOrDo(!ShouldSkip("CMOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4k: Check that LevelValue is excluded from AttributeList when CMOCONC.S.F01 (LEV) is not set"); - VerifyOrDo(!ShouldSkip(" !CMOCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 4l: 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)"); - 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 28: { - LogStep(28, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 30: { - LogStep(30, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 32: { - LogStep(32, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 7b: TH1 reads GeneratedCommandList 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CMOCONC_2_1Suite : public TestCommand -{ -public: - Test_TC_CMOCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CMOCONC_2_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CMOCONC_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); - MinMeasuredValue = 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::MeasurementUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::MeasurementMediumEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::LevelValueEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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 reads from the DUT the MinMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the MaxMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the MeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the PeakMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the PeakMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the AverageMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the AverageMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads from the DUT the MeasurementUnit attribute."); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the MeasurementMedium attribute."); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads from the DUT the LevelValue attribute."); - VerifyOrDo(!ShouldSkip("CMOCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, - CarbonMonoxideConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FLDCONC_1_1Suite : public TestCommand -{ -public: - Test_TC_FLDCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_FLDCONC_1_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_FLDCONC_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, 3U)); - 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)); - { - 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(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - } - break; - case 9: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - break; - case 10: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - } - break; - case 11: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 12: - 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(CheckConstraintHasMasksClear("value", value, 16UL)); - } - break; - case 13: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 14: - 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(CheckConstraintHasMasksClear("value", value, 32UL)); - } - break; - 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, 9UL)); - 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 16: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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(CheckConstraintExcludes("value", value, 7UL)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - } - break; - case 21: - 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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 22: - 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(CheckConstraintExcludes("value", value, 3UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 23: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 24: - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - } - break; - case 25: - 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, 10UL)); - } - break; - case 26: - 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(CheckConstraintExcludes("value", value, 10UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - 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")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap and check for either bit 0 or 1 set"); - VerifyOrDo( - !ShouldSkip( - " !FLDCONC.S.F00 && !FLDCONC.S.F01 && !FLDCONC.S.F02 && !FLDCONC.S.F03 && !FLDCONC.S.F04 && !FLDCONC.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given FLDCONC.S.F00(MEA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given FLDCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given FLDCONC.S.F01(LEV) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given FLDCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given FLDCONC.S.F02(MED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.F02 && FLDCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given FLDCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.F02 && !FLDCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given FLDCONC.S.F03(CRI) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.F03 && FLDCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given FLDCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.F03 && !FLDCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given FLDCONC.S.F04(PEA) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.F04 && FLDCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given FLDCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.F04 && !FLDCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given FLDCONC.S.F05(AVG) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.F05 && FLDCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3m: Given FLDCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.F05 && !FLDCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4b: Read the optional attribute Uncertainty in AttributeList"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A0007 && FLDCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep( - 18, - "Step 4c: Check the optional attribute Uncertainty is excluded from AttributeList when FLDCONC.S.A0007 is not set"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.A0007 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4d: Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue " - "and Measurement Unit in AttributeList"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 4e: Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are " - "excluded from AttributeList when FLDCONC.S.F00 (MEA) is not set"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4f: Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4g: Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " - "FLDCONC.S.F04 (PEA) is not set"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.F04 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 4h: Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4i: Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " - "FLDCONC.S.F05 (AVG) is not set"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.F05 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4j: Read the optional, feature dependent attribute LevelValue in AttributeList"); - VerifyOrDo(!ShouldSkip("FLDCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4k: Check that LevelValue is excluded from AttributeList when FLDCONC.S.F01 (LEV) is not set"); - VerifyOrDo(!ShouldSkip(" !FLDCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 4l: 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)"); - 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 28: { - LogStep(28, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 30: { - LogStep(30, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 32: { - LogStep(32, "Step 7: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FLDCONC_2_1Suite : public TestCommand -{ -public: - Test_TC_FLDCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_FLDCONC_2_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_FLDCONC_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); - MinMeasuredValue = 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::FormaldehydeConcentrationMeasurement::MeasurementUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::FormaldehydeConcentrationMeasurement::MeasurementMediumEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::FormaldehydeConcentrationMeasurement::LevelValueEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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 reads from the DUT the MinMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the MaxMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the MeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the PeakMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the PeakMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the AverageMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the AverageMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads from the DUT the MeasurementUnit attribute."); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the MeasurementMedium attribute."); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads from the DUT the LevelValue attribute."); - VerifyOrDo(!ShouldSkip("FLDCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, - FormaldehydeConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_NDOCONC_1_1Suite : public TestCommand -{ -public: - Test_TC_NDOCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_NDOCONC_1_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_NDOCONC_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, 3U)); - 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)); - { - 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(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - } - break; - case 9: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - break; - case 10: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - } - break; - case 11: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 12: - 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(CheckConstraintHasMasksClear("value", value, 16UL)); - } - break; - case 13: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 14: - 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(CheckConstraintHasMasksClear("value", value, 32UL)); - } - break; - 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, 9UL)); - 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 16: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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(CheckConstraintExcludes("value", value, 7UL)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - } - break; - case 21: - 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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 22: - 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(CheckConstraintExcludes("value", value, 3UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 23: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 24: - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - } - break; - case 25: - 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, 10UL)); - } - break; - case 26: - 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(CheckConstraintExcludes("value", value, 10UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - 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")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap and check for either bit 0 or 1 set"); - VerifyOrDo( - !ShouldSkip( - " !NDOCONC.S.F00 && !NDOCONC.S.F01 && !NDOCONC.S.F02 && !NDOCONC.S.F03 && !NDOCONC.S.F04 && !NDOCONC.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given NDOCONC.S.F00(MEA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given NDOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given NDOCONC.S.F01(LEV) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given NDOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given NDOCONC.S.F02(MED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.F02 && NDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given NDOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.F02 && !NDOCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given NDOCONC.S.F03(CRI) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.F03 && NDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given NDOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.F03 && !NDOCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given NDOCONC.S.F04(PEA) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.F04 && NDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given NDOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.F04 && NDOCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given NDOCONC.S.F05(AVG) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.F05 && NDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3m: Given NDOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.F05 && !NDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4b: Read the optional attribute Uncertainty in AttributeList"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A0007 && NDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep( - 18, - "Step 4c: Check the optional attribute Uncertainty is excluded from AttributeList when NDOCONC.S.A0007 is not set"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.A0007 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4d: Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue " - "and Measurement Unit in AttributeList"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 4e: Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are " - "excluded from AttributeList when NDOCONC.S.F00 (MEA) is not set"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4f: Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4g: Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " - "NDOCONC.S.F04 (PEA) is not set"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.F04 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 4h: Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4i: Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " - "NDOCONC.S.F05 (AVG) is not set"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.F05 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4j: Read the optional, feature dependent attribute LevelValue in AttributeList"); - VerifyOrDo(!ShouldSkip("NDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4k: Check that LevelValue is excluded from AttributeList when NDOCONC.S.F01 (LEV) is not set"); - VerifyOrDo(!ShouldSkip(" !NDOCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 4l: 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)"); - 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 28: { - LogStep(28, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 30: { - LogStep(30, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 6b: 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)"); - 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 32: { - LogStep(32, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_NDOCONC_2_1Suite : public TestCommand -{ -public: - Test_TC_NDOCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_NDOCONC_2_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_NDOCONC_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); - MinMeasuredValue = 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::MeasurementUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::MeasurementMediumEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::LevelValueEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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 reads from the DUT the MinMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the MaxMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the MeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the PeakMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the PeakMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the AverageMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the AverageMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads from the DUT the MeasurementUnit attribute."); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the MeasurementMedium attribute."); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads from the DUT the LevelValue attribute."); - VerifyOrDo(!ShouldSkip("NDOCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, - NitrogenDioxideConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OZCONC_1_1Suite : public TestCommand -{ -public: - Test_TC_OZCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OZCONC_1_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OZCONC_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, 3U)); - 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)); - { - 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(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - } - break; - case 9: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - break; - case 10: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - } - break; - case 11: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 12: - 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(CheckConstraintHasMasksClear("value", value, 16UL)); - } - break; - case 13: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 14: - 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(CheckConstraintHasMasksClear("value", value, 32UL)); - } - break; - 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, 9UL)); - 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 16: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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(CheckConstraintExcludes("value", value, 7UL)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - } - break; - case 21: - 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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 22: - 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(CheckConstraintExcludes("value", value, 3UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 23: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 24: - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - } - break; - case 25: - 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, 10UL)); - } - break; - case 26: - 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(CheckConstraintExcludes("value", value, 10UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - 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")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap and check for either bit 0 or 1 set"); - VerifyOrDo( - !ShouldSkip(" !OZCONC.S.F00 && !OZCONC.S.F01 && !OZCONC.S.F02 && !OZCONC.S.F03 && !OZCONC.S.F04 && !OZCONC.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given OZCONC.S.F00(MEA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("OZCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given OZCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given OZCONC.S.F01(LEV) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("OZCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given OZCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given OZCONC.S.F02(MED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("OZCONC.S.F02 && OZCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given OZCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.F02 && !OZCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given OZCONC.S.F03(CRI) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("OZCONC.S.F03 && OZCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given OZCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.F03 && !OZCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given OZCONC.S.F04(PEA) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("OZCONC.S.F04 && OZCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given OZCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.F04 && !OZCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given OZCONC.S.F05(AVG) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("OZCONC.S.F05 && OZCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3m: Given OZCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.F05 && !OZCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4b: Read the optional attribute Uncertainty in AttributeList"); - VerifyOrDo(!ShouldSkip("OZCONC.S.A0007 && OZCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep( - 18, - "Step 4c: Check the optional attribute Uncertainty is excluded from AttributeList when OZCONC.S.A0007 is not set"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.A0007 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4d: Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue " - "and Measurement Unit in AttributeList"); - VerifyOrDo(!ShouldSkip("OZCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 4e: Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are " - "excluded from AttributeList when OZCONC.S.F00 (MEA) is not set"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4f: Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("OZCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4g: Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " - "OZCONC.S.F04 (PEA) is not set"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.F04 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 4h: Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("OZCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4i: Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " - "OZCONC.S.F05 (AVG) is not set"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.F05 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4j: Read the optional, feature dependent attribute LevelValue in AttributeList"); - VerifyOrDo(!ShouldSkip("OZCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4k: Check that LevelValue is excluded from AttributeList when OZCONC.S.F01 (LEV) is not set"); - VerifyOrDo(!ShouldSkip(" !OZCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 4l: TH reads AttributeList attribute from DUT. 1.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. 2.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)"); - 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 28: { - LogStep(28, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5b: Read the global attribute: EventList. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 30: { - LogStep(30, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 32: { - LogStep(32, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OZCONC_2_1Suite : public TestCommand -{ -public: - Test_TC_OZCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OZCONC_2_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OZCONC_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); - MinMeasuredValue = 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OzoneConcentrationMeasurement::MeasurementUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OzoneConcentrationMeasurement::MeasurementMediumEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OzoneConcentrationMeasurement::LevelValueEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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 reads from the DUT the MinMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("OZCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the MaxMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("OZCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the MeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("OZCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the PeakMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("OZCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the PeakMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("OZCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the AverageMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("OZCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the AverageMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("OZCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads from the DUT the MeasurementUnit attribute."); - VerifyOrDo(!ShouldSkip("OZCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the MeasurementMedium attribute."); - VerifyOrDo(!ShouldSkip("OZCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads from the DUT the LevelValue attribute."); - VerifyOrDo(!ShouldSkip("OZCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, - OzoneConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PMHCONC_1_1Suite : public TestCommand -{ -public: - Test_TC_PMHCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PMHCONC_1_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PMHCONC_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, 3U)); - 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)); - { - 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(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - } - break; - case 9: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - break; - case 10: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - } - break; - case 11: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 12: - 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(CheckConstraintHasMasksClear("value", value, 16UL)); - } - break; - case 13: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 14: - 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(CheckConstraintHasMasksClear("value", value, 32UL)); - } - break; - 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, 9UL)); - 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 16: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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(CheckConstraintExcludes("value", value, 7UL)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - } - break; - case 21: - 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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 22: - 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(CheckConstraintExcludes("value", value, 3UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 23: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 24: - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - } - break; - case 25: - 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, 10UL)); - } - break; - case 26: - 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(CheckConstraintExcludes("value", value, 10UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - 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")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap and check for either bit 0 or 1 set"); - VerifyOrDo( - !ShouldSkip( - " !PMHCONC.S.F00 && !PMHCONC.S.F01 && !PMHCONC.S.F02 && !PMHCONC.S.F03 && !PMHCONC.S.F04 && !PMHCONC.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given PMHCONC.S.F00(MEA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given PMHCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given PMHCONC.S.F01(LEV) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given PMHCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given PMHCONC.S.F02(MED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.F02 && PMHCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given PMHCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.F02 && !PMHCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given PMHCONC.S.F03(CRI) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.F03 && PMHCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given PMHCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.F03 && !PMHCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given PMHCONC.S.F04(PEA) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.F04 && PMHCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given PMHCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.F04 && PMHCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given PMHCONC.S.F05(AVG) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.F05 && PMHCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3m: Given PMHCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.F05 && !PMHCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4b: Read the optional attribute Uncertainty in AttributeList"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A0007 && PMHCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep( - 18, - "Step 4c: Check the optional attribute Uncertainty is excluded from AttributeList when PMHCONC.S.A0007 is not set"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.A0007 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4d: Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue " - "and Measurement Unit in AttributeList"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 4e: Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are " - "excluded from AttributeList when PMHCONC.S.F00 (MEA) is not set"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4f: Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4g: Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " - "PMHCONC.S.F04 (PEA) is not set"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.F04 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 4h: Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4i: Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " - "PMHCONC.S.F05 (AVG) is not set"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.F05 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4j: Read the optional, feature dependent attribute LevelValue in AttributeList"); - VerifyOrDo(!ShouldSkip("PMHCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4k: Check that LevelValue is excluded from AttributeList when PMHCONC.S.F01 (LEV) is not set"); - VerifyOrDo(!ShouldSkip(" !PMHCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 4l: 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)"); - 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 28: { - LogStep(28, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 30: { - LogStep(30, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 32: { - LogStep(32, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PMHCONC_2_1Suite : public TestCommand -{ -public: - Test_TC_PMHCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PMHCONC_2_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PMHCONC_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); - MinMeasuredValue = 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Pm1ConcentrationMeasurement::MeasurementUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Pm1ConcentrationMeasurement::MeasurementMediumEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Pm1ConcentrationMeasurement::LevelValueEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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 reads from the DUT the MinMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the MaxMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the MeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the PeakMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the PeakMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the AverageMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the AverageMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads from the DUT the MeasurementUnit attribute."); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the MeasurementMedium attribute."); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads from the DUT the LevelValue attribute."); - VerifyOrDo(!ShouldSkip("PMHCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, - Pm1ConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PMICONC_1_1Suite : public TestCommand -{ -public: - Test_TC_PMICONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PMICONC_1_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PMICONC_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, 3U)); - 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)); - { - 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(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - } - break; - case 9: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - break; - case 10: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - } - break; - case 11: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 12: - 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(CheckConstraintHasMasksClear("value", value, 16UL)); - } - break; - case 13: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 14: - 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(CheckConstraintHasMasksClear("value", value, 32UL)); - } - break; - 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, 9UL)); - 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 16: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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(CheckConstraintExcludes("value", value, 7UL)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - } - break; - case 21: - 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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 22: - 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(CheckConstraintExcludes("value", value, 3UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 23: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 24: - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - } - break; - case 25: - 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, 10UL)); - } - break; - case 26: - 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(CheckConstraintExcludes("value", value, 10UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - 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")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap and check for either bit 0 or 1 set"); - VerifyOrDo( - !ShouldSkip( - " !PMICONC.S.F00 && !PMICONC.S.F01 && !PMICONC.S.F02 && !PMICONC.S.F03 && !PMICONC.S.F04 && !PMICONC.S.F05 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given PMICONC.S.F00(MEA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PMICONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given PMICONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given PMICONC.S.F01(LEV) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PMICONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given PMICONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given PMICONC.S.F02(MED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PMICONC.S.F02 && PMICONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given PMICONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.F02 && !PMICONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given PMICONC.S.F03(CRI) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("PMICONC.S.F03 && PMICONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given PMICONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.F03 && !PMICONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given PMICONC.S.F04(PEA) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("PMICONC.S.F04 && PMICONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given PMICONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.F04 && !PMICONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given PMICONC.S.F05(AVG) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("PMICONC.S.F05 && PMICONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3m: Given PMICONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.F05 && !PMICONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4b: Read the optional attribute Uncertainty in AttributeList"); - VerifyOrDo(!ShouldSkip("PMICONC.S.A0007 && PMICONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep( - 18, - "Step 4c: Check the optional attribute Uncertainty is excluded from AttributeList when PMICONC.S.A0007 is not set"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.A0007 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4d: Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue " - "and Measurement Unit in AttributeList"); - VerifyOrDo(!ShouldSkip("PMICONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 4e: Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are " - "excluded from AttributeList when PMICONC.S.F00 (MEA) is not set"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4f: Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("PMICONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4g: Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " - "PMICONC.S.F04 (PEA) is not set"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.F04 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 4h: Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("PMICONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4i: Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " - "PMICONC.S.F05 (AVG) is not set"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.F05 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4j: Read the optional, feature dependent attribute LevelValue in AttributeList"); - VerifyOrDo(!ShouldSkip("PMICONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4k: Check that LevelValue is excluded from AttributeList when PMICONC.S.F01 (LEV) is not set"); - VerifyOrDo(!ShouldSkip(" !PMICONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 4l: 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)"); - 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 28: { - LogStep(28, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 30: { - LogStep(30, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 32: { - LogStep(32, "Step 7b: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PMICONC_2_1Suite : public TestCommand -{ -public: - Test_TC_PMICONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PMICONC_2_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PMICONC_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); - MinMeasuredValue = 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Pm25ConcentrationMeasurement::MeasurementUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Pm25ConcentrationMeasurement::MeasurementMediumEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Pm25ConcentrationMeasurement::LevelValueEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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 reads from the DUT the MinMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMICONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the MaxMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMICONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the MeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMICONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the PeakMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMICONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the PeakMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("PMICONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the AverageMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMICONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the AverageMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("PMICONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads from the DUT the MeasurementUnit attribute."); - VerifyOrDo(!ShouldSkip("PMICONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the MeasurementMedium attribute."); - VerifyOrDo(!ShouldSkip("PMICONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads from the DUT the LevelValue attribute."); - VerifyOrDo(!ShouldSkip("PMICONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, - Pm25ConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PMKCONC_1_1Suite : public TestCommand -{ -public: - Test_TC_PMKCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PMKCONC_1_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PMKCONC_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, 3U)); - 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)); - { - 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(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - } - break; - case 9: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - break; - case 10: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - } - break; - case 11: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 12: - 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(CheckConstraintHasMasksClear("value", value, 16UL)); - } - break; - case 13: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 14: - 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(CheckConstraintHasMasksClear("value", value, 32UL)); - } - break; - 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, 9UL)); - 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 16: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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(CheckConstraintExcludes("value", value, 7UL)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - } - break; - case 21: - 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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 22: - 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(CheckConstraintExcludes("value", value, 3UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 23: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 24: - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - } - break; - case 25: - 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, 10UL)); - } - break; - case 26: - 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(CheckConstraintExcludes("value", value, 10UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - 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")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap and check for either bit 0 or 1 set"); - VerifyOrDo( - !ShouldSkip( - " !PMKCONC.S.F00 && !PMKCONC.S.F01 && !PMKCONC.S.F02 && !PMKCONC.S.F03 && !PMKCONC.S.F04 && !PMKCONC.S.F05 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given PMKCONC.S.F00(MEA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given PMKCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given PMKCONC.S.F01(LEV) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given PMKCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given PMKCONC.S.F02(MED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.F02 && PMKCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given PMKCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.F02 && !PMKCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given PMKCONC.S.F03(CRI) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.F03 && PMKCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given PMKCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.F03 && !PMKCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given PMKCONC.S.F04(PEA) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.F04 && PMKCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given PMKCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.F04 && !PMKCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given PMKCONC.S.F05(AVG) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.F05 && PMKCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3m: Given PMKCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.F05 && !PMKCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4b: Read the optional attribute Uncertainty in AttributeList"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A0007 && PMKCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep( - 18, - "Step 4c: Check the optional attribute Uncertainty is excluded from AttributeList when PMKCONC.S.A0007 is not set"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.A0007 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4d: Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue " - "and Measurement Unit in AttributeList"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 4e: Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are " - "excluded from AttributeList when PMKCONC.S.F00 (MEA) is not set"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4f: Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4g: Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " - "PMKCONC.S.F04 (PEA) is not set"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.F04 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 4h: Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4i: Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " - "PMKCONC.S.F05 (AVG) is not set"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.F05 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4j: Read the optional, feature dependent attribute LevelValue in AttributeList"); - VerifyOrDo(!ShouldSkip("PMKCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4k: Check that LevelValue is excluded from AttributeList when PMKCONC.S.F01 (LEV) is not set"); - VerifyOrDo(!ShouldSkip(" !PMKCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 4l: 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)"); - 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 28: { - LogStep(28, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 30: { - LogStep(30, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 32: { - LogStep(32, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PMKCONC_2_1Suite : public TestCommand -{ -public: - Test_TC_PMKCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_PMKCONC_2_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PMKCONC_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); - MinMeasuredValue = 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Pm10ConcentrationMeasurement::MeasurementUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Pm10ConcentrationMeasurement::MeasurementMediumEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Pm10ConcentrationMeasurement::LevelValueEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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 reads from the DUT the MinMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the MaxMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the MeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the PeakMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the PeakMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the AverageMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the AverageMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads from the DUT the MeasurementUnit attribute."); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the MeasurementMedium attribute."); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads from the DUT the LevelValue attribute."); - VerifyOrDo(!ShouldSkip("PMKCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, - Pm10ConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_RNCONC_1_1Suite : public TestCommand -{ -public: - Test_TC_RNCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_RNCONC_1_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RNCONC_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, 3U)); - 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)); - { - 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(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - } - break; - case 9: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - break; - case 10: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - } - break; - case 11: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 12: - 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(CheckConstraintHasMasksClear("value", value, 16UL)); - } - break; - case 13: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 14: - 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(CheckConstraintHasMasksClear("value", value, 32UL)); - } - break; - 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, 9UL)); - 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 16: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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(CheckConstraintExcludes("value", value, 7UL)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - } - break; - case 21: - 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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 22: - 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(CheckConstraintExcludes("value", value, 3UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 23: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 24: - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - } - break; - case 25: - 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, 10UL)); - } - break; - case 26: - 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(CheckConstraintExcludes("value", value, 10UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - 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")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap and check for either bit 0 or 1 set"); - VerifyOrDo( - !ShouldSkip(" !RNCONC.S.F00 && !RNCONC.S.F01 && !RNCONC.S.F02 && !RNCONC.S.F03 && !RNCONC.S.F04 && !RNCONC.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given RNCONC.S.F00(MEA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("RNCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given RNCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given RNCONC.S.F01(LEV) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("RNCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given RNCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given RNCONC.S.F02(MED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("RNCONC.S.F02 && RNCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given RNCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.F02 && !RNCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given RNCONC.S.F03(CRI) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("RNCONC.S.F03 && RNCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given RNCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.F03 && !RNCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given RNCONC.S.F04(PEA) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("RNCONC.S.F04 && RNCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given RNCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.F04 && RNCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given RNCONC.S.F05(AVG) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("RNCONC.S.F05 && RNCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3m: Given RNCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.F05 && !RNCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4b: Read the optional attribute Uncertainty in AttributeList"); - VerifyOrDo(!ShouldSkip("RNCONC.S.A0007 && RNCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep( - 18, - "Step 4c: Check the optional attribute Uncertainty is excluded from AttributeList when RNCONC.S.A0007 is not set"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.A0007 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4d: Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue " - "and Measurement Unit in AttributeList"); - VerifyOrDo(!ShouldSkip("RNCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 4e: Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are " - "excluded from AttributeList when RNCONC.S.F00 (MEA) is not set"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4f: Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("RNCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4g: Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " - "RNCONC.S.F04 (PEA) is not set"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.F04 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 4h: Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("RNCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4i: Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " - "RNCONC.S.F05 (AVG) is not set"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.F05 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4j: Read the optional, feature dependent attribute LevelValue in AttributeList"); - VerifyOrDo(!ShouldSkip("RNCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4k: Check that LevelValue is excluded from AttributeList when RNCONC.S.F01 (LEV) is not set"); - VerifyOrDo(!ShouldSkip(" !RNCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 27: { - LogStep( - 27, - "Step 4l: TH reads the AttributeList attribute from the 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)"); - 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 28: { - LogStep(28, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 30: { - LogStep(30, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 6b: Read the global attribute AcceptedCommandList. 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)"); - 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 32: { - LogStep(32, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 7b: Read the global attribute: GeneratedCommandList. 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_RNCONC_2_1Suite : public TestCommand -{ -public: - Test_TC_RNCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_RNCONC_2_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RNCONC_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); - MinMeasuredValue = 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::RadonConcentrationMeasurement::MeasurementUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::RadonConcentrationMeasurement::MeasurementMediumEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::RadonConcentrationMeasurement::LevelValueEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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 reads from the DUT the MinMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("RNCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the MaxMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("RNCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the MeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("RNCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the PeakMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("RNCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the PeakMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("RNCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: H reads from the DUT the AverageMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("RNCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the AverageMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("RNCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads from the DUT the MeasurementUnit attribute."); - VerifyOrDo(!ShouldSkip("RNCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the MeasurementMedium attribute."); - VerifyOrDo(!ShouldSkip("RNCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads from the DUT the LevelValue attribute."); - VerifyOrDo(!ShouldSkip("RNCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, - RadonConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TVOCCONC_1_1Suite : public TestCommand -{ -public: - Test_TC_TVOCCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TVOCCONC_1_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TVOCCONC_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, 3U)); - 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)); - { - 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(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - } - break; - case 9: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - break; - case 10: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - } - break; - case 11: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 12: - 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(CheckConstraintHasMasksClear("value", value, 16UL)); - } - break; - case 13: - 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)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 14: - 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(CheckConstraintHasMasksClear("value", value, 32UL)); - } - break; - 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, 9UL)); - 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 16: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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(CheckConstraintExcludes("value", value, 7UL)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - } - break; - case 21: - 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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 22: - 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(CheckConstraintExcludes("value", value, 3UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 23: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 24: - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - } - break; - case 25: - 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, 10UL)); - } - break; - case 26: - 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(CheckConstraintExcludes("value", value, 10UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - 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")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap and check for either bit 0 or 1 set"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F00 && !TVOCCONC.S.F01 && !TVOCCONC.S.F02 && !TVOCCONC.S.F03 && !TVOCCONC.S.F04 " - "&& !TVOCCONC.S.F05 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given TVOCCONC.S.F00(MEA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given TVOCCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given TVOCCONC.S.F01(LEV) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given TVOCCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given TVOCCONC.S.F02(MED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.F02 && TVOCCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given TVOCCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F02 && !TVOCCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given TVOCCONC.S.F03(CRI) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.F03 && TVOCCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given TVOCCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F03 && !TVOCCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given TVOCCONC.S.F04(PEA) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.F04 && TVOCCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given TVOCCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F04 && !TVOCCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given TVOCCONC.S.F05(AVG) ensure featuremap has the correct bits set"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.F05 && TVOCCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3m: Given TVOCCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F05 && !TVOCCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4b: Read the optional attribute Uncertainty in AttributeList"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0007 && TVOCCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, - "Step 4c: Check the optional attribute Uncertainty is excluded from AttributeList when TVOCCONC.S.A0007 is not " - "set"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.A0007 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 4d: Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue " - "and Measurement Unit in AttributeList"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 4e: Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are " - "excluded from AttributeList when TVOCCONC.S.F00 (MEA) is not set"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 4f: Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, - "Step 4g: Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " - "TVOCCONC.S.F04 (PEA) is not set"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F04 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 4h: Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " - "AttributeList"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4i: Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " - "TVOCCONC.S.F05 (AVG) is not set"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F05 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4j: Read the optional, feature dependent attribute LevelValue in AttributeList"); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4k: Check that LevelValue is excluded from AttributeList when TVOCCONC.S.F01 (LEV) is not set"); - VerifyOrDo(!ShouldSkip(" !TVOCCONC.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 4b: Read the global attribute: AttributeList. 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)"); - 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 28: { - LogStep(28, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 29: { - LogStep(29, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 30: { - LogStep(30, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 31: { - LogStep(31, - "Step 6b: Read the global attribute: AcceptedCommandList. 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)"); - 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 32: { - LogStep(32, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 7b: Read the global attribute: GeneratedCommandList. 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TVOCCONC_2_1Suite : public TestCommand -{ -public: - Test_TC_TVOCCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TVOCCONC_2_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TVOCCONC_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); - MinMeasuredValue = 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - 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(CheckConstraintType("value", "single", "single")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - 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", "elapsed_s", "elapsed_s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 604800UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::MeasurementUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::MeasurementMediumEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::LevelValueEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - 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 reads from the DUT the MinMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the MaxMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the MeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasuredValue::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the PeakMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the PeakMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the AverageMeasuredValue attribute."); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the AverageMeasuredValueWindow attribute."); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads from the DUT the MeasurementUnit attribute."); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the MeasurementMedium attribute."); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads from the DUT the LevelValue attribute."); - VerifyOrDo(!ShouldSkip("TVOCCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, - TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::LevelValue::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestIcdManagementClusterSuite : public TestCommand -{ -public: - TestIcdManagementClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestIcdManagementCluster", 26, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestIcdManagementClusterSuite() {} - - 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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("idleModeInterval", value, 2000UL)); - } - 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("activeModeInterval", value, 300UL)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("activeModeThreshold", value, 300U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("ICDCounter", value, 0UL)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("clientsSupportedPerFabric", value, 2U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("registeredClients", iter_0, 0)); - } - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("ICDCounter", value.ICDCounter, 0UL)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("ICDCounter", value.ICDCounter, 0UL)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("registeredClients", iter_0, 0)); - VerifyOrReturn(CheckValue("registeredClients[0].checkInNodeID", iter_0.GetValue().checkInNodeID, 101ULL)); - VerifyOrReturn( - CheckValue("registeredClients[0].monitoredSubject", iter_0.GetValue().monitoredSubject, 1001ULL)); - VerifyOrReturn(CheckValueAsString( - "registeredClients[0].key", iter_0.GetValue().key, - chip::ByteSpan( - chip::Uint8::from_const_char("\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"), 16))); - VerifyOrReturn(CheckNextListItemDecodes("registeredClients", iter_0, 1)); - VerifyOrReturn(CheckValue("registeredClients[1].checkInNodeID", iter_0.GetValue().checkInNodeID, 201ULL)); - VerifyOrReturn( - CheckValue("registeredClients[1].monitoredSubject", iter_0.GetValue().monitoredSubject, 2001ULL)); - VerifyOrReturn(CheckValueAsString("registeredClients[1].key", iter_0.GetValue().key, - chip::ByteSpan(chip::Uint8::from_const_char(" !\042#$%&'()*+,-./"), 16))); - VerifyOrReturn(CheckNoMoreListItems("registeredClients", iter_0, 2)); - } - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("ICDCounter", value.ICDCounter, 0UL)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("registeredClients", iter_0, 0)); - VerifyOrReturn(CheckValue("registeredClients[0].checkInNodeID", iter_0.GetValue().checkInNodeID, 101ULL)); - VerifyOrReturn( - CheckValue("registeredClients[0].monitoredSubject", iter_0.GetValue().monitoredSubject, 1002ULL)); - VerifyOrReturn(CheckValueAsString( - "registeredClients[0].key", iter_0.GetValue().key, - chip::ByteSpan(chip::Uint8::from_const_char("\001\021!1AQaq\201\221\241\261\301\321\341\361"), 16))); - VerifyOrReturn(CheckNextListItemDecodes("registeredClients", iter_0, 1)); - VerifyOrReturn(CheckValue("registeredClients[1].checkInNodeID", iter_0.GetValue().checkInNodeID, 201ULL)); - VerifyOrReturn( - CheckValue("registeredClients[1].monitoredSubject", iter_0.GetValue().monitoredSubject, 2001ULL)); - VerifyOrReturn(CheckValueAsString("registeredClients[1].key", iter_0.GetValue().key, - chip::ByteSpan(chip::Uint8::from_const_char(" !\042#$%&'()*+,-./"), 16))); - VerifyOrReturn(CheckNoMoreListItems("registeredClients", iter_0, 2)); - } - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("ICDCounter", value.ICDCounter, 0UL)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("registeredClients", iter_0, 0)); - VerifyOrReturn(CheckValue("registeredClients[0].checkInNodeID", iter_0.GetValue().checkInNodeID, 101ULL)); - VerifyOrReturn( - CheckValue("registeredClients[0].monitoredSubject", iter_0.GetValue().monitoredSubject, 1002ULL)); - VerifyOrReturn(CheckValueAsString( - "registeredClients[0].key", iter_0.GetValue().key, - chip::ByteSpan(chip::Uint8::from_const_char("\001\021!1AQaq\201\221\241\261\301\321\341\361"), 16))); - VerifyOrReturn(CheckNextListItemDecodes("registeredClients", iter_0, 1)); - VerifyOrReturn(CheckValue("registeredClients[1].checkInNodeID", iter_0.GetValue().checkInNodeID, 201ULL)); - VerifyOrReturn( - CheckValue("registeredClients[1].monitoredSubject", iter_0.GetValue().monitoredSubject, 2002ULL)); - VerifyOrReturn(CheckValueAsString( - "registeredClients[1].key", iter_0.GetValue().key, - chip::ByteSpan(chip::Uint8::from_const_char("\002\022\0422BRbr\202\222\242\262\302\322\342/"), 16))); - VerifyOrReturn(CheckNoMoreListItems("registeredClients", iter_0, 2)); - } - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("registeredClients", iter_0, 0)); - VerifyOrReturn(CheckValue("registeredClients[0].checkInNodeID", iter_0.GetValue().checkInNodeID, 201ULL)); - VerifyOrReturn( - CheckValue("registeredClients[0].monitoredSubject", iter_0.GetValue().monitoredSubject, 2002ULL)); - VerifyOrReturn(CheckValueAsString( - "registeredClients[0].key", iter_0.GetValue().key, - chip::ByteSpan(chip::Uint8::from_const_char("\002\022\0422BRbr\202\222\242\262\302\322\342/"), 16))); - VerifyOrReturn(CheckNoMoreListItems("registeredClients", iter_0, 1)); - } - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("registeredClients", iter_0, 0)); - } - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - 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 IdleModeInterval"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::IdleModeInterval::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read ActiveModeInterval"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::ActiveModeInterval::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Read ActiveModeThreshold"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::ActiveModeThreshold::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Read ICDCounter"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::ICDCounter::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Read ClientsSupportedPerFabric"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::ClientsSupportedPerFabric::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Unregister 1.0"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type value; - value.checkInNodeID = 101ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::UnregisterClient::Id, - value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Unregister 2.0"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type value; - value.checkInNodeID = 102ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::UnregisterClient::Id, - value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Unregister 3.0"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type value; - value.checkInNodeID = 102ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::UnregisterClient::Id, - value, chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Read RegisteredClients"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::RegisteredClients::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Register 1.0 (key too short)"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type value; - value.checkInNodeID = 101ULL; - value.monitoredSubject = 1001ULL; - value.key = - chip::ByteSpan(chip::Uint8::from_const_char( - "\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036garbage: not in length on purpose"), - 15); - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::RegisterClient::Id, - value, chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Register 1.0 (key too long)"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type value; - value.checkInNodeID = 101ULL; - value.monitoredSubject = 1001ULL; - value.key = chip::ByteSpan( - chip::Uint8::from_const_char( - "\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\377garbage: not in length on purpose"), - 17); - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::RegisterClient::Id, - value, chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Register 1.1"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type value; - value.checkInNodeID = 101ULL; - value.monitoredSubject = 1001ULL; - value.key = chip::ByteSpan( - chip::Uint8::from_const_char( - "\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037garbage: not in length on purpose"), - 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::RegisterClient::Id, - value, chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Register 2.1"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type value; - value.checkInNodeID = 201ULL; - value.monitoredSubject = 2001ULL; - value.key = chip::ByteSpan(chip::Uint8::from_const_char(" !\042#$%&'()*+,-./garbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::RegisterClient::Id, - value, chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Register 3.1"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type value; - value.checkInNodeID = 301ULL; - value.monitoredSubject = 3001ULL; - value.key = chip::ByteSpan(chip::Uint8::from_const_char("0123456789:;<=>?garbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::RegisterClient::Id, - value, chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Read RegisteredClients"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::RegisteredClients::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Register 1.1"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type value; - value.checkInNodeID = 101ULL; - value.monitoredSubject = 1002ULL; - value.key = chip::ByteSpan( - chip::Uint8::from_const_char("\001\021!1AQaq\201\221\241\261\301\321\341\361garbage: not in length on purpose"), - 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::RegisterClient::Id, - value, chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Read RegisteredClients"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::RegisteredClients::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Register 2.2 (wrong verification key)"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type value; - value.checkInNodeID = 201ULL; - value.monitoredSubject = 2002ULL; - value.key = chip::ByteSpan( - chip::Uint8::from_const_char("\002\022\0422BRbr\202\222\242\262\302\322\342/garbage: not in length on purpose"), - 16); - value.verificationKey.Emplace(); - value.verificationKey.Value() = - chip::ByteSpan(chip::Uint8::from_const_char(" !\042#$%&'()*+,-//garbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::RegisterClient::Id, - value, chip::NullOptional - - ); - } - case 19: { - LogStep(19, "Read RegisteredClients"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::RegisteredClients::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Unregister 1.1 (wrong key)"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type value; - value.checkInNodeID = 101ULL; - value.verificationKey.Emplace(); - value.verificationKey.Value() = chip::ByteSpan( - chip::Uint8::from_const_char("\001!!1AQaq\201\221\241\261\301\321\341\361garbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::UnregisterClient::Id, - value, chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Read RegisteredClients"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::RegisteredClients::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Unregister 2.1"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type value; - value.checkInNodeID = 201ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::UnregisterClient::Id, - value, chip::NullOptional - - ); - } - case 23: { - LogStep(23, "Read RegisteredClients"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::RegisteredClients::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Unregister 1.3"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type value; - value.checkInNodeID = 101ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::UnregisterClient::Id, - value, chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Unregister 2.2"); - ListFreer listFreer; - chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type value; - value.checkInNodeID = 102ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Commands::UnregisterClient::Id, - value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OPCREDS_1_2Suite : public TestCommand -{ -public: - Test_TC_OPCREDS_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPCREDS_1_2", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OPCREDS_1_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; - - 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, 65533UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - 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, 5UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - 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, 5UL)); - } - 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)); - shouldContinue = true; - break; - case 7: - 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)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 11UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - 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, 8UL)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 4b: 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)"); - 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 6: { - LogStep(6, - "Step 5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 7: { - LogStep(7, "Step 6a: TH reads AcceptedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 6b: 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)"); - 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 9: { - LogStep(9, "Step 7a: TH reads GeneratedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_BINFO_1_1Suite : public TestCommand -{ -public: - Test_TC_BINFO_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BINFO_1_1", 22, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BINFO_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, 2U)); - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 19UL)); - 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))); - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 19UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 11UL)); - } - 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, 12UL)); - } - break; - case 7: - 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, 13UL)); - } - break; - case 8: - 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, 14UL)); - } - break; - case 9: - 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, 15UL)); - } - break; - case 10: - 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, 16UL)); - } - break; - 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, 17UL)); - } - 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, 18UL)); - } - 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::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 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, 0UL)); - } - break; - case 16: - 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)); - } - break; - case 17: - 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, 2UL)); - } - break; - case 18: - 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, 3UL)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: TH reads optional attribute(ManufacturingDate) in attributeList"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4c: TH reads optional attribute(PartNumber) in attributeList"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4d: TH reads optional attribute(ProductURL) in attributeList"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4e: TH reads optional attribute(ProductLabel) in attributeList"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4f: TH reads optional attribute(SerialNumber) in attributeList"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4g: TH reads optional attribute(LocalConfigDisabled) in attributeList"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4h: TH reads optional attribute(Reachable) in attributeList"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4i: TH reads optional attribute(UniqueID) in attributeList"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, - "Step 4j: 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)"); - 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 14: { - LogStep(14, "Step 5a: TH1 reads EventList from DUT"); - VerifyOrDo(!ShouldSkip(" !BINFO.S.E00 && !BINFO.S.E01 && !BINFO.S.E02 && !BINFO.S.A0011 && PICS_EVENT_LIST_ENABLED"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::EventList::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 5b: Read BINFO.S.E00(StartUp) event in EventList"); - VerifyOrDo(!ShouldSkip("BINFO.S.E00 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::EventList::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 5c: Read BINFO.S.E01(ShutDown) event in EventList"); - VerifyOrDo(!ShouldSkip("BINFO.S.E01 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::EventList::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 5d: Read BINFO.S.E02(Leave) event in EventList"); - VerifyOrDo(!ShouldSkip("BINFO.S.E02 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::EventList::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 5e: Read (ReachableChanged) event in EventList"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0011 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::EventList::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 5f: TH reads EventList 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 20: { - LogStep(20, - "Step 6: TH reads AcceptedCommandList 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)"); - 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 21: { - LogStep(21, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_BINFO_2_1Suite : public TestCommand -{ -public: - Test_TC_BINFO_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BINFO_2_1", 71, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BINFO_2_1Suite() - { - if (VendorNameValueBuffer != nullptr) - { - chip::Platform::MemoryFree(VendorNameValueBuffer); - VendorNameValueBuffer = nullptr; - } - if (ProductNameValueBuffer != nullptr) - { - chip::Platform::MemoryFree(ProductNameValueBuffer); - ProductNameValueBuffer = nullptr; - } - if (NodeLabelValueBuffer != nullptr) - { - chip::Platform::MemoryFree(NodeLabelValueBuffer); - NodeLabelValueBuffer = nullptr; - } - if (HardwareVersionStringValueBuffer != nullptr) - { - chip::Platform::MemoryFree(HardwareVersionStringValueBuffer); - HardwareVersionStringValueBuffer = nullptr; - } - if (SoftwareVersionStringValueBuffer != nullptr) - { - chip::Platform::MemoryFree(SoftwareVersionStringValueBuffer); - SoftwareVersionStringValueBuffer = nullptr; - } - if (ManufacturingDateValueBuffer != nullptr) - { - chip::Platform::MemoryFree(ManufacturingDateValueBuffer); - ManufacturingDateValueBuffer = nullptr; - } - if (PartNumberValueBuffer != nullptr) - { - chip::Platform::MemoryFree(PartNumberValueBuffer); - PartNumberValueBuffer = nullptr; - } - if (ProductURLValueBuffer != nullptr) - { - chip::Platform::MemoryFree(ProductURLValueBuffer); - ProductURLValueBuffer = nullptr; - } - if (ProductLabelValueBuffer != nullptr) - { - chip::Platform::MemoryFree(ProductLabelValueBuffer); - ProductLabelValueBuffer = nullptr; - } - if (SerialNumberValueBuffer != nullptr) - { - chip::Platform::MemoryFree(SerialNumberValueBuffer); - SerialNumberValueBuffer = nullptr; - } - if (UniqueIDValueBuffer != nullptr) - { - chip::Platform::MemoryFree(UniqueIDValueBuffer); - UniqueIDValueBuffer = nullptr; - } - } - - 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; - - uint16_t DataModelRevisionValue; - char * VendorNameValueBuffer = nullptr; - chip::CharSpan VendorNameValue; - chip::VendorId VendorIDValue; - char * ProductNameValueBuffer = nullptr; - chip::CharSpan ProductNameValue; - uint16_t ProductIDValue; - char * NodeLabelValueBuffer = nullptr; - chip::CharSpan NodeLabelValue; - uint16_t HardwareVersionValue; - char * HardwareVersionStringValueBuffer = nullptr; - chip::CharSpan HardwareVersionStringValue; - uint32_t SoftwareVersionValue; - char * SoftwareVersionStringValueBuffer = nullptr; - chip::CharSpan SoftwareVersionStringValue; - char * ManufacturingDateValueBuffer = nullptr; - chip::CharSpan ManufacturingDateValue; - char * PartNumberValueBuffer = nullptr; - chip::CharSpan PartNumberValue; - char * ProductURLValueBuffer = nullptr; - chip::CharSpan ProductURLValue; - char * ProductLabelValueBuffer = nullptr; - chip::CharSpan ProductLabelValue; - char * SerialNumberValueBuffer = nullptr; - chip::CharSpan SerialNumberValue; - char * UniqueIDValueBuffer = nullptr; - chip::CharSpan UniqueIDValue; - chip::app::Clusters::BasicInformation::Structs::CapabilityMinimaStruct::DecodableType CapabilityMinimaValue; - chip::app::Clusters::BasicInformation::Structs::ProductAppearanceStruct::DecodableType ProductAppearancevalue; - - 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)); - shouldContinue = true; - break; - case 2: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - DataModelRevisionValue = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("dataModelRevision", value, DataModelRevisionValue)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - if (VendorNameValueBuffer != nullptr) - { - chip::Platform::MemoryFree(VendorNameValueBuffer); - } - VendorNameValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(VendorNameValueBuffer, value.data(), value.size()); - VendorNameValue = chip::CharSpan(VendorNameValueBuffer, value.size()); - } - 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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("vendorName", value, VendorNameValue)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "vendor_id", "vendor_id")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65521U)); - VendorIDValue = value; - } - 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), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorID", value, VendorIDValue)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - if (ProductNameValueBuffer != nullptr) - { - chip::Platform::MemoryFree(ProductNameValueBuffer); - } - ProductNameValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(ProductNameValueBuffer, value.data(), value.size()); - ProductNameValue = chip::CharSpan(ProductNameValueBuffer, value.size()); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("productName", value, ProductNameValue)); - } - break; - case 15: - 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, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - ProductIDValue = value; - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("productID", value, ProductIDValue)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - if (NodeLabelValueBuffer != nullptr) - { - chip::Platform::MemoryFree(NodeLabelValueBuffer); - } - NodeLabelValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(NodeLabelValueBuffer, value.data(), value.size()); - NodeLabelValue = chip::CharSpan(NodeLabelValueBuffer, value.size()); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("newnode", 7))); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 16)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("location", value, chip::CharSpan("in", 2))); - } - break; - case 25: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - HardwareVersionValue = value; - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("hardwareVersion", value, HardwareVersionValue)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMinLength("value", value, 1)); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 64)); - if (HardwareVersionStringValueBuffer != nullptr) - { - chip::Platform::MemoryFree(HardwareVersionStringValueBuffer); - } - HardwareVersionStringValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(HardwareVersionStringValueBuffer, value.data(), value.size()); - HardwareVersionStringValue = chip::CharSpan(HardwareVersionStringValueBuffer, value.size()); - } - 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), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("hardwareVersionString", value, HardwareVersionStringValue)); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967294UL)); - SoftwareVersionValue = value; - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("softwareVersion", value, SoftwareVersionValue)); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value", value, 1)); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 64)); - if (SoftwareVersionStringValueBuffer != nullptr) - { - chip::Platform::MemoryFree(SoftwareVersionStringValueBuffer); - } - SoftwareVersionStringValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(SoftwareVersionStringValueBuffer, value.data(), value.size()); - SoftwareVersionStringValue = chip::CharSpan(SoftwareVersionStringValueBuffer, value.size()); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("softwareVersionString", value, SoftwareVersionStringValue)); - } - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMinLength("value", value, 8)); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 16)); - if (ManufacturingDateValueBuffer != nullptr) - { - chip::Platform::MemoryFree(ManufacturingDateValueBuffer); - } - ManufacturingDateValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(ManufacturingDateValueBuffer, value.data(), value.size()); - ManufacturingDateValue = chip::CharSpan(ManufacturingDateValueBuffer, value.size()); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("manufacturingDate", value, ManufacturingDateValue)); - } - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - if (PartNumberValueBuffer != nullptr) - { - chip::Platform::MemoryFree(PartNumberValueBuffer); - } - PartNumberValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(PartNumberValueBuffer, value.data(), value.size()); - PartNumberValue = chip::CharSpan(PartNumberValueBuffer, value.size()); - } - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("partNumber", value, PartNumberValue)); - } - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "long_char_string", "long_char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 256)); - if (ProductURLValueBuffer != nullptr) - { - chip::Platform::MemoryFree(ProductURLValueBuffer); - } - ProductURLValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(ProductURLValueBuffer, value.data(), value.size()); - ProductURLValue = chip::CharSpan(ProductURLValueBuffer, value.size()); - } - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("productURL", value, ProductURLValue)); - } - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 64)); - if (ProductLabelValueBuffer != nullptr) - { - chip::Platform::MemoryFree(ProductLabelValueBuffer); - } - ProductLabelValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(ProductLabelValueBuffer, value.data(), value.size()); - ProductLabelValue = chip::CharSpan(ProductLabelValueBuffer, value.size()); - } - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("productLabel", value, ProductLabelValue)); - } - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - if (SerialNumberValueBuffer != nullptr) - { - chip::Platform::MemoryFree(SerialNumberValueBuffer); - } - SerialNumberValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(SerialNumberValueBuffer, value.data(), value.size()); - SerialNumberValue = chip::CharSpan(SerialNumberValueBuffer, value.size()); - } - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("serialNumber", value, SerialNumberValue)); - } - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("localConfigDisabled", value, false)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("localConfigDisabled", value, true)); - } - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("reachable", value, true)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - break; - case 60: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 61: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("reachable", value, true)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - break; - case 62: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - if (UniqueIDValueBuffer != nullptr) - { - chip::Platform::MemoryFree(UniqueIDValueBuffer); - } - UniqueIDValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(UniqueIDValueBuffer, value.data(), value.size()); - UniqueIDValue = chip::CharSpan(UniqueIDValueBuffer, value.size()); - } - break; - case 63: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 64: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("uniqueID", value, UniqueIDValue)); - } - break; - case 65: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::BasicInformation::Structs::CapabilityMinimaStruct::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CapabilityMinimaValue = value; - } - break; - case 66: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 67: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::BasicInformation::Structs::CapabilityMinimaStruct::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 68: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::BasicInformation::Structs::ProductAppearanceStruct::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "ProductAppearanceStruct", "ProductAppearanceStruct")); - ProductAppearancevalue = value; - } - break; - case 69: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 70: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::BasicInformation::Structs::ProductAppearanceStruct::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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, "Step 1: During Commissioning, TH Saves the CountryCode Information from SetRegulatoryConfig command"); - 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, "Step 2: TH reads DataModelRevision from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::DataModelRevision::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: TH writes DataModelRevision from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint16_t value; - value = 4388U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::DataModelRevision::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: TH reads DataModelRevision from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::DataModelRevision::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: TH reads VendorName from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorName::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: TH writes VendorName from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("samplegarbage: not in length on purpose", 6); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::VendorName::Id, value, chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: reads VendorName from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorName::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 8: TH reads VendorID from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Verify that VendorID matches the value assigned to this manufacturer"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && BINFO.S.A0002"), 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 10: { - LogStep(10, "Step 9: TH writes VendorID from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::VendorId value; - value = static_cast(17); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorID::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 10: TH reads VendorID from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 11: TH reads ProductName from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductName::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 12: TH writes ProductName from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("newproductgarbage: not in length on purpose", 10); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductName::Id, value, chip::NullOptional, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 13: TH reads ProductName from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductName::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 14: TH reads ProductID from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::ProductID::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 15: TH writes ProductID from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint16_t value; - value = 17697U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::ProductID::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 16: TH reads ProductID from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::ProductID::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 17: TH reads NodeLabel from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 18: TH writes NodeLabel from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("newnodegarbage: not in length on purpose", 7); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 19: TH reads NodeLabel from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 20a: TH reads Location from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - true, chip::NullOptional); - } - case 22: { - LogStep(22, "Verify that the Location is same as CountryCode value saved from step1"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && BINFO.S.A0006"), 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 23: { - LogStep(23, "Step 20b: TH write Location from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("ingarbage: not in length on purpose", 2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 20c: TH reads Location from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 21: TH reads HardwareVersion from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::HardwareVersion::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 22: TH writes HardwareVersion from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint16_t value; - value = 17713U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::HardwareVersion::Id, value, chip::NullOptional, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 23: TH reads HardwareVersion from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::HardwareVersion::Id, true, chip::NullOptional); - } - case 28: { - LogStep(28, "Step 24: TH reads HardwareVersionString from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::HardwareVersionString::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 25: TH writes HardwareVersionString from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("newhardwareversiongarbage: not in length on purpose", 18); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::HardwareVersionString::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 30: { - LogStep(30, "Step 26: TH reads HardwareVersionString from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::HardwareVersionString::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, "Step 27: TH reads SoftwareVersion from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::SoftwareVersion::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, - "Verify that the SoftwareVersion is not displayed to the end-user through any device specific means (ex: " - "screen, audio)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && BINFO.S.A0009"), 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 33: { - LogStep(33, "Step 28: TH writes SoftwareVersion from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint32_t value; - value = 33299UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::SoftwareVersion::Id, value, chip::NullOptional, chip::NullOptional); - } - case 34: { - LogStep(34, "Step 29: TH reads SoftwareVersion from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::SoftwareVersion::Id, true, chip::NullOptional); - } - case 35: { - LogStep(35, "Step 30: TH reads SoftwareVersionString from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::SoftwareVersionString::Id, true, chip::NullOptional); - } - case 36: { - LogStep(36, "Step 31: TH writes SoftwareVersionString from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("1.0garbage: not in length on purpose", 3); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::SoftwareVersionString::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 37: { - LogStep(37, "Step 32: TH reads SoftwareVersionString from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::SoftwareVersionString::Id, true, chip::NullOptional); - } - case 38: { - LogStep(38, "Step 33: TH reads ManufacturingDate from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ManufacturingDate::Id, true, chip::NullOptional); - } - case 39: { - LogStep(39, "Verify if the first 8 characters specify date according to ISO 8601, i.e, YYYYMMDD"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && BINFO.S.A000b"), 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 40: { - LogStep(40, "Step 34: TH writes ManufacturingDate from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("20210814789452INgarbage: not in length on purpose", 16); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ManufacturingDate::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 41: { - LogStep(41, "Step 35: TH reads ManufacturingDate from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ManufacturingDate::Id, true, chip::NullOptional); - } - case 42: { - LogStep(42, "Step 36: TH reads PartNumber from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::PartNumber::Id, - true, chip::NullOptional); - } - case 43: { - LogStep(43, "Step 37: TH writes PartNumber from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("newpartgarbage: not in length on purpose", 7); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::PartNumber::Id, value, chip::NullOptional, chip::NullOptional); - } - case 44: { - LogStep(44, "Step 38: TH reads PartNumber from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::PartNumber::Id, - true, chip::NullOptional); - } - case 45: { - LogStep(45, "Step 39: TH reads ProductURL from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::ProductURL::Id, - true, chip::NullOptional); - } - case 46: { - LogStep(46, - "Verify that it specifies a link to a specific web page, Verify that it follows the syntax rules specified in " - "RFC 3986."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && BINFO.S.A000d"), 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 47: { - LogStep(47, "Step 40: TH writes ProductURL from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("https://www.example.comgarbage: not in length on purpose", 23); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductURL::Id, value, chip::NullOptional, chip::NullOptional); - } - case 48: { - LogStep(48, "Step 41: TH reads ProductURL from the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.A000d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::ProductURL::Id, - true, chip::NullOptional); - } - case 49: { - LogStep(49, "Step 42: TH reads ProductLabel from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductLabel::Id, true, chip::NullOptional); - } - case 50: { - LogStep(50, "Verify that it does not include the name of the vendor as defined within the VendorName attribute"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && BINFO.S.A000e"), 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 51: { - LogStep(51, "Step 43: TH writes ProductLabel from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("newproductlabelgarbage: not in length on purpose", 15); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductLabel::Id, value, chip::NullOptional, chip::NullOptional); - } - case 52: { - LogStep(52, "Step 44: TH reads ProductLabel from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductLabel::Id, true, chip::NullOptional); - } - case 53: { - LogStep(53, "Step 45: TH reads SerialNumber from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::SerialNumber::Id, true, chip::NullOptional); - } - case 54: { - LogStep(54, "Step 46: TH writes SerialNumber from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("newserialnumbergarbage: not in length on purpose", 15); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::SerialNumber::Id, value, chip::NullOptional, chip::NullOptional); - } - case 55: { - LogStep(55, "Step 47: TH reads SerialNumber from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::SerialNumber::Id, true, chip::NullOptional); - } - case 56: { - LogStep(56, "Step 48: TH reads LocalConfigDisabled from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::LocalConfigDisabled::Id, true, chip::NullOptional); - } - case 57: { - LogStep(57, "Step 49: TH sets LocalConfigDisabled to True"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::LocalConfigDisabled::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 58: { - LogStep(58, "Step 50: TH reads LocalConfigDisabled from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::LocalConfigDisabled::Id, true, chip::NullOptional); - } - case 59: { - LogStep(59, "Step 51: TH reads Reachable from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Reachable::Id, - true, chip::NullOptional); - } - case 60: { - LogStep(60, "Step 52a: TH sends Write request message to DUT to change value of Reachable to false"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Reachable::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 61: { - LogStep(61, "Step 52b: TH reads Reachable from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Reachable::Id, - true, chip::NullOptional); - } - case 62: { - LogStep(62, "Step 53: TH reads UniqueID from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::UniqueID::Id, - true, chip::NullOptional); - } - case 63: { - LogStep(63, "Step 54: TH writes UniqueID from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("newidgarbage: not in length on purpose", 5); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::UniqueID::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 64: { - LogStep(64, "Step 55: TH reads UniqueID from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::UniqueID::Id, - true, chip::NullOptional); - } - case 65: { - LogStep(65, "Step 56: TH reads CapabilityMinima attribute from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::CapabilityMinima::Id, true, chip::NullOptional); - } - case 66: { - LogStep(66, "Step 57: TH writes CapabilityMinima from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::BasicInformation::Structs::CapabilityMinimaStruct::Type value; - - value.caseSessionsPerFabric = 4U; - value.subscriptionsPerFabric = 4U; - - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::CapabilityMinima::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 67: { - LogStep(67, "Step 58: TH reads CapabilityMinima attribute from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::CapabilityMinima::Id, true, chip::NullOptional); - } - case 68: { - LogStep(68, "Step 59: TH reads ProductAppearance from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductAppearance::Id, true, chip::NullOptional); - } - case 69: { - LogStep(69, "Step 60: TH writes ProductAppearance to the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::BasicInformation::Structs::ProductAppearanceStruct::Type value; - - value.finish = static_cast(3); - value.primaryColor.SetNonNull(); - value.primaryColor.Value() = static_cast(4); - - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductAppearance::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 70: { - LogStep(70, "Step 61: TH reads ProductAppearance attribute from the DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductAppearance::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_BINFO_2_2Suite : public TestCommand -{ -public: - Test_TC_BINFO_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BINFO_2_2", 14, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_BINFO_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; - - uint32_t SoftwareVersionValue; - bool ReachableValue; - uint8_t CurrentFabricIndexValue; - - 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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - SoftwareVersionValue = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("reachable", value, true)); - ReachableValue = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CurrentFabricIndexValue = value; - } - break; - case 4: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::BasicInformation::Events::StartUp::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "StartUp", "StartUp")); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 5: - switch (mTestSubStepIndex) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 6: - switch (mTestSubStepIndex) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - 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)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 10: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::BasicInformation::Events::StartUp::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("startUp.softwareVersion", value.softwareVersion, SoftwareVersionValue)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - switch (mTestSubStepIndex) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 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: TH reads SoftwareVersion attribute from DUT and saves for future use"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::SoftwareVersion::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Precondition: TH reads Reachable attribute from DUT and saves for future use"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Reachable::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Precondition: TH saves the FabricIndex during commissioning"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Precondition: TH subscribes to StartUp event on the Basic Information cluster of the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return SubscribeEvent(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Events::StartUp::Id, 30, - 100, false, chip::NullOptional, chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 5: { - LogStep(5, "Precondition: TH subscribes to ShutDown event on the Basic Information cluster of the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 0; - return SubscribeEvent(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Events::ShutDown::Id, 30, - 100, false, chip::NullOptional, chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 6: { - LogStep(6, "Precondition: TH subscribes to Leave event on the Basic Information cluster of the DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.E02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 0; - return SubscribeEvent(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Events::Leave::Id, 30, - 100, false, chip::NullOptional, chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 7: { - LogStep(7, "Step 1: Reboot the DUT"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 1: Reboot target device(DUT)"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - 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(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "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 10: { - LogStep(10, "Step 2: TH reads the StartUp event from DUT"); - VerifyOrDo(!ShouldSkip("BINFO.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Events::StartUp::Id, false, - chip::NullOptional); - } - case 11: { - LogStep(11, "Verify that StartUp event has priority set as CRITICAL"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && BINFO.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("If priority set as CRITICAL enter 'y' for successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Step 3: TH subscribes to the ShutDown event on the DUT. Shutdown DUT."); - VerifyOrDo(!ShouldSkip("BINFO.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 0; - return SubscribeEvent(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Events::ShutDown::Id, 30, - 100, false, chip::NullOptional, chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 13: { - LogStep(13, "Verify that ShutDown event has priority set as CRITICAL"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && BINFO.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("If priority set as CRITICAL enter 'y' for successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CNET_1_3Suite : public TestCommand -{ -public: - Test_TC_CNET_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_1_3", 21, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CNET_1_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)); - { - 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)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("featureMap", 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(CheckValue("featureMap", 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(CheckValue("featureMap", 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, 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 7: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 8: - 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, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - } - break; - case 9: - 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, 2UL)); - } - break; - case 10: - 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, 3UL)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - { - 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, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - } - break; - 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, 3UL)); - } - break; - case 16: - 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)); - } - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - } - break; - case 19: - 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("generatedCommandList", iter_0, 0)); - } - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip(" !CNET.S.F00 && !CNET.S.F01 && !CNET.S.F02 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Read the global attribute: FeatureMap when CNET.S.F00 is set"); - VerifyOrDo(!ShouldSkip("CNET.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Read the global attribute: FeatureMap when CNET.S.F01 is set"); - VerifyOrDo(!ShouldSkip("CNET.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Read the global attribute: FeatureMap when CNET.S.F02 is set"); - VerifyOrDo(!ShouldSkip("CNET.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 4b: Read mandatory attributes in AttributeList if CNET.S.F00(WI)/CNET.S.F01(TH)/CNET.S.F02(ET) is true"); - VerifyOrDo(!ShouldSkip("CNET.S.F00 || CNET.S.F01 || CNET.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4c: Read the optional attribute(ScanMaxTimeSeconds): AttributeList"); - VerifyOrDo(!ShouldSkip("CNET.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4d: Reading optional attribute(ConnectMaxTimeSeconds) in AttributeList"); - VerifyOrDo(!ShouldSkip("CNET.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 4e: 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)"); - 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 12: { - LogStep(12, - "Step 5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 13: { - LogStep( - 13, - "Step 6a: Read AcceptedCommandList If DUT supports Wi-Fi/Thread related features CNET.S.F00(WI),CNET.S.F01(TH)"); - VerifyOrDo(!ShouldSkip("( CNET.S.F00 || CNET.S.F01 )"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 6b: Read AcceptedCommandList If DUT supports Wi-Fi related features (CNET.S.F00(WI) is true)"); - VerifyOrDo(!ShouldSkip("CNET.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 6c: Read AcceptedCommandList If DUT supports Thread related features(CNET.S.F01(TH) is true)"); - VerifyOrDo(!ShouldSkip("CNET.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 6d: Read AcceptedCommandList If DUT supports Ethernet related features(CNET.S.F02(TH) is true)"); - VerifyOrDo(!ShouldSkip("CNET.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, - "Step 6e: 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)"); - 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 18: { - LogStep(18, - "Step 7a: Read the GeneratedCommandList If DUT supports Wi-Fi/Thread related features(CNET.S.F00(WI) or " - "CNET.S.F01(TH) is true)"); - VerifyOrDo(!ShouldSkip("( CNET.S.F00 || CNET.S.F01 )"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 19: { - LogStep( - 19, - "Step 7b: Read the GeneratedCommandList If DUT supports Ethernet related features(CNET.S.F02(ET) must be true)"); - VerifyOrDo(!ShouldSkip("CNET.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), NetworkCommissioning::Id, - NetworkCommissioning::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 7c: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DESC_1_1Suite : public TestCommand -{ -public: - Test_TC_DESC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DESC_1_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DESC_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)); - shouldContinue = true; - 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, 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))); - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - 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, "Step 3: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 4b: 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)"); - 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 6: { - LogStep(6, - "Step 5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 7: { - LogStep(7, - "Step 6: TH reads AcceptedCommandList 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)"); - 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 8: { - LogStep(8, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DLOG_1_1Suite : public TestCommand -{ -public: - Test_TC_DLOG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DLOG_1_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DLOG_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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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)); - shouldContinue = true; - break; - case 7: - 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(CheckNextListItemDecodes("acceptedCommandList", iter_0, 0)); - VerifyOrReturn(CheckValue("acceptedCommandList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - 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(CheckNextListItemDecodes("generatedCommandList", iter_0, 0)); - VerifyOrReturn(CheckValue("generatedCommandList[0]", iter_0.GetValue(), 1UL)); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: TWait 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), DiagnosticLogs::Id, - DiagnosticLogs::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TTH reads the FeatureMap from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), DiagnosticLogs::Id, DiagnosticLogs::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TTH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), DiagnosticLogs::Id, DiagnosticLogs::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TTH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), DiagnosticLogs::Id, DiagnosticLogs::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 4b: 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)"); - 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 6: { - LogStep(6, - "Step 5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 7: { - LogStep(7, "Step 6a: TTH reads AcceptedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), DiagnosticLogs::Id, - DiagnosticLogs::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 6b: TTH 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)"); - 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 9: { - LogStep(9, "Step 7a: TTH reads GeneratedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), DiagnosticLogs::Id, - DiagnosticLogs::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 7b: TTH 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGETH_1_1Suite : public TestCommand -{ -public: - Test_TC_DGETH_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGETH_1_1", 22, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DGETH_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)); - { - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - 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 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 7: - 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)); - } - break; - case 8: - 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)); - } - break; - case 9: - 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, 2UL)); - } - break; - case 10: - 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, 3UL)); - } - break; - 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, 4UL)); - } - 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, 5UL)); - } - 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, 6UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - } - break; - 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, 8UL)); - } - 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)); - shouldContinue = true; - break; - case 18: - 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)); - } - break; - case 19: - 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")); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads the FeatureMap from DUT"); - VerifyOrDo(!ShouldSkip(" !DGETH.S.F00 && !DGETH.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given DGETH.S.F00 ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DGETH.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given DGETH.S.F01 ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DGETH.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4b: TH reads optional attribute(PHYRate) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4c: TH reads optional attribute(FullDuplex) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep( - 9, - "Step 4d: TH reads optional attribute(PacketRxCount) and Feature dependent(DGETH.S.F00(PKTCNT)) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep( - 10, - "Step 4e: TH reads optional attribute(PacketRxCount) and Feature dependent(DGETH.S.F00(PKTCNT)) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep( - 11, - "Step 4f: TH reads optional attribute(PacketRxCount) and Feature dependent(DGETH.S.F01(ERRCNT)) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 12: { - LogStep( - 12, - "Step 4g: TH reads optional attribute(PacketRxCount) and Feature dependent(DGETH.S.F01(ERRCNT)) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 13: { - LogStep( - 13, - "Step 4h: TH reads optional attribute(PacketRxCount) and Feature dependent(DGETH.S.F01(ERRCNT)) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 4i: TH reads optional attribute(CarrierDetect) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4j: TH reads optional attribute(TimeSinceReset) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, - "Step 4k: 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)"); - 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 17: { - LogStep(17, - "Step 5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 18: { - LogStep(18, "Step 6a: TH reads AcceptedCommandList from DUT"); - VerifyOrDo(!ShouldSkip("( DGETH.S.F00 || DGETH.S.F01 )"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 6b: TH reads AcceptedCommandList from DUT"); - VerifyOrDo(!ShouldSkip(" !DGETH.S.F00 && !DGETH.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, - "Step 6c: 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)"); - 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 21: { - LogStep(21, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGETH_2_1Suite : public TestCommand -{ -public: - Test_TC_DGETH_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGETH_2_1", 17, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DGETH_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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - 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", "boolean", "boolean")); - } - break; - case 3: - 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 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - 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 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - 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 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - 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 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - 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 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 13: - 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", "boolean", "boolean")); - } - 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)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int64u", "int64u")); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read PHYRate attribute constraints"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read FullDuplex attribute constraints"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::FullDuplex::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: Read PacketRxCount attribute constraints"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PacketRxCount::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, - "Step 4b: Read PacketRxCount value from DUT and verify the number of packets received on ethernet network " - "interface"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGETH.S.A0002"), 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 5: { - LogStep(5, "Step 5a: Read PacketTxCount attribute constraints"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PacketTxCount::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 5b: Read PacketTxCount value from DUT and verify the number of packets received on ethernet network " - "interface"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGETH.S.A0003"), 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 7: { - LogStep(7, "Step 6a: Read TxErrCount attribute constraints"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::TxErrCount::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 6b: Read TxErrCount value from DUT and verify value indicates the number of failed packet transmission " - "on ethernet network interface"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGETH.S.A0004"), 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 9: { - LogStep(9, "Step 7a: Read CollisionCount attribute constraints"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::CollisionCount::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 7b: Read CollisionCount value from DUT and verify value indicates the number of collision occurred while " - "transmitting packets on ethernet network interface"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGETH.S.A0005"), 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 11: { - LogStep(11, "Step 8a: Read OverrunCount attribute constraints"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::OverrunCount::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 8b: Read OverrunCount value from DUT and verify value indicates the number of packets dropped due to " - "lack of buffer memory on ethernet network interface"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGETH.S.A0006"), 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 13: { - LogStep(13, "Step 9a: Read CarrierDetect attribute constraints"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::CarrierDetect::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 9b: Read CarrierDetect value from DUT and verify value indicates the presence of carrier detect control " - "signal on ethernet network interface"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGETH.S.A0007"), 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, "Step 10a: Read TimeSinceReset attribute constraints"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::TimeSinceReset::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, - "Step 10b: Read TimeSinceReset value from DUT and verify the value indicates the duration of time, in minutes"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGETH.S.A0008"), 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGETH_2_2Suite : public TestCommand -{ -public: - Test_TC_DGETH_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGETH_2_2", 22, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DGETH_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; - - uint64_t PacketRxCountValue; - uint64_t PacketTxCountValue; - uint64_t TxErrCountValue; - uint64_t CollisionCountValue; - uint64_t OverrunCountValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - 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", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - 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(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - break; - case 4: - 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", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - 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(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - 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(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - break; - case 7: - 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", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - 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(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - break; - case 9: - 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", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - 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(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - PacketRxCountValue = value; - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - PacketTxCountValue = value; - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TxErrCountValue = value; - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - CollisionCountValue = value; - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - OverrunCountValue = value; - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxValue("value", value, TxErrCountValue)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxValue("value", value, CollisionCountValue)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxValue("value", value, OverrunCountValue)); - } - 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.1: TH reads PHYRate attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2a.2: TH reads PHYRate attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2a.3: TH reads PHYRate attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2a.4: TH reads PHYRate attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 2a.5: TH reads PHYRate attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 2a.6: TH reads PHYRate attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2a.7: TH reads PHYRate attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 2a.8: TH reads PHYRate attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 2a.9: TH reads PHYRate attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 2a.10: TH reads PHYRate attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PHYRate::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 2b: TH reads PacketRxCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PacketRxCount::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 2c: TH reads PacketTxCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::PacketTxCount::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 2d: TH reads TxErrCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::TxErrCount::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 2e: TH reads CollisionCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::CollisionCount::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 2f: TH reads OverrunCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::OverrunCount::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 2g: Sends ResetCounts command"); - VerifyOrDo(!ShouldSkip("DGETH.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::EthernetNetworkDiagnostics::Commands::ResetCounts::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Commands::ResetCounts::Id, value, chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Step 2h: TH reads PacketRxCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0002 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 2i: TH reads PacketTxCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0003 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 2j: TH reads TxErrCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::TxErrCount::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 2k: TH reads CollisionCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::CollisionCount::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 2l: TH reads OverrunCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGETH.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), EthernetNetworkDiagnostics::Id, - EthernetNetworkDiagnostics::Attributes::OverrunCount::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FLW_1_1Suite : public TestCommand -{ -public: - Test_TC_FLW_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FLW_1_1", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_FLW_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, 3U)); - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 3UL)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, - FlowMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, FlowMeasurement::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, - FlowMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, - FlowMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: Read the optional attribute(Tolerance) in AttributeList"); - VerifyOrDo(!ShouldSkip("FLW.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, - FlowMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 4c: 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)"); - 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 7: { - LogStep(7, - "Step 5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 8: { - LogStep(8, - "Step 6: 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)"); - 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 9: { - LogStep(9, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FLW_2_1Suite : public TestCommand -{ -public: - Test_TC_FLW_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FLW_2_1", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_FLW_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::app::DataModel::Nullable MinMeasuredVariable; - chip::app::DataModel::Nullable MaxMeasuredVariable; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65533U)); - MinMeasuredVariable = 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredVariable)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - MaxMeasuredVariable = value; - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredVariable)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredVariable)); - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2048U)); - } - 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: Read the mandatory attribute: MinMeasuredValue"); - VerifyOrDo(!ShouldSkip("FLW.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, - FlowMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the mandatory attribute: MaxMeasuredValue"); - VerifyOrDo(!ShouldSkip("FLW.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, - FlowMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Read the mandatory attribute: MeasuredValue"); - VerifyOrDo(!ShouldSkip("FLW.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, - FlowMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the Tolerance attribute"); - VerifyOrDo(!ShouldSkip("FLW.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, FlowMeasurement::Attributes::Tolerance::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FLABEL_1_1Suite : public TestCommand -{ -public: - Test_TC_FLABEL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FLABEL_1_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_FLABEL_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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FixedLabel::Id, FixedLabel::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FixedLabel::Id, FixedLabel::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FixedLabel::Id, FixedLabel::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FixedLabel::Id, FixedLabel::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 4b: 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)"); - 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 6: { - LogStep(6, - "Step 5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 7: { - LogStep(7, - "Step 6: TH reads AcceptedCommandList 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)"); - 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 8: { - LogStep(8, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FLABEL_2_1Suite : public TestCommand -{ -public: - Test_TC_FLABEL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FLABEL_2_1", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_FLABEL_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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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, "Step 1: TH reads LabelList from the DUT"); - VerifyOrDo(!ShouldSkip("FLABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FixedLabel::Id, FixedLabel::Attributes::LabelList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: TH tries to write LabelList attribute of the DUT by setting Label = Test_Label, Value= Test_Value"); - VerifyOrDo(!ShouldSkip("FLABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = chip::Span("Test_Labelgarbage: not in length on purpose", 10); - listHolder_0->mList[0].value = chip::Span("Test_Valuegarbage: not in length on purpose", 10); - - value = - chip::app::DataModel::List(listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FixedLabel::Id, FixedLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: TH reads LabelList from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && FLABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FAN_1_1Suite : public TestCommand -{ -public: - Test_TC_FAN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_1_1", 20, 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_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)); - shouldContinue = true; - 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)); - { - 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; - 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, 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 10: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - 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, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - 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, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); - } - 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, 9UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 11UL)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - 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")); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - 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)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - 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, "Step 2b: Read the global attribute: FeatureMap"); - 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, "Step 2c: 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, "Step 2d: 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, "Step 2e: 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, "Step 2f: 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, "Step 2g: 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, "Step 2h: 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, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3b: 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 12: { - LogStep(12, "Step 3c: 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 13: { - LogStep(13, "Step 3d: 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 14: { - LogStep(14, "Step 3e: 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 15: { - LogStep(15, - "Step 3f: 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)"); - 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 16: { - LogStep(16, "Step 4a: 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 17: { - LogStep(17, - "Step 4b: 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)"); - 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 18: { - LogStep(18, "Step 5a: 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); - } - case 19: { - LogStep(19, - "Step 5b: TH reads from the DUT the GeneratedCommandList attribute. 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FAN_2_1Suite : public TestCommand -{ -public: - Test_TC_FAN_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_2_1", 5, 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_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)); - { - chip::app::Clusters::FanControl::FanModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - 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)); - { - chip::app::Clusters::FanControl::FanModeSequenceEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); - } - 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(CheckConstraintType("value", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::Percent value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - 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 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, "Step 3: 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, "Step 4: 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, "Step 5: 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_FAN_2_2Suite : public TestCommand -{ -public: - Test_TC_FAN_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_2_2", 4, 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_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, "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 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, "Step 3: 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, "Step 4: 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)); - { - chip::BitMask 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)); - { - chip::BitMask 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, "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 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, "Step 3: 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)); - { - chip::BitMask 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)); - { - chip::BitMask 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, "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 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, "Step 3: 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::FanModeEnum 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)); - { - chip::Percent 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)); - { - chip::Percent 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::FanModeEnum 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::FanModeEnum 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::FanModeEnum 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", 6, 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_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 mTimeout; - - uint8_t rSpeedMax; - - 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))); - rSpeedMax = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - 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(), rSpeedMax)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("speedCurrent", value, rSpeedMax)); - } - 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 reads from the DUT 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, "Step 3: TH writes to the DUT the a value less than or equal to the value read in step 2"); - VerifyOrDo(!ShouldSkip("FAN.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = rSpeedMax; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 3: { - LogStep(3, "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 4: { - LogStep(4, "Step 4: TH reads from the DUT 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 5: { - LogStep(5, "Step 5: TH reads from the DUT 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_6Suite : public TestCommand -{ -public: - Test_TC_FAN_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FAN_3_6", 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_FAN_3_6Suite() {} - - 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)); - shouldContinue = true; - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::FanControl::AirflowDirectionEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("airflowDirection", value, 0U)); - } - 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::Clusters::FanControl::AirflowDirectionEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("airflowDirection", 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 a value of Forward to the DUT"); - VerifyOrDo(!ShouldSkip("FAN.S.A000B"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::FanControl::AirflowDirectionEnum value; - value = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AirflowDirection::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Wait 1000ms"); - VerifyOrDo(!ShouldSkip("FAN.S.A000B"), 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 AirflowDirection attribute and check it is forwards"); - VerifyOrDo(!ShouldSkip("FAN.S.A000B"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AirflowDirection::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: TH writes a value of Reverse to the DUT"); - VerifyOrDo(!ShouldSkip("FAN.S.A000B"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::FanControl::AirflowDirectionEnum value; - value = static_cast(1); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AirflowDirection::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Wait 1000ms"); - VerifyOrDo(!ShouldSkip("FAN.S.A000B"), 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 5: TH reads from the DUT the AirflowDirection attribute and check it is reverse"); - VerifyOrDo(!ShouldSkip("FAN.S.A000B"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::AirflowDirection::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", 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_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))); - 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, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 7: - 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, "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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::EventList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: 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, "Step 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, "Step 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, "Step 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, "Step 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, "Step 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, - "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"); - 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, "Step 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", 20, 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 - { - 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, 8UL)); - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 2UL)); - } - 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, 3UL)); - } - break; - case 7: - 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, 4UL)); - } - break; - case 8: - 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, 5UL)); - } - break; - case 9: - 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, 6UL)); - } - break; - case 10: - 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)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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, 3UL)); - } - 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, 0UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - } - break; - 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, 2UL)); - } - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - } - 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)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: Read optional attribute(UpTime) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGGEN.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4c: Read optional attribute(TotalOperationalHours) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGGEN.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4d: Read optional attribute(BootReason) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGGEN.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4e: Read optional attribute(ActiveHardwareFaults) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGGEN.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4f: Read optional attribute(ActiveRadioFaults) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGGEN.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4g: Read optional attribute(ActiveNetworkFaults) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGGEN.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 4h: 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)"); - 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 12: { - LogStep(12, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 5b: Read optional event(HardwareFaultChange) in EventList"); - VerifyOrDo(!ShouldSkip("DGGEN.S.E00 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 5c: Read optional event(RadioFaultChange) in EventList"); - VerifyOrDo(!ShouldSkip("DGGEN.S.E01 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 5d: Read optional event(NetworkFaultChange) in EventList"); - VerifyOrDo(!ShouldSkip("DGGEN.S.E02 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, - "Step 5e: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 17: { - LogStep(17, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, - "Step 6b: 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)"); - 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 19: { - LogStep(19, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_GRPKEY_1_1Suite : public TestCommand -{ -public: - Test_TC_GRPKEY_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_GRPKEY_1_1", 14, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_GRPKEY_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, 2U)); - 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)); - { - 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)); - { - 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, 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 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, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - 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 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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::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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads the FeatureMap from DUT"); - VerifyOrDo(!ShouldSkip(" !GRPKEY.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given GRPKEY.S.F00(CS) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip(" !PICS_EVENT_LIST_ENABLED "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 4b: 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.TThe 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)"); - 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 7: { - LogStep(7, "Step 5a: TH1 reads EventList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::EventList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 9: { - LogStep(9, - "Step 5b: TH reads EventList 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)"); - 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 10: { - LogStep(10, "Step 6a: TH reads AcceptedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 12: { - LogStep(12, "Step 7a: TH reads GeneratedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_GRPKEY_2_2Suite : public TestCommand -{ -public: - Test_TC_GRPKEY_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_GRPKEY_2_2", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_GRPKEY_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; - - uint16_t Max_GrpKey; - - 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))); - Max_GrpKey = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("groupKeySet.groupKeySetID", value.groupKeySet.groupKeySetID, 26U)); - VerifyOrReturn(CheckValue("groupKeySet.groupKeySecurityPolicy", value.groupKeySet.groupKeySecurityPolicy, 0U)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey0", value.groupKeySet.epochKey0)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime0", value.groupKeySet.epochStartTime0)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime0.Value()", value.groupKeySet.epochStartTime0.Value(), 1ULL)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey1", value.groupKeySet.epochKey1)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime1", value.groupKeySet.epochStartTime1)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime1.Value()", value.groupKeySet.epochStartTime1.Value(), - 18446744073709551613ULL)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey2", value.groupKeySet.epochKey2)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime2", value.groupKeySet.epochStartTime2)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime2.Value()", value.groupKeySet.epochStartTime2.Value(), - 18446744073709551614ULL)); - } - 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), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("groupKeySet.groupKeySetID", value.groupKeySet.groupKeySetID, 26U)); - VerifyOrReturn(CheckValue("groupKeySet.groupKeySecurityPolicy", value.groupKeySet.groupKeySecurityPolicy, 0U)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey0", value.groupKeySet.epochKey0)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime0", value.groupKeySet.epochStartTime0)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime0.Value()", value.groupKeySet.epochStartTime0.Value(), 1ULL)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey1", value.groupKeySet.epochKey1)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime1", value.groupKeySet.epochStartTime1)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime1.Value()", value.groupKeySet.epochStartTime1.Value(), - 17446744073709551613ULL)); - VerifyOrReturn(CheckValueNull("groupKeySet.epochKey2", value.groupKeySet.epochKey2)); - VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime2", value.groupKeySet.epochStartTime2)); - VerifyOrReturn(CheckValue("groupKeySet.epochStartTime2.Value()", value.groupKeySet.epochStartTime2.Value(), - 17446744073709551614ULL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); - 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 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, - "Step 1: TH reads MaxGroupKeysPerFabric attribute from GroupKeyManagement cluster on DUT using a " - "fabric-filtered read. Save the value as Max_GrpKey for future use."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 18446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 3: TH sends KeySetRead command to GroupKeyManagement cluster with GroupKeySetID as 0x01a"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; - value.groupKeySetID = 26U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Commands::KeySetRead::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 4: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT on EP0."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNull(); - value.groupKeySet.epochStartTime1.SetNull(); - value.groupKeySet.epochKey2.SetNull(); - value.groupKeySet.epochStartTime2.SetNull(); - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 5: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT on EP0."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNull(); - value.groupKeySet.epochStartTime2.SetNull(); - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Step 6: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNull(); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 18446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Step 7: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNull(); - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 18446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 8: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 0ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 18446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 9: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNull(); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 18446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Step 10: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNull(); - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 18446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 11: { - LogStep(11, - "Step 11: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT. Note: EpochStartTime1 is " - "earlier than EpochStartTime0"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 1ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 18446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 12: { - LogStep(12, - "Step 12: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT. Note: EpochKey1 and " - "EpochStartTime1 are null when EpochKey2 and EpochStartTime2 are not null"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNull(); - value.groupKeySet.epochStartTime1.SetNull(); - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 18446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 13: { - LogStep(13, - "Step 13: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT. Note: EpochKey2 is set to " - "null and EpochStartTime2 is not null"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNull(); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 18446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 14: { - LogStep(14, - "Step 14: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT. Note: EpochKey2 is not null " - "and EpochStartTime2 is null"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNull(); - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 15: { - LogStep(15, - "Step 15: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT. Note: EpochStartTime2 is " - "earlier than EpochStartTime1"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Step 16: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = - chip::ByteSpan(chip::Uint8::from_const_char("\xd0garbage: not in length on purpose"), 1); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Step 16: Repeat the step by sending EpochKey1 with 1 byte value (< 16 bytes)"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = - chip::ByteSpan(chip::Uint8::from_const_char("\xd1garbage: not in length on purpose"), 1); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Step 16: Note: Repeat the step by sending EpochKey2 with 1 byte value (< 16 bytes)"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = - chip::ByteSpan(chip::Uint8::from_const_char("\xd2garbage: not in length on purpose"), 1); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 19: { - LogStep(19, - "Step 16a: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT. Note: Repeat step 16 by " - "sending KeySetWrite Command with EpochKey0, EpochKey1 and EpochKey2 having 15 bytes value (< 16 byte)"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xdegarbage: not in length on purpose"), - 15); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 20: { - LogStep(20, - "Step 16a: Repeat step 16a by sending KeySetWrite Command with EpochKey1 having 15 bytes value (< 16 byte)"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xdegarbage: not in length on purpose"), - 15); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 21: { - LogStep(21, - "Step 16a: Repeat step 16a by sending KeySetWrite Command with EpochKey2 having 15 bytes value (< 16 byte)"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = - chip::ByteSpan(chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xdegarbage: not in length on purpose"), - 15); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 22: { - LogStep(22, - "Step 16b: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT. Note: Repeat step 16 by " - "sending KeySetWrite Command with EpochKey0, EpochKey1 and EpochKey2 having 17 bytes value (> 16 bytes)"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xdegarbage: not in length on purpose"), - 17); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 23: { - LogStep(23, - "Step 16b: Repeat step 16 by sending KeySetWrite Command with EpochKey1 having 17 bytes value (> 16 bytes)"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xdegarbage: not in length on purpose"), - 17); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 24: { - LogStep(24, - "Step 16b: Repeat step 16 by sending KeySetWrite Command with EpochKey2 having 17 bytes value (> 16 bytes)"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xdegarbage: not in length on purpose"), - 17); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 25: { - LogStep(25, - "Step 17: TH sends KeySetWrite command in the GroupKeyManagement cluster to DUT on EP0. Note: KeySetWrite " - "command is sent with different EpochKeys,EpochStartTime1 and EpochStartTime2 values"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 26U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd3\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd4\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 17446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd5\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 17446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Step 18: TH sends KeySetRead command to GroupKeyManagement cluster with GroupKeySetID as 0x01a"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; - value.groupKeySetID = 26U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Commands::KeySetRead::Id, - value, chip::NullOptional - - ); - } - case 27: { - LogStep(27, - "Step 19: TH sends KeySetRead command to GroupKeyManagement cluster with GroupKeySetID as 0x01b that does not " - "exist in the GroupKeyMap attribute list."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; - value.groupKeySetID = 27U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Commands::KeySetRead::Id, - value, chip::NullOptional - - ); - } - case 28: { - LogStep(28, - "Step 20: TH removes the Group key set that was added by sending a KeySetRemove command to the " - "GroupKeyManagement cluster with the GroupKeySetID field set to 0x01a."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type value; - value.groupKeySetID = 26U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetRemove::Id, value, chip::NullOptional - - ); - } - case 29: { - LogStep(29, - "Step 21: TH sends KeySetWrite command to DUT until size of list for TH’s fabric in GroupKeyMap attribute " - "contains Max_GrpKey entries, starting with GroupKeySetID 1 and incrementing by 1 each time."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 30: { - LogStep(30, "Step 23: TH again sends KeySetWrite command to DUT with any other GroupKeySetID not used yet."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C00.Rsp && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 3U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd1\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 18446744073709551613ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\xd2\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdfgarbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 18446744073709551614ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 31: { - LogStep(31, "Step 24: TH sends KeySetReadAllIndices command to DUT."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C05.Rsp && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 32: { - LogStep(32, - "Step 22: TH removes the Group key set that was added by sending a KeySetRemove command to the " - "GroupKeyManagement cluster with the GroupKeySetID field set to 0x0"); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type value; - value.groupKeySetID = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetRemove::Id, value, chip::NullOptional - - ); - } - case 33: { - LogStep( - 33, - "Step 23: TH removes the Group key set that was added by sending a KeySetRemove command to the GroupKeyManagement " - "cluster with the GroupKeySetID field set to 0x01b that does not exist in the GroupKeyMap attribute list."); - VerifyOrDo(!ShouldSkip("GRPKEY.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type value; - value.groupKeySetID = 27U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetRemove::Id, value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ICDM_1_1Suite : public TestCommand -{ -public: - Test_TC_ICDM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ICDM_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_ICDM_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, 1UL)); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - } - break; - case 3: - 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 4: - 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, 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 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, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 3UL)); - } - break; - case 7: - 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, 4UL)); - } - break; - case 8: - 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, 5UL)); - } - 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::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 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 17: - 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)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads ClusterRevision attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::ClusterRevision::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads FeatureMap attribute from DUT"); - VerifyOrDo(!ShouldSkip("ICDM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: TH reads FeatureMap attribute from DUT"); - VerifyOrDo(!ShouldSkip(" !ICDM.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH reads AttributeList attribute from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4b: Read the optional attribute(RegisteredClients) in AttributeList"); - VerifyOrDo(!ShouldSkip("ICDM.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4c: Read the optional attribute(IcdCounter) in AttributeList"); - VerifyOrDo(!ShouldSkip("ICDM.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4d: Read the optional attribute(ClientsSupportedPerFabric) in AttributeList"); - VerifyOrDo(!ShouldSkip("ICDM.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, - "Step 4e: 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)"); - 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 10: { - LogStep(10, "Step 5a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 12: { - LogStep(12, "Step 6a: TH reads AcceptedCommandList attribute from DUT"); - VerifyOrDo(!ShouldSkip(" !ICDM.S.F00 && !ICDM.S.C03.Rsp "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 6b: TH reads AcceptedCommandList attribute from DUT if ICDM.S.F00 is true"); - VerifyOrDo(!ShouldSkip("ICDM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 6c: Read the optional command (StayActiveRequest) in AttributeList"); - VerifyOrDo(!ShouldSkip("ICDM.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, - "Step 6d: 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)"); - 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 16: { - LogStep(16, "Step 7a: TH reads GeneratedCommandList attribute from DUT"); - VerifyOrDo(!ShouldSkip(" !ICDM.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 7a: TH reads GeneratedCommandList attribute from DUT"); - VerifyOrDo(!ShouldSkip("ICDM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ICDM_2_1Suite : public TestCommand -{ -public: - Test_TC_ICDM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ICDM_2_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_ICDM_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; - - uint32_t IdleModeIntervalValue; - - 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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 500UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 64800000UL)); - IdleModeIntervalValue = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 300UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, IdleModeIntervalValue)); - } - break; - case 3: - 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, 300U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::IcdManagement::Structs::MonitoringRegistrationStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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", "int32u", "int32u")); - } - break; - case 6: - 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, 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 reads from the DUT the IdleModeInterval attribute"); - VerifyOrDo(!ShouldSkip("ICDM.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::IdleModeInterval::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the ActiveModeInterval attribute"); - VerifyOrDo(!ShouldSkip("ICDM.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::ActiveModeInterval::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the ActiveModeThreshold attribute"); - VerifyOrDo(!ShouldSkip("ICDM.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::ActiveModeThreshold::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the RegisteredClients attribute"); - VerifyOrDo(!ShouldSkip("ICDM.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::RegisteredClients::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the IcdCounter attribute"); - VerifyOrDo(!ShouldSkip("ICDM.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, IcdManagement::Attributes::ICDCounter::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the ClientsSupportedPerFabric attribute"); - VerifyOrDo(!ShouldSkip("ICDM.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), IcdManagement::Id, - IcdManagement::Attributes::ClientsSupportedPerFabric::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_I_1_1Suite : public TestCommand -{ -public: - Test_TC_I_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_1_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_I_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, 4U)); - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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)); - } - 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, 64UL)); - } - break; - case 7: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: Read the optional command(TriggerEffect) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 6: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 7: Read EventList attribute from the DUT. For this cluster the list is usually empty but it can contain " - "manufacturer specific event IDs."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_I_2_1Suite : public TestCommand -{ -public: - Test_TC_I_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_2_1", 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_I_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)); - { - 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)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Identify::IdentifyTypeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); - } - 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 reads the IdentifyTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("I.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::IdentifyTime::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the IdentifyType attribute from the DUT"); - VerifyOrDo(!ShouldSkip("I.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::IdentifyType::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_I_2_2Suite : public TestCommand -{ -public: - Test_TC_I_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_2_2", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_I_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; - - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 51U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 69U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 42U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 58U)); - } - 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)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("identifyTime", 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 5U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 15U)); - } - 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 sends Identify command to DUT, with the IdentifyTime field set to 0x003c (60s)."); - VerifyOrDo(!ShouldSkip("I.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::Identify::Type value; - value.identifyTime = 60U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::Identify::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 2b: TH reads immediately IdentifyTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("I.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::IdentifyTime::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Step 2c: After 10 seconds, the TH reads IdentifyTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("I.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::IdentifyTime::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 3: 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"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C01.Rsp && I.S.C00.Tx"), - 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 6: { - LogStep(6, "Step 4a: TH sends Identify command to DUT, with the IdentifyTime field set to 0x0000 (stop identifying)."); - VerifyOrDo(!ShouldSkip("I.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::Identify::Type value; - value.identifyTime = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::Identify::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Step 4b: TH reads immediately IdentifyTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("I.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::IdentifyTime::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 6a: TH writes a value of 0x000f (15s) to IdentifyTime attribute of DUT"); - VerifyOrDo(!ShouldSkip("I.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint16_t value; - value = 15U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::IdentifyTime::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 9: { - LogStep(9, "Wait 5000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 6b: After 5 seconds, the TH reads IdentifyTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("I.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Attributes::IdentifyTime::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_I_2_3Suite : public TestCommand -{ -public: - Test_TC_I_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_2_3", 21, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_I_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)); - 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)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - 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)); - 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)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and the " - "effect variant field set to 0x00 default"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; - value.effectIdentifier = static_cast(0); - value.effectVariant = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "DUT executes a blink effect"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C40.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 3: { - LogStep(3, - "Step 2b: TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and the " - "effect variant field set to 0x00 default"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; - value.effectIdentifier = static_cast(1); - value.effectVariant = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "DUT executes a breathe effect"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C40.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 5: { - LogStep(5, - "Step 2c: TH sends TriggerEffect command to DUT with the effect identifier field set to 0x02 okay and the " - "effect variant field set to 0x00 default"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; - value.effectIdentifier = static_cast(2); - value.effectVariant = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "DUT executes an okay effect"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C40.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 7: { - LogStep(7, - "Step 2d: 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"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; - value.effectIdentifier = static_cast(11); - value.effectVariant = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "DUT executes a channel change effect"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C40.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 9: { - LogStep(9, - "Step 2e: TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and the " - "effect variant field set to 0x00 default"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; - value.effectIdentifier = static_cast(1); - value.effectVariant = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "DUT executes a breathe effect"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C40.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 11: { - LogStep(11, - "Step 2f: 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"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; - value.effectIdentifier = static_cast(254); - value.effectVariant = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "DUT stops the breathe effect after the current effect sequence"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C40.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 13: { - LogStep(13, - "Step 2g: TH sends TriggerEffect command to DUT with the effect identifier field set to 0x01 breathe and the " - "effect variant field set to 0x00 default"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; - value.effectIdentifier = static_cast(1); - value.effectVariant = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "DUT executes a breathe effect"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C40.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, - "Step 2h: 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"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; - value.effectIdentifier = static_cast(255); - value.effectVariant = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value, - chip::NullOptional - - ); - } - case 16: { - LogStep(16, "DUT stops the breathe effect as soon as possible."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C40.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 17: { - LogStep(17, - "Step 3a: TH sends TriggerEffect command to DUT with the effect identifier field set to 0x00 blink and the " - "effect variant field set to 0x42 unknown"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; - value.effectIdentifier = static_cast(0); - value.effectVariant = static_cast(66); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value, - chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Check DUT executes a blink effect."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C40.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 19: { - LogStep(19, - "Step 3b: 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"); - VerifyOrDo(!ShouldSkip("I.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::TriggerEffect::Type value; - value.effectIdentifier = static_cast(255); - value.effectVariant = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Identify::Id, Identify::Commands::TriggerEffect::Id, value, - chip::NullOptional - - ); - } - case 20: { - LogStep(20, "DUT stops any effect that may be still running as soon as possible"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && I.S.C40.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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ILL_1_1Suite : public TestCommand -{ -public: - Test_TC_ILL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ILL_1_1", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ILL_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, 3U)); - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 3UL)); - } - 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, 4UL)); - } - 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)); - { - 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")); - } - break; - case 9: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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: read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: Read the optional attribute(Tolerance) in AttributeList"); - VerifyOrDo(!ShouldSkip("ILL.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4c: Read the optional attribute(LightSensorType) in AttributeList"); - VerifyOrDo(!ShouldSkip("ILL.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, - "Step 5: Read EventList attribute from the DUT.For this cluster the list is usually empty but it can contain " - "manufacturer specific event IDs."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 8: { - LogStep(8, "Step 6: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 7: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ILL_2_1Suite : public TestCommand -{ -public: - Test_TC_ILL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ILL_2_1", 6, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ILL_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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65533U)); - } - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 2U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2048U)); - } - 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(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - 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 reads MinMeasuredValue attribute from DUT"); - VerifyOrDo(!ShouldSkip("ILL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads MaxMeasuredValue attribute from DUT"); - VerifyOrDo(!ShouldSkip("ILL.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads MeasuredValue attribute from DUT"); - VerifyOrDo(!ShouldSkip("ILL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads Tolerance attribute from DUT"); - VerifyOrDo(!ShouldSkip("ILL.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::Tolerance::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads LightSensorType attribute from DUT"); - VerifyOrDo(!ShouldSkip("ILL.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::LightSensorType::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ILL_2_2Suite : public TestCommand -{ -public: - Test_TC_ILL_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ILL_2_2", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ILL_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; - - chip::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - MinMeasuredValue = 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", "int16u", "int16u")); - MaxMeasuredValue = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - } - 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 reads MinMeasuredValue attribute from DUT"); - VerifyOrDo(!ShouldSkip("ILL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2b: TH reads MaxMeasuredValue attribute from DUT"); - VerifyOrDo(!ShouldSkip("ILL.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: Cover the sensor or darken the room"); - 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 4: { - LogStep(4, "Wait 1s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 4: After a few seconds, TH reads MeasuredValue attribute from DUT."); - VerifyOrDo(!ShouldSkip("ILL.S.A0000 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5: Expose the sensor again to light"); - 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 7: { - LogStep(7, "Wait 1s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 6: After a few seconds, TH reads MeasuredValue attribute from DUT."); - VerifyOrDo(!ShouldSkip("ILL.S.A0000 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IlluminanceMeasurement::Id, - IlluminanceMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LVL_1_1Suite : public TestCommand -{ -public: - Test_TC_LVL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_1_1", 20, 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_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, 5U)); - 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)); - { - 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)); - { - 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, 15UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 17UL)); - 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 7: - 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, 15UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 17UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 8: - 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, 16384UL)); - } - break; - case 9: - 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, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 10: - 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, 2UL)); - } - break; - 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, 3UL)); - } - 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, 16UL)); - } - 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, 18UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 19UL)); - } - break; - 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, 20UL)); - } - break; - case 16: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - } - break; - case 17: - 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, 8UL)); - } - break; - case 18: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 19: - 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; - 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 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, "Step 1: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::ClusterRevision::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip(" !LVL.S.F00 && !LVL.S.F01 && !LVL.S.F02 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: Given LVL.S.F00(OO) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("LVL.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2c: Given LVL.S.F01(LT) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("LVL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 2d: Given LVL.S.F02(FQ) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("LVL.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3b: Read the optional attribute(StartUpCurrentLevel and RemainingTime) in AttributeList"); - VerifyOrDo(!ShouldSkip("LVL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3c: Read the optional attribute(CurrentFrequency, MinFrequency and MinFrequency) in AttributeList"); - VerifyOrDo(!ShouldSkip("LVL.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3d: Read the optional attribute(MinLevel) in AttributeList"); - VerifyOrDo(!ShouldSkip("LVL.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3e: Read the optional attribute(MaxLevel) in AttributeList"); - VerifyOrDo(!ShouldSkip("LVL.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3f: Read the optional attribute(OnOffTransitionTime) in AttributeList"); - VerifyOrDo(!ShouldSkip("LVL.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3g: Read the optional attribute(OnTransitionTime) in AttributeList"); - VerifyOrDo(!ShouldSkip("LVL.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3h: Read the optional attribute(OffTransitionTime) in AttributeList"); - VerifyOrDo(!ShouldSkip("LVL.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 3i: Read the optional attribute(DefaultMoveRate) in AttributeList"); - VerifyOrDo(!ShouldSkip("LVL.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4a.1: Read the Feature-dependent(LVL.S.F02) command in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("LVL.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4b: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 5: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::EventList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LVL_2_1Suite : public TestCommand -{ -public: - Test_TC_LVL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_2_1", 21, 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_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::app::DataModel::Nullable CurrentLevelValue; - uint8_t MinLevelValue; - uint8_t MinLevelFeatureMapNotSupportedValue; - uint8_t MaxLevelValue; - uint8_t MaxLevelFeatureMapNotSupportedValue; - uint16_t MinFrequencyValue; - uint16_t MaxFrequencyValue; - - 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)); - { - 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, 254U)); - CurrentLevelValue = value; - } - break; - case 2: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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("minLevel", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); - MinLevelValue = value; - } - 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)); - MinLevelFeatureMapNotSupportedValue = value; - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("maxLevel", value, 254U)); - VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinLevelValue)); - MaxLevelValue = value; - } - break; - case 6: - 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, MinLevelFeatureMapNotSupportedValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - MaxLevelFeatureMapNotSupportedValue = value; - } - break; - case 7: - 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, MinLevelValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxLevelValue)); - } - 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(CheckConstraintType("value", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinLevelFeatureMapNotSupportedValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxLevelFeatureMapNotSupportedValue)); - } - break; - case 9: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 10: - 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, 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - MaxFrequencyValue = value; - } - break; - case 12: - 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, MaxFrequencyValue)); - } - break; - case 13: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 14: - 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, MinLevelValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxLevelValue)); - } - 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(CheckConstraintType("value", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinLevelFeatureMapNotSupportedValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxLevelFeatureMapNotSupportedValue)); - } - break; - case 16: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 17: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 18: - 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, 255U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - } - break; - case 20: - 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, 255U)); - } - 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, "Step 1: Reads the CurrentLevel attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Reads the RemainingTime attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::RemainingTime::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3a: Reads the MinLevel attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A0002 && LVL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinLevel::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3b: Reads the MinLevel attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A0002 && !LVL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinLevel::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4: Reads the MaxLevel attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A0003 && LVL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MaxLevel::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4a: Reads the MaxLevel attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A0003 && !LVL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MaxLevel::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4b & 4C Reads the CurrentLevel attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.F01 && LVL.S.A0002 && LVL.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4b & 4C Reads the CurrentLevel attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A0002 && LVL.S.A0003 && !LVL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 5: 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, "Step 6: 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, "Step 7: Reads the MaxFrequency attribute"); - 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, "Step 7b & 7C Reads the CurrentFrequency attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A0004 && LVL.S.A0005 && LVL.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentFrequency::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 8: Reads the OnOffTransitionTime attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::OnOffTransitionTime::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 9a: Reads the OnLevel attribute "); - VerifyOrDo(!ShouldSkip("LVL.S.F01 && LVL.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 9b: Reads the OnLevel attribute "); - VerifyOrDo(!ShouldSkip("LVL.S.A0011 && !LVL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 10: Reads the OnTransitionTime attribute "); - VerifyOrDo(!ShouldSkip("LVL.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnTransitionTime::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 11: Reads the OffTransitionTime attribute "); - VerifyOrDo(!ShouldSkip("LVL.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OffTransitionTime::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 12: Reads the DefaultMoveRate attribute "); - VerifyOrDo(!ShouldSkip("LVL.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::DefaultMoveRate::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 13: Reads the Options attribute "); - VerifyOrDo(!ShouldSkip("LVL.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::Options::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Step 14: Reads the StartUpCurrentLevel attribute "); - VerifyOrDo(!ShouldSkip("LVL.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::StartUpCurrentLevel::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LVL_2_2Suite : public TestCommand -{ -public: - Test_TC_LVL_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_2_2", 20, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("OnOffTransitionTimeConfigValue", 0, UINT16_MAX, &mOnOffTransitionTimeConfigValue); - AddArgument("OnLevelConfigValue", 0, UINT8_MAX, &mOnLevelConfigValue); - AddArgument("OnTransitionTimeConfigValue", 0, UINT16_MAX, &mOnTransitionTimeConfigValue); - AddArgument("OffTransitionTimeConfigValue", 0, UINT16_MAX, &mOffTransitionTimeConfigValue); - AddArgument("DefaultMoveRateConfigValue", 0, UINT8_MAX, &mDefaultMoveRateConfigValue); - AddArgument("StartUpCurrentLevelConfigValue", 0, UINT8_MAX, &mStartUpCurrentLevelConfigValue); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LVL_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 mOnOffTransitionTimeConfigValue; - chip::Optional mOnLevelConfigValue; - chip::Optional mOnTransitionTimeConfigValue; - chip::Optional mOffTransitionTimeConfigValue; - chip::Optional mDefaultMoveRateConfigValue; - chip::Optional mStartUpCurrentLevelConfigValue; - chip::Optional mTimeout; - - uint16_t OnOffTransitionTimeValue; - chip::app::DataModel::Nullable OnLevelValue; - chip::app::DataModel::Nullable OnTransitionTimeValue; - chip::app::DataModel::Nullable OffTransitionTimeValue; - chip::app::DataModel::Nullable DefaultMoveRatevalue; - chip::app::DataModel::Nullable StartUpCurrentLevelValue; - - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - OnOffTransitionTimeValue = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn( - CheckValue("onOffTransitionTime", value, - mOnOffTransitionTimeConfigValue.HasValue() ? mOnOffTransitionTimeConfigValue.Value() : 10U)); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintNotValue("value", value, OnOffTransitionTimeValue)); - } - break; - case 4: - 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, 254U)); - OnLevelValue = value; - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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("onLevel", value)); - VerifyOrReturn(CheckValue("onLevel.Value()", value.Value(), - mOnLevelConfigValue.HasValue() ? mOnLevelConfigValue.Value() : 5U)); - VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintNotValue("value", value, OnLevelValue)); - } - break; - case 7: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - OnTransitionTimeValue = value; - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("onTransitionTime", value)); - VerifyOrReturn(CheckValue("onTransitionTime.Value()", value.Value(), - mOnTransitionTimeConfigValue.HasValue() ? mOnTransitionTimeConfigValue.Value() : 5U)); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintNotValue("value", value, OnTransitionTimeValue)); - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - OffTransitionTimeValue = value; - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("offTransitionTime", value)); - VerifyOrReturn(CheckValue("offTransitionTime.Value()", value.Value(), - mOffTransitionTimeConfigValue.HasValue() ? mOffTransitionTimeConfigValue.Value() : 10U)); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintNotValue("value", value, OffTransitionTimeValue)); - } - break; - case 13: - 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, 255U)); - DefaultMoveRatevalue = value; - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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(CheckValueNonNull("defaultMoveRate", value)); - VerifyOrReturn(CheckValue("defaultMoveRate.Value()", value.Value(), - mDefaultMoveRateConfigValue.HasValue() ? mDefaultMoveRateConfigValue.Value() : 111U)); - VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintNotValue("value", value, DefaultMoveRatevalue)); - } - break; - case 16: - 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, 255U)); - StartUpCurrentLevelValue = value; - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("startUpCurrentLevel", value)); - VerifyOrReturn( - CheckValue("startUpCurrentLevel.Value()", value.Value(), - mStartUpCurrentLevelConfigValue.HasValue() ? mStartUpCurrentLevelConfigValue.Value() : 5U)); - VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintNotValue("value", value, StartUpCurrentLevelValue)); - } - break; - case 19: - 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, "Step 1a: Reads the OnOffTransitionTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::OnOffTransitionTime::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: writes the OnOffTransitionTime attribute on the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint16_t value; - value = mOnOffTransitionTimeConfigValue.HasValue() ? mOnOffTransitionTimeConfigValue.Value() : 10U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::OnOffTransitionTime::Id, value, chip::NullOptional, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 1c: Reads the OnOffTransitionTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::OnOffTransitionTime::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2a: Reads the OnLevel attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 2b: writes the OnLevel attribute on the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = mOnLevelConfigValue.HasValue() ? mOnLevelConfigValue.Value() : 5U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 2c: Reads the OnLevel attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3a: Reads the OnTransitionTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnTransitionTime::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3b: Writes the OnTransitionTime attribute on the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = mOnTransitionTimeConfigValue.HasValue() ? mOnTransitionTimeConfigValue.Value() : 5U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnTransitionTime::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3c: Reads the OnTransitionTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnTransitionTime::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4a: Reads the OffTransitionTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OffTransitionTime::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4b: Writes the OffTransitionTime attribute on the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = mOffTransitionTimeConfigValue.HasValue() ? mOffTransitionTimeConfigValue.Value() : 10U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OffTransitionTime::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4c: Reads the OffTransitionTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OffTransitionTime::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 5a: Reads the DefaultMoveRate attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::DefaultMoveRate::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 5b: Writes the DefaultMoveRate attribute on the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = mDefaultMoveRateConfigValue.HasValue() ? mDefaultMoveRateConfigValue.Value() : 111U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::DefaultMoveRate::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 5c: Reads the DefaultMoveRate attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::DefaultMoveRate::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 6a: Reads the StartUpCurrentLevel attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::StartUpCurrentLevel::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 6b: Rwrites the StartUpCurrentLevel attribute on the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = mStartUpCurrentLevelConfigValue.HasValue() ? mStartUpCurrentLevelConfigValue.Value() : 5U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::StartUpCurrentLevel::Id, value, chip::NullOptional, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 6c: Rreads the StartUpCurrentLevel attribute from the DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::StartUpCurrentLevel::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "writes back 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LVL_3_1Suite : public TestCommand -{ -public: - Test_TC_LVL_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_3_1", 47, 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_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 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 9: - 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 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)); - { - 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 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)); - shouldContinue = true; - break; - case 17: - 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, 127U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 173U)); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 200U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - 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(), 200U)); - } - break; - case 22: - 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(), 200U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("options", value, 0U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - 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(), 100U)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - 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(), 100U)); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 32: - 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(), 100U)); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 34: - 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(), 160U)); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("options", 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; - case 39: - 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(), 100U)); - } - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 42: - 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(), 120U)); - } - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 44: - 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(), 120U)); - } - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 46: - 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(), 160U)); - } - 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 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, "Step 1: 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, "Step 1a: TH writes NULL to the OnLevel attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 2a: TH sends Off command to DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C04.Rsp && 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 7: { - LogStep(7, "Step 2b: TH sends a MoveToLevelWithOnOff command to DUT, with Level =50 and TransitionTime =0 (immediate)"); - VerifyOrDo(!ShouldSkip("LVL.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::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::MoveToLevelWithOnOff::Id, - value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 2c: TH reads OnOff attribute (On/Off cluster) from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && LVL.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 2d: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C04.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3a: TH sends On command to DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C04.Rsp && 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 11: { - LogStep(11, "Step 3b: 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 12: { - LogStep(12, "Step 3c: 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 13: { - LogStep(13, - "Step 4a: TH sends a MoveToLevel command to the DUT with Level = 200 and TransitionTime = 300 (30 s). This " - "means the level should increase by 150 units in 30s, so 5 units/s"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 200U; - 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::MoveToLevel::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "Step 4b: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.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 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Step 4c: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.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 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 4d: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.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, "Wait 5000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Step 4e: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.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 22: { - LogStep(22, "Step 4f: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.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 23: { - LogStep(23, "Step 5a: 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 24: { - LogStep(24, "Step 5b: TH reads Options attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::Options::Id, true, - chip::NullOptional); - } - case 25: { - LogStep(25, "Step 5c: 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 26: { - LogStep(26, "Step 5d: TH sends a MoveToLevel command to the DUT with"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 100U; - 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 27: { - LogStep(27, "Step 5e: 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 28: { - LogStep(28, "Step 5f: TH sends Off command to DUT"); - 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 29: { - LogStep(29, "Step 5g: TH sends a MoveToLevel command to the DUT with"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 120U; - 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 30: { - LogStep(30, "Step 5h: 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 31: { - LogStep(31, "Step 5i: TH sends a MoveToLevel command to the DUT with"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 140U; - value.transitionTime.SetNonNull(); - value.transitionTime.Value() = 0U; - value.optionsMask = static_cast>(1U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value, - chip::NullOptional - - ); - } - case 32: { - LogStep(32, "Step 5j: 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 33: { - LogStep(33, "Step 5k: TH sends a MoveToLevel command to the DUT with"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 160U; - value.transitionTime.SetNonNull(); - value.transitionTime.Value() = 0U; - value.optionsMask = static_cast>(1U); - value.optionsOverride = static_cast>(1U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value, - chip::NullOptional - - ); - } - case 34: { - LogStep(34, "Step 5l: 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 35: { - LogStep(35, "Step 6a: TH writes 1 to the Options attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(1U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 36: { - LogStep(36, "Step 6b: TH reads Options attribute"); - VerifyOrDo(!ShouldSkip("LVL.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::Options::Id, true, - chip::NullOptional); - } - case 37: { - LogStep(37, "Step 6c: 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 38: { - LogStep(38, "Step 6d: TH sends a MoveToLevel command to the DUT with"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 100U; - 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 39: { - LogStep(39, "Step 6e: 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 40: { - LogStep(40, "Step 6f: TH sends Off command to DUT"); - 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 41: { - LogStep(41, "Step 6g: TH sends a MoveToLevel command to the DUT with"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 120U; - 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 42: { - LogStep(42, "Step 6h: 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 43: { - LogStep(43, "Step 6i: TH sends a MoveToLevel command to the DUT with"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 140U; - value.transitionTime.SetNonNull(); - value.transitionTime.Value() = 0U; - value.optionsMask = static_cast>(1U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value, - chip::NullOptional - - ); - } - case 44: { - LogStep(44, "Step 6j: 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 45: { - LogStep(45, "Step 6k: TH sends a MoveToLevel command to the DUT with"); - VerifyOrDo(!ShouldSkip("LVL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 160U; - value.transitionTime.SetNonNull(); - value.transitionTime.Value() = 0U; - value.optionsMask = static_cast>(1U); - value.optionsOverride = static_cast>(1U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value, - chip::NullOptional - - ); - } - case 46: { - LogStep(46, "Step 6l: 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LVL_4_1Suite : public TestCommand -{ -public: - Test_TC_LVL_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_4_1", 26, 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_4_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::app::DataModel::Nullable CurrentLevelValue; - - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - 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)); - { - 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)); - } - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 9: - 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")); - CurrentLevelValue = value; - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - 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)); - { - 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 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - { - 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 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 19: - 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, 127U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 173U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - 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, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - 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(), 254U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - 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 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, "Step 1a: 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, "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 2a: TH sends Off command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C00.Rsp && LVL.S.C05.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 7: { - LogStep(7, "Step 2b: TH sends a MoveWithOnOff command to DUT, with MoveMode =0x00 (up) and Rate =10 (units/s)"); - VerifyOrDo(!ShouldSkip("LVL.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::Type value; - value.moveMode = static_cast(0); - value.rate.SetNonNull(); - value.rate.Value() = 10U; - value.optionsMask = static_cast>(0U); - value.optionsOverride = static_cast>(0U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveWithOnOff::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 2c: TH reads OnOff attribute (On/Off cluster) from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && LVL.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 2d: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C05.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Wait 5000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2e: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C05.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3a: 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 13: { - LogStep(13, "Step 3b: 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 14: { - LogStep(14, "Step 3c: 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 15: { - LogStep(15, "Step 4a: TH sends a Move command to the DUT with MoveMode =0x00 (up) and Rate =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 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, "Step 4b: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Wait 10s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 4c: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Wait 10s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Step 4d: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Wait 19s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 19000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Step 4e: TH reads CurrentLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("LVL.S.C01.Rsp && LVL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, "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 25: { - LogStep(25, "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_5_1Suite : public TestCommand -{ -public: - Test_TC_LVL_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LVL_5_1", 23, 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_5_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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - 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)); - { - 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 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)); - { - 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 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, 127U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 173U)); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 200U)); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentLevel", value)); - VerifyOrReturn(CheckValue("currentLevel.Value()", value.Value(), 200U)); - } - break; - case 20: - 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(), 200U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - 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 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, "Step 1: 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, "Step 2a: 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, - "Step 2b: 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, "Step 2c: 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, "Step 3a: 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, "Step 3b: 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, "Step 3c: 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, - "Step 4a: 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, "Step 4b: 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, "Step 4c: 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, "Step 4d: 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, "Step 4e: 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, "Step 4f: 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; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::OnOffTransitionTime::Id, value, chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1a: H 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 3: { - LogStep(3, "Step 1b: 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 4: { - LogStep(4, "Step 2a: 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 5: { - LogStep(5, "Step 2b: 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, - "Step 2c: 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, "Step 2d: Wait 5000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 3: 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 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); - } - case 10: { - LogStep(10, "Step 4: 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 11: { - LogStep(11, - "Step 5: 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 12: { - LogStep(12, "Wait 5000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 6: 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 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, "Step 7: 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 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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional - - ); - } - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LVL_7_1Suite : public TestCommand -{ -public: - 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_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 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; } - - // - // 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)); - { - 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)); - { - 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)); - maxLevelValue = value; - } - 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)); - { - 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)); - { - 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)); - { - 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)); - 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)); - { - 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)); - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - 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: - 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; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::OnOffTransitionTime::Id, value, chip::NullOptional, chip::NullOptional); - } - case 2: { - 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; - value = static_cast>(0U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 3: { - 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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 4: { - 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 = mRandomLevelValue.HasValue() ? mRandomLevelValue.Value() : 100U; - 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 7: { - LogStep(7, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 8: { - 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, "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, "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, "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, - "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, - "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::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, "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); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - 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::CurrentFrequency::Id, - true, chip::NullOptional); - } - 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::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 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; - } -}; - -class Test_TC_LCFG_1_1Suite : public TestCommand -{ -public: - Test_TC_LCFG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LCFG_1_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_LCFG_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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 7: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), LocalizationConfiguration::Id, - LocalizationConfiguration::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), LocalizationConfiguration::Id, - LocalizationConfiguration::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), LocalizationConfiguration::Id, - LocalizationConfiguration::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), LocalizationConfiguration::Id, - LocalizationConfiguration::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), LocalizationConfiguration::Id, - LocalizationConfiguration::Attributes::EventList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: TH reads AcceptedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), LocalizationConfiguration::Id, - LocalizationConfiguration::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: TH reads GeneratedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), LocalizationConfiguration::Id, - LocalizationConfiguration::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LUNIT_1_2Suite : public TestCommand -{ -public: - Test_TC_LUNIT_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LUNIT_1_2", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LUNIT_1_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; - - 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)); - { - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - 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 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 0UL)); - } - break; - case 7: - 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 8: - 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")); - } - break; - case 9: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap from DUT"); - VerifyOrDo(!ShouldSkip(" !LUNIT.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, UnitLocalization::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: Given LUNIT.S.F00(TEMP) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("LUNIT.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, UnitLocalization::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4b: TH reads Feature dependent(LUNIT.S.F00) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("LUNIT.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5: TH reads EventList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, UnitLocalization::Attributes::EventList::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 6: TH reads AcceptedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 7: TH reads GeneratedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LUNIT_3_1Suite : public TestCommand -{ -public: - Test_TC_LUNIT_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LUNIT_3_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LUNIT_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 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)); - { - chip::app::Clusters::UnitLocalization::TempUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitLocalization::TempUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("temperatureUnit", value, 0U)); - } - 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::Clusters::UnitLocalization::TempUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("temperatureUnit", value, 1U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitLocalization::TempUnitEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("temperatureUnit", value, 2U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - 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, "Step 1: TH reads TemperatureUnit attribute from DUT"); - VerifyOrDo(!ShouldSkip("LUNIT.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::TemperatureUnit::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: TH writes 0 (Fahrenheit) to TemperatureUnit attribute"); - VerifyOrDo(!ShouldSkip("LUNIT.S.A0000 && LUNIT.TempUnit.Fahrenheit"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::UnitLocalization::TempUnitEnum value; - value = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::TemperatureUnit::Id, value, chip::NullOptional, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: TH reads TemperatureUnit attribute"); - VerifyOrDo(!ShouldSkip("LUNIT.S.A0000 && LUNIT.TempUnit.Fahrenheit"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::TemperatureUnit::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: TH writes 1 (Celsius) to TemperatureUnit attribute"); - VerifyOrDo(!ShouldSkip("LUNIT.S.A0000 && LUNIT.TempUnit.Celsius"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::UnitLocalization::TempUnitEnum value; - value = static_cast(1); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::TemperatureUnit::Id, value, chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: TH reads TemperatureUnit attribute"); - VerifyOrDo(!ShouldSkip("LUNIT.S.A0000 && LUNIT.TempUnit.Celsius"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::TemperatureUnit::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: TH writes 2 (Kelvin) to TemperatureUnit attribute"); - VerifyOrDo(!ShouldSkip("LUNIT.S.A0000 && LUNIT.TempUnit.Kelvin"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::UnitLocalization::TempUnitEnum value; - value = static_cast(2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::TemperatureUnit::Id, value, chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: TH reads TemperatureUnit attribute"); - VerifyOrDo(!ShouldSkip("LUNIT.S.A0000 && LUNIT.TempUnit.Kelvin"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::TemperatureUnit::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 8: TH writes 5 to TemperatureUnit attribute"); - VerifyOrDo(!ShouldSkip("LUNIT.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::UnitLocalization::TempUnitEnum value; - value = static_cast(5); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UnitLocalization::Id, - UnitLocalization::Attributes::TemperatureUnit::Id, value, chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LTIME_1_2Suite : public TestCommand -{ -public: - Test_TC_LTIME_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LTIME_1_2", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LTIME_1_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; - - 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(CheckConstraintType("value", "bitmap32", "bitmap32")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1UL)); - } - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 1UL)); - } - 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, 2UL)); - } - break; - case 7: - 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 8: - 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")); - } - break; - case 9: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: TH reads optional attribute(ActiveCalendarType) in AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4c: TH reads optional attribute(SupportedCalendarTypes) in AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5: TH reads EventList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::EventList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 6: TH reads AcceptedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 7: TH reads GeneratedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LTIME_3_1Suite : public TestCommand -{ -public: - Test_TC_LTIME_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LTIME_3_1", 12, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LTIME_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 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)); - { - chip::app::Clusters::TimeFormatLocalization::HourFormatEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::TimeFormatLocalization::HourFormatEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("hourFormat", value, 0U)); - } - 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::Clusters::TimeFormatLocalization::HourFormatEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("hourFormat", value, 1U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::TimeFormatLocalization::CalendarTypeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 11U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 12)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - 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 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, "Step 1: TH reads HourFormat attribute from DUT"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::HourFormat::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: If (LTIME.S.A0000.12HR) TH writes 0 to HourFormat attribute"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0000.12HR"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::TimeFormatLocalization::HourFormatEnum value; - value = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::HourFormat::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: TH reads HourFormat attribute"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::HourFormat::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: If (LTIME.S.A0000.24HR) TH writes 1 to HourFormat attribute"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0000.24HR"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::TimeFormatLocalization::HourFormatEnum value; - value = static_cast(1); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::HourFormat::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: TH reads HourFormat attribute"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::HourFormat::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: TH reads ActiveCalendarType attribute from DUT"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::ActiveCalendarType::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: TH reads SupportedCalendarTypes attribute from DUT"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::SupportedCalendarTypes::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 8: TH writes value in PIXIT.LTIME.SCT to ActiveCalendarType attribute, followed by reading the " - "ActiveCalendarType attribute value"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0001 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 9: Repeat step 8 for all the values in PIXIT.LTIME.SCT"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0001 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 10: TH writes 50 to ActiveCalendarType attribute"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::TimeFormatLocalization::CalendarTypeEnum value; - value = static_cast(50); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::ActiveCalendarType::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 11: TH writes 5 to HourFormat attribute"); - VerifyOrDo(!ShouldSkip("LTIME.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::TimeFormatLocalization::HourFormatEnum value; - value = static_cast(5); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), TimeFormatLocalization::Id, - TimeFormatLocalization::Attributes::HourFormat::Id, value, chip::NullOptional, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LWM_1_1Suite : public TestCommand -{ -public: - Test_TC_LWM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LWM_1_1", 15, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LWM_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(CheckConstraintType("value", "bitmap32", "bitmap32")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 3: - 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 4: - 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, 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 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, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 2UL)); - } - break; - case 7: - 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, 3UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - 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 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - 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, 0UL)); - } - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads from the DUT the ClusterRevision attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, - "Step 3: TH reads from the DUT the FeatureMap attribute, bit 0: SHALL be 1 if and only if LWM.S.F00(DEPONOFF)"); - VerifyOrDo(!ShouldSkip("LWM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: TH reads from the DUT the FeatureMap attribute."); - VerifyOrDo(!ShouldSkip(" !LWM.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads from the DUT the AttributeList attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH reads from the DUT the AttributeList attribute."); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4b: Read the optional attribute(StartUpMode) in AttributeList"); - VerifyOrDo(!ShouldSkip("LWM.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4c: Read the Feature dependent attribute(DEPONOFF) in AttributeList"); - VerifyOrDo(!ShouldSkip("LWM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 4d: 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)"); - 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 9: { - LogStep(9, "Step 5a: TH reads from the DUT the EventList attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::EventList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 5b: TH reads EventList 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 ignore 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 11: { - LogStep(11, "Step 6a: TH reads from the DUT the AcceptedCommandList attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 6b: TH reads AcceptedCommandList attribute from DUT.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)"); - 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 13: { - LogStep(13, "Step 7a: TH reads from the DUT the GeneratedCommandList attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 7b: TH reads GeneratedCommandList 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[1688447564.178537][4220:4222] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0057 Attribute " - "0x0000_FFF8 DataVersion: 1795162772 [1688447564.178684][4220:4222] CHIP:TOO: GeneratedCommandList: 0 " - "entries [1688447564.178984][4220:4222] CHIP:EM: <<< [E:5540i S:25125 M:256711779 (Ack:197472718)] (S) Msg TX " - "to 1:0000000000000001 [10DB] --- Type 0000:10 (SecureChannel:StandaloneAck) XXXX is the allowed MEI range " - "(0x0001 - 0xFFF1)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LWM_2_1Suite : public TestCommand -{ -public: - Test_TC_LWM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LWM_2_1", 14, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("NewMode_CHANGE_OK", 0, UINT8_MAX, &mNewModeChangeOk); - AddArgument("NewMode_CHANGE_FAIL", 0, UINT8_MAX, &mNewModeChangeFail); - AddArgument("invalid_mode_th", 0, UINT8_MAX, &mInvalidModeTh); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LWM_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 mNewModeChangeOk; - chip::Optional mNewModeChangeFail; - chip::Optional mInvalidModeTh; - chip::Optional mTimeout; - - uint8_t old_current_mode_dut; - uint8_t Step6_current_mode_dut; - uint8_t Step10_current_mode_dut; - - 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)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::LaundryWasherMode::Structs::ModeOptionStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintMinLength("value", value, 2)); - } - 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", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - old_current_mode_dut = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::LaundryWasherMode::Commands::ChangeToModeResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - 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)); - Step6_current_mode_dut = value; - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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("currentMode", value, Step6_current_mode_dut)); - VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - 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)); - Step10_current_mode_dut = value; - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::LaundryWasherMode::Commands::ChangeToModeResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentMode", value, mNewModeChangeOk.HasValue() ? mNewModeChangeOk.Value() : 2U)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::LaundryWasherMode::Commands::ChangeToModeResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 1U)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentMode", value, mNewModeChangeOk.HasValue() ? mNewModeChangeOk.Value() : 2U)); - } - 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:Commission DUT to TH (can be skipped if done in a preceding test)."); - 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 reads from the DUT the SupportedModes attribute."); - VerifyOrDo(!ShouldSkip("LWM.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::SupportedModes::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the CurrentMode attribute."); - VerifyOrDo(!ShouldSkip("LWM.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::CurrentMode::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH sends a ChangeToMode command to the DUT with NewMode set to new_mode_th"); - VerifyOrDo(!ShouldSkip("LWM.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LaundryWasherMode::Commands::ChangeToMode::Type value; - value.newMode = old_current_mode_dut; - return SendCommand(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, LaundryWasherMode::Commands::ChangeToMode::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep( - 4, - "Step 5: Manually put the device in a state from which it will FAIL to transition to PIXIT.LWM.MODE_CHANGE_FAIL"); - VerifyOrDo(!ShouldSkip("LWM.S.M.CAN_TEST_MODE_FAILURE && PICS_SKIP_SAMPLE_APP"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the CurrentMode attribute."); - VerifyOrDo(!ShouldSkip("LWM.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::CurrentMode::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH sends a ChangeToMode command to the DUT with NewMode set to PIXIT.LWM.MODE_CHANGE_FAIL"); - VerifyOrDo(!ShouldSkip("LWM.S.M.CAN_TEST_MODE_FAILURE && LWM.S.C00.Rsp && PICS_SKIP_SAMPLE_APP"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 8: TH reads from the DUT the CurrentMode attribute."); - VerifyOrDo(!ShouldSkip("LWM.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::CurrentMode::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 9: Manually put the device in a state from which it will SUCCESSFULLY transition to " - "PIXIT.LWM.MODE_CHANGE_OK"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 10: TH reads from the DUT the CurrentMode attribute."); - VerifyOrDo(!ShouldSkip("LWM.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::CurrentMode::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH sends a ChangeToMode command to the DUT with NewMode set to PIXIT.LWM.MODE_CHANGE_OK"); - VerifyOrDo(!ShouldSkip("LWM.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LaundryWasherMode::Commands::ChangeToMode::Type value; - value.newMode = mNewModeChangeOk.HasValue() ? mNewModeChangeOk.Value() : 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, LaundryWasherMode::Commands::ChangeToMode::Id, - value, chip::NullOptional - - ); - } - case 11: { - LogStep(11, - "Step 12: TH reads from the DUT the CurrentMode attribute. Verify that the DUT response contains an integer " - "value equal to PIXIT.LWM.MODE_CHANGE_OK"); - VerifyOrDo(!ShouldSkip("LWM.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::CurrentMode::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 13: TH sends a ChangeToMode command to the DUT with NewMode set to invalid_mode_th"); - VerifyOrDo(!ShouldSkip("LWM.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LaundryWasherMode::Commands::ChangeToMode::Type value; - value.newMode = mInvalidModeTh.HasValue() ? mInvalidModeTh.Value() : 5U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, LaundryWasherMode::Commands::ChangeToMode::Id, - value, chip::NullOptional - - ); - } - case 13: { - LogStep(13, - "Step 14: TH reads from the DUT the CurrentMode attribute. Verify that the DUT response contains an integer " - "value equal to PIXIT.LWM.MODE_CHANGE_OK"); - VerifyOrDo(!ShouldSkip("LWM.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LaundryWasherMode::Id, - LaundryWasherMode::Attributes::CurrentMode::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LOWPOWER_1_1Suite : public TestCommand -{ -public: - Test_TC_LOWPOWER_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LOWPOWER_1_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_LOWPOWER_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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 0)); - VerifyOrReturn(CheckValue("attributeList[0]", iter_0.GetValue(), 65528UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 1)); - VerifyOrReturn(CheckValue("attributeList[1]", iter_0.GetValue(), 65529UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 2)); - VerifyOrReturn(CheckValue("attributeList[2]", iter_0.GetValue(), 65530UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 3)); - VerifyOrReturn(CheckValue("attributeList[3]", iter_0.GetValue(), 65531UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 4)); - VerifyOrReturn(CheckValue("attributeList[4]", iter_0.GetValue(), 65532UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 5)); - VerifyOrReturn(CheckValue("attributeList[5]", iter_0.GetValue(), 65533UL)); - VerifyOrReturn(CheckNoMoreListItems("attributeList", iter_0, 6)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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(CheckNextListItemDecodes("attributeList", iter_0, 0)); - VerifyOrReturn(CheckValue("attributeList[0]", iter_0.GetValue(), 65528UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 1)); - VerifyOrReturn(CheckValue("attributeList[1]", iter_0.GetValue(), 65529UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 2)); - VerifyOrReturn(CheckValue("attributeList[2]", iter_0.GetValue(), 65531UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 3)); - VerifyOrReturn(CheckValue("attributeList[3]", iter_0.GetValue(), 65532UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 4)); - VerifyOrReturn(CheckValue("attributeList[4]", iter_0.GetValue(), 65533UL)); - VerifyOrReturn(CheckNoMoreListItems("attributeList", iter_0, 5)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 0)); - VerifyOrReturn(CheckValue("acceptedCommandList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 7: - 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; - 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, "Step 1: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Attributes::EventList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_KEYPADINPUT_1_2Suite : public TestCommand -{ -public: - Test_TC_KEYPADINPUT_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_KEYPADINPUT_1_2", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_KEYPADINPUT_1_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; - - 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)); - { - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - 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 7: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 8: - 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)); - } - break; - case 9: - 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)); - } - break; - case 10: - 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; - 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, "Step 1: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::ClusterRevision::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip(" !KEYPADINPUT.S.F00 && KEYPADINPUT.S.F01 && !KEYPADINPUT.S.F02 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: Given (KEYPADINPUT.S.F00(NV)) FeatureMap bit mask is set or not"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2c: Given (KEYPADINPUT.S.F01(LK)) FeatureMap bit mask is set or not"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 2d: Given (KEYPADINPUT.S.F02(NK)) FeatureMap bit mask is set or not"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Attributes::EventList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_APPLAUNCHER_1_3Suite : public TestCommand -{ -public: - Test_TC_APPLAUNCHER_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_APPLAUNCHER_1_3", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_APPLAUNCHER_1_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)); - { - 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, 1UL)); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - } - break; - case 3: - 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 4: - 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, 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 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 0UL)); - } - break; - case 7: - 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)); - } - break; - case 8: - 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)); - } - break; - case 9: - 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, 3UL)); - } - break; - case 10: - 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; - 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 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, "Step 1: read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip("APPLAUNCHER.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip(" !APPLAUNCHER.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3b: Read the optional attribute(CatalogList) in AttributeList"); - VerifyOrDo(!ShouldSkip("APPLAUNCHER.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3c: Read the optional attribute(CurrentApp) in AttributeList"); - VerifyOrDo(!ShouldSkip("APPLAUNCHER.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::EventList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MEDIAINPUT_1_4Suite : public TestCommand -{ -public: - Test_TC_MEDIAINPUT_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAINPUT_1_4", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MEDIAINPUT_1_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)); - { - 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)); - { - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - 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 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 0UL)); - } - break; - case 7: - 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)); - } - break; - case 8: - 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)); - } - break; - case 9: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 10: - 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; - 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 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, "Step 1: read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip(" !MEDIAINPUT.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2: Given MEDIAINPUT.S.F00(NU) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3b: Read the optional attribute(InputList) in AttributeList"); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3c: Read the optional attribute(CurrentInput) in AttributeList"); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::EventList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WAKEONLAN_1_5Suite : public TestCommand -{ -public: - Test_TC_WAKEONLAN_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WAKEONLAN_1_5", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WAKEONLAN_1_5Suite() {} - - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 7: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 8: - 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; - 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, "Step 1: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3b: Read the optional attribute(MACAddress) in AttributeList"); - VerifyOrDo(!ShouldSkip("WAKEONLAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::EventList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CHANNEL_1_6Suite : public TestCommand -{ -public: - Test_TC_CHANNEL_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CHANNEL_1_6", 16, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CHANNEL_1_6Suite() {} - - 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)); - { - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - 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 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 7: - 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)); - } - break; - case 8: - 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)); - } - break; - case 9: - 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, 2UL)); - } - break; - case 10: - 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)); - } - break; - 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, 2UL)); - } - 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, 3UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - } - break; - case 15: - 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; - 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, "Step 1: read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip("( !CHANNEL.S.F00 && !CHANNEL.S.F01 )"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: Given CCHANNEL.S.F00(CL) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2c: Given CHANNEL.S.F01(LI) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3b: Read the optional attribute(ChannelList): AttributeList"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3c: Reading optional attribute(Lineup) in AttributeList"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3d: Read the optional attribute(CurrentChannel): AttributeList"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4a: Read the optional command(ChangeChannel) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4b: Read the optional command(ChangeChannelByNumber) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4c: Read the optional command(SkipChannel) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Step 5a: Read the global attribute: GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("( !CHANNEL.S.F00 && !CHANNEL.S.F01 )"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Step 5b: Read the global attribute: GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.F00 || CHANNEL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::EventList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MEDIAPLAYBACK_1_7Suite : public TestCommand -{ -public: - Test_TC_MEDIAPLAYBACK_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAPLAYBACK_1_7", 24, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MEDIAPLAYBACK_1_7Suite() {} - - 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)); - { - 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)); - { - 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, 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 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 7: - 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)); - } - break; - case 8: - 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, 2UL)); - } - break; - case 9: - 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, 3UL)); - } - break; - case 10: - 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, 4UL)); - } - break; - 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, 5UL)); - } - 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, 6UL)); - } - 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - } - break; - 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, 4UL)); - } - break; - case 16: - 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, 5UL)); - } - break; - case 17: - 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, 6UL)); - } - break; - case 18: - 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)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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)); - } - break; - case 21: - 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 22: - 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, 10UL)); - } - break; - case 23: - 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; - 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, "Step 1: read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::ClusterRevision::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip(" !MEDIAPLAYBACK.S.F00 && !MEDIAPLAYBACK.S.F01 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: Given MEDIAPLAYBACK.S.F00(AS) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2c: Given MEDIAPLAYBACK.S.F01(VS) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3b: Read the optional attribute(StartTime) in AttributeList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3c: Read the optional attribute(Duration) in AttributeList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3d: Read the optional attribute(SampledPosition) in AttributeList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3e: Read the optional attribute(PlaybackSpeed) in AttributeList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3f: Read the optional attribute(SeekRangeEnd) in AttributeList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3g: Read the optional attribute(SeekRangeStart) in AttributeList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 4a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, - MediaPlayback::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 4b: Read the optional command(StartOver) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, - MediaPlayback::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4c: Read the optional command(Previous) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, - MediaPlayback::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4d: Read the optional command(Next) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, - MediaPlayback::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4e: Read the optional command(Rewind) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, - MediaPlayback::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4f: Read the optional command(FastForward) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, - MediaPlayback::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 4g: Read the optional command(SkipForward) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, - MediaPlayback::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 4h: Read the optional command(SkipBackward) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C09.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, - MediaPlayback::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 4i: Read the optional command(Seek) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C0b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, - MediaPlayback::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, - MediaPlayback::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::EventList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_AUDIOOUTPUT_1_8Suite : public TestCommand -{ -public: - Test_TC_AUDIOOUTPUT_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_AUDIOOUTPUT_1_8", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_AUDIOOUTPUT_1_8Suite() {} - - 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(CheckConstraintType("value", "bitmap32", "bitmap32")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - 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 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, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 0UL)); - } - break; - case 7: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 8: - 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; - 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 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, "Step 1: read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::ClusterRevision::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip("AUDIOOUTPUT.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip(" !AUDIOOUTPUT.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::EventList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TGTNAV_1_9Suite : public TestCommand -{ -public: - Test_TC_TGTNAV_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TGTNAV_1_9", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TGTNAV_1_9Suite() {} - - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 1UL)); - } - 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, 0UL)); - } - break; - case 7: - 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)); - } - break; - case 8: - 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; - 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, "Step 1: read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, - TargetNavigator::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, TargetNavigator::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, - TargetNavigator::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, - TargetNavigator::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3b: Read the optional attribute(CurrentTarget) in AttributeList"); - VerifyOrDo(!ShouldSkip("TGTNAV.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, - TargetNavigator::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, - TargetNavigator::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, - TargetNavigator::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, TargetNavigator::Attributes::EventList::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_APBSC_1_10Suite : public TestCommand -{ -public: - Test_TC_APBSC_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_APBSC_1_10", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_APBSC_1_10Suite() {} - - 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, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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)); - } - 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)); - } - break; - case 7: - 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, 3UL)); - } - break; - case 8: - 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")); - } - break; - case 9: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 10: - 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; - 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, "Step 1: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Read FeatureMap attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3b: Read the optional attribute(VendorName) in AttributeList"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3c: Read the optional attribute(VendorID) in AttributeList"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3d: Read the optional attribute(ProductID) in AttributeList"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::EventList::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CONTENTLAUNCHER_1_11Suite : public TestCommand -{ -public: - Test_TC_CONTENTLAUNCHER_1_11Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CONTENTLAUNCHER_1_11", 13, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CONTENTLAUNCHER_1_11Suite() {} - - 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)); - { - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - 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 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 7: - 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)); - } - break; - case 8: - 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)); - } - break; - case 9: - 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)); - } - break; - case 10: - 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)); - } - break; - 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, 2UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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, "Step 1: read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, - ContentLauncher::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip("( !CONTENTLAUNCHER.S.F00 && !CONTENTLAUNCHER.S.F01 )"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: Given CONTENTLAUNCHER.S.F00 (CS) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2c: Given CONTENTLAUNCHER.S.F01(UP) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, - ContentLauncher::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, - ContentLauncher::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3b: Read the optional attribute(AcceptHeader): AttributeList"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, - ContentLauncher::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3c: Read the optional attribute(SupportedStreamingProtocols): AttributeList"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, - ContentLauncher::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4a: Read the optional command(LaunchContent) in AcceptedCommandList attribute"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.C.C00.Tx"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, - ContentLauncher::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4b: Read the optional command(LaunchURL) in AcceptedCommandList attribute"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.C.C01.Tx"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, - ContentLauncher::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, - ContentLauncher::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 6: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Attributes::EventList::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ALOGIN_1_12Suite : public TestCommand -{ -public: - Test_TC_ALOGIN_1_12Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ALOGIN_1_12", 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_ALOGIN_1_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)); - { - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 3UL)); - } - 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)); - } - break; - case 7: - 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; - 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, "Step 1: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Attributes::ClusterRevision::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, - AccountLogin::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, - AccountLogin::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 6: TH reads EventList attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Attributes::EventList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_LOWPOWER_2_1Suite : public TestCommand -{ -public: - Test_TC_LOWPOWER_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LOWPOWER_2_1", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_LOWPOWER_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)); - 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, "Step 1: TH sends Sleep command to DUT"); - VerifyOrDo(!ShouldSkip("LOWPOWER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LowPower::Commands::Sleep::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Commands::Sleep::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_KEYPADINPUT_3_2Suite : public TestCommand -{ -public: - Test_TC_KEYPADINPUT_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_KEYPADINPUT_3_2", 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_KEYPADINPUT_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 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)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 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, "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 1: TH sends CEC Settings Keys(0x0A) to DUT"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.F01 && KEYPADINPUT.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(10); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 2: TH sends CEC Home Keys(0x09) to DUT"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.F01 && KEYPADINPUT.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(9); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_KEYPADINPUT_3_3Suite : public TestCommand -{ -public: - Test_TC_KEYPADINPUT_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_KEYPADINPUT_3_3", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_KEYPADINPUT_3_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)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 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, "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 1a: Send Numbers1"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.C00.Rsp && KEYPADINPUT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(33); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1b: Send Numbers2"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.C00.Rsp && KEYPADINPUT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(34); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 1c: Send Numbers3"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.C00.Rsp && KEYPADINPUT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(35); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 1d: Send Numbers4"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.C00.Rsp && KEYPADINPUT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(36); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 1e: Send Numbers5"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.C00.Rsp && KEYPADINPUT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(37); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Step 1f: Send Numbers6"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.C00.Rsp && KEYPADINPUT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(38); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Step 1g: Send Numbers7"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.C00.Rsp && KEYPADINPUT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(39); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 1h: Send Numbers8"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.C00.Rsp && KEYPADINPUT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(40); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 1i: Send Numbers9"); - VerifyOrDo(!ShouldSkip("KEYPADINPUT.S.C00.Rsp && KEYPADINPUT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(41); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_APPLAUNCHER_3_5Suite : public TestCommand -{ -public: - Test_TC_APPLAUNCHER_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_APPLAUNCHER_3_5", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_APPLAUNCHER_3_5Suite() {} - - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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 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, - "Step 1: TH reads CatalogList attribute from the DUT and where each entry in the list is a CSA-issued Vendor " - "Id of type unsigned 16 bit integer ranging between 0-65536 for the catalog"); - VerifyOrDo(!ShouldSkip("APPLAUNCHER.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::CatalogList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_APPLAUNCHER_3_6Suite : public TestCommand -{ -public: - Test_TC_APPLAUNCHER_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_APPLAUNCHER_3_6", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_APPLAUNCHER_3_6Suite() {} - - 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)); - { - chip::app::DataModel::Nullable< - chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEPStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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 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, - "Step 1: TH reads CurrentApp attribute from the DUT and Verify the in-focus application attributes, which " - "should include the display Application ID(type:uint16) Catalog Vendor ID(type:string) or Null if there is no " - "current in-focus application"); - VerifyOrDo(!ShouldSkip("APPLAUNCHER.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::CurrentApp::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_APPLAUNCHER_3_7Suite : public TestCommand -{ -public: - Test_TC_APPLAUNCHER_3_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_APPLAUNCHER_3_7", 3, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("catalogVendorId", 0, UINT16_MAX, &mCatalogVendorId); - AddArgument("applicationId", &mApplicationId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_APPLAUNCHER_3_7Suite() {} - - 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 mCatalogVendorId; - chip::Optional mApplicationId; - 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)); - { - chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 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 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, "Step 1: Launch an app with the provided a application ID"); - VerifyOrDo(!ShouldSkip("APPLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type value; - value.application.Emplace(); - - value.application.Value().catalogVendorID = mCatalogVendorId.HasValue() ? mCatalogVendorId.Value() : 123U; - value.application.Value().applicationID = - mApplicationId.HasValue() ? mApplicationId.Value() : chip::Span("exampleid", 9); - - value.data.Emplace(); - value.data.Value() = chip::ByteSpan(chip::Uint8::from_const_char("Hello Worldgarbage: not in length on purpose"), 11); - return SendCommand(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Commands::LaunchApp::Id, value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 2: TH sends a LaunchApp command to DUT to launch an app which is not available"); - VerifyOrDo(!ShouldSkip("APPLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type value; - value.application.Emplace(); - - value.application.Value().catalogVendorID = mCatalogVendorId.HasValue() ? mCatalogVendorId.Value() : 123U; - value.application.Value().applicationID = - chip::Span("NonAvailableAppgarbage: not in length on purpose", 15); - - value.data.Emplace(); - value.data.Value() = chip::ByteSpan(chip::Uint8::from_const_char("Hello Worldgarbage: not in length on purpose"), 11); - return SendCommand(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Commands::LaunchApp::Id, value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MEDIAINPUT_3_10Suite : public TestCommand -{ -public: - Test_TC_MEDIAINPUT_3_10Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAINPUT_3_10", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MEDIAINPUT_3_10Suite() {} - - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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 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, - "Step 1: TH reads the InputList attribute from the DUT to show list of Inputs available and Verify list of " - "available inputs supported by the device is provided, where each entry in the list contains an " - "index(type:uint 8), InputType (InputType Enums), Name (type: Strings), and Description(Type:String)"); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::InputList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MEDIAINPUT_3_11Suite : public TestCommand -{ -public: - Test_TC_MEDIAINPUT_3_11Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAINPUT_3_11", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("Index", 0, UINT8_MAX, &mIndex); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MEDIAINPUT_3_11Suite() {} - - 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 mIndex; - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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("currentInput", value, mIndex.HasValue() ? mIndex.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 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, - "Step 1: TH reads the InputList attribute from the DUT to show list of Inputs available and Verify list of " - "available inputs supported by the device is provided, where each entry in the list contains an " - "index(type:uint 8), InputType (InputType Enums), Name (type: Strings), and Description(Type:String)"); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::InputList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, - "Step 2: TH sends SelectInput command to DUT to select an input by passing the index of the preferred input."); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaInput::Commands::SelectInput::Type value; - value.index = mIndex.HasValue() ? mIndex.Value() : 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::SelectInput::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 3: TH reads _CurrentInput attribute from the DUT to show the current input selected."); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.A0001 && MEDIAINPUT.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::CurrentInput::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MEDIAINPUT_3_12Suite : public TestCommand -{ -public: - Test_TC_MEDIAINPUT_3_12Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAINPUT_3_12", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MEDIAINPUT_3_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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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; - 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 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, - "Step 1: TH reads the InputList attribute from the DUT to show list of Inputs available and Verify list of " - "available inputs supported by the device is provided, where each entry in the list contains an " - "index(type:uint 8), InputType (InputType Enums), Name (type: Strings), and Description(Type:String)"); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::InputList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Show Input Status Command"); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaInput::Commands::ShowInputStatus::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::ShowInputStatus::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 3: Hide Input Status Command"); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaInput::Commands::HideInputStatus::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::HideInputStatus::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MEDIAINPUT_3_13Suite : public TestCommand -{ -public: - Test_TC_MEDIAINPUT_3_13Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAINPUT_3_13", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("Index", 0, UINT8_MAX, &mIndex); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MEDIAINPUT_3_13Suite() {} - - 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 mIndex; - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 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, "Step 1: TH reads the InputList attribute from the DUT to show list of Inputs available"); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::InputList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: TH sends a RenameInput command to DUT to rename an input from the list returned in step 1"); - VerifyOrDo(!ShouldSkip("MEDIAINPUT.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaInput::Commands::RenameInput::Type value; - value.index = mIndex.HasValue() ? mIndex.Value() : 1U; - value.name = chip::Span("A1garbage: not in length on purpose", 2); - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::RenameInput::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 3: TH reads the InputList attribute from the DUT to show list of Inputs available"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAINPUT.S.A0000 && MEDIAINPUT.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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CHANNEL_5_1Suite : public TestCommand -{ -public: - Test_TC_CHANNEL_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CHANNEL_5_1", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CHANNEL_5_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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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, - "Step 1: TH reads the ChannelList attribute from the DUT to show list of Inputs available and Verify that the " - "response contains a list of the known TV channels. Each list element should consist of the following,Major " - "number (unsigned 16-bit integer, mandatory),Minor number (unsigned 16-bit integer, mandatory),Name (String, " - "optional),Call sign (String, optional),Affiliate call sign (String, optional)"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::ChannelList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CHANNEL_5_2Suite : public TestCommand -{ -public: - Test_TC_CHANNEL_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CHANNEL_5_2", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("majornumber", 0, UINT16_MAX, &mMajornumber); - AddArgument("minornumber", 0, UINT16_MAX, &mMinornumber); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CHANNEL_5_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 mMajornumber; - chip::Optional mMinornumber; - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, - mMajornumber.HasValue() ? mMajornumber.Value() : 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, - mMinornumber.HasValue() ? mMinornumber.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, "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 1: TH reads the ChannelList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::ChannelList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, - "Step 2: TH sends a ChangeChannelByNumber command to the DUT with channel information (major and minor " - "numbers) from the list in step 1"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = mMajornumber.HasValue() ? mMajornumber.Value() : 9U; - value.minorNumber = mMinornumber.HasValue() ? mMinornumber.Value() : 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 2a: Verify that the channel has changed on the device"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CHANNEL.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if channel has changed on the devicegarbage: not in length on purpose", 53); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Step 3: TH reads the CurrentChannel attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.A0002 && CHANNEL.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CHANNEL_5_3Suite : public TestCommand -{ -public: - Test_TC_CHANNEL_5_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CHANNEL_5_3", 7, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("majornumber", 0, UINT16_MAX, &mMajornumber); - AddArgument("minornumber", 0, UINT16_MAX, &mMinornumber); - AddArgument("majornumber2", 0, UINT16_MAX, &mMajornumber2); - AddArgument("minornumber2", 0, UINT16_MAX, &mMinornumber2); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CHANNEL_5_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 mMajornumber; - chip::Optional mMinornumber; - chip::Optional mMajornumber2; - chip::Optional mMinornumber2; - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 2: - 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")); - } - 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("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, - mMajornumber.HasValue() ? mMajornumber.Value() : 6U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, - mMinornumber.HasValue() ? mMinornumber.Value() : 0U)); - } - 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("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, - mMajornumber2.HasValue() ? mMajornumber2.Value() : 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, - mMinornumber2.HasValue() ? mMinornumber2.Value() : 1U)); - VerifyOrReturn(CheckConstraintType("value", "ChannelInfoStruct", "ChannelInfoStruct")); - } - 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, - "Step 1: TH reads the Lineup attribute from the DUT to show list of Inputs available and Verify that the " - "response contains a lineup info object"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::Lineup::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: TH reads the ChannelList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::ChannelList::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: TH reads the CurrentChannel attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: TH sends a SkipChannel command to the DUT with a value of 1"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 1; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 4a: Verify that the channel has changed on the device"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CHANNEL.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' if channel has changed on the devicegarbage: not in length on purpose", 53); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 5: TH reads the CurrentChannel attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CHANNEL.S.A0002 && CHANNEL.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MEDIAPLAYBACK_6_1Suite : public TestCommand -{ -public: - Test_TC_MEDIAPLAYBACK_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAPLAYBACK_6_1", 12, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MEDIAPLAYBACK_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)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentState", value, 1U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentState", value, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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)); - { - chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentState", value, 1U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentState", value, 2U)); - } - 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: Media content in a paused state at the beginning of the content"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Pause::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Pause::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1: Reads the CurrentState attribute"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0000 && MEDIAPLAYBACK.S.C01.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2: Sends a Play command"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Play::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Play::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Verify that the media state is playing"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Please enter 'y' if media state is playinggarbage: not in length on purpose", 42); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 3: Reads the CurrentState attribute"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0000 && MEDIAPLAYBACK.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4: sends a Pause command"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Pause::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Pause::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Verify that the media is paused"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Please enter 'y' if media state is pausedgarbage: not in length on purpose", 41); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 5: Reads the CurrentState attribute"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C01.Rsp && MEDIAPLAYBACK.S.A0000"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 6: Sends a Stop command"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Stop::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Stop::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Verify that the media is stoped"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Please enter 'y' if media state is stopedgarbage: not in length on purpose", 41); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 7: Reads the CurrentState attribute"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0000 && MEDIAPLAYBACK.S.C02.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MEDIAPLAYBACK_6_2Suite : public TestCommand -{ -public: - Test_TC_MEDIAPLAYBACK_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAPLAYBACK_6_2", 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_MEDIAPLAYBACK_6_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; - - 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)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentState", value, 1U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentState", value, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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::DataModel::Nullable - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 10000ULL)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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)); - { - chip::app::DataModel::Nullable - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 0ULL)); - } - 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: Media content in a paused state at the beginning of the content"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Pause::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Pause::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1: Reads the CurrentState attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0000 && MEDIAPLAYBACK.S.C01.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2: Sends a Play command to the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Play::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Play::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Verify that the media state is playing"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Please enter 'y' if media state is playinggarbage: not in length on purpose", 42); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 3: Reads the CurrentState attribute"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0000 && MEDIAPLAYBACK.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4: Sends a StartOver command to the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::StartOver::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::StartOver::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Verify that the media is started over"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.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' if media is started overgarbage: not in length on purpose", 41); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 5: Sends a Next command to the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Next::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Next::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Verify that the next media item in the queue has been loaded"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if media item in the queue has been loadedgarbage: not in length on purpose", 59); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 6: Sends a Previous command to the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Previous::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Previous::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Verify that the previous media item in the queue has been loaded"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if previous media item in the queue has been loadedgarbage: not in length on purpose", 68); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Step 7: Sends a SkipForward command to the DUT "); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::SkipForward::Type value; - value.deltaPositionMilliseconds = 10000ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::SkipForward::Id, value, - chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Verify that the media has skipped forward 10 seconds"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if media has skipped forward 10 secondsgarbage: not in length on purpose", 56); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 8: Reads the SampledPosition attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0003 && MEDIAPLAYBACK.S.C08.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 9: Sends a SkipBackward command to the DUT "); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C09.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::SkipBackward::Type value; - value.deltaPositionMilliseconds = 10000ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::SkipBackward::Id, value, - chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Verify that the media has skipped backward 10 seconds"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C09.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if media has skipped backward 10 secondsgarbage: not in length on purpose", 57); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Step 10: Reads the SampledPosition attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0003 && MEDIAPLAYBACK.S.C09.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MEDIAPLAYBACK_6_3Suite : public TestCommand -{ -public: - Test_TC_MEDIAPLAYBACK_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAPLAYBACK_6_3", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("SeekPosition", 0, UINT64_MAX, &mSeekPosition); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MEDIAPLAYBACK_6_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 mSeekPosition; - 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)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 10000ULL)); - } - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 5U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Media content in a paused state at the beginning of the content"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Pause::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Pause::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1: TH sends a Seek command to the DUT with a Position value of 10000"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C0b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Seek::Type value; - value.position = 10000ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Seek::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Verify that the media has moved to 10 seconds from the starting point"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C0b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if media has moved to 10 seconds from the starting pointgarbage: not in length on purpose", 73); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Step 2: TH reads the SampledPosition attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0003 && MEDIAPLAYBACK.S.C0b.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3: TH reads the StartTime attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0001 && 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 6: { - LogStep(6, "Step 4: TH reads the SeekRangeEnd attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.A0005"), 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 7: { - LogStep(7, "Step 5: TH reads the SeekRangeStart attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.A0006"), 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 8: { - LogStep(8, "Step 6: TH reads the Duration attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.A0002"), 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 9: { - LogStep(9, - "Step 7: TH sends a Seek command to the DUT with a Position value beyond the furthest valid position (ex: " - "beyond the duration of the media)"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C0b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Seek::Type value; - value.position = mSeekPosition.HasValue() ? mSeekPosition.Value() : 100000000ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Seek::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "verify that the media has not moved."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C0b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' if media has not movedgarbage: not in length on purpose", 39); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MEDIAPLAYBACK_6_4Suite : public TestCommand -{ -public: - Test_TC_MEDIAPLAYBACK_6_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAPLAYBACK_6_4", 23, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MEDIAPLAYBACK_6_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)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentState", value, 1U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("playbackSpeed", value, 0.0f)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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::Clusters::MediaPlayback::PlaybackStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentState", value, 0U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("playbackSpeed", value, 1.0f)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("playbackSpeed", value, 2.0f)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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)); - { - chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentState", value, 0U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("playbackSpeed", value, -1.0f)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("playbackSpeed", value, -2.0f)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("playbackSpeed", value, 1.0f)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Media content in a paused state at the beginning of the content"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Pause::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Pause::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1: Reads the CurrentState attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0000 && MEDIAPLAYBACK.S.C01.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2: Reads the PlaybackSpeed attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C01.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3: Sends a FastForward command"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::FastForward::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::FastForward::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "verify that the media state is playing"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.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' if media state is playinggarbage: not in length on purpose", 42); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 4: Reads the CurrentState attribute"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0000 && MEDIAPLAYBACK.S.C07.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5: Reads the PlaybackSpeed attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C07.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 6: Sends a FastForward command"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C07.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::FastForward::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::FastForward::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "verify that the media play speed has increased."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.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' if media play speed has increased.garbage: not in length on purpose", 51); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 7: Reads the PlaybackSpeed attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C07.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 8: Sends a Rewind command to the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Rewind::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Rewind::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "verify that the media play has reversed direction."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if media play has reversed directiongarbage: not in length on purpose", 53); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 9: Reads the CurrentState attribute"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0000 && MEDIAPLAYBACK.S.C06.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 10: Reads the PlaybackSpeed attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 11: Sends a Rewind command to the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Rewind::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Rewind::Id, value, - chip::NullOptional - - ); - } - case 16: { - LogStep(16, "verify that the media play speed has increased in the reverse direction."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C06.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if media play speed has increased in the reverse directiongarbage: not in length on purpose", 75); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Step 12: Reads the PlaybackSpeed attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C06.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 13: Sends a Play command"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Play::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Commands::Play::Id, value, - chip::NullOptional - - ); - } - case 19: { - LogStep(19, "verify that the media is has resumed playing forward at the default speed."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if media is has resumed playing forward at the default speedgarbage: not in length on purpose", - 77); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 14: Reads the PlaybackSpeed attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MEDIAPLAYBACK.S.A0004 && MEDIAPLAYBACK.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id, - true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 15: Sends consecutive FastForward commands"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.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 22: { - LogStep(22, "Step 16: Sends consecutive Rewind commands"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && MEDIAPLAYBACK.S.C06.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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_AUDIOOUTPUT_7_1Suite : public TestCommand -{ -public: - Test_TC_AUDIOOUTPUT_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_AUDIOOUTPUT_7_1", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("Index", 0, UINT8_MAX, &mIndex); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_AUDIOOUTPUT_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 mIndex; - 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)); - { - chip::app::DataModel::DecodableList - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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("currentOutput", value, mIndex.HasValue() ? mIndex.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 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, "Step 1: Reads the OutputList attribute"); - VerifyOrDo(!ShouldSkip("AUDIOOUTPUT.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::OutputList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Sends a SelectAudioOutput command"); - VerifyOrDo(!ShouldSkip("AUDIOOUTPUT.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AudioOutput::Commands::SelectOutput::Type value; - value.index = mIndex.HasValue() ? mIndex.Value() : 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Commands::SelectOutput::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 3: Reads the CurrentOutput attribute"); - VerifyOrDo(!ShouldSkip("AUDIOOUTPUT.S.A0001 && AUDIOOUTPUT.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::CurrentOutput::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_AUDIOOUTPUT_7_2Suite : public TestCommand -{ -public: - Test_TC_AUDIOOUTPUT_7_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_AUDIOOUTPUT_7_2", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("Index", 0, UINT8_MAX, &mIndex); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_AUDIOOUTPUT_7_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 mIndex; - chip::Optional mTimeout; - - chip::app::DataModel::DecodableList - audioOutputListValues; - - 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)); - { - chip::app::DataModel::DecodableList - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - audioOutputListValues = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 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, "Step 1: TH reads the OutputList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("AUDIOOUTPUT.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::OutputList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep( - 2, - "Step 2: TH sends a RenameOutput command to the DUT with an index from the list in step 1 and the name 'CertTest'"); - VerifyOrDo(!ShouldSkip("AUDIOOUTPUT.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AudioOutput::Commands::RenameOutput::Type value; - value.index = mIndex.HasValue() ? mIndex.Value() : 1U; - value.name = chip::Span("CertTestgarbage: not in length on purpose", 8); - return SendCommand(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Commands::RenameOutput::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, - "Step 3: TH reads the OutputList attribute from the DUT. Verify that the output at the index provided in step " - "2 has the name CertTest"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && AUDIOOUTPUT.S.A0001 && AUDIOOUTPUT.S.C01.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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TGTNAV_8_1Suite : public TestCommand -{ -public: - Test_TC_TGTNAV_8_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TGTNAV_8_1", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("targetvalue", 0, UINT8_MAX, &mTargetvalue); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TGTNAV_8_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 mTargetvalue; - chip::Optional mTimeout; - - chip::app::DataModel::DecodableList - TargetListValues; - - 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, 255U)); - } - break; - case 2: - 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")); - TargetListValues = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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("currentTarget", value, mTargetvalue.HasValue() ? mTargetvalue.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, "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 1a: Reads the CurrentTarget attribute"); - VerifyOrDo(!ShouldSkip("TGTNAV.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, - TargetNavigator::Attributes::CurrentTarget::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: Reads the TargetList attribute"); - VerifyOrDo(!ShouldSkip("TGTNAV.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, TargetNavigator::Attributes::TargetList::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2a: Sends a NavigateTarget command"); - VerifyOrDo(!ShouldSkip("TGTNAV.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Type value; - value.target = mTargetvalue.HasValue() ? mTargetvalue.Value() : 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, TargetNavigator::Commands::NavigateTarget::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 2b: Reads the CurrentTarget attribute"); - VerifyOrDo(!ShouldSkip("TGTNAV.S.A0001 && TGTNAV.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, - TargetNavigator::Attributes::CurrentTarget::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_APBSC_9_1Suite : public TestCommand -{ -public: - Test_TC_APBSC_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_APBSC_9_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_APBSC_9_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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "vendor_id", "vendor_id")); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 256)); - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ApplicationBasic::Structs::ApplicationStruct::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "ApplicationStruct", "ApplicationStruct")); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - } - break; - case 8: - 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")); - } - 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 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, "Step 1: Reads the VendorName attribute"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::VendorName::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Reads the VendorID attribute"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: Reads the ApplicationName attribute"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::ApplicationName::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: Reads the ProductID attribute"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::ProductID::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: Reads the Application attribute"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::Application::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: Reads the Status attribute"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::Status::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: Reads the ApplicationVersion attribute"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::ApplicationVersion::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 8: Reads the AllowedVendorList attribute"); - VerifyOrDo(!ShouldSkip("APBSC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::AllowedVendorList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CONTENTLAUNCHER_10_1Suite : public TestCommand -{ -public: - Test_TC_CONTENTLAUNCHER_10_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CONTENTLAUNCHER_10_1", 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_CONTENTLAUNCHER_10_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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 2: - 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")); - } - 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, "Step 1: TH reads the AcceptHeader attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Attributes::AcceptHeader::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: TH reads the SupportedStreamingProtocols attribute from the DUT"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, - ContentLauncher::Attributes::SupportedStreamingProtocols::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WAKEONLAN_4_1Suite : public TestCommand -{ -public: - Test_TC_WAKEONLAN_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WAKEONLAN_4_1", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WAKEONLAN_4_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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value", value, 12)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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, "Step 1: TH reads the MACAddress attribute from the DUT"); - VerifyOrDo(!ShouldSkip("WAKEONLAN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::MACAddress::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: TH sends a Sleep command to DUT"); - VerifyOrDo(!ShouldSkip("LOWPOWER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LowPower::Commands::Sleep::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Commands::Sleep::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 3: TH sends a Wake-On LAN magic packet containing the MAC address from step 1"); - 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' after successgarbage: not in length on purpose", 30); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ALOGIN_12_1Suite : public TestCommand -{ -public: - Test_TC_ALOGIN_12_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ALOGIN_12_1", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("TempAccountIdentifier", &mTempAccountIdentifier); - AddArgument("catalogVendorId", 0, UINT16_MAX, &mCatalogVendorId); - AddArgument("applicationId", &mApplicationId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ALOGIN_12_1Suite() - { - if (setupPINBuffer != nullptr) - { - chip::Platform::MemoryFree(setupPINBuffer); - setupPINBuffer = nullptr; - } - } - - 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 mTempAccountIdentifier; - chip::Optional mCatalogVendorId; - chip::Optional mApplicationId; - chip::Optional mTimeout; - - char * setupPINBuffer = nullptr; - chip::CharSpan setupPIN; - - 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)); - { - chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (setupPINBuffer != nullptr) - { - chip::Platform::MemoryFree(setupPINBuffer); - } - setupPINBuffer = static_cast(chip::Platform::MemoryAlloc(value.setupPIN.size())); - memcpy(setupPINBuffer, value.setupPIN.data(), value.setupPIN.size()); - setupPIN = chip::CharSpan(setupPINBuffer, value.setupPIN.size()); - } - 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; - 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, "Launch an app with the provided a application ID"); - VerifyOrDo(!ShouldSkip("APPLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type value; - value.application.Emplace(); - - value.application.Value().catalogVendorID = mCatalogVendorId.HasValue() ? mCatalogVendorId.Value() : 123U; - value.application.Value().applicationID = - mApplicationId.HasValue() ? mApplicationId.Value() : chip::Span("exampleid", 9); - - value.data.Emplace(); - value.data.Value() = chip::ByteSpan(chip::Uint8::from_const_char("Hello Worldgarbage: not in length on purpose"), 11); - return SendCommand(kIdentityAlpha, GetEndpoint(3), ApplicationLauncher::Id, - ApplicationLauncher::Commands::LaunchApp::Id, value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1: TH sends a GetSetupPIN command to the DUT with test values provided by the product maker."); - VerifyOrDo(!ShouldSkip("ALOGIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Type value; - value.tempAccountIdentifier = - mTempAccountIdentifier.HasValue() ? mTempAccountIdentifier.Value() : chip::Span("1111", 4); - return SendCommand(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Commands::GetSetupPIN::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 2: TH sends a Login command to the DUT with test values provided by the product maker."); - VerifyOrDo(!ShouldSkip("ALOGIN.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AccountLogin::Commands::Login::Type value; - value.tempAccountIdentifier = - mTempAccountIdentifier.HasValue() ? mTempAccountIdentifier.Value() : chip::Span("1111", 4); - value.setupPIN = setupPIN; - return SendCommand(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Commands::Login::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 3: TH sends a Logout command to the DUT with test values provided by the product maker."); - VerifyOrDo(!ShouldSkip("ALOGIN.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AccountLogin::Commands::Logout::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Commands::Logout::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CONTENTLAUNCHER_10_3Suite : public TestCommand -{ -public: - Test_TC_CONTENTLAUNCHER_10_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CONTENTLAUNCHER_10_3", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("data", &mData); - AddArgument("SearchValue", &mSearchValue); - AddArgument("ExternalIdName", &mExternalIdName); - AddArgument("ExternalIdValue", &mExternalIdValue); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CONTENTLAUNCHER_10_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 mData; - chip::Optional mSearchValue; - chip::Optional mExternalIdName; - chip::Optional mExternalIdValue; - 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)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), - mData.HasValue() ? mData.Value() : chip::Span("exampleData", 11))); - } - 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::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), - mData.HasValue() ? mData.Value() : chip::Span("exampleData", 11))); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 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, - "Step 1: TH sends a LaunchContent command to the DUT with a search parameter and string, and AutoPlay flag set " - "to false"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(0); - listHolder_1->mList[0].value = - mSearchValue.HasValue() ? mSearchValue.Value() : chip::Span("exampleValue", 12); - listHolder_1->mList[0].externalIDList.Emplace(); - - { - auto * listHolder_4 = - new ListHolder(1); - listFreer.add(listHolder_4); - - listHolder_4->mList[0].name = - mExternalIdName.HasValue() ? mExternalIdName.Value() : chip::Span("name", 4); - listHolder_4->mList[0].value = - mExternalIdValue.HasValue() ? mExternalIdValue.Value() : chip::Span("value", 5); - - listHolder_1->mList[0].externalIDList.Value() = - chip::app::DataModel::List( - listHolder_4->mList, 1); - } - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = false; - value.data.Emplace(); - value.data.Value() = mData.HasValue() ? mData.Value() : chip::Span("exampleData", 11); - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Verify that DUT present via its user interface a list of matches based on the provided search criteria."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' if DUT present via its user interface a list of matches based " - "on the provided search criteria.garbage: not in length on purpose", - 111); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 3: { - LogStep(3, - "Step 2: TH sends a LaunchContent command to the DUT with a search parameter and string, and AutoPlay flag set " - "to true"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(0); - listHolder_1->mList[0].value = - mSearchValue.HasValue() ? mSearchValue.Value() : chip::Span("exampleValue", 12); - listHolder_1->mList[0].externalIDList.Emplace(); - - { - auto * listHolder_4 = - new ListHolder(1); - listFreer.add(listHolder_4); - - listHolder_4->mList[0].name = - mExternalIdName.HasValue() ? mExternalIdName.Value() : chip::Span("name", 4); - listHolder_4->mList[0].value = - mExternalIdValue.HasValue() ? mExternalIdValue.Value() : chip::Span("value", 5); - - listHolder_1->mList[0].externalIDList.Value() = - chip::app::DataModel::List( - listHolder_4->mList, 1); - } - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - value.data.Emplace(); - value.data.Value() = mData.HasValue() ? mData.Value() : chip::Span("exampleData", 11); - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Verify that DUT should also begin playing content that best matched the given search criteria"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Please enter 'y' if DUT begin playing content that best matched the given " - "search criteriagarbage: not in length on purpose", - 89); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CONTENTLAUNCHER_10_5Suite : public TestCommand -{ -public: - Test_TC_CONTENTLAUNCHER_10_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CONTENTLAUNCHER_10_5", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("GoodURL", &mGoodURL); - AddArgument("BadURL", &mBadURL); - AddArgument("UnauthorizedURL", &mUnauthorizedURL); - AddArgument("DisplayContent", &mDisplayContent); - AddArgument("providerNameString", &mProviderNameString); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CONTENTLAUNCHER_10_5Suite() {} - - 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 mGoodURL; - chip::Optional mBadURL; - chip::Optional mUnauthorizedURL; - chip::Optional mDisplayContent; - chip::Optional mProviderNameString; - 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)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), - mDisplayContent.HasValue() ? mDisplayContent.Value() - : chip::Span("exampleData", 11))); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 1U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 2U)); - } - 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 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, "Step 1: TH sends a LaunchURL command to the DUT with a known good content URL string"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; - value.contentURL = mGoodURL.HasValue() ? mGoodURL.Value() : chip::Span("https://csa-iot.org/", 20); - value.brandingInformation.Emplace(); - - value.brandingInformation.Value().providerName = - mProviderNameString.HasValue() ? mProviderNameString.Value() : chip::Span("exampleName", 11); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Verify that DUT launched the content at the given URL"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT launched the content at the given URLgarbage: not in length on purpose", 61); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2: TH sends a LaunchURL command to the DUT with a known good content URL string and a display string"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; - value.contentURL = mGoodURL.HasValue() ? mGoodURL.Value() : chip::Span("https://csa-iot.org/", 20); - value.displayString.Emplace(); - value.displayString.Value() = - mDisplayContent.HasValue() ? mDisplayContent.Value() : chip::Span("exampleData", 11); - value.brandingInformation.Emplace(); - - value.brandingInformation.Value().providerName = - mProviderNameString.HasValue() ? mProviderNameString.Value() : chip::Span("exampleName", 11); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, - "Verify that DUT launched the content at the given URL with the given display string in the " - "application-specific description area"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Please enter 'y' if DUT launched the content at the given URL with the given display " - "string in the application-specific description areagarbage: not in length on purpose", - 136); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 3: TH sends a LaunchURL command to the DUT with a known good content URL string and a brand information " - "object."); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; - value.contentURL = mGoodURL.HasValue() ? mGoodURL.Value() : chip::Span("https://csa-iot.org/", 20); - value.brandingInformation.Emplace(); - - value.brandingInformation.Value().providerName = - mProviderNameString.HasValue() ? mProviderNameString.Value() : chip::Span("exampleName", 11); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, - "Verify that DUT launched the content at the given URL with the player interface updated as per the provided " - "branding information"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Please enter 'y' if DUT launched the content at the given URL with the player interface " - "updated as per the provided branding informationgarbage: not in length on purpose", - 136); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 4: TH sends a LaunchURL command to the DUT with a known unreachable content URL string."); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; - value.contentURL = mBadURL.HasValue() ? mBadURL.Value() : chip::Span("https://badurl", 14); - value.brandingInformation.Emplace(); - - value.brandingInformation.Value().providerName = - mProviderNameString.HasValue() ? mProviderNameString.Value() : chip::Span("exampleName", 11); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 5: TH sends a LaunchURL command to the DUT with a known un-authorized content URL string."); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; - value.contentURL = - mUnauthorizedURL.HasValue() ? mUnauthorizedURL.Value() : chip::Span("https://csa-iot.org/badauth", 27); - value.brandingInformation.Emplace(); - - value.brandingInformation.Value().providerName = - mProviderNameString.HasValue() ? mProviderNameString.Value() : chip::Span("exampleName", 11); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CONTENTLAUNCHER_10_7Suite : public TestCommand -{ -public: - Test_TC_CONTENTLAUNCHER_10_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CONTENTLAUNCHER_10_7", 27, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("PopularityName", &mPopularityName); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CONTENTLAUNCHER_10_7Suite() {} - - 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 mPopularityName; - 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)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - 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)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 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, - "Step 1: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Actor and " - "Value as An Actor’s name, for example, Gaby sHoffman"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(0); - listHolder_1->mList[0].value = chip::Span("Gaby sHoffmangarbage: not in length on purpose", 13); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 3: { - LogStep(3, - "Step 2: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Channel and " - "Value as Channel Name name, for example, PBS"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(1); - listHolder_1->mList[0].value = chip::Span("PBSgarbage: not in length on purpose", 3); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 3: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Character and " - "Value as Character’s name,for example,Snow White"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(2); - listHolder_1->mList[0].value = chip::Span("Snow Whitegarbage: not in length on purpose", 10); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = false; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 7: { - LogStep(7, - "Step 4: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Director and " - "Value as Director’s name, for example, Spike Lee"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(3); - listHolder_1->mList[0].value = chip::Span("Spike Leegarbage: not in length on purpose", 9); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 9: { - LogStep(9, - "Step 5: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Event and " - "Value as An Event’s name , for example Football games"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(4); - listHolder_1->mList[0].value = chip::Span("Football gamesgarbage: not in length on purpose", 14); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 11: { - LogStep(11, - "Step 6: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Franchise and " - "Value as Franchise’s name,for example Star Wars"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(5); - listHolder_1->mList[0].value = chip::Span("Star Warsgarbage: not in length on purpose", 9); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 13: { - LogStep(13, - "Step 7: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Genre and " - "Value as Genre’s name, for example Horror"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(6); - listHolder_1->mList[0].value = chip::Span("Horrorgarbage: not in length on purpose", 6); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 15: { - LogStep(15, - "Step 8: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As League and " - "Value as League’s name, for example NCAA"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(7); - listHolder_1->mList[0].value = chip::Span("NCAAgarbage: not in length on purpose", 4); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 17: { - LogStep(17, - "Step 9: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Popularity " - "and Value as Popularity’s name"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(8); - listHolder_1->mList[0].value = - mPopularityName.HasValue() ? mPopularityName.Value() : chip::Span("popular content", 15); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 19: { - LogStep(19, - "Step 10: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Provider and " - "Value as Provider’s name, for example Netflix"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(9); - listHolder_1->mList[0].value = chip::Span("Netflixgarbage: not in length on purpose", 7); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 20: { - LogStep(20, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 21: { - LogStep(21, - "Step 11: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Sport and " - "Value as Sport’s name, for example, football"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(10); - listHolder_1->mList[0].value = chip::Span("footballgarbage: not in length on purpose", 8); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 23: { - LogStep(23, - "Step 12: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As SportsTeam " - "and Value as SportTeam’s name , for example Arsenel"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(11); - listHolder_1->mList[0].value = chip::Span("Arsenelgarbage: not in length on purpose", 7); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 25: { - LogStep(25, - "Step 13: TH sends a LaunchContent command to the DUT with search parameter consisting of Type As Type and " - "Value as Type’s name, for example TVSeries"); - VerifyOrDo(!ShouldSkip("CONTENTLAUNCHER.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(12); - listHolder_1->mList[0].value = chip::Span("TVSeriesgarbage: not in length on purpose", 8); - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Verify that DUT should play or display the search result."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && CONTENTLAUNCHER.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span( - "Please enter 'y' if DUT play or display the search result.garbage: not in length on purpose", 58); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_MOD_1_1Suite : public TestCommand -{ -public: - Test_TC_MOD_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_1_1", 15, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_MOD_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)); - shouldContinue = true; - 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, 1UL)); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - } - break; - case 3: - 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 4: - 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, 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 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, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 4UL)); - } - break; - case 7: - 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, 5UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - 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 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - 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, 0UL)); - } - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision attribute from the DUT"); - 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, "Step 3a: TH reads the FeatureMap attribute from the DUT"); - VerifyOrDo(!ShouldSkip("MOD.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: TH reads the FeatureMap attribute from the DUT"); - VerifyOrDo(!ShouldSkip(" !MOD.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4b: TH reads the optional attribute(StartUpMode) in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("MOD.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4c: TH reads the optional attribute(OnMode) in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("MOD.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 4d: 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)"); - 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 9: { - LogStep(9, "Step 5a: TH reads from the DUT the EventList attribute"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 11: { - LogStep(11, "Step 6a: TH reads AcceptedCommandList attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 6b: 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)"); - 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 13: { - LogStep(13, "Step 7a: TH reads GeneratedCommandList attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class OTA_SuccessfulTransferSuite : public TestCommand -{ -public: - OTA_SuccessfulTransferSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("OTA_SuccessfulTransfer", 11, credsIssuerConfig) - { - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("requestorNodeId", 0, UINT64_MAX, &mRequestorNodeId); - AddArgument("providerNodeId", 0, UINT64_MAX, &mProviderNodeId); - AddArgument("providerPayload", &mProviderPayload); - AddArgument("providerDiscriminator", 0, UINT16_MAX, &mProviderDiscriminator); - AddArgument("providerPort", 0, UINT16_MAX, &mProviderPort); - AddArgument("providerKvs", &mProviderKvs); - AddArgument("otaImageFilePath", &mOtaImageFilePath); - AddArgument("rawImageFilePath", &mRawImageFilePath); - AddArgument("rawImageContent", &mRawImageContent); - AddArgument("downloadImageFilePath", &mDownloadImageFilePath); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~OTA_SuccessfulTransferSuite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mEndpoint; - chip::Optional mRequestorNodeId; - chip::Optional mProviderNodeId; - chip::Optional mProviderPayload; - chip::Optional mProviderDiscriminator; - chip::Optional mProviderPort; - chip::Optional mProviderKvs; - chip::Optional mOtaImageFilePath; - chip::Optional mRawImageFilePath; - chip::Optional mRawImageContent; - chip::Optional mDownloadImageFilePath; - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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, "Create OTA image"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::CreateOtaImage::Type value; - value.otaImageFilePath = - mOtaImageFilePath.HasValue() ? mOtaImageFilePath.Value() : chip::Span("/tmp/otaImage", 13); - value.rawImageFilePath = - mRawImageFilePath.HasValue() ? mRawImageFilePath.Value() : chip::Span("/tmp/rawImage", 13); - value.rawImageContent = - mRawImageContent.HasValue() ? mRawImageContent.Value() : chip::Span("Have a hootenanny!", 18); - return CreateOtaImage(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Start the provider with an image"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("chip-ota-provider-appgarbage: not in length on purpose", 21); - value.discriminator.Emplace(); - value.discriminator.Value() = mProviderDiscriminator.HasValue() ? mProviderDiscriminator.Value() : 50U; - value.port.Emplace(); - value.port.Value() = mProviderPort.HasValue() ? mProviderPort.Value() : 5560U; - value.kvs.Emplace(); - value.kvs.Value() = - mProviderKvs.HasValue() ? mProviderKvs.Value() : chip::Span("/tmp/chip_kvs_provider", 22); - value.filepath.Emplace(); - value.filepath.Value() = - mOtaImageFilePath.HasValue() ? mOtaImageFilePath.Value() : chip::Span("/tmp/otaImage", 13); - return Start(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Commission the provider from alpha"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mProviderNodeId.HasValue() ? mProviderNodeId.Value() : 12648430ULL; - value.payload = - mProviderPayload.HasValue() ? mProviderPayload.Value() : chip::Span("MT:-24J0IX4122-.548G00", 22); - return PairWithCode(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Wait for the commissioned provider to be retrieved for alpha"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mProviderNodeId.HasValue() ? mProviderNodeId.Value() : 12648430ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Install ACL for QueryImage"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNonNull(); - listHolder_3->mList[0].cluster.Value() = 41UL; - listHolder_3->mList[0].endpoint.SetNull(); - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Stop the requestor"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Stop::Type value; - return Stop(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Start the requestor with an OTA download path"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.otaDownloadPath.Emplace(); - value.otaDownloadPath.Value() = mDownloadImageFilePath.HasValue() ? mDownloadImageFilePath.Value() - : chip::Span("/tmp/downloadedImage", 20); - return Start(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Wait for the commissioned requestor to be retrieved for alpha"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mRequestorNodeId.HasValue() ? mRequestorNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Send an announce OTA provider command to the requestor"); - ListFreer listFreer; - chip::app::Clusters::OtaSoftwareUpdateRequestor::Commands::AnnounceOTAProvider::Type value; - value.providerNodeID = mProviderNodeId.HasValue() ? mProviderNodeId.Value() : 12648430ULL; - value.vendorID = static_cast(0); - value.announcementReason = static_cast(0); - value.endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), OtaSoftwareUpdateRequestor::Id, - OtaSoftwareUpdateRequestor::Commands::AnnounceOTAProvider::Id, value, chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Wait for transfer complete message"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMessage::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("defaultgarbage: not in length on purpose", 7); - value.message = chip::Span("OTA image downloadedgarbage: not in length on purpose", 20); - return WaitForMessage(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Compare original file to downloaded file"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::CompareFiles::Type value; - value.file1 = mRawImageFilePath.HasValue() ? mRawImageFilePath.Value() : chip::Span("/tmp/rawImage", 13); - value.file2 = mDownloadImageFilePath.HasValue() ? mDownloadImageFilePath.Value() - : chip::Span("/tmp/downloadedImage", 20); - return CompareFiles(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OCC_1_1Suite : public TestCommand -{ -public: - Test_TC_OCC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_1_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_OCC_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, 3U)); - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 7: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, OccupancySensing::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, OccupancySensing::Attributes::EventList::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OCC_2_1Suite : public TestCommand -{ -public: - Test_TC_OCC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_2_1", 13, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OCC_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)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OccupancySensing::OccupancySensorTypeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 5: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 6: - 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, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - break; - case 7: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 8: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 9: - 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, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - break; - case 10: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 12: - 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, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - 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: Reads mandatory attribute constrains: Occupancy"); - VerifyOrDo(!ShouldSkip("OCC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, OccupancySensing::Attributes::Occupancy::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Reads mandatory attribute constrains: OccupancySensorType"); - VerifyOrDo(!ShouldSkip("OCC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::OccupancySensorType::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Reads mandatory attribute constrains: OccupancySensorTypeBitmap"); - VerifyOrDo(!ShouldSkip("OCC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::OccupancySensorTypeBitmap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: Reads optional attribute: PIROccupiedToUnoccupiedDelay"); - VerifyOrDo(!ShouldSkip("OCC.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::PIROccupiedToUnoccupiedDelay::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: Reads optional attribute constrains: PIRUnoccupiedToOccupiedDelay"); - VerifyOrDo(!ShouldSkip("OCC.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::PIRUnoccupiedToOccupiedDelay::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: Reads optional attribute constrains: PIRUnoccupiedToOccupiedThreshold"); - VerifyOrDo(!ShouldSkip("OCC.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::PIRUnoccupiedToOccupiedThreshold::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: Read optional attribute: UltrasonicOccupiedToUnoccupiedDelay"); - VerifyOrDo(!ShouldSkip("OCC.S.A0020"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: Read attribute: UltrasonicUnoccupiedToOccupiedDelay"); - VerifyOrDo(!ShouldSkip("OCC.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedDelay::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: Read attribute: UltrasonicUnoccupiedToOccupiedThreshold"); - VerifyOrDo(!ShouldSkip("OCC.S.A0022"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedThreshold::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: Reads optional attribute constrains: PhysicalContactOccupiedToUnoccupiedDelay"); - VerifyOrDo(!ShouldSkip("OCC.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 12: Reads optional attribute constrains: PhysicalContactUnoccupiedToOccupiedDelay"); - VerifyOrDo(!ShouldSkip("OCC.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedDelay::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 13: Reads optional attribute constrains: PhysicalContactUnoccupiedToOccupiedThreshold"); - VerifyOrDo(!ShouldSkip("OCC.S.A0032"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OCC_2_3Suite : public TestCommand -{ -public: - Test_TC_OCC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_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_OCC_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)); - { - chip::app::Clusters::OccupancySensing::OccupancySensorTypeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - 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: Reads mandatory attribute constrains: OccupancySensorType"); - VerifyOrDo(!ShouldSkip("OCC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::OccupancySensorType::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Reads mandatory attribute constrains: OccupancySensorTypeBitmap"); - VerifyOrDo(!ShouldSkip("OCC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, - OccupancySensing::Attributes::OccupancySensorTypeBitmap::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OO_1_1Suite : public TestCommand -{ -public: - Test_TC_OO_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OO_1_1", 15, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OO_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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); - } - 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)); - { - 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)); - { - 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, 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 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 7: - 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, 16384UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 16385UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 16386UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 16387UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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::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)); - } - break; - 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, 64UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 66UL)); - } - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip("( !OO.S.F00 && !OO.S.F01 )"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given OO.S.F00(LT) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("OO.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given OO.S.F01(DF) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("OO.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4b: Read the feature dependent(OO.S.F00) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("OO.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 4c: 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)"); - 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 9: { - LogStep(9, - "Step 5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 10: { - LogStep(10, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 6b: Read the feature dependent(OO.S.F00) commands in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("OO.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 6c: 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)"); - 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 13: { - LogStep(13, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OO_2_1Suite : public TestCommand -{ -public: - Test_TC_OO_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OO_2_1", 6, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OO_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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - break; - case 2: - 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; - case 3: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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(CheckConstraintType("value", "enum8", "enum8")); - } - 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: Read the mandatory attribute: OnOff"); - 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 2: { - LogStep(2, "Step 3: Read LT attribute: GlobalSceneControl"); - VerifyOrDo(!ShouldSkip("OO.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Read LT attribute: OnTime"); - VerifyOrDo(!ShouldSkip("OO.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: Read LT attribute: OffWaitTime"); - VerifyOrDo(!ShouldSkip("OO.S.A4002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: Read LT attribute: StartUpOnOff"); - VerifyOrDo(!ShouldSkip("OO.S.A4003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OO_2_2Suite : public TestCommand -{ -public: - Test_TC_OO_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OO_2_2", 23, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OO_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; - - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - 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; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - 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; - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - 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; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - 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; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - 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, "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: 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 2: { - LogStep(2, "Step 2b: 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 3: { - LogStep(3, "Step 3a: 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 4: { - LogStep(4, "Step 3b: 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 5: { - LogStep(5, "Step 3c: 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 6: { - LogStep(6, "Step 3d: 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 7: { - LogStep(7, "Step 4a: 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 8: { - LogStep(8, "Step 4b: 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 9: { - LogStep(9, "Step 4c: 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 10: { - LogStep(10, "Step 4d: 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 11: { - LogStep(11, "Step 5c: Send Toggle Command"); - VerifyOrDo(!ShouldSkip("OO.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Toggle::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Toggle::Id, value, chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Wait 1000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 5d: Check on/off attribute value is true after toggle 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 14: { - LogStep(14, "Send Toggle Command"); - VerifyOrDo(!ShouldSkip("OO.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Toggle::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Toggle::Id, value, chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Wait 1000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 16: { - LogStep(16, "Check on/off attribute value is false after toggle 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 17: { - LogStep(17, "Step 6a: Operate on device to set OnOff attribute manually to on"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && OO.M.ManuallyControlled && OO.S.A0000"), - 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 18: { - LogStep(18, "Step 6b: Check on/off attribute value is true after on command"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && OO.S.A0000 && OO.M.ManuallyControlled"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 6c: Operate on device to set OnOff attribute manually to off"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && OO.M.ManuallyControlled && OO.S.A0000"), - 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 20: { - LogStep(20, "Step 6d: Check on/off attribute value is false after off command"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && OO.S.A0000 && OO.M.ManuallyControlled"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Reset 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_OO_2_4Suite : public TestCommand -{ -public: - Test_TC_OO_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OO_2_4", 32, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OO_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)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - 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)); - shouldContinue = true; - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - 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; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - 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; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - 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, "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 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 2: { - LogStep(2, "Step 3a: TH writes a value of 0 to StartUpOnOff attribute of DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Reboot target device"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Step 3c: Reboot target device(DUT)"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - 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(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "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 6: { - LogStep(6, "Step 3d: TH reads the OnOff attribute from the DUT"); - 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 7: { - LogStep(7, "Step 4a: TH writes a value of 1 to StartUpOnOff attribute of DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = static_cast(1); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4b: Reboot target device"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 4c: Reboot target device(DUT)"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - 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(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "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 11: { - LogStep(11, "Step 4d: TH reads the OnOff attribute from the DUT"); - 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 12: { - LogStep(12, "Step 5a: TH writes a value of 2 to StartUpOnOff attribute of DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = static_cast(2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 5b: Reboot target device"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 5c: Reboot target device(DUT)"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - 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(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "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 16: { - LogStep(16, "Step 5d: TH reads the OnOff attribute from the DUT"); - 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 17: { - LogStep(17, "Step 5e: Reboot target device"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 5f: Reboot target device(DUT)"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - 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(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "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 20: { - LogStep(20, "Step 5g: TH reads the OnOff attribute from the DUT"); - 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 21: { - LogStep(21, "Step 6a: TH writes NULL to StartUpOnOff attribute of DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 6b: Reboot target device"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Step 6c: Reboot target device(DUT)"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - 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(kIdentityAlpha, value); - } - case 24: { - LogStep(24, "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 25: { - LogStep(25, "Step 6d: TH reads the OnOff attribute from the DUT"); - 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 26: { - LogStep(26, "Step 6e: TH sends Off command to DUT"); - 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 27: { - LogStep(27, "Step 6f: TH reads the OnOff attribute from the DUT"); - 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 28: { - LogStep(28, "Step 6g: Reboot target device"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 29: { - LogStep(29, "Step 6h: Reboot target device(DUT)"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - 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(kIdentityAlpha, value); - } - case 30: { - LogStep(30, "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 31: { - LogStep(31, "Step 6i: TH reads the OnOff attribute from the DUT"); - 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_OPSTATE_1_1Suite : public TestCommand -{ -public: - Test_TC_OPSTATE_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPSTATE_1_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_OPSTATE_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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 2UL)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - 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)); - } - break; - case 8: - 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)); - } - 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::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - } - break; - 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, 1UL)); - } - 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - } - 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - } - 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::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 16: - 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, 4UL)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, OperationalState::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: TH reads from the DUT the optional attribute(CountdownTime) in the AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("OPSTATE.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 4c: TH reads AttributeList attribute from DUT. 1.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. 2.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)"); - 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 7: { - LogStep(7, "Step 5a: TH reads from the DUT the EventList attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, OperationalState::Attributes::EventList::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 5b: TH reads from the DUT the optional event(OperationCompletion) in EventList."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && OPSTATE.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, OperationalState::Attributes::EventList::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, - "Step 5c: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 10: { - LogStep(10, "Step 6a: Read the optional command(Start) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("OPSTATE.S.C02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 6b: Read the optional command(Stop) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("OPSTATE.S.C01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 6c: Read the optional command(Pause) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("OPSTATE.S.C00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 6d: Read the optional command(Resume) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("OPSTATE.S.C03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 6e: TH reads AcceptedCommandList 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)"); - 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 15: { - LogStep(15, "Step 7a: Read the global attribute: GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("!OPSTATE.S.C00 || !OPSTATE.S.C01 || !OPSTATE.S.C02 || !OPSTATE.S.C03"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 7a: Read the global attribute: GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("(OPSTATE.S.C00 || OPSTATE.S.C01 || OPSTATE.S.C02 || OPSTATE.S.C03)"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OPSTATE_2_4Suite : public TestCommand -{ -public: - Test_TC_OPSTATE_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPSTATE_2_4", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OPSTATE_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: - switch (mTestSubStepIndex) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - 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), 3)); - 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: Commission DUT to TH"); - 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: Set up a subscription to the OperationalError event"); - VerifyOrDo(!ShouldSkip("OPSTATE.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 0; - return SubscribeEvent(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Events::OperationalError::Id, 100, 5000, false, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: At the DUT take the vendor defined action to generate an OperationalError event"); - VerifyOrDo(!ShouldSkip("OPSTATE.S.E00 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the OperationalState attribute"); - VerifyOrDo(!ShouldSkip("OPSTATE.S.A0004 && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PS_1_1Suite : public TestCommand -{ -public: - Test_TC_PS_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PS_1_1", 20, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PS_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, 2U)); - 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)); - { - 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, 2UL)); - 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, 2UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); - } - break; - case 7: - 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, 31UL)); - 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 8: - 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, 31UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 9: - 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, 5UL)); - } - break; - case 10: - 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, 14UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 15UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 16UL)); - } - break; - 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, 26UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 28UL)); - } - 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, 19UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 25UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 15: - 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 16: - 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)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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, 2UL)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::ClusterRevision::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip(" !PS.S.F00 && !PS.S.F01 && !PS.S.F02 && !PS.S.F03 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given PS.S.F00(WIRED) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PS.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given PS.S.F01(BAT) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PS.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3c: Given PS.S.F02(RECHG) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PS.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3d: Given PS.S.F03(REPLC) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PS.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4a: Read the Feature dependent(PS.S.F00-WIRED) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("PS.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4b: Read the Feature dependent(PS.S.F01-BAT) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("PS.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4c: Read the Feature dependent(PS.S.F02-RECHG) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("PS.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4d: Read the Feature dependent(PS.S.F03-REPLC) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("PS.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Step 5: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 6: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 7a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && !PS.S.E00 && !PS.S.E01 && !PS.S.E02 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 7b: Read PS.S.E00(WiredFaultChange) event in EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PS.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Step 7c: Read PS.S.E01(BatFaultChange) event in EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PS.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Step 7d: Read PS.S.E02(BatChargeFaultChange) event in EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PS.S.E02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 7e: Read EventList attribute from the DUT.For this cluster the list is usually empty but it can contain " - "manufacturer specific event IDs."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PS_2_1Suite : public TestCommand -{ -public: - Test_TC_PS_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PS_2_1", 33, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PS_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)); - { - chip::app::Clusters::PowerSource::PowerSourceStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - 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", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 60)); - } - break; - case 4: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PowerSource::WiredCurrentTypeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); - } - break; - case 7: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 10: - 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; - 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(CheckConstraintMaxLength("value", value, 8)); - } - break; - case 12: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 13: - 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, 200U)); - } - break; - case 14: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PowerSource::BatChargeLevelEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 16: - 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; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PowerSource::BatReplaceabilityEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 18: - 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; - case 19: - 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(CheckConstraintMaxLength("value", value, 8)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 60)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PowerSource::BatCommonDesignationEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum16", "enum16")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 80U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 20)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 20)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PowerSource::BatApprovedChemistryEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum16", "enum16")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 26: - 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, 255U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PowerSource::BatChargeStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 28: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 29: - 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; - case 30: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 31: - 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(CheckConstraintMaxLength("value", value, 16)); - } - break; - case 32: - 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")); - } - 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: Test Harness Client reads Status attribute from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::Status::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Test Harness Client reads Order attribute from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::Order::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Test Harness Client reads Description attribute from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::Description::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: Test Harness Client reads WiredAssessedInputVoltage attribue from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, - PowerSource::Attributes::WiredAssessedInputVoltage::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: Test Harness Client reads WiredAssessedInputFrequency attribute from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, - PowerSource::Attributes::WiredAssessedInputFrequency::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: Test Harness Client reads WiredCurrentType attribute from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::WiredCurrentType::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: Test Harness Client reads WiredAssessedCurrent attribute from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::WiredAssessedCurrent::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: Test Harness Client reads WiredNominalVoltage from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::WiredNominalVoltage::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: Test Harness Client reads WiredMaximumCurrent from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::WiredMaximumCurrent::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: Test Harness Client reads WiredPresent from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::WiredPresent::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 12: Test Harness Client reads ActiveWiredFaults from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::ActiveWiredFaults::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 13: Test Harness Client reads BatVoltage from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatVoltage::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Step 14: Test Harness Client reads BatPercentRemaining from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatPercentRemaining::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 15: Test Harness Client reads BatTimeRemaining from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A000d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatTimeRemaining::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 16: Test Harness Client reads BatChargeLevel from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatChargeLevel::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 17: Test Harness Client reads BatReplacementNeeded from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatReplacementNeeded::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 18: Test Harness Client reads BatReplaceability from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatReplaceability::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 19: Test Harness Client reads BatPresent from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatPresent::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Step 20: Test Harness Client readsActiveBatFaults from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::ActiveBatFaults::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 21: Test Harness Client reads BatReplacementDescription from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, - PowerSource::Attributes::BatReplacementDescription::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 22: Test Harness Client reads BatCommonDesignation from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatCommonDesignation::Id, - true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 23: Test Harness Client reads BatANSIDesignation from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatANSIDesignation::Id, - true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 24: Test Harness Client reads BatIECDesignation from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0016"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatIECDesignation::Id, - true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 25: Test Harness Client reads BatApprovedChemistry from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatApprovedChemistry::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 26: Test Harness Client reads BatCapacity from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0018"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatCapacity::Id, true, - chip::NullOptional); - } - case 26: { - LogStep(26, "Step 27: Test Harness Client reads BatQuantity from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A0019"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatQuantity::Id, true, - chip::NullOptional); - } - case 27: { - LogStep(27, "Step 28: Test Harness Client reads BatChargeState from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatChargeState::Id, true, - chip::NullOptional); - } - case 28: { - LogStep(28, "Step 29: Test Harness Client reads BatTimeToFullCharge from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A001b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatTimeToFullCharge::Id, - true, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 30: Test Harness Client reads BatFunctionalWhileCharging from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A001c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, - PowerSource::Attributes::BatFunctionalWhileCharging::Id, true, chip::NullOptional); - } - case 30: { - LogStep(30, "Step 31: Test Harness Client reads BatChargingCurrent from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A001d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::BatChargingCurrent::Id, - true, chip::NullOptional); - } - case 31: { - LogStep(31, "Step 32: Test Harness Client reads ActiveBatChargeFaults from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A001e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, - PowerSource::Attributes::ActiveBatChargeFaults::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, "Step 33: Test Harness Client reads EndpointList from Server DUT"); - VerifyOrDo(!ShouldSkip("PS.S.A001f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PowerSource::Id, PowerSource::Attributes::EndpointList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PRS_1_1Suite : public TestCommand -{ -public: - Test_TC_PRS_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PRS_1_1", 16, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PRS_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, 3U)); - 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)); - { - 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)); - { - 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, 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 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, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 16UL)); - } - break; - case 7: - 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, 17UL)); - } - break; - case 8: - 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, 18UL)); - } - break; - case 9: - 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, 20UL)); - } - break; - case 10: - 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, 3UL)); - } - break; - 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, 19UL)); - } - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip(" !PRS.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: Given PRS.S.F00(EXT) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PRS.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: Read the global mandatory attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: Read the global mandatory attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4b: Read the optional attribute(ScaledValue) in AttributeList"); - VerifyOrDo(!ShouldSkip("PRS.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4c: Read the optional attribute(MinScaledValue) in AttributeList"); - VerifyOrDo(!ShouldSkip("PRS.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4d: Read the optional attribute(MaxScaledValue) in AttributeList"); - VerifyOrDo(!ShouldSkip("PRS.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4e: Read the optional attribute(Scale) in AttributeList"); - VerifyOrDo(!ShouldSkip("PRS.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4f: Read the optional attribute(Tolerance) in AttributeList"); - VerifyOrDo(!ShouldSkip("PRS.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4g: Read the optional attribute(ScaledTolerance) in AttributeList"); - VerifyOrDo(!ShouldSkip("PRS.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 4h: 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)"); - 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 13: { - LogStep(13, - "Step 5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 14: { - LogStep(14, - "Step 6: TH reads AcceptedCommandList 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)"); - 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 15: { - LogStep(15, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PRS_2_1Suite : public TestCommand -{ -public: - Test_TC_PRS_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PRS_2_1", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PRS_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::app::DataModel::Nullable MinMeasuredValue; - chip::app::DataModel::Nullable MaxMeasuredValue; - chip::app::DataModel::Nullable MinScaledValue; - chip::app::DataModel::Nullable MaxScaledValue; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32767)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32766)); - MinMeasuredValue = 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - MaxMeasuredValue = value; - } - 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(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2048U)); - } - 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(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32767)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32766)); - MinScaledValue = value; - } - 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(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinScaledValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - MaxScaledValue = value; - } - break; - case 7: - 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinScaledValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxScaledValue)); - } - break; - case 8: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2048U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int8s", "int8s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -127)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); - } - 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: Read the mandatory attribute constraints: MinMeasuredValue"); - VerifyOrDo(!ShouldSkip("PRS.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the mandatory attribute constraints: MaxMeasuredValue"); - VerifyOrDo(!ShouldSkip("PRS.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Read the mandatory attribute constraints: MeasuredValue"); - VerifyOrDo(!ShouldSkip("PRS.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: Read the optional attribute: Tolerance"); - VerifyOrDo(!ShouldSkip("PRS.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::Tolerance::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: Read the optional attribute: MinScaledValue"); - VerifyOrDo(!ShouldSkip("PRS.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::MinScaledValue::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: Read the optional attribute: MaxScaledValue"); - VerifyOrDo(!ShouldSkip("PRS.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::MaxScaledValue::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: Read the optional attribute: ScaledValue"); - VerifyOrDo(!ShouldSkip("PRS.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::ScaledValue::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: Read the optional attribute: ScaledTolerance"); - VerifyOrDo(!ShouldSkip("PRS.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::ScaledTolerance::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: Read the optional attribute: Scale"); - VerifyOrDo(!ShouldSkip("PRS.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::Scale::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PRS_2_2Suite : public TestCommand -{ -public: - Test_TC_PRS_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PRS_2_2", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PRS_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; - - chip::app::DataModel::Nullable ValueBeforeChange; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ValueBeforeChange = value; - } - 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)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, ValueBeforeChange)); - } - 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 reads from the DUT the MeasuredValue attribute"); - VerifyOrDo(!ShouldSkip("PRS.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Operate on device to change the pressure significantly"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PRS.M.PressureChange"), 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 3: { - LogStep(3, "Wait 2s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Step 4: After a few seconds, TH reads from the DUT the MeasuredValue attribute"); - VerifyOrDo(!ShouldSkip("PRS.S.A0000 && PRS.M.PressureChange"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PressureMeasurement::Id, - PressureMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PCC_1_1Suite : public TestCommand -{ -public: - Test_TC_PCC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PCC_1_1", 50, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PCC_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, 4U)); - 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)); - { - 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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 64UL)); - } - break; - case 10: - 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, 17UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 18UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 19UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 32UL)); - 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 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 17UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 18UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 19UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 32UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 3UL)); - } - 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, 4UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - } - break; - 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, 6UL)); - } - break; - case 16: - 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)); - } - break; - case 17: - 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, 8UL)); - } - break; - case 18: - 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)); - } - break; - case 19: - 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, 10UL)); - } - break; - case 20: - 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 21: - 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, 12UL)); - } - break; - case 22: - 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, 16UL)); - } - break; - case 23: - 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, 20UL)); - } - break; - case 24: - 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, 21UL)); - } - break; - case 25: - 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, 22UL)); - } - break; - case 26: - 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, 23UL)); - } - break; - case 27: - 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, 33UL)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 29: - 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 30: - 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)); - } - break; - case 31: - 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)); - } - break; - case 32: - 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, 2UL)); - } - break; - case 33: - 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, 3UL)); - } - break; - case 34: - 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, 4UL)); - } - break; - case 35: - 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, 5UL)); - } - break; - case 36: - 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, 6UL)); - } - break; - case 37: - 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)); - } - break; - case 38: - 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, 8UL)); - } - break; - case 39: - 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)); - } - break; - case 40: - 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, 10UL)); - } - break; - case 41: - 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 42: - 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, 12UL)); - } - break; - case 43: - 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, 13UL)); - } - break; - case 44: - 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, 14UL)); - } - break; - case 45: - 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, 15UL)); - } - break; - case 46: - 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, 16UL)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads the FeatureMap attribute from the DUT"); - VerifyOrDo( - !ShouldSkip(" !PCC.S.F00 && !PCC.S.F01 && !PCC.S.F02 && !PCC.S.F03 && !PCC.S.F04 && !PCC.S.F05 && !PCC.S.F06 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given PCC.S.F00(PRSCONST) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PCC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given PCC.S.F01(PRSCOMP) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PCC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given PCC.S.F02(FLW) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PCC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given PCC.S.F03(SPD) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PCC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given PCC.S.F04(TEMP) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PCC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given PCC.S.F05(AUTO) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PCC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given PCC.S.F06(LOCAL) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("PCC.S.F06"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4a: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4a: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4b: TH reads optional attribute(MinConstPressure) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 4c TH reads optional attribute(MaxConstPressure) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 4d: TH reads optional attribute(MinCompPressure) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4e: TH reads optional attribute(MaxCompPressure) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4f: TH reads optional attribute(MinConstSpeed) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4g: TH reads optional attribute(MaxConstSpeed) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4h: TH reads optional attribute(MinConstFlow) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 4i: TH reads optional attribute(MaxConstFlow) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 4j: TH reads optional attribute(MinConstTemp) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 4k: TH reads optional attribute(MaxConstTemp) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 4l: TH reads optional attribute(PumpStatus) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 4m: TH reads optional attribute(Speed) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 4n: TH reads optional attribute(LifetimeRunningHours) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4o: TH reads optional attribute(Power) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0016"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4p: TH reads optional attribute(LifetimeEnergyConsumed) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 4q: TH reads optional attribute(ControlMode) attribute in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 28: { - LogStep(28, - "Step 4r: TH reads AttributeList attribute from DUT. 1.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. 2.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)"); - 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 29: { - LogStep(29, "Step 5a: TH reads EventList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && !PCC.S.E00 && !PCC.S.E01 && !PCC.S.E02 && !PCC.S.E03 && !PCC.S.E04 " - "&& !PCC.S.E05 && !PCC.S.E06 && !PCC.S.E07 && !PCC.S.E08 && !PCC.S.E09 && !PCC.S.E0a && " - "!PCC.S.E0b && !PCC.S.E0c && !PCC.S.E0d && !PCC.S.E0e && !PCC.S.E0f && !PCC.S.E10 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 30: { - LogStep(30, "Step 5b: TH reads from the DUT the EventList optional (SupplyVoltageLow)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, "Step 5c: TH reads from the DUT the EventList optional (SupplyVoltageHigh)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, "Step 5d: TH reads from the DUT the EventList optional (PowerMissingPhase)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 33: { - LogStep(33, "Step 5e: TH reads from the DUT the EventList optional (SystemPressureLow)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 34: { - LogStep(34, "Step 5f: TH reads from the DUT the EventList optional (SystemPressureHigh)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 35: { - LogStep(35, "Step 5g: TH reads from the DUT the EventList optional (DryRunning)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 36: { - LogStep(36, "Step 5h: TH reads from the DUT the EventList optional (MotorTemperatureHigh)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E06"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 37: { - LogStep(37, "Step 5i: TH reads from the DUT the EventList optional (PumpMotorFatalFailure)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E07"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 38: { - LogStep(38, "Step 5j: TH reads from the DUT the EventList optional (ElectronicTemperatureHigh)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E08"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 39: { - LogStep(39, "Step 5k: TH reads from the DUT the EventList optional (PumpBlocked)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E09"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 40: { - LogStep(40, "Step 5l: TH reads from the DUT the EventList optional (SensorFailure)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 41: { - LogStep(41, "Step 5m: TH reads from the DUT the EventList optional (ElectronicNonFatalFailure)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E0b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 42: { - LogStep(42, "Step 5n: TH reads from the DUT the EventList optional (ElectronicFatalFailure)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E0c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 43: { - LogStep(43, "Step 5o: TH reads from the DUT the EventList optional (GeneralFault)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E0d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 44: { - LogStep(44, "Step 5p: TH reads from the DUT the EventList optional (Leakage)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E0e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 45: { - LogStep(45, "Step 5q: TH reads from the DUT the EventList optional (AirDetection)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E0f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 46: { - LogStep(46, "Step 5r: TH reads from the DUT the EventList optional (TurbineOperation)attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && PCC.S.E10"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 47: { - LogStep(47, - "Step 5s: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 48: { - LogStep(48, - "Step 6: TH reads AcceptedCommandList 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)"); - 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 49: { - LogStep(49, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PCC_2_1Suite : public TestCommand -{ -public: - Test_TC_PCC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PCC_2_1", 24, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PCC_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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 4: - 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - 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(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - 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(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 7: - 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 9: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 12: - 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 13: - 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap16", "bitmap16")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 8U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 17: - 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -32768)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 18: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 19: - 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", "int24u", "int24u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 16777215UL)); - } - break; - case 20: - 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", "int24u", "int24u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 16777215UL)); - } - break; - case 21: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - 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: Read the mandatory attribute: MaxPressure"); - VerifyOrDo(!ShouldSkip("PCC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MaxPressure::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the mandatory attribute: MaxSpeed"); - VerifyOrDo(!ShouldSkip("PCC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MaxSpeed::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Read the mandatory attribute: MaxFlow"); - VerifyOrDo(!ShouldSkip("PCC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MaxFlow::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: Read the optional attribute: MinConstPressure"); - VerifyOrDo(!ShouldSkip("PCC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MinConstPressure::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: Read the optional attribute: MaxConstPressure"); - VerifyOrDo(!ShouldSkip("PCC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MaxConstPressure::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: Read the optional attribute: MinCompPressure"); - VerifyOrDo(!ShouldSkip("PCC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MinCompPressure::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: Read the optional attribute: MaxCompPressure"); - VerifyOrDo(!ShouldSkip("PCC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MaxCompPressure::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: Read the optional attribute: MinConstSpeed"); - VerifyOrDo(!ShouldSkip("PCC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MinConstSpeed::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: Read the optional attribute: MaxConstSpeed"); - VerifyOrDo(!ShouldSkip("PCC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MaxConstSpeed::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: Read the optional attribute: MinConstFlow"); - VerifyOrDo(!ShouldSkip("PCC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MinConstFlow::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 12: Read the optional attribute: MaxConstFlow"); - VerifyOrDo(!ShouldSkip("PCC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MaxConstFlow::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 13: Read the optional attribute: MinConstTemp"); - VerifyOrDo(!ShouldSkip("PCC.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MinConstTemp::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 14: Read the optional attribute: MaxConstTemp"); - VerifyOrDo(!ShouldSkip("PCC.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::MaxConstTemp::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 15: Read the optional attribute: PumpStatus"); - VerifyOrDo(!ShouldSkip("PCC.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::PumpStatus::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 16: Read attribute: EffectiveOperationMode"); - VerifyOrDo(!ShouldSkip("PCC.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 17: Read attribute: EffectiveControlMode"); - VerifyOrDo(!ShouldSkip("PCC.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 18: Read attribute: Capacity"); - VerifyOrDo(!ShouldSkip("PCC.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::Capacity::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 19: Read the optional attribute: Speed"); - VerifyOrDo(!ShouldSkip("PCC.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::Speed::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 20: Read the optional attribute: LifetimeRunningHours"); - VerifyOrDo(!ShouldSkip("PCC.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 21: Read the optional attribute: Power"); - VerifyOrDo(!ShouldSkip("PCC.S.A0016"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::Power::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 22: Read the optional attribute: LifetimeEnergyConsumed"); - VerifyOrDo(!ShouldSkip("PCC.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 23: Read optional attribute: OperationMode"); - VerifyOrDo(!ShouldSkip("PCC.S.A0020"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::OperationMode::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 24: Read optional attribute: ControlMode"); - VerifyOrDo(!ShouldSkip("PCC.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::ControlMode::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PCC_2_2Suite : public TestCommand -{ -public: - Test_TC_PCC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PCC_2_2", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PCC_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; - - 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::PumpConfigurationAndControl::OperationModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveOperationMode", value, 0U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveOperationMode", value, 1U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveOperationMode", value, 2U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveOperationMode", value, 3U)); - } - 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 write 0 (Normal) to the OperationMode attribute to DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0020"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - value = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::OperationMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2b: TH reads from the DUT the EffectiveOperationMode attribute"); - VerifyOrDo(!ShouldSkip("PCC.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3a: TH write 1 (Minimum) to the OperationMode attribute to DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.F03 && PCC.S.A0020"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - value = static_cast(1); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::OperationMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3b: TH reads from the DUT the EffectiveOperationMode attribute"); - VerifyOrDo(!ShouldSkip("PCC.S.F03 && PCC.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH write 2 (Maximum) to the OperationMode attribute to DUT one at a time."); - VerifyOrDo(!ShouldSkip("PCC.S.F03 && PCC.S.A0020"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - value = static_cast(2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::OperationMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4b: TH reads from the DUT the EffectiveOperationMode attribute"); - VerifyOrDo(!ShouldSkip("PCC.S.F03 && PCC.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5a: TH write 3 (Local) to the OperationMode attribute to DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.F06 && PCC.S.A0020"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - value = static_cast(3); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::OperationMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 5b: TH reads from the DUT the EffectiveOperationMode attribute"); - VerifyOrDo(!ShouldSkip("PCC.S.F06 && PCC.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PCC_2_3Suite : public TestCommand -{ -public: - Test_TC_PCC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PCC_2_3", 15, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PCC_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)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveOperationMode", value, 0U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveControlMode", value, 0U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveControlMode", value, 1U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveControlMode", value, 2U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveControlMode", value, 3U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveControlMode", value, 5U)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("effectiveControlMode", value, 7U)); - } - 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 write 0 (Normal) to the OperationMode attribute to DUT."); - VerifyOrDo(!ShouldSkip("PCC.S.A0020"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::OperationModeEnum value; - value = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::OperationMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2b: TH reads from the DUT the EffectiveOperationMode attribute"); - VerifyOrDo(!ShouldSkip("PCC.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3a: TH write 0 (ConstantSpeed) to the ControlMode attribute to DUT one at a time."); - VerifyOrDo(!ShouldSkip("PCC.S.F03 && PCC.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - value = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::ControlMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3b: TH reads from the DUT the EffectiveControlMode attribute."); - VerifyOrDo(!ShouldSkip("PCC.S.F03 && PCC.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH write 1 (ConstantPressure) to the ControlMode attribute to DUT one at a time."); - VerifyOrDo(!ShouldSkip("PCC.S.F00 && PCC.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - value = static_cast(1); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::ControlMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4b: TH reads from the DUT the EffectiveControlMode attribute."); - VerifyOrDo(!ShouldSkip("PCC.S.F00 && PCC.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5a: TH write 2 (ProportionalPressure) to the ControlMode attribute to DUT one at a time."); - VerifyOrDo(!ShouldSkip("PCC.S.F01 && PCC.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - value = static_cast(2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::ControlMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 5b: TH reads from the DUT the EffectiveControlMode attribute."); - VerifyOrDo(!ShouldSkip("PCC.S.F01 && PCC.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 6a: TH write 3 (ConstantFlow) to the ControlMode attribute to DUT one at a time."); - VerifyOrDo(!ShouldSkip("PCC.S.F02 && PCC.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - value = static_cast(3); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::ControlMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 6b: TH reads from the DUT the _EffectiveControlMode attribute."); - VerifyOrDo(!ShouldSkip("PCC.S.F02 && PCC.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 7a: TH write 5 (ConstantTemperature) to the ControlMode attribute to DUT one at a time."); - VerifyOrDo(!ShouldSkip("PCC.S.F04 && PCC.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - value = static_cast(5); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::ControlMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 7b: TH reads from the DUT the EffectiveControlMode attribute."); - VerifyOrDo(!ShouldSkip("PCC.S.F04 && PCC.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 8a: TH write 7 (Automatic) to the ControlMode attribute to DUT one at a time."); - VerifyOrDo(!ShouldSkip("PCC.S.F05 && PCC.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::PumpConfigurationAndControl::ControlModeEnum value; - value = static_cast(7); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::ControlMode::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 14: { - LogStep(14, "Step 8b: TH reads from the DUT the EffectiveControlMode attribute."); - VerifyOrDo(!ShouldSkip("PCC.S.F05 && PCC.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PCC_2_4Suite : public TestCommand -{ -public: - Test_TC_PCC_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PCC_2_4", 13, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PCC_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)); - 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(CheckValueNonNull("lifetimeRunningHours", value)); - VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", value.Value(), 1UL)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("lifetimeRunningHours", value)); - VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", value.Value(), 2UL)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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("lifetimeRunningHours", value)); - VerifyOrReturn(CheckValue("lifetimeRunningHours.Value()", value.Value(), 3UL)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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("lifetimeEnergyConsumed", value)); - VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", value.Value(), 1UL)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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(CheckValueNonNull("lifetimeEnergyConsumed", value)); - VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", value.Value(), 2UL)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("lifetimeEnergyConsumed", value)); - VerifyOrReturn(CheckValue("lifetimeEnergyConsumed.Value()", value.Value(), 3UL)); - } - 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: Write 1 to the LifetimeRunningHours attribute to DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 1UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2b: Reads the attribute: LifetimeRunningHours"); - VerifyOrDo(!ShouldSkip("PCC.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3a: Write 2 to the LifetimeRunningHours attribute to DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 2UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3b: Reads the attribute: LifetimeRunningHours"); - VerifyOrDo(!ShouldSkip("PCC.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: Write 3 to the LifetimeRunningHours attribute to DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 3UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4b: Reads the attribute: LifetimeRunningHours"); - VerifyOrDo(!ShouldSkip("PCC.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5a: Write 1 to the LifetimeEnergyConsumed attribute to DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 1UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 5b: Reads the attribute: LifetimeEnergyConsumed"); - VerifyOrDo(!ShouldSkip("PCC.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 6a: Write 2 to the LifetimeEnergyConsumed attribute to DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 2UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 6b: Reads the attribute: LifetimeEnergyConsumed"); - VerifyOrDo(!ShouldSkip("PCC.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 7a: Write 3 to the LifetimeEnergyConsumed attribute to DUT"); - VerifyOrDo(!ShouldSkip("PCC.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 3UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 7b: Reads the attribute: LifetimeEnergyConsumed"); - VerifyOrDo(!ShouldSkip("PCC.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), PumpConfigurationAndControl::Id, - PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PSCFG_1_1Suite : public TestCommand -{ -public: - Test_TC_PSCFG_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PSCFG_1_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_PSCFG_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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Commission DUT to TH"); - 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 reads the ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, - PowerSourceConfiguration::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, - PowerSourceConfiguration::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, - PowerSourceConfiguration::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, - PowerSourceConfiguration::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 5: TH reads the AcceptedCommandList attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, - PowerSourceConfiguration::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: TH reads the GeneratedCommandList attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, - PowerSourceConfiguration::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, - "Step 7: Read EventList attribute from the DUT.For this cluster the list is usually empty but it can contain " - "manufacturer specific event IDs."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PSCFG_2_1Suite : public TestCommand -{ -public: - Test_TC_PSCFG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PSCFG_2_1", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_PSCFG_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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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: Commission DUT to TH"); - 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 reads the Sources attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PSCFG.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), PowerSourceConfiguration::Id, - PowerSourceConfiguration::Attributes::Sources::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_REFALM_1_1Suite : public TestCommand -{ -public: - Test_TC_REFALM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_REFALM_1_1", 12, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_REFALM_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, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - 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)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - } - 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::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 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 8: - 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")); - } - 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::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads from the DUT the ClusterRevision attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAlarm::Id, - RefrigeratorAlarm::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the FeatureMap attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAlarm::Id, - RefrigeratorAlarm::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TH reads from the DUT the AttributeList attribute"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAlarm::Id, - RefrigeratorAlarm::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads from the DUT the AttributeList attribute"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAlarm::Id, - RefrigeratorAlarm::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 4b: 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)"); - 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 6: { - LogStep(6, "Step 5a: TH reads from the DUT the EventList attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAlarm::Id, - RefrigeratorAlarm::Attributes::EventList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, - "Step 5b: TH reads EventList 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 8: { - LogStep(8, "Step 6a: TH reads from the DUT the AcceptedCommandList attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAlarm::Id, - RefrigeratorAlarm::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, - "Step 6: TH reads AcceptedCommandList 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)"); - 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 10: { - LogStep(10, "Step 7a: TH reads from the DUT the AcceptedCommandList attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAlarm::Id, - RefrigeratorAlarm::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_RH_1_1Suite : public TestCommand -{ -public: - Test_TC_RH_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_RH_1_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RH_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, 3U)); - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 3UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 7: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read FeatureMap attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: Read the optional attribute(Tolerance) in AttributeList"); - VerifyOrDo(!ShouldSkip("RH.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 6: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 7: Read EventList attribute from the DUT.For this cluster the list is usually empty but it can contain " - "manufacturer specific event IDs."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_RH_2_1Suite : public TestCommand -{ -public: - Test_TC_RH_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_RH_2_1", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RH_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::app::DataModel::Nullable CurrentMinMeasured; - chip::app::DataModel::Nullable CurrentMaxMeasured; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); - CurrentMinMeasured = 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, CurrentMinMeasured)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - CurrentMaxMeasured = value; - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, CurrentMinMeasured)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, CurrentMaxMeasured)); - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2048U)); - } - 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 reads the MinMeasuredValue attribute from the DUT"); - VerifyOrDo(!ShouldSkip("RH.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the MaxMeasuredValue attribute from the DUT"); - VerifyOrDo(!ShouldSkip("RH.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads the MeasuredValue attribute from the DUT"); - VerifyOrDo(!ShouldSkip("RH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads the Tolerance attribute from the DUT"); - VerifyOrDo(!ShouldSkip("RH.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::Tolerance::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SMOKECO_1_1Suite : public TestCommand -{ -public: - Test_TC_SMOKECO_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SMOKECO_1_1", 25, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SMOKECO_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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("featureMap", value, 1UL)); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("featureMap", value, 2UL)); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("featureMap", value, 3UL)); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - } - 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - } - break; - case 7: - 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)); - } - break; - case 8: - 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, 2UL)); - } - break; - case 9: - 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, 4UL)); - } - break; - case 10: - 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, 8UL)); - } - break; - 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, 9UL)); - } - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 12UL)); - } - break; - 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, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - } - break; - case 16: - 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)); - } - break; - case 17: - 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)); - } - break; - case 18: - 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, 6UL)); - } - break; - case 19: - 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)); - } - break; - case 20: - 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, 8UL)); - } - break; - case 21: - 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)); - } - break; - case 22: - 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")); - } - break; - case 23: - 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)); - } - break; - case 24: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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, "Commission DUT to TH"); - 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 the ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ClusterRevision::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "TH reads from the DUT the FeatureMap attribute"); - VerifyOrDo(!ShouldSkip("!SMOKECO.S.F00 && !SMOKECO.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "TH reads from the DUT the FeatureMap attribute(Smoke Alarm)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.F00 && !SMOKECO.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "TH reads from the DUT the FeatureMap attribute(CO Alarm)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.F01 && !SMOKECO.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "TH reads from the DUT the FeatureMap attribute(Smoke Alarm & CO Alarm)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.F00 && SMOKECO.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "TH reads from the DUT the AttributeList attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "TH reads from the DUT the AttributeList attribute(SmokeState)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "TH reads from the DUT the AttributeList attribute(COState)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "TH reads from the DUT the AttributeList attribute(DeviceMuted)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "TH reads from the DUT the AttributeList attribute(InterconnectSmokeAlarm)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "TH reads from the DUT the AttributeList attribute(InterconnectCOAlarm)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "TH reads from the DUT the AttributeList attribute(ContaminationState)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "TH reads from the DUT the AttributeList attribute(SmokeSensitivityLevel)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "TH reads from the DUT the AttributeList attribute(ExpiryDate)"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "TH reads from the DUT the EventList attribute"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "TH reads from the DUT the EventList attribute(SmokeAlarm)"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && SMOKECO.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "TH reads from the DUT the EventList attribute(COAlarm)"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && SMOKECO.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "TH reads from the DUT the EventList attribute(AlarmMuted)"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && SMOKECO.S.E06"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "TH reads from the DUT the EventList attribute(MuteEnded)"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && SMOKECO.S.E07"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "TH reads from the DUT the EventList attribute(InterconnectSmokeAlarm)"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && SMOKECO.S.E08"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "TH reads from the DUT the EventList attribute(InterconnectCOAlarm)"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && SMOKECO.S.E09"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "TH reads from the DUT the AcceptedCommandList attribute"); - VerifyOrDo(!ShouldSkip("!SMOKECO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "TH reads from the DUT the AcceptedCommandList attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "TH reads from the DUT the GeneratedCommandList attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SMOKECO_2_1Suite : public TestCommand -{ -public: - Test_TC_SMOKECO_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SMOKECO_2_1", 14, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SMOKECO_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)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 8U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - 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::SmokeCoAlarm::MuteStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); - } - break; - case 6: - 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; - 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; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::EndOfServiceEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::SensitivityEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "epoch_s", "epoch_s")); - } - 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, "Commission DUT to TH"); - 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 ExpressedState attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "TH reads from the DUT the SmokeState attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::SmokeState::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "TH reads from the DUT the COState attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::COState::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "TH reads from the DUT the BatteryAlert attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::BatteryAlert::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "TH reads from the DUT the DeviceMuted attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::DeviceMuted::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "TH reads from the DUT the TestInProgress attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::TestInProgress::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "TH reads from the DUT the HardwareFaultAlert attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::HardwareFaultAlert::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "TH reads from the DUT the EndOfServiceAlert attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::EndOfServiceAlert::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "TH reads from the DUT the InterconnectSmokeAlarm attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::InterconnectSmokeAlarm::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "TH reads from the DUT the InterconnectCOAlarm attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::InterconnectCOAlarm::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "TH reads from the DUT the ContaminationState attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ContaminationState::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "TH reads from the DUT the SmokeSensitivityLevel attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::SmokeSensitivityLevel::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "TH reads from the DUT the ExpiryDate attribute"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpiryDate::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SMOKECO_2_2Suite : public TestCommand -{ -public: - Test_TC_SMOKECO_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SMOKECO_2_2", 20, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("TEST_EVENT_TRIGGER_KEY", &mTestEventTriggerKey); - AddArgument("TEST_EVENT_TRIGGER_WARNING_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerWarningSmokeAlarm); - AddArgument("TEST_EVENT_TRIGGER_CRITICAL_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerCriticalSmokeAlarm); - AddArgument("TEST_EVENT_TRIGGER_SMOKE_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerSmokeAlarmClear); - AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); - } - - ~Test_TC_SMOKECO_2_2Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(990)); } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - chip::Optional mTestEventTriggerKey; - chip::Optional mTestEventTriggerWarningSmokeAlarm; - chip::Optional mTestEventTriggerCriticalSmokeAlarm; - chip::Optional mTestEventTriggerSmokeAlarmClear; - chip::Optional mEventNumber; - - 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)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEventTriggersEnabled", value, 1)); - } - 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::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 7: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::SmokeAlarm::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeAlarm.alarmSeverityLevel", value.alarmSeverityLevel, 1U)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testInProgress", value, 0)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_BUSY)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testInProgress", value, 0)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 2U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 15: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::SmokeAlarm::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeAlarm.alarmSeverityLevel", value.alarmSeverityLevel, 2U)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 19: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AllClear::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - 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, "Commission DUT to TH"); - 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 subscribes to SmokeState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::SmokeState::Id, 3, - 30, true, chip::NullOptional, chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 2: { - LogStep(2, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster"); - VerifyOrDo(!ShouldSkip("DGGEN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::TestEventTriggersEnabled::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Warning Smoke Alarm Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerWarningSmokeAlarm.HasValue() ? mTestEventTriggerWarningSmokeAlarm.Value() : 0xffffffff00000090ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 6: { - LogStep(6, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "TH reads SmokeAlarm event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::SmokeAlarm::Id, false, - chip::NullOptional); - } - case 8: { - LogStep(8, "Start manually DUT self-test"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && SMOKECO.M.ManuallyControlledTest"), - 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 9: { - LogStep(9, "TH reads TestInProgress attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::TestInProgress::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "TH sends SelfTestRequest command to DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SmokeCoAlarm::Commands::SelfTestRequest::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Commands::SelfTestRequest::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "TH reads TestInProgress attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::TestInProgress::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Critical Smoke Alarm Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerCriticalSmokeAlarm.HasValue() ? mTestEventTriggerCriticalSmokeAlarm.Value() - : 0xffffffff0000009cULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 13: { - LogStep(13, "TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 14: { - LogStep(14, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "TH reads SmokeAlarm event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::SmokeAlarm::Id, false, - chip::NullOptional); - } - case 16: { - LogStep(16, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke " - "Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerSmokeAlarmClear.HasValue() ? mTestEventTriggerSmokeAlarmClear.Value() : 0xffffffff000000a0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 17: { - LogStep(17, "TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 18: { - LogStep(18, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "TH reads AllClear event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AllClear::Id, false, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SMOKECO_2_3Suite : public TestCommand -{ -public: - Test_TC_SMOKECO_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SMOKECO_2_3", 20, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("TEST_EVENT_TRIGGER_KEY", &mTestEventTriggerKey); - AddArgument("TEST_EVENT_TRIGGER_WARNING_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerWarningCoAlarm); - AddArgument("TEST_EVENT_TRIGGER_CRITICAL_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerCriticalCoAlarm); - AddArgument("TEST_EVENT_TRIGGER_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerCoAlarmClear); - AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); - } - - ~Test_TC_SMOKECO_2_3Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(990)); } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - chip::Optional mTestEventTriggerKey; - chip::Optional mTestEventTriggerWarningCoAlarm; - chip::Optional mTestEventTriggerCriticalCoAlarm; - chip::Optional mTestEventTriggerCoAlarmClear; - chip::Optional mEventNumber; - - 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)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEventTriggersEnabled", value, 1)); - } - 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::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 2U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 7: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::COAlarm::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COAlarm.alarmSeverityLevel", value.alarmSeverityLevel, 1U)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testInProgress", value, 0)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_BUSY)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testInProgress", value, 0)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 2U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 2U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 15: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::COAlarm::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COAlarm.alarmSeverityLevel", value.alarmSeverityLevel, 2U)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 19: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AllClear::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - 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, "Commission DUT to TH"); - 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 subscribes to COState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::COState::Id, 3, - 30, true, chip::NullOptional, chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 2: { - LogStep(2, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster"); - VerifyOrDo(!ShouldSkip("DGGEN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::TestEventTriggersEnabled::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Warning CO Alarm Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerWarningCoAlarm.HasValue() ? mTestEventTriggerWarningCoAlarm.Value() : 0xffffffff00000091ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "TH waits for a report of COState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 6: { - LogStep(6, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "TH reads COAlarm event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::COAlarm::Id, false, - chip::NullOptional); - } - case 8: { - LogStep(8, "Start manually DUT self-test"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && SMOKECO.M.ManuallyControlledTest"), - 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 9: { - LogStep(9, "TH reads TestInProgress attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::TestInProgress::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "TH sends SelfTestRequest command to DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SmokeCoAlarm::Commands::SelfTestRequest::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Commands::SelfTestRequest::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "TH reads TestInProgress attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::TestInProgress::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Critical CO Alarm Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerCriticalCoAlarm.HasValue() ? mTestEventTriggerCriticalCoAlarm.Value() : 0xffffffff0000009dULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 13: { - LogStep(13, "TH waits for a report of COState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 14: { - LogStep(14, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "TH reads COAlarm event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::COAlarm::Id, false, - chip::NullOptional); - } - case 16: { - LogStep(16, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for CO " - "Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerCoAlarmClear.HasValue() ? mTestEventTriggerCoAlarmClear.Value() : 0xffffffff000000a1ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 17: { - LogStep(17, "TH waits for a report of COState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 18: { - LogStep(18, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "TH reads AllClear event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AllClear::Id, false, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SMOKECO_2_4Suite : public TestCommand -{ -public: - Test_TC_SMOKECO_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SMOKECO_2_4", 50, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("TEST_EVENT_TRIGGER_KEY", &mTestEventTriggerKey); - AddArgument("TEST_EVENT_TRIGGER_WARNING_BATTERY_ALERT", 0, UINT64_MAX, &mTestEventTriggerWarningBatteryAlert); - AddArgument("TEST_EVENT_TRIGGER_CRITICAL_BATTERY_ALERT", 0, UINT64_MAX, &mTestEventTriggerCriticalBatteryAlert); - AddArgument("TEST_EVENT_TRIGGER_BATTERY_ALERT_CLEAR", 0, UINT64_MAX, &mTestEventTriggerBatteryAlertClear); - AddArgument("TEST_EVENT_TRIGGER_HARDWARE_FAULT_ALERT", 0, UINT64_MAX, &mTestEventTriggerHardwareFaultAlert); - AddArgument("TEST_EVENT_TRIGGER_HARDWARE_FAULT_ALERT_CLEAR", 0, UINT64_MAX, &mTestEventTriggerHardwareFaultAlertClear); - AddArgument("TEST_EVENT_TRIGGER_END_OF_SERVICE_ALERT", 0, UINT64_MAX, &mTestEventTriggerEndOfServiceAlert); - AddArgument("TEST_EVENT_TRIGGER_END_OF_SERVICE_ALERT_CLEAR", 0, UINT64_MAX, &mTestEventTriggerEndOfServiceAlertClear); - AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); - } - - ~Test_TC_SMOKECO_2_4Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(2910)); } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - chip::Optional mTestEventTriggerKey; - chip::Optional mTestEventTriggerWarningBatteryAlert; - chip::Optional mTestEventTriggerCriticalBatteryAlert; - chip::Optional mTestEventTriggerBatteryAlertClear; - chip::Optional mTestEventTriggerHardwareFaultAlert; - chip::Optional mTestEventTriggerHardwareFaultAlertClear; - chip::Optional mTestEventTriggerEndOfServiceAlert; - chip::Optional mTestEventTriggerEndOfServiceAlertClear; - chip::Optional mEventNumber; - - 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)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("batteryAlert", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEventTriggersEnabled", value, 1)); - } - 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::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("batteryAlert", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 3U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 7: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::LowBattery::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lowBattery.alarmSeverityLevel", value.alarmSeverityLevel, 1U)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("batteryAlert", value, 2U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 3U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 11: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::LowBattery::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lowBattery.alarmSeverityLevel", value.alarmSeverityLevel, 2U)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("batteryAlert", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 15: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AllClear::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("hardwareFaultAlert", value, 0)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("hardwareFaultAlert", value, 1)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - shouldContinue = true; - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 5U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 20: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::HardwareFault::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("hardwareFaultAlert", value, 0)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 24: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AllClear::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::EndOfServiceEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("endOfServiceAlert", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::EndOfServiceEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("endOfServiceAlert", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 6U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 29: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::EndOfService::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::EndOfServiceEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("endOfServiceAlert", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 33: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AllClear::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testInProgress", value, 0)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testInProgress", value, 1)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - shouldContinue = true; - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 4U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testInProgress", value, 0)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - shouldContinue = true; - break; - case 40: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::SelfTestComplete::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 42: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AllClear::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testInProgress", value, 1)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - shouldContinue = true; - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 4U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testInProgress", value, 0)); - VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); - } - shouldContinue = true; - break; - case 47: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::SelfTestComplete::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 49: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AllClear::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - 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, "Commission DUT to TH"); - 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 subscribes to BatteryAlert attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::BatteryAlert::Id, - 3, 30, true, chip::NullOptional, chip::NullOptional, - /* autoResubscribe = */ chip::NullOptional); - } - case 2: { - LogStep(2, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster"); - VerifyOrDo(!ShouldSkip("DGGEN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::TestEventTriggersEnabled::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Warning Battery Alert Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerWarningBatteryAlert.HasValue() ? mTestEventTriggerWarningBatteryAlert.Value() - : 0xffffffff00000095ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 6: { - LogStep(6, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "TH reads LowBattery event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::LowBattery::Id, false, - chip::NullOptional); - } - case 8: { - LogStep(8, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Critical Battery Alert Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerCriticalBatteryAlert.HasValue() ? mTestEventTriggerCriticalBatteryAlert.Value() - : 0xffffffff0000009eULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 9: { - LogStep(9, "TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 10: { - LogStep(10, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "TH reads LowBattery event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::LowBattery::Id, false, - chip::NullOptional); - } - case 12: { - LogStep(12, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Battery Alert Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerBatteryAlertClear.HasValue() ? mTestEventTriggerBatteryAlertClear.Value() : 0xffffffff000000a5ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 13: { - LogStep(13, "TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 14: { - LogStep(14, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "TH reads AllClear event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AllClear::Id, false, - chip::NullOptional); - } - case 16: { - LogStep(16, "TH subscribes to HardwareFaultAlert attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::HardwareFaultAlert::Id, 3, 30, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 17: { - LogStep(17, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Hardware Fault Alert Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerHardwareFaultAlert.HasValue() ? mTestEventTriggerHardwareFaultAlert.Value() - : 0xffffffff00000093ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 18: { - LogStep(18, "TH waits for a report of HardwareFaultAlert attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 19: { - LogStep(19, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "TH reads HardwareFault event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::HardwareFault::Id, false, - chip::NullOptional); - } - case 21: { - LogStep(21, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Hardware Fault Alert Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerHardwareFaultAlertClear.HasValue() - ? mTestEventTriggerHardwareFaultAlertClear.Value() - : 0xffffffff000000a3ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 22: { - LogStep(22, "TH waits for a report of HardwareFaultAlert attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 23: { - LogStep(23, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 24: { - LogStep(24, "TH reads AllClear event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AllClear::Id, false, - chip::NullOptional); - } - case 25: { - LogStep(25, "TH subscribes to EndOfServiceAlert attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::EndOfServiceAlert::Id, 3, 30, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 26: { - LogStep(26, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for End " - "of Service Alert Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerEndOfServiceAlert.HasValue() ? mTestEventTriggerEndOfServiceAlert.Value() : 0xffffffff0000009aULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 27: { - LogStep(27, "TH waits for a report of EndOfServiceAlert attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 28: { - LogStep(28, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 29: { - LogStep(29, "TH reads EndOfService event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::EndOfService::Id, false, - chip::NullOptional); - } - case 30: { - LogStep(30, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for End " - "of Service Alert Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerEndOfServiceAlertClear.HasValue() - ? mTestEventTriggerEndOfServiceAlertClear.Value() - : 0xffffffff000000aaULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 31: { - LogStep(31, "TH waits for a report of EndOfServiceAlert attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 32: { - LogStep(32, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 33: { - LogStep(33, "TH reads AllClear event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AllClear::Id, false, - chip::NullOptional); - } - case 34: { - LogStep(34, "TH subscribes to TestInProgress attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::TestInProgress::Id, 3, 30, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 35: { - LogStep(35, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 36: { - LogStep(36, "Start manually DUT self-test"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && SMOKECO.M.ManuallyControlledTest"), - 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 37: { - LogStep(37, "TH waits for a report of TestInProgress attribute from DUT with a timeout of 180 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 38: { - LogStep(38, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 39: { - LogStep(39, "TH waits for a report of TestInProgress attribute from DUT with a timeout of 180 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 40: { - LogStep(40, "TH reads SelfTestComplete event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::SelfTestComplete::Id, false, - chip::NullOptional); - } - case 41: { - LogStep(41, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 42: { - LogStep(42, "TH reads AllClear event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AllClear::Id, false, - chip::NullOptional); - } - case 43: { - LogStep(43, "TH sends SelfTestRequest command to DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SmokeCoAlarm::Commands::SelfTestRequest::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Commands::SelfTestRequest::Id, value, - chip::NullOptional - - ); - } - case 44: { - LogStep(44, "TH waits for a report of TestInProgress attribute from DUT with a timeout of 180 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 45: { - LogStep(45, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 46: { - LogStep(46, "TH waits for a report of TestInProgress attribute from DUT with a timeout of 180 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 47: { - LogStep(47, "TH reads SelfTestComplete event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::SelfTestComplete::Id, false, - chip::NullOptional); - } - case 48: { - LogStep(48, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 49: { - LogStep(49, "TH reads AllClear event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AllClear::Id, false, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SMOKECO_2_5Suite : public TestCommand -{ -public: - Test_TC_SMOKECO_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SMOKECO_2_5", 75, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("TEST_EVENT_TRIGGER_KEY", &mTestEventTriggerKey); - AddArgument("TEST_EVENT_TRIGGER_WARNING_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerWarningSmokeAlarm); - AddArgument("TEST_EVENT_TRIGGER_CRITICAL_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerCriticalSmokeAlarm); - AddArgument("TEST_EVENT_TRIGGER_SMOKE_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerSmokeAlarmClear); - AddArgument("TEST_EVENT_TRIGGER_WARNING_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerWarningCoAlarm); - AddArgument("TEST_EVENT_TRIGGER_CRITICAL_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerCriticalCoAlarm); - AddArgument("TEST_EVENT_TRIGGER_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerCoAlarmClear); - AddArgument("TEST_EVENT_TRIGGER_DEVICE_MUTED", 0, UINT64_MAX, &mTestEventTriggerDeviceMuted); - AddArgument("TEST_EVENT_TRIGGER_DEVICE_MUTED_CLEAR", 0, UINT64_MAX, &mTestEventTriggerDeviceMutedClear); - AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerInterconnectSmokeAlarm); - AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_SMOKE_ALARM_CLEAR", 0, UINT64_MAX, - &mTestEventTriggerInterconnectSmokeAlarmClear); - AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarm); - AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarmClear); - AddArgument("TEST_EVENT_TRIGGER_CONTAMINATION_STATE_HIGH", 0, UINT64_MAX, &mTestEventTriggerContaminationStateHigh); - AddArgument("TEST_EVENT_TRIGGER_CONTAMINATION_STATE_LOW", 0, UINT64_MAX, &mTestEventTriggerContaminationStateLow); - AddArgument("TTEST_EVENT_TRIGGER_CONTAMINATION_STATE_CLEAR", 0, UINT64_MAX, &mTtestEventTriggerContaminationStateClear); - AddArgument("TEST_EVENT_TRIGGER_SENSITIVITY_LEVEL_HIGH", 0, UINT64_MAX, &mTestEventTriggerSensitivityLevelHigh); - AddArgument("TEST_EVENT_TRIGGER_SENSITIVITY_LEVEL_LOW", 0, UINT64_MAX, &mTestEventTriggerSensitivityLevelLow); - AddArgument("TTEST_EVENT_TRIGGER_SENSITIVITY_LEVEL_CLEAR", 0, UINT64_MAX, &mTtestEventTriggerSensitivityLevelClear); - AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); - } - - ~Test_TC_SMOKECO_2_5Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(6090)); } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - chip::Optional mTestEventTriggerKey; - chip::Optional mTestEventTriggerWarningSmokeAlarm; - chip::Optional mTestEventTriggerCriticalSmokeAlarm; - chip::Optional mTestEventTriggerSmokeAlarmClear; - chip::Optional mTestEventTriggerWarningCoAlarm; - chip::Optional mTestEventTriggerCriticalCoAlarm; - chip::Optional mTestEventTriggerCoAlarmClear; - chip::Optional mTestEventTriggerDeviceMuted; - chip::Optional mTestEventTriggerDeviceMutedClear; - chip::Optional mTestEventTriggerInterconnectSmokeAlarm; - chip::Optional mTestEventTriggerInterconnectSmokeAlarmClear; - chip::Optional mTestEventTriggerInterconnectCoAlarm; - chip::Optional mTestEventTriggerInterconnectCoAlarmClear; - chip::Optional mTestEventTriggerContaminationStateHigh; - chip::Optional mTestEventTriggerContaminationStateLow; - chip::Optional mTtestEventTriggerContaminationStateClear; - chip::Optional mTestEventTriggerSensitivityLevelHigh; - chip::Optional mTestEventTriggerSensitivityLevelLow; - chip::Optional mTtestEventTriggerSensitivityLevelClear; - chip::Optional mEventNumber; - - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum interconnectSmokeAlarmSeverityLevel; - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum interconnectCOAlarmSeverityLevel; - - 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)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("interconnectSmokeAlarm", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEventTriggersEnabled", value, 1)); - } - 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::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - interconnectSmokeAlarmSeverityLevel = value; - } - shouldContinue = true; - break; - case 6: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::InterconnectSmokeAlarm::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("interconnectSmokeAlarm.alarmSeverityLevel", value.alarmSeverityLevel, - interconnectSmokeAlarmSeverityLevel)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 7U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("interconnectSmokeAlarm", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 11: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AllClear::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("interconnectCOAlarm", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - interconnectCOAlarmSeverityLevel = value; - } - shouldContinue = true; - break; - case 16: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::InterconnectCOAlarm::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("interconnectCOAlarm.alarmSeverityLevel", value.alarmSeverityLevel, - interconnectCOAlarmSeverityLevel)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 8U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("interconnectCOAlarm", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 21: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AllClear::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("contaminationState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 2U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("contaminationState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - 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)); - { - chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("contaminationState", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("contaminationState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::SensitivityEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeSensitivityLevel", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::SensitivityEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeSensitivityLevel", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::SensitivityEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeSensitivityLevel", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::SensitivityEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeSensitivityLevel", value, 2U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::SensitivityEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeSensitivityLevel", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::MuteStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceMuted", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 41: - 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 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::MuteStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceMuted", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 47: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AlarmMuted::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::MuteStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceMuted", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 50: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::MuteEnded::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 2U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::MuteStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceMuted", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 58: - 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 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 60: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 61: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 62: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 63: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::MuteStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceMuted", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 64: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::AlarmMuted::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 65: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 66: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::MuteStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceMuted", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 67: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::Events::MuteEnded::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 68: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 69: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 2U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 70: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 71: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 72: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::MuteStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceMuted", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 73: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 74: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - 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, "Commission DUT to TH"); - 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 subscribes to InterconnectSmokeAlarm attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::InterconnectSmokeAlarm::Id, 3, 30, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 2: { - LogStep(2, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::TestEventTriggersEnabled::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Interconnect Smoke Alarm Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerInterconnectSmokeAlarm.HasValue() - ? mTestEventTriggerInterconnectSmokeAlarm.Value() - : 0xffffffff00000092ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 6: { - LogStep(6, "TH reads InterconnectSmokeAlarm event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && SMOKECO.S.E08"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::InterconnectSmokeAlarm::Id, - false, chip::NullOptional); - } - case 7: { - LogStep(7, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Interconnect Smoke Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerInterconnectSmokeAlarmClear.HasValue() - ? mTestEventTriggerInterconnectSmokeAlarmClear.Value() - : 0xffffffff000000a2ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 9: { - LogStep(9, "TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 10: { - LogStep(10, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "TH reads AllClear event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && SMOKECO.S.E0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AllClear::Id, false, - chip::NullOptional); - } - case 12: { - LogStep(12, "TH subscribes to InterconnectCOAlarm attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::InterconnectCOAlarm::Id, 3, 30, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 13: { - LogStep(13, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Interconnect CO Alarm Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerInterconnectCoAlarm.HasValue() ? mTestEventTriggerInterconnectCoAlarm.Value() - : 0xffffffff00000094ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 15: { - LogStep(15, "TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 16: { - LogStep(16, "TH reads InterconnectCOAlarm event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && SMOKECO.S.E09"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::InterconnectCOAlarm::Id, false, - chip::NullOptional); - } - case 17: { - LogStep(17, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Interconnect CO Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerInterconnectCoAlarmClear.HasValue() - ? mTestEventTriggerInterconnectCoAlarmClear.Value() - : 0xffffffff000000a4ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 19: { - LogStep(19, "TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 20: { - LogStep(20, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 21: { - LogStep(21, "TH reads AllClear event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.E0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AllClear::Id, false, - chip::NullOptional); - } - case 22: { - LogStep(22, "TH subscribes to ContaminationState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::ContaminationState::Id, 3, 30, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 23: { - LogStep(23, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Contamination State (High) Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerContaminationStateHigh.HasValue() - ? mTestEventTriggerContaminationStateHigh.Value() - : 0xffffffff00000096ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 24: { - LogStep(24, "TH waits for a report of ContaminationState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 25: { - LogStep(25, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Contamination State Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTtestEventTriggerContaminationStateClear.HasValue() - ? mTtestEventTriggerContaminationStateClear.Value() - : 0xffffffff000000a6ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 26: { - LogStep(26, "TH waits for a report of ContaminationState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 27: { - LogStep(27, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Contamination State (Low) Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerContaminationStateLow.HasValue() ? mTestEventTriggerContaminationStateLow.Value() - : 0xffffffff00000097ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 28: { - LogStep(28, "TH waits for a report of ContaminationState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 29: { - LogStep(29, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Contamination State Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTtestEventTriggerContaminationStateClear.HasValue() - ? mTtestEventTriggerContaminationStateClear.Value() - : 0xffffffff000000a6ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 30: { - LogStep(30, "TH waits for a report of ContaminationState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 31: { - LogStep(31, "TH subscribes to SmokeSensitivityLevel attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::SmokeSensitivityLevel::Id, 3, 30, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 32: { - LogStep(32, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke " - "Sensitivity Level (High) Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerSensitivityLevelHigh.HasValue() ? mTestEventTriggerSensitivityLevelHigh.Value() - : 0xffffffff00000098ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 33: { - LogStep(33, "TH waits for a report of SmokeSensitivityLevel attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 34: { - LogStep(34, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke " - "Sensitivity Level Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTtestEventTriggerSensitivityLevelClear.HasValue() - ? mTtestEventTriggerSensitivityLevelClear.Value() - : 0xffffffff000000a8ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 35: { - LogStep(35, "TH waits for a report of SmokeSensitivityLevel attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 36: { - LogStep(36, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke " - "Sensitivity Level (Low) Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerSensitivityLevelLow.HasValue() ? mTestEventTriggerSensitivityLevelLow.Value() - : 0xffffffff00000099ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 37: { - LogStep(37, "TH waits for a report of SmokeSensitivityLevel attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 38: { - LogStep(38, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke " - "Sensitivity Level Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTtestEventTriggerSensitivityLevelClear.HasValue() - ? mTtestEventTriggerSensitivityLevelClear.Value() - : 0xffffffff000000a8ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 39: { - LogStep(39, "TH waits for a report of SmokeSensitivityLevel attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 40: { - LogStep(40, "TH subscribes to DeviceMuted attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::DeviceMuted::Id, - 3, 30, true, chip::NullOptional, chip::NullOptional, - /* autoResubscribe = */ chip::NullOptional); - } - case 41: { - LogStep(41, "TH reads FeatureMap attribute(Smoke Alarm) from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 42: { - LogStep(42, "TH subscribes to SmokeState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && SMOKECO.S.A0001"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::SmokeState::Id, 3, - 30, true, chip::NullOptional, chip::Optional(true), - /* autoResubscribe = */ chip::NullOptional); - } - case 43: { - LogStep(43, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Warning Smoke Alarm Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerWarningSmokeAlarm.HasValue() ? mTestEventTriggerWarningSmokeAlarm.Value() : 0xffffffff00000090ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 44: { - LogStep(44, "TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && SMOKECO.S.A0001"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 45: { - LogStep(45, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Manual Device Mute Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerDeviceMuted.HasValue() ? mTestEventTriggerDeviceMuted.Value() : 0xffffffff0000009bULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 46: { - LogStep(46, "TH waits for a report of DeviceMuted attribute from DUT with a timeout of 120 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 47: { - LogStep(47, "TH reads AlarmMuted event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && SMOKECO.S.E06"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AlarmMuted::Id, false, - chip::NullOptional); - } - case 48: { - LogStep(48, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Manual Device Mute Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerDeviceMutedClear.HasValue() ? mTestEventTriggerDeviceMutedClear.Value() : 0xffffffff000000abULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 49: { - LogStep(49, "TH waits for a report of DeviceMuted attribute from DUT with a timeout of 120 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 50: { - LogStep(50, "TH reads MuteEnded event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && SMOKECO.S.E07"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::MuteEnded::Id, false, - chip::NullOptional); - } - case 51: { - LogStep(51, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Critical Smoke Alarm Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerCriticalSmokeAlarm.HasValue() ? mTestEventTriggerCriticalSmokeAlarm.Value() - : 0xffffffff0000009cULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 52: { - LogStep(52, "TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && SMOKECO.S.A0001"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 53: { - LogStep(53, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Manual Device Mute Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerDeviceMuted.HasValue() ? mTestEventTriggerDeviceMuted.Value() : 0xffffffff0000009bULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 54: { - LogStep(54, "TH waits 60 Seconds"); - VerifyOrDo(!ShouldSkip("!PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 60000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 55: { - LogStep(55, "TH reads DeviceMuted attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::DeviceMuted::Id, true, - chip::NullOptional); - } - case 56: { - LogStep(56, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke " - "Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F00 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerSmokeAlarmClear.HasValue() ? mTestEventTriggerSmokeAlarmClear.Value() : 0xffffffff000000a0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 57: { - LogStep(57, "TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.A0001 && SMOKECO.S.F00"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 58: { - LogStep(58, "TH reads FeatureMap attribute(CO Alarm) from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 59: { - LogStep(59, "TH subscribes to COState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && SMOKECO.S.A0002"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::COState::Id, 3, - 30, true, chip::NullOptional, chip::Optional(true), - /* autoResubscribe = */ chip::NullOptional); - } - case 60: { - LogStep(60, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Warning CO Alarm Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerWarningCoAlarm.HasValue() ? mTestEventTriggerWarningCoAlarm.Value() : 0xffffffff00000091ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 61: { - LogStep(61, "TH waits for a report of COState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && SMOKECO.S.A0002"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 62: { - LogStep(62, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Manual Device Mute Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerDeviceMuted.HasValue() ? mTestEventTriggerDeviceMuted.Value() : 0xffffffff0000009bULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 63: { - LogStep(63, "TH waits for a report of DeviceMuted attribute from DUT with a timeout of 120 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 64: { - LogStep(64, "TH reads AlarmMuted event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && SMOKECO.S.E06"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::AlarmMuted::Id, false, - chip::NullOptional); - } - case 65: { - LogStep(65, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Manual Device Mute Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerDeviceMutedClear.HasValue() ? mTestEventTriggerDeviceMutedClear.Value() : 0xffffffff000000abULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 66: { - LogStep(66, "TH waits for a report of DeviceMuted attribute from DUT with a timeout of 120 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 67: { - LogStep(67, "TH reads MuteEnded event from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && SMOKECO.S.E07"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Events::MuteEnded::Id, false, - chip::NullOptional); - } - case 68: { - LogStep(68, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Critical CO Alarm Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerCriticalCoAlarm.HasValue() ? mTestEventTriggerCriticalCoAlarm.Value() : 0xffffffff0000009dULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 69: { - LogStep(69, "TH waits for a report of COState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && SMOKECO.S.A0002"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 70: { - LogStep(70, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Manual Device Mute Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerDeviceMuted.HasValue() ? mTestEventTriggerDeviceMuted.Value() : 0xffffffff0000009bULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 71: { - LogStep(71, "TH waits 60 Seconds"); - VerifyOrDo(!ShouldSkip("!PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 60000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 72: { - LogStep(72, "TH reads DeviceMuted attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::DeviceMuted::Id, true, - chip::NullOptional); - } - case 73: { - LogStep(73, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for CO " - "Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && DGGEN.S.C00.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerCoAlarmClear.HasValue() ? mTestEventTriggerCoAlarmClear.Value() : 0xffffffff000000a1ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 74: { - LogStep(74, "TH waits for a report of COState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0004 && SMOKECO.S.F01 && SMOKECO.S.A0002"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SMOKECO_2_6Suite : public TestCommand -{ -public: - Test_TC_SMOKECO_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_SMOKECO_2_6", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("TEST_EVENT_TRIGGER_KEY", &mTestEventTriggerKey); - AddArgument("TEST_EVENT_TRIGGER_WARNING_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerWarningSmokeAlarm); - AddArgument("TEST_EVENT_TRIGGER_SMOKE_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerSmokeAlarmClear); - AddArgument("TEST_EVENT_TRIGGER_WARNING_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerWarningCoAlarm); - AddArgument("TEST_EVENT_TRIGGER_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerCoAlarmClear); - AddArgument("TEST_EVENT_TRIGGER_WARNING_BATTERY_ALERT", 0, UINT64_MAX, &mTestEventTriggerWarningBatteryAlert); - AddArgument("TEST_EVENT_TRIGGER_BATTERY_ALERT_CLEAR", 0, UINT64_MAX, &mTestEventTriggerBatteryAlertClear); - AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerInterconnectSmokeAlarm); - AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_SMOKE_ALARM_CLEAR", 0, UINT64_MAX, - &mTestEventTriggerInterconnectSmokeAlarmClear); - AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarm); - AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarmClear); - AddArgument("HIEST_PRI_ALARM", 0, UINT8_MAX, &mHiestPriAlarm); - AddArgument("HIEST_PRI_ALARM_2", 0, UINT8_MAX, &mHiestPriAlarm2); - AddArgument("HIEST_PRI_ALARM_3", 0, UINT8_MAX, &mHiestPriAlarm3); - AddArgument("HIEST_PRI_ALARM_4", 0, UINT8_MAX, &mHiestPriAlarm4); - AddArgument("HIEST_PRI_ALARM_5", 0, UINT8_MAX, &mHiestPriAlarm5); - } - - ~Test_TC_SMOKECO_2_6Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(3090)); } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - chip::Optional mTestEventTriggerKey; - chip::Optional mTestEventTriggerWarningSmokeAlarm; - chip::Optional mTestEventTriggerSmokeAlarmClear; - chip::Optional mTestEventTriggerWarningCoAlarm; - chip::Optional mTestEventTriggerCoAlarmClear; - chip::Optional mTestEventTriggerWarningBatteryAlert; - chip::Optional mTestEventTriggerBatteryAlertClear; - chip::Optional mTestEventTriggerInterconnectSmokeAlarm; - chip::Optional mTestEventTriggerInterconnectSmokeAlarmClear; - chip::Optional mTestEventTriggerInterconnectCoAlarm; - chip::Optional mTestEventTriggerInterconnectCoAlarmClear; - chip::Optional mHiestPriAlarm; - chip::Optional mHiestPriAlarm2; - chip::Optional mHiestPriAlarm3; - chip::Optional mHiestPriAlarm4; - chip::Optional mHiestPriAlarm5; - - 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)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("batteryAlert", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("interconnectSmokeAlarm", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("interconnectCOAlarm", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEventTriggersEnabled", value, 1)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("batteryAlert", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("smokeState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm2.HasValue() ? mHiestPriAlarm2.Value() : 2U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("COState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm3.HasValue() ? mHiestPriAlarm3.Value() : 7U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("interconnectCOAlarm", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm4.HasValue() ? mHiestPriAlarm4.Value() : 7U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("interconnectSmokeAlarm", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm5.HasValue() ? mHiestPriAlarm5.Value() : 3U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("batteryAlert", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - shouldContinue = true; - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - 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, "Commission DUT to TH"); - 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 ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "TH subscribes to BatteryAlert attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::BatteryAlert::Id, - 3, 30, true, chip::NullOptional, chip::NullOptional, - /* autoResubscribe = */ chip::NullOptional); - } - case 3: { - LogStep(3, "TH subscribes to InterconnectSmokeAlarm attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::InterconnectSmokeAlarm::Id, 3, 30, true, chip::NullOptional, - chip::Optional(true), /* autoResubscribe = */ chip::NullOptional); - } - case 4: { - LogStep(4, "TH subscribes to InterconnectCOAlarm attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, - SmokeCoAlarm::Attributes::InterconnectCOAlarm::Id, 3, 30, true, chip::NullOptional, - chip::Optional(true), /* autoResubscribe = */ chip::NullOptional); - } - case 5: { - LogStep(5, "TH subscribes to COState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::COState::Id, 3, - 30, true, chip::NullOptional, chip::Optional(true), - /* autoResubscribe = */ chip::NullOptional); - } - case 6: { - LogStep(6, "TH subscribes to SmokeState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::SmokeState::Id, 3, - 30, true, chip::NullOptional, chip::Optional(true), - /* autoResubscribe = */ chip::NullOptional); - } - case 7: { - LogStep(7, "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster"); - VerifyOrDo(!ShouldSkip("DGGEN.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Attributes::TestEventTriggersEnabled::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Warning Battery Alert Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerWarningBatteryAlert.HasValue() ? mTestEventTriggerWarningBatteryAlert.Value() - : 0xffffffff00000095ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 9: { - LogStep(9, "TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 10: { - LogStep(10, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Interconnect Smoke Alarm Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerInterconnectSmokeAlarm.HasValue() - ? mTestEventTriggerInterconnectSmokeAlarm.Value() - : 0xffffffff00000092ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 11: { - LogStep(11, "TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 12: { - LogStep(12, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Interconnect CO Alarm Test Event"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerInterconnectCoAlarm.HasValue() ? mTestEventTriggerInterconnectCoAlarm.Value() - : 0xffffffff00000094ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 13: { - LogStep(13, "TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 14: { - LogStep(14, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Warning CO Alarm Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerWarningCoAlarm.HasValue() ? mTestEventTriggerWarningCoAlarm.Value() : 0xffffffff00000091ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 15: { - LogStep(15, "TH waits for a report of COState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 16: { - LogStep(16, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Warning Smoke Alarm Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerWarningSmokeAlarm.HasValue() ? mTestEventTriggerWarningSmokeAlarm.Value() : 0xffffffff00000090ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 17: { - LogStep(17, "TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 18: { - LogStep(18, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke " - "Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerSmokeAlarmClear.HasValue() ? mTestEventTriggerSmokeAlarmClear.Value() : 0xffffffff000000a0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 20: { - LogStep(20, "TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 21: { - LogStep(21, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 22: { - LogStep(22, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for CO " - "Alarm Test Event clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerCoAlarmClear.HasValue() ? mTestEventTriggerCoAlarmClear.Value() : 0xffffffff000000a1ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 23: { - LogStep(23, "TH waits for a report of COState attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 24: { - LogStep(24, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Interconnect CO Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerInterconnectCoAlarmClear.HasValue() - ? mTestEventTriggerInterconnectCoAlarmClear.Value() - : 0xffffffff000000a4ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 26: { - LogStep(26, "TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 27: { - LogStep(27, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 28: { - LogStep(28, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Interconnect Smoke Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = mTestEventTriggerInterconnectSmokeAlarmClear.HasValue() - ? mTestEventTriggerInterconnectSmokeAlarmClear.Value() - : 0xffffffff000000a2ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 29: { - LogStep(29, "TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 30: { - LogStep(30, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - case 31: { - LogStep(31, - "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " - "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " - "Battery Alert Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; - value.enableKey = mTestEventTriggerKey.HasValue() - ? mTestEventTriggerKey.Value() - : chip::ByteSpan(chip::Uint8::from_const_char("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"), - 16); - value.eventTrigger = - mTestEventTriggerBatteryAlertClear.HasValue() ? mTestEventTriggerBatteryAlertClear.Value() : 0xffffffff000000a5ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralDiagnostics::Id, - GeneralDiagnostics::Commands::TestEventTrigger::Id, value, chip::NullOptional - - ); - } - case 32: { - LogStep(32, "TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return WaitForReport(); - } - case 33: { - LogStep(33, "TH reads ExpressedState attribute from DUT"); - VerifyOrDo(!ShouldSkip("SMOKECO.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), SmokeCoAlarm::Id, SmokeCoAlarm::Attributes::ExpressedState::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SWTCH_1_1Suite : public TestCommand -{ -public: - Test_TC_SWTCH_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SWTCH_1_1", 20, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SWTCH_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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); - } - 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)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); - } - 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, 2UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); - } - break; - case 8: - 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, 2UL)); - } - break; - case 9: - 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, 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 10: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 11: - 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 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, 0UL)); - } - 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, 1UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - } - break; - 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, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 16: - 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, 6UL)); - } - break; - case 17: - 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, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - case 18: - 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")); - } - break; - case 19: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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 3: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2a: Read FeatureMap attribute and Check values of flags in this FeatureMap"); - VerifyOrDo(!ShouldSkip("!SWTCH.S.F00 && !SWTCH.S.F01 && !SWTCH.S.F02 && !SWTCH.S.F03 && !SWTCH.S.F04"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: Given SWTCH.S.F00(LS) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("SWTCH.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2c: Given SWTCH.S.F01(MS) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("SWTCH.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 2d: Given SWTCH.S.F02(MSR) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("SWTCH.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 2e: Given SWTCH.S.F03(MSL) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("SWTCH.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2f: Given SWTCH.S.F04(MSM) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("SWTCH.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("SWTCH.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4b: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && !SWTCH.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4b: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED && !SWTCH.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 5a: Read the global attribute: EventList "); - VerifyOrDo(!ShouldSkip("!SWTCH.S.F00 && !SWTCH.S.F01 && !SWTCH.S.F02 && !SWTCH.S.F03 && !SWTCH.S.F04 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 5b: Read EventList if SWTCH.S.F00(LS)"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && SWTCH.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Step 5c: Read EventList if SWTCH.S.F01(MS) & !SWTCH.S.F02(MSR)"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && SWTCH.S.F01 && !SWTCH.S.F02"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Step 5d: Read EventList if SWTCH.S.F01(MS) & SWTCH.S.F02(MSR) & !SWTCH.S.F03(MSL) & !SWTCH.S.F04(MSM)"); - VerifyOrDo(!ShouldSkip(" PICS_EVENT_LIST_ENABLED && SWTCH.S.F01 && SWTCH.S.F02 && !SWTCH.S.F03 && !SWTCH.S.F04 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 5e: Read EventList if SWTCH.S.F01(MS) & SWTCH.S.F02(MSR) & SWTCH.S.F03(MSL) & !SWTCH.S.F04(MSM)"); - VerifyOrDo(!ShouldSkip(" PICS_EVENT_LIST_ENABLED && SWTCH.S.F01 && SWTCH.S.F02 && SWTCH.S.F03 && !SWTCH.S.F04 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 5f: Read EventList if SWTCH.S.F01(MS) & SWTCH.S.F02(MSR) & !SWTCH.S.F03(MSL) & SWTCH.S.F04(MSM) "); - VerifyOrDo(!ShouldSkip(" PICS_EVENT_LIST_ENABLED && SWTCH.S.F01 && SWTCH.S.F02 && !SWTCH.S.F03 && SWTCH.S.F04 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Step 5g: Read EventList if SWTCH.S.F01(MS) & SWTCH.S.F02(MSR) & SWTCH.S.F03(MSL) & SWTCH.S.F04(MSM) "); - VerifyOrDo(!ShouldSkip(" PICS_EVENT_LIST_ENABLED && SWTCH.S.F01 && SWTCH.S.F02 && SWTCH.S.F03 && SWTCH.S.F04 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Step 6: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Step 7: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SWTCH_2_1Suite : public TestCommand -{ -public: - Test_TC_SWTCH_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SWTCH_2_1", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_SWTCH_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; - - uint8_t NumberOfPositionsValue; - - 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, 2U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - NumberOfPositionsValue = value; - } - 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", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, NumberOfPositionsValue - 1)); - } - 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, 2U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - 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: Read NumberOfPositions attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::NumberOfPositions::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2b: Read CurrentPosition attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::CurrentPosition::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2c: Read MultiPressMax attribute"); - VerifyOrDo(!ShouldSkip("SWTCH.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Switch::Id, Switch::Attributes::MultiPressMax::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_RVCOPSTATE_1_1Suite : public TestCommand -{ -public: - Test_TC_RVCOPSTATE_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_RVCOPSTATE_1_1", 14, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RVCOPSTATE_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, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 2UL)); - } - 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, 0UL)); - } - break; - case 7: - 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)); - } - break; - case 8: - 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, 3UL)); - } - break; - case 9: - 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, 2UL)); - } - break; - case 10: - 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, 2UL)); - } - break; - 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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, 4UL)); - } - 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 reads the ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads the FeatureMap attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: TH reads from the DUT the optional attribute(CountdownTime) in the AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("RVCOPSTATE.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5a: TH reads from the DUT the EventList attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::EventList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5b: TH reads from the DUT the optional event(OperationCompletion) in EventList."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && RVCOPSTATE.S.E01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::EventList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 6a: Read the optional command(Pause) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("RVCOPSTATE.S.C00.Rsp || RVCOPSTATE.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 6b: Read the optional command(Stop) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("RVCOPSTATE.S.C01.Rsp || RVCOPSTATE.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 6c: Read the optional command(Start) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("RVCOPSTATE.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 6d: Read the optional command(Resume) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("RVCOPSTATE.S.C03.Rsp || RVCOPSTATE.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 7: Read the global attribute: GeneratedCommandList"); - VerifyOrDo( - !ShouldSkip(" !RVCOPSTATE.S.C00.Rsp && !RVCOPSTATE.S.C01.Rsp && !RVCOPSTATE.S.C02.Rsp && !RVCOPSTATE.S.C03.Rsp "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 7: Read the global attribute: GeneratedCommandList"); - VerifyOrDo( - !ShouldSkip(" RVCOPSTATE.S.C00.Rsp || RVCOPSTATE.S.C01.Rsp || RVCOPSTATE.S.C02.Rsp || RVCOPSTATE.S.C03.Rsp "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TCCM_1_1Suite : public TestCommand -{ -public: - Test_TC_TCCM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCCM_1_1", 15, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TCCM_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)); - { - 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)); - { - 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, 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 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, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 2UL)); - } - break; - case 7: - 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, 3UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - 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 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - 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, 0UL)); - } - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAndTemperatureControlledCabinetMode::Id, - RefrigeratorAndTemperatureControlledCabinetMode::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the FeatureMap attribute."); - VerifyOrDo(!ShouldSkip("!TCCM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAndTemperatureControlledCabinetMode::Id, - RefrigeratorAndTemperatureControlledCabinetMode::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep( - 3, "Step 3: TH reads from the DUT the FeatureMap attribute, bit 0: SHALL be 1 if and only if TCCM.S.F00(DEPONOFF)"); - VerifyOrDo(!ShouldSkip("TCCM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAndTemperatureControlledCabinetMode::Id, - RefrigeratorAndTemperatureControlledCabinetMode::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads from the DUT the AttributeList attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAndTemperatureControlledCabinetMode::Id, - RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH reads from the DUT the AttributeList attribute."); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAndTemperatureControlledCabinetMode::Id, - RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 4b: TH reads from the DUT the AttributeList attribute. 0x0002: SHALL be included if and only if " - "TCCM.S.A0002(StartUpMode)"); - VerifyOrDo(!ShouldSkip("TCCM.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAndTemperatureControlledCabinetMode::Id, - RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, - "Step 4c: TH reads from the DUT the AttributeList attribute. 0x0003 SHALL be included if and only if " - "TCCM.S.F00(DEPONOFF)"); - VerifyOrDo(!ShouldSkip("TCCM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAndTemperatureControlledCabinetMode::Id, - RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 4d: 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))"); - 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 9: { - LogStep(9, "Step 5a: TH reads from the DUT the EventList attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAndTemperatureControlledCabinetMode::Id, - RefrigeratorAndTemperatureControlledCabinetMode::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 5b: TH reads EventList 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 11: { - LogStep(11, "Step 6a: TH reads from the DUT the AcceptedCommandList attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAndTemperatureControlledCabinetMode::Id, - RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 13: { - LogStep(13, "Step 7a: TH reads from the DUT the GeneratedCommandList attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RefrigeratorAndTemperatureControlledCabinetMode::Id, - RefrigeratorAndTemperatureControlledCabinetMode::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TCTL_1_1Suite : public TestCommand -{ -public: - Test_TC_TCTL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCTL_1_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_TCTL_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)); - { - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - 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 7: - 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 8: - 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)); - } - break; - case 9: - 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, 3UL)); - } - break; - case 10: - 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, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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, 0UL)); - } - 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::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - 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 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads from the DUT the ClusterRevision attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads from the DUT the FeatureMap attribute"); - VerifyOrDo(!ShouldSkip("!TCTL.S.F00 && !TCTL.S.F01 && !TCTL.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, - "Step 3b: TH reads from the DUT the FeatureMap attribute. bit 0: SHALL be 1 if and only if TCTL.S.F00(TN) & " - "!TCTL.S.F01(TL)"); - VerifyOrDo(!ShouldSkip("TCTL.S.F00 && !TCTL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, - "Step 3c: TH reads from the DUT the FeatureMap attribute. bit 1: SHALL be 1 if and only if TCTL.S.F01(TL) & " - "!TCTL.S.F00(TN)"); - VerifyOrDo(!ShouldSkip("TCTL.S.F01 && !TCTL.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 3d: TH reads from the DUT the FeatureMap attribute. bit 2: SHALL be 1 if and only if TCTL.S.F02(A_STEP) " - "& TCTL.S.F00(TN)"); - VerifyOrDo(!ShouldSkip("TCTL.S.F02 && !TCTL.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4a: TH reads from the DUT the AttributeList attribute."); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4a: TH reads from the DUT the AttributeList attribute."); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 4b: TH reads from the DUT the AttributeList attribute. 0x0000, 0x0001, 0x0002: SHALL be included if and " - "only if TCTL.S.F00(TN)"); - VerifyOrDo(!ShouldSkip("TCTL.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, - "Step 4c: TH reads from the DUT the AttributeList attribute. 0x0003: SHALL be included if and only if " - "TCTL.S.F02(A_STEP)"); - VerifyOrDo(!ShouldSkip("TCTL.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 4d: TH reads from the DUT the AttributeList attribute. 0x0004 & 0x0005: SHALL be included if and only if " - "TCTL.S.F01(TL)"); - VerifyOrDo(!ShouldSkip("TCTL.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 4e: 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)"); - 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 12: { - LogStep(12, "Step 5a: TH reads from the DUT the AcceptedCommandList attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, - "Step 5b: 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)"); - 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 14: { - LogStep(14, "Step 6a: TH reads from the DUT the GeneratedCommandList attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, - "Step 6b: TH reads GeneratedCommandList attribute from DUT.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)"); - 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 16: { - LogStep(16, "Step 7a: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::EventList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, - "Step 7b: TH reads EventList 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TMP_1_1Suite : public TestCommand -{ -public: - Test_TC_TMP_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TMP_1_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TMP_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, 4U)); - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 3UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 7: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read FeatureMap attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4b: Read the optional attribute(Tolerance) in AttributeList"); - VerifyOrDo(!ShouldSkip("TMP.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5: Read AcceptedCommandList attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 6: Read GeneratedCommandList attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 7: Read EventList attribute from the DUT.For this cluster the list is usually empty but it can contain " - "manufacturer specific event IDs."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TMP_2_1Suite : public TestCommand -{ -public: - Test_TC_TMP_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TMP_2_1", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TMP_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::app::DataModel::Nullable CurrentMinMeasured; - chip::app::DataModel::Nullable CurrentMaxMeasured; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32766)); - CurrentMinMeasured = 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, CurrentMinMeasured)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - CurrentMaxMeasured = value; - } - 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(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, CurrentMinMeasured)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, CurrentMaxMeasured)); - } - break; - case 4: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2048U)); - } - 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: Read the mandatory attribute: MinMeasuredValue"); - VerifyOrDo(!ShouldSkip("TMP.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the mandatory attribute: MaxMeasuredValue"); - VerifyOrDo(!ShouldSkip("TMP.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Read the mandatory attribute: MeasuredValue"); - VerifyOrDo(!ShouldSkip("TMP.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 6: Read the optional attribute: Tolerance"); - VerifyOrDo(!ShouldSkip("TMP.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::Tolerance::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TSTAT_1_1Suite : public TestCommand -{ -public: - Test_TC_TSTAT_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSTAT_1_1", 59, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSTAT_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)); - shouldContinue = true; - 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)); - { - 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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 64UL)); - } - break; - case 10: - 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, 27UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 28UL)); - 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 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 27UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 28UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 18UL)); - } - 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, 17UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - } - break; - 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, 20UL)); - } - break; - case 16: - 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, 19UL)); - } - break; - case 17: - 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, 17UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 18UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 25UL)); - } - break; - case 18: - 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, 32UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 33UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 34UL)); - } - break; - case 19: - 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, 52UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 53UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 54UL)); - } - break; - case 20: - 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, 55UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 56UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 57UL)); - } - break; - case 21: - 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)); - } - break; - case 22: - 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)); - } - break; - case 23: - 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, 16UL)); - } - break; - case 24: - 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, 26UL)); - } - break; - case 25: - 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, 29UL)); - } - break; - case 26: - 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, 35UL)); - } - break; - case 27: - 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, 36UL)); - } - break; - case 28: - 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, 37UL)); - } - break; - case 29: - 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, 41UL)); - } - break; - case 30: - 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, 48UL)); - } - break; - case 31: - 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, 49UL)); - } - break; - case 32: - 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, 50UL)); - } - break; - case 33: - 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, 58UL)); - } - break; - case 34: - 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, 64UL)); - } - break; - case 35: - 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, 65UL)); - } - break; - case 36: - 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, 66UL)); - } - break; - case 37: - 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, 67UL)); - } - break; - case 38: - 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, 68UL)); - } - break; - case 39: - 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, 69UL)); - } - break; - case 40: - 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, 70UL)); - } - break; - case 41: - 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, 71UL)); - } - break; - case 42: - 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, 3UL)); - } - break; - case 43: - 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, 4UL)); - } - break; - case 44: - 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, 8UL)); - } - break; - case 45: - 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, 21UL)); - } - break; - case 46: - 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, 22UL)); - } - break; - case 47: - 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, 5UL)); - } - break; - case 48: - 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, 6UL)); - } - break; - case 49: - 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)); - } - break; - case 50: - 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, 23UL)); - } - break; - case 51: - 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, 24UL)); - } - break; - case 52: - 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, 30UL)); - } - break; - case 53: - 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)); - } - break; - case 54: - 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, 4UL)); - } - break; - case 55: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 56: - 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)); - } - break; - case 57: - 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)); - } - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - 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, "Step 3a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip("!TSTAT.S.F00 && !TSTAT.S.F01 && !TSTAT.S.F02 && !TSTAT.S.F03 && !TSTAT.S.F04 && !TSTAT.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given TSTAT.S.F00(HEAT ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given TSTAT.S.F01(COOL) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given TSTAT.S.F02(OCC) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given TSTAT.S.F03(SCH) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given TSTAT.S.F04(SB) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given TSTAT.S.F05(AUTO) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given TSTAT.S.F06(LTNE) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F06"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4b: Read the Feature dependent(TSTAT.S.F00(HEAT)) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Step 4c: Read the Feature dependent(TSTAT.S.F01(COOL)) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Step 4d: Read the Feature dependent(TSTAT.S.F02(OCC)) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4e: Read the Feature dependent(TSTAT.S.F00(HEAT) & TSTAT.S.F02(OCC)) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00 && TSTAT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4f: Read the Feature dependent(TSTAT.S.F01(COOL) & TSTAT.S.F02(OCC)) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01 && TSTAT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4g: Read the Feature dependent(TSTAT.S.F05(AUTO)) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4h: Read the Feature dependent(TSTAT.S.F03(SCH)) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Step 4i: Read the Feature dependent(TSTAT.S.F04(SB)) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Step 4j: Read the Feature dependent(TSTAT.S.F04(SB) & TSTAT.S.F02(OCC)) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F04 && TSTAT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "Step 4k: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Step 4l: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 23: { - LogStep(23, "Step 4m: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, "Step 4n: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4o: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A001d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4p: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0023"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 27: { - LogStep(27, "Step 4q: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0024"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 28: { - LogStep(28, "Step 4r: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0025"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 29: { - LogStep(29, "Step 4s: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0029"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 30: { - LogStep(30, "Step 4t: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 31: { - LogStep(31, "Step 4u: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Step 4x: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0032"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, "Step 5y: Read the optional attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A003a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 34: { - LogStep(34, "Step 4z: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0040"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 35: { - LogStep(35, "Step 4A: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0041"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 36: { - LogStep(36, "Step 4B: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0042"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 37: { - LogStep(37, "Step 4C: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0043"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 38: { - LogStep(38, "Step 5D: Read the optional attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0044"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 39: { - LogStep(39, "Step 4E: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0045"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 40: { - LogStep(40, "Step 4F: Read the optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0046"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 41: { - LogStep(41, "Step 5G: Read the optional attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0047"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 42: { - LogStep(42, "Step 4H: Read the Feature dependent(TSTAT.S.F00(HEAT)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00 && TSTAT.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 43: { - LogStep(43, "Step 4I: Read the Feature dependent(TSTAT.S.F00(HEAT)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00 && TSTAT.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 44: { - LogStep(44, "Step 4J: Read the Feature dependent(TSTAT.S.F00(HEAT)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00 && TSTAT.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 45: { - LogStep(45, "Step 4K: Read the Feature dependent(TSTAT.S.F00(HEAT)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00 && TSTAT.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 46: { - LogStep(46, "Step 4L: Read the Feature dependent(TSTAT.S.F00(HEAT)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00 && TSTAT.S.A0016"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 47: { - LogStep(47, "Step 4M: Read the Feature dependent(TSTAT.S.F01(COOL)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01 && TSTAT.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 48: { - LogStep(48, "Step 4N: Read the Feature dependent(TSTAT.S.F01(COOL)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01 && TSTAT.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 49: { - LogStep(49, "Step 4O: Read the Feature dependent(TSTAT.S.F01(COOL)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01 && TSTAT.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 50: { - LogStep(50, "Step 4P: Read the Feature dependent(TSTAT.S.F01(COOL)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01 && TSTAT.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 51: { - LogStep(51, "Step 4Q: Read the Feature dependent(TSTAT.S.F01(COOL)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01 && TSTAT.S.A0018"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 52: { - LogStep(52, "Step 4R: Read the Feature dependent(TSTAT.S.F05(AUTO)) optional attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F05 && TSTAT.S.A001e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 53: { - LogStep(53, "Step 5a: Read Feature dependent(TSTAT.S.F03(SCH)) commands in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 54: { - LogStep(54, "Step 5b: Read the optional attribute: AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 55: { - LogStep(55, "Step 6a: Read the global attribute: GeneratedCommandList"); - VerifyOrDo(!ShouldSkip(" !TSTAT.S.C04.Rsp && !TSTAT.S.C02.Rsp "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 56: { - LogStep(56, "Step 6b: Read Feature dependent(TSTAT.S.F03(SCH)) commands in GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 57: { - LogStep(57, "Step 6c: Read optional command (GetRelayStatusLogResponse) in GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("TSTAT.S.C04.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 58: { - LogStep(58, - "Step 7: Read EventList attribute from the DUT.For this cluster the list is usually empty but it can contain " - "manufacturer specific event IDs."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TSTAT_2_1Suite : public TestCommand -{ -public: - Test_TC_TSTAT_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSTAT_2_1", 70, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSTAT_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; - - int16_t AbsMinCoolSetpointLimitStep5; - int8_t MinSetpointDeadBandValue; - int16_t AbsMaxCoolSetpointLimitStep6; - int16_t MinCoolSetpointLimitValue; - int16_t MaxCoolSetpointLimitValue; - int16_t MaxHeatSetpointLimitValue; - int16_t OccupiedCoolingSetpointValue; - int16_t AbsMinHeatValue; - int16_t AbsMaxHeatValue; - int16_t UnoccupiedCoolingSetpointValue; - - 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)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - AbsMinCoolSetpointLimitStep5 = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - MinSetpointDeadBandValue = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - AbsMaxCoolSetpointLimitStep6 = value; - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - MinCoolSetpointLimitValue = value; - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - MaxCoolSetpointLimitValue = value; - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - MaxHeatSetpointLimitValue = value; - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - OccupiedCoolingSetpointValue = value; - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - AbsMinHeatValue = value; - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - AbsMaxHeatValue = value; - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - UnoccupiedCoolingSetpointValue = value; - } - 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(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 12: - 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 13: - 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")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMaxValue("value", value, AbsMinCoolSetpointLimitStep5 - MinSetpointDeadBandValue)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1575)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 20: - 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)); - } - break; - case 21: - 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)); - } - break; - case 22: - 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")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 63U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int8s", "int8s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -25)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 25)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinCoolSetpointLimitValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxCoolSetpointLimitValue)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3200)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, AbsMinCoolSetpointLimitStep5)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, OccupiedCoolingSetpointValue - MinSetpointDeadBandValue)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, AbsMinHeatValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, AbsMaxHeatValue)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3200)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, UnoccupiedCoolingSetpointValue - MinSetpointDeadBandValue)); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MinCoolSetpointLimitValue - MinSetpointDeadBandValue)); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, AbsMinHeatValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxHeatSetpointLimitValue)); - } - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3000)); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 700)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxCoolSetpointLimitValue - MinSetpointDeadBandValue)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, AbsMinCoolSetpointLimitStep5)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxCoolSetpointLimitValue)); - } - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3200)); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, MinCoolSetpointLimitValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, AbsMaxCoolSetpointLimitStep6)); - } - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int8s", "int8s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 25)); - } - break; - case 41: - 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")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Thermostat::ThermostatControlSequence value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); - } - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 6U)); - } - break; - case 46: - 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, 255U)); - } - break; - case 47: - 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, 255U)); - } - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); - } - break; - case 49: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1440U)); - } - break; - case 50: - 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")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); - } - break; - case 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap16", "bitmap16")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127U)); - } - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 53: - 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "epoch_s", "epoch_s")); - } - break; - case 55: - 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, 255U)); - } - break; - case 56: - 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, 255U)); - } - break; - case 57: - 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, 255U)); - } - break; - case 58: - 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, 255U)); - } - break; - case 59: - 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, 255U)); - } - break; - case 60: - 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, 255U)); - } - break; - case 61: - 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, 255U)); - } - break; - case 62: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); - } - break; - case 63: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 64: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 65: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 66: - 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")); - } - break; - case 67: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); - } - break; - case 68: - 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 69: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("ACCapacityformat", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - } - 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, "Saving value for comparision in step 5 read AbsMinCoolSetpointLimit attribute"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::AbsMinCoolSetpointLimit::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Saving value for comparision in step 5 read attribute MinSetpointDeadBand attribute"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0019"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinSetpointDeadBand::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Saving value for comparision in step 6 read AbsMaxCoolSetpointLimit attribute"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::AbsMaxCoolSetpointLimit::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Saving value for comparision in step 17 read MinCoolSetpointLimit attribute"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Saving value for comparision in step 17 read MaxCoolSetpointLimit attribute"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0018"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxCoolSetpointLimit::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Saving value for comparision in step 17 read MaxHeatSetpointLimit"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0016"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Saving value for comparision in step 13 read attribute OccupiedCoolingSetpoint"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::OccupiedCoolingSetpoint::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Saving value for comparision in step 15 read attribute AbsMinHeatSetpointLimit"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::AbsMinHeatSetpointLimit::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Saving value for comparision in step 15 read attribute AbsMaxHeatSetpointLimit"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::AbsMaxHeatSetpointLimit::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Saving value for comparision in step 16 read UnoccupiedCoolingSetpoint attribute"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::UnoccupiedCoolingSetpoint::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 2: Reads mandatory attributes from DUT: LocalTemperature"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::LocalTemperature::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3: Read OutdoorTemperature attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::OutdoorTemperature::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 4: Read Occupancy attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::Occupancy::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Step 5a: Read attribute AbsMinHeatSetpointLimit if TSTAT.S.F05 feature is supported"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0003 && TSTAT.S.A0005 && TSTAT.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::AbsMinHeatSetpointLimit::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 5b: Read attribute AbsMinHeatSetpointLimit if TSTAT.S.F05 feature is supported"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0003 && !TSTAT.S.A0005 && TSTAT.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::AbsMinHeatSetpointLimit::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 6a: Read attribute AbsMinHeatSetpointLimit from DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0003 && !TSTAT.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::AbsMinHeatSetpointLimit::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 6b: Reads mandatory attributes from DUT: AbsMaxHeatSetpointLimit"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::AbsMaxHeatSetpointLimit::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 7: Read attribute AbsMinCoolSetpointLimit from DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::AbsMinCoolSetpointLimit::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 8: Read attribute AbsMaxCoolSetpointLimit from DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::AbsMaxCoolSetpointLimit::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 9: Read PICoolingDemand attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::PICoolingDemand::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "Step 10: Read PIHeatingDemand attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::PIHeatingDemand::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Step 11: Read HVACSystemTypeConfiguration attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::HVACSystemTypeConfiguration::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 12: Read LocalTemperatureCalibration attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::LocalTemperatureCalibration::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 13a: Read attribute OccupiedCoolingSetpoint from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01 && TSTAT.S.A0017 && TSTAT.S.A0018"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::OccupiedCoolingSetpoint::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 13b: Read attribute OccupiedCoolingSetpoint from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01 && !TSTAT.S.A0017 && !TSTAT.S.A0018"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::OccupiedCoolingSetpoint::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Step 14a: Read attribute OccupiedHeatingSetpoint if TSTAT.S.F05 feature is supported"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F05 && TSTAT.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::OccupiedHeatingSetpoint::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 14b: Read attribute OccupiedHeatingSetpoint from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00 && !TSTAT.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::OccupiedHeatingSetpoint::Id, true, chip::NullOptional); - } - case 28: { - LogStep(28, "Step 15a: Read UnoccupiedCoolingSetpoint attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F05 && TSTAT.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::UnoccupiedCoolingSetpoint::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 15b: Read UnoccupiedCoolingSetpoint attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F01 && TSTAT.S.F02 && !TSTAT.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::UnoccupiedCoolingSetpoint::Id, true, chip::NullOptional); - } - case 30: { - LogStep(30, "Step 16a: Read UnoccupiedHeatingSetpoint attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00 && TSTAT.S.F02 && TSTAT.S.F05 && TSTAT.S.A0013"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::UnoccupiedHeatingSetpoint::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, "Step 16b: Read UnoccupiedHeatingSetpoint attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F00 && TSTAT.S.F02 && !TSTAT.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::UnoccupiedHeatingSetpoint::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, "Step 17a: Reads attribute from DUT: MinHeatSetpointLimit"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0015 && TSTAT.S.F05 && TSTAT.S.A0017 && TSTAT.S.A0003"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id, - true, chip::NullOptional); - } - case 33: { - LogStep(33, - "Step 17b: Reads MinHeatSetpointLimit attribute from Server DUT and verifies that the value is within range"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0015 && TSTAT.S.A0016 && TSTAT.S.A0003 && !TSTAT.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id, - true, chip::NullOptional); - } - case 34: { - LogStep(34, - "Step 17c: Reads MinHeatSetpointLimit attribute from Server DUT and verifies that the value is within range"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0003 && !TSTAT.S.A0015 && !TSTAT.S.A0016 && !TSTAT.S.F05"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinHeatSetpointLimit::Id, - true, chip::NullOptional); - } - case 35: { - LogStep(35, "Step 18a: Read attribute MaxHeatSetpointLimit from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0016 && !TSTAT.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id, - true, chip::NullOptional); - } - case 36: { - LogStep(36, "Step 18b: Reads attribute from DUT: MaxHeatSetpointLimit"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0016 && TSTAT.S.F05 && TSTAT.S.A0018"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxHeatSetpointLimit::Id, - true, chip::NullOptional); - } - case 37: { - LogStep(37, "Step 19a: Read attribute MinCoolSetpointLimit from DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0017 && TSTAT.S.A0018 && TSTAT.S.A0005"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id, - true, chip::NullOptional); - } - case 38: { - LogStep(38, "Step 19b: Read attribute MinCoolSetpointLimit from DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0017 && !TSTAT.S.A0018 && !TSTAT.S.A0005"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinCoolSetpointLimit::Id, - true, chip::NullOptional); - } - case 39: { - LogStep(39, "Step 20: Read attribute MaxCoolSetpointLimit from DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0018 && TSTAT.S.A0006 && TSTAT.S.A0017"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MaxCoolSetpointLimit::Id, - true, chip::NullOptional); - } - case 40: { - LogStep(40, "Step 21: Read attribute MinSetpointDeadBand from DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::MinSetpointDeadBand::Id, - true, chip::NullOptional); - } - case 41: { - LogStep(41, "Step 22: Read RemoteSensing attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::RemoteSensing::Id, true, - chip::NullOptional); - } - case 42: { - LogStep(42, "Step 23: Read attribute ControlSequenceOfOperation from DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A001b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::ControlSequenceOfOperation::Id, true, chip::NullOptional); - } - case 43: { - LogStep(43, "Step 24: Read attribute SystemMode from DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A001c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::SystemMode::Id, true, - chip::NullOptional); - } - case 44: { - LogStep(44, "Step 26: Read ThermostatRunningMode attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A001e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ThermostatRunningMode::Id, - true, chip::NullOptional); - } - case 45: { - LogStep(45, "Step 27: Reads constraints of optional attributes from DUT: StartOfWeek"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::StartOfWeek::Id, true, - chip::NullOptional); - } - case 46: { - LogStep(46, "Step 28: Reads optional attributes from DUT: NumberOfWeeklyTransitions"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::NumberOfWeeklyTransitions::Id, true, chip::NullOptional); - } - case 47: { - LogStep(47, "Step 29: Reads optional attributes from DUT: NumberOfDailyTransitions"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::NumberOfDailyTransitions::Id, true, chip::NullOptional); - } - case 48: { - LogStep(48, "Step 30: Read TemperatureSetpointHold attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0023"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::TemperatureSetpointHold::Id, true, chip::NullOptional); - } - case 49: { - LogStep(49, "Step 31: Read TemperatureSetpointHoldDuration attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0024"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::TemperatureSetpointHoldDuration::Id, true, chip::NullOptional); - } - case 50: { - LogStep(50, "Step 32: Read ThermostatProgrammingOperationMode attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0025"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::ThermostatProgrammingOperationMode::Id, true, chip::NullOptional); - } - case 51: { - LogStep(51, "Step 33: Read ThermostatRunningState attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0029"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ThermostatRunningState::Id, - true, chip::NullOptional); - } - case 52: { - LogStep(52, "Step 34: Read SetpointChangeSource attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::SetpointChangeSource::Id, - true, chip::NullOptional); - } - case 53: { - LogStep(53, "Step 35: Read SetpointChangeAmount attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::SetpointChangeAmount::Id, - true, chip::NullOptional); - } - case 54: { - LogStep(54, "Step 36: Read SetpointChangeSourceTimestamp attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0032"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, - Thermostat::Attributes::SetpointChangeSourceTimestamp::Id, true, chip::NullOptional); - } - case 55: { - LogStep(55, "Step 37: Read OccupiedSetback attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::OccupiedSetback::Id, true, - chip::NullOptional); - } - case 56: { - LogStep(56, "Step 38: Read OccupiedSetbackMin attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::OccupiedSetbackMin::Id, - true, chip::NullOptional); - } - case 57: { - LogStep(57, "Step 39: Read OccupiedSetbackMax attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::OccupiedSetbackMax::Id, - true, chip::NullOptional); - } - case 58: { - LogStep(58, "Step 40: Read UnoccupiedSetback attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F02 && TSTAT.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::UnoccupiedSetback::Id, - true, chip::NullOptional); - } - case 59: { - LogStep(59, "Step 41: Read UnoccupiedSetbackMin attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F02 && TSTAT.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::UnoccupiedSetbackMin::Id, - true, chip::NullOptional); - } - case 60: { - LogStep(60, "Step 42: Read UnoccupiedSetbackMax attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.F02 && TSTAT.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::UnoccupiedSetbackMax::Id, - true, chip::NullOptional); - } - case 61: { - LogStep(61, "Step 43: Read EmergencyHeatDelta attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A003a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::EmergencyHeatDelta::Id, - true, chip::NullOptional); - } - case 62: { - LogStep(62, "Step 44: Read ACType attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0040"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ACType::Id, true, - chip::NullOptional); - } - case 63: { - LogStep(63, "Step 45: Read ACCapacity attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0041"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ACCapacity::Id, true, - chip::NullOptional); - } - case 64: { - LogStep(64, "Step 46: Read ACRefrigerantType attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0042"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ACRefrigerantType::Id, - true, chip::NullOptional); - } - case 65: { - LogStep(65, "Step 47: Read ACCompressorType attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0043"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ACCompressorType::Id, true, - chip::NullOptional); - } - case 66: { - LogStep(66, "Step 48: Read ACErrorCode attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0044"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ACErrorCode::Id, true, - chip::NullOptional); - } - case 67: { - LogStep(67, "Step 49: Read ACLouverPosition attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0045"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ACLouverPosition::Id, true, - chip::NullOptional); - } - case 68: { - LogStep(68, "Step 50: Read ACCoilTemperature attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0046"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ACCoilTemperature::Id, - true, chip::NullOptional); - } - case 69: { - LogStep(69, "Step 51: Read ACCapacityFormat attribute from the DUT"); - VerifyOrDo(!ShouldSkip("TSTAT.S.A0047"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Thermostat::Id, Thermostat::Attributes::ACCapacityformat::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TSUIC_1_1Suite : public TestCommand -{ -public: - Test_TC_TSUIC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSUIC_1_1", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSUIC_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, 2U)); - 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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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::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")); - } - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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)); - shouldContinue = true; - 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 read ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read FeatureMap attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 4b: Read the global attribute: AttributeList. 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)"); - 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 6: { - LogStep(6, "Step 5a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, - "Step 5b: Read the global attribute: AcceptedCommandList. 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)"); - 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 8: { - LogStep(8, "Step 6a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, - "Step 6b: Read the global attribute: GeneratedCommandList. 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)"); - 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 10: { - LogStep(10, - "Step 7: Read EventList attribute from the DUT.For this cluster the list is usually empty but it can contain " - "manufacturer specific event IDs."); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TSUIC_2_1Suite : public TestCommand -{ -public: - Test_TC_TSUIC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSUIC_2_1", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSUIC_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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); - } - 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", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); - } - 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", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", 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: Read the mandatory attribute: TemperatureDisplayMode"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the mandatory attribute: KeypadLockout"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Read the optional attribute: ScheduleProgrammingVisibility"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TSUIC_2_2Suite : public TestCommand -{ -public: - Test_TC_TSUIC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSUIC_2_2", 37, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TSUIC_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; - - 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("temperatureDisplayMode", value, 0U)); - } - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("temperatureDisplayMode", value, 1U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("temperatureDisplayMode", value, 1U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("keypadLockout", value, 0U)); - } - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("keypadLockout", value, 1U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("keypadLockout", value, 2U)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("keypadLockout", value, 3U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("keypadLockout", value, 4U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("keypadLockout", value, 5U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("keypadLockout", value, 5U)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", value, 0U)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", value, 1U)); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", 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 2a: Writes a value of 0 to TemperatureDisplayMode attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Verify device temperature displayed in °C"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TSUIC.S.A0000"), 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 3: { - LogStep(3, "Step 2b: TH reads the TemperatureDisplayMode attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2c: Writes a value of 1 to TemperatureDisplayMode attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 1U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Verify device temperature displayed in °F"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TSUIC.S.A0000"), 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 6: { - LogStep(6, "Step 2d: TH reads the TemperatureDisplayMode attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2e: Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 2U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 2f: TH reads the TemperatureDisplayMode attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3a: Writes a value of 0 to KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 10: { - LogStep(10, "Verify all device functionality available to the user"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TSUIC.S.A0001"), 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 11: { - LogStep(11, "Step 3b: TH reads the KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3c: Writes a value of 1 to KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 1U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 13: { - LogStep(13, "Verify device operates at Level 1 reduced functionality"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TSUIC.S.A0001"), 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 14: { - LogStep(14, "Step 3d: TH reads the KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 3e: Writes a value of 2 to KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 2U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 16: { - LogStep(16, "Verify device operates at Level 2 reduced functionality"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TSUIC.S.A0001"), 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 17: { - LogStep(17, "Step 3f: TH reads the KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 3g: Writes a value of 3 to KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 3U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 19: { - LogStep(19, "Verify device operates at Level 3 reduced functionality"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TSUIC.S.A0001"), 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 20: { - LogStep(20, "Step 3h: TH reads the KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 3i: Writes a value of 4 to KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 4U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 22: { - LogStep(22, "Verify device operates at Level 4 reduced functionality"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TSUIC.S.A0001"), 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 23: { - LogStep(23, "Step 3j: TH reads the KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 3k: Writes a value of 5 to KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 5U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 25: { - LogStep(25, "Verify device operates at least functionality level"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TSUIC.S.A0001"), 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 26: { - LogStep(26, "Step 3l: TH reads the KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 3m: Writes a value of greater than 5 to KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 6U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 28: { - LogStep(28, "Step 3n: TH reads the KeypadLockout attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 4a: Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 30: { - LogStep(30, "Verify local schedule programming functionality is enabled at the thermostat"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TSUIC.S.A0002"), 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 31: { - LogStep(31, "Step 4b: TH reads the ScheduleProgrammingVisibility attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Step 4c: Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 1U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 33: { - LogStep(33, "Verify local schedule programming functionality is disabled at the thermostat"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TSUIC.S.A0002"), 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 34: { - LogStep(34, "Step 4d: TH reads the ScheduleProgrammingVisibility attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, true, - chip::NullOptional); - } - case 35: { - LogStep(35, "Step 4e: Writes a value of greater than 1 to ScheduleProgrammingVisibility attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 2U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 36: { - LogStep(36, "Step 4f: TH reads the ScheduleProgrammingVisibility attribute of DUT"); - VerifyOrDo(!ShouldSkip("TSUIC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ThermostatUserInterfaceConfiguration::Id, - ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGTHREAD_1_1Suite : public TestCommand -{ -public: - Test_TC_DGTHREAD_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DGTHREAD_1_1", 24, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DGTHREAD_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)); - { - 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)); - { - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 11UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 12UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 13UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 59UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 60UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 61UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 62UL)); - 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 8: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 11UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 12UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 13UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 59UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 60UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 61UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 62UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 9: - 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, 6UL)); - } - break; - case 10: - 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, 14UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 15UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 16UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 17UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 18UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 19UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 20UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 21UL)); - } - break; - 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, 22UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 23UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 24UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 25UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 26UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 27UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 28UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 29UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 30UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 31UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 32UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 33UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 34UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 35UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 36UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 37UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 38UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 39UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 40UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 41UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 42UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 43UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 44UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 45UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 46UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 47UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 48UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 49UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 50UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 51UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 52UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 53UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 54UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 55UL)); - } - 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, 56UL)); - } - 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, 57UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 58UL)); - } - break; - case 15: - 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 16: - 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)); - } - break; - case 17: - 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)); - } - 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)); - { - 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")); - } - break; - case 20: - 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)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads the FeatureMap from DUT"); - VerifyOrDo(!ShouldSkip(" !DGTHREAD.S.F00 && !DGTHREAD.S.F01 && !DGTHREAD.S.F02 && !DGTHREAD.S.F03 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given DGTHREAD.S.F00(PKTCNT) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given DGTHREAD.S.F01(ERRCNT) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given DGTHREAD.S.F02(MLECNT) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given DGTHREAD.S.F03(MACCNT) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4a: TH reads mandatory attributes in AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4a: TH reads mandatory attributes in AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4b: TH reads Feature dependent attribute(DGTHREAD.S.F01(ERRCNT)) in attributeList"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0006 && DGTHREAD.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4c: TH reads Feature dependent attribute (DGTHREAD.S.F02(MLECNT)) in attributeList"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4d: TH reads Feature dependent attribute (DGTHREAD.S.F03(MACCNT)) in attributeList"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4e: Read the optional attribute (ActiveTimestamp) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0038"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 4f: Read the optional attribute (PendingTimestamp) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0039"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 4g: Read the optional attribute (Delay) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A003a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 5a: TH reads EventList from DUT"); - VerifyOrDo(!ShouldSkip(" !DGTHREAD.S.E00 && !DGTHREAD.S.E01 && PICS_EVENT_LIST_ENABLED"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 5b: TH reads DGTHREAD.S.E00(ConnectionStatus) event in EventList"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.E00 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 5c: TH reads DGTHREAD.S.E01(NetworkFaultChange) event in EventList"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.E01 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, - "Step 5d: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 19: { - LogStep(19, "Step 6a: TH reads AcceptedCommandList from DUT"); - VerifyOrDo(!ShouldSkip(" !DGTHREAD.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 6b: TH reads AcceptedCommandList from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 6c: TH reads AcceptedCommandList 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)"); - 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 22: { - LogStep(22, "Step 7a: TH reads GeneratedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGTHREAD_2_1Suite : public TestCommand -{ -public: - Test_TC_DGTHREAD_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DGTHREAD_2_1", 34, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DGTHREAD_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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 6U)); - } - 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(CheckConstraintType("value", "char_string", "char_string")); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - 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", "int64u", "int64u")); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int64u", "int64u")); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 14: - 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", "int32u", "int32u")); - } - 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(CheckConstraintType("value", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 16: - 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, 255U)); - } - break; - case 17: - 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, 255U)); - } - break; - case 18: - 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, 255U)); - } - break; - case 19: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 20: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 21: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 22: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 23: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 24: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 25: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 26: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 27: - 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", "int64u", "int64u")); - } - break; - case 28: - 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", "int64u", "int64u")); - } - break; - case 29: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - 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", "octet_string", "octet_string")); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 33: - 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")); - } - 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 reads Channel attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::Channel::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads RoutingRole attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RoutingRole::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, - "Step 4a: TH reads Network Name attribute value from DUT and Verify that Network name is of the type string"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::NetworkName::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, - "Step 4b: Read NetworkName attribute from DUT and verify response value, If value is NULL then verify that " - "RoutingRole is set to 1"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGTHREAD.S.A0002"), 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 5: { - LogStep(5, "Step 5a: TH reads PanId attribute value from DUT and Verify that PanId is of the type uint16"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::PanId::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, - "Step 5b: Read PanId attribute from DUT and verify response value, If value is NULL then verify that " - "RoutingRole is set to 1"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGTHREAD.S.A0003"), 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 7: { - LogStep(7, - "Step 6a: TH reads ExtendedPanId attribute value from DUT and Verify that ExtendedPanId is of the type uint64"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::ExtendedPanId::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 6b: Read ExtendedPanId attribute from DUT and verify response value, If value is NULL then verify that " - "RoutingRole is set to 1"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGTHREAD.S.A0004"), 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 9: { - LogStep(9, - "Step 7: Read MeshLocalPrefix attribute from DUT and verify response value, If value is NULL then verify that " - "RoutingRole is set to 1"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGTHREAD.S.A0005"), 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 10: { - LogStep(10, "Step 8a: TH reads OverrunCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0006 && DGTHREAD.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::OverrunCount::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 8b: Read OverrunCount attribute from DUT and verify response value, If the Overruncount is greater than " - "zero or not"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGTHREAD.S.A0006"), 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 12: { - LogStep(12, - "Step 9: Read NeighborTableList attribute from DUT and Verify that the NeighborTable List size is Zero or " - "greater and verify each node types"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGTHREAD.S.A0007"), 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 13: { - LogStep(13, - "Step 10: Read RouteTable attribute from DUT and Verify that the RouteTableList List size is Zero or greater " - "and verify each node types"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGTHREAD.S.A0008"), 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 14: { - LogStep(14, "Step 11: TH reads PartitionId attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::PartitionId::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 12: TH reads Weighting attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::Weighting::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 13: TH reads DataVersion attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::DataVersion::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 14: TH reads StableDataVersion attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::StableDataVersion::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 15: TH reads LeaderRouterId attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A000d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::LeaderRouterId::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 16: TH reads DetachedRoleCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A000e && DGTHREAD.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 17: TH reads ChildRoleCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A000f && DGTHREAD.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::ChildRoleCount::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 18: TH reads RouterRoleCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0010 && DGTHREAD.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RouterRoleCount::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 19: TH reads LeaderRoleCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0011 && DGTHREAD.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 20: TH reads AttachAttemptCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0012 && DGTHREAD.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 21: TH reads PartitionIdChangeCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0013 && DGTHREAD.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 22: TH reads BetterPartitionAttachAttemptCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0014 && DGTHREAD.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::Id, true, - chip::NullOptional); - } - case 26: { - LogStep(26, "Step 23: TH reads ParentChangeCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0015 && DGTHREAD.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::ParentChangeCount::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 24: TH reads ActiveTimestamp attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0038"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::Id, true, chip::NullOptional); - } - case 28: { - LogStep(28, "Step 25: TH reads PendingTimestamp attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0039"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::PendingTimestamp::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 26: TH reads Delay attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A003a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::Delay::Id, true, chip::NullOptional); - } - case 30: { - LogStep(30, "Step 27: Read SecurityPolicy struct attribute from DUT and Verify the each field"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGTHREAD.S.A003b"), 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 31: { - LogStep(31, "Step 28: TH reads ChannelPage0Mask attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A003c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::ChannelPage0Mask::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, "Step 29: Read OperationalDatasetComponents struct attribute from DUT and Verify the each field"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && DGTHREAD.S.A003d"), 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 33: { - LogStep(33, "Step 30: TH reads ActiveNetworkFaults attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A003e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGTHREAD_2_2Suite : public TestCommand -{ -public: - Test_TC_DGTHREAD_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DGTHREAD_2_2", 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_DGTHREAD_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; - - 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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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 reads TxTotalCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0016"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxTotalCount::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads TxUnicastCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxUnicastCount::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads TxBroadcastCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0018"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads TxAckRequestedCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0019"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxAckRequestedCount::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads TxAckedCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxAckedCount::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads TxNoAckRequestedCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A001b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads TxDataCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A001c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxDataCount::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads TxDataPollCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A001d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxDataPollCount::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads TxBeaconCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A001e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxBeaconCount::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads TxBeaconRequestCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A001f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 12: TH reads TxOtherCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0020"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxOtherCount::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 13: TH reads TxRetryCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxRetryCount::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 14: TH reads TxDirectMaxRetryExpiryCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0022"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 15: TH reads TxIndirectMaxRetryExpiryCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0023"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 16: TH reads TxErrCcaCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0024"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 17: TH reads TxErrAbortCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0025"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 18: TH reads TxErrBusyChannelCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0026"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGTHREAD_2_3Suite : public TestCommand -{ -public: - Test_TC_DGTHREAD_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DGTHREAD_2_3", 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_DGTHREAD_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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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 reads RxTotalCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0027"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxTotalCount::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads RxUnicastCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0028"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxUnicastCount::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads RxBroadcastCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0029"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads RxDataCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A002a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxDataCount::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads RxDataPollCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A002b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxDataPollCount::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads RxBeaconCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A002c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxBeaconCount::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: TH reads RxBeaconRequestCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A002d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: TH reads RxOtherCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A002e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxOtherCount::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: TH reads RxAddressFilteredCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A002f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: TH reads RxDestAddrFilteredCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0030"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 12: TH reads RxDuplicatedCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0031"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 13: TH reads RxErrNoFrameCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0032"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 14: TH reads RxErrUnknownNeighborCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0033"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 15: TH reads RxErrInvalidSrcAddrCount attribute value from DUT and verify data type"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0034"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 16: TH reads RxErrSecCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0035"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxErrSecCount::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 17: TH reads RxErrFcsCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0036"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 18: TH reads RxErrOtherCount attribute value from DUT"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0037"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGTHREAD_2_4Suite : public TestCommand -{ -public: - Test_TC_DGTHREAD_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DGTHREAD_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_DGTHREAD_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)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("overrunCount", value, 0ULL)); - } - 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: Sends ResetCounts command"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ThreadNetworkDiagnostics::Commands::ResetCounts::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Commands::ResetCounts::Id, value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 3: Read the Overruncount attribute"); - VerifyOrDo(!ShouldSkip("DGTHREAD.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), ThreadNetworkDiagnostics::Id, - ThreadNetworkDiagnostics::Attributes::OverrunCount::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TIMESYNC_1_1Suite : public TestCommand -{ -public: - Test_TC_TIMESYNC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TIMESYNC_1_1", 40, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TIMESYNC_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, 2U)); - } - break; - case 2: - 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 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(CheckConstraintHasMasksClear("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(CheckConstraintHasMasksClear("value", value, 2UL)); - } - 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, 4UL)); - } - 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(CheckConstraintHasMasksClear("value", value, 4UL)); - } - 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, 8UL)); - } - break; - case 9: - 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(CheckConstraintHasMasksClear("value", value, 8UL)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - 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 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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(CheckConstraintContains("value", value, 2UL)); - } - 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(CheckConstraintExcludes("value", value, 2UL)); - } - 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))); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 11UL)); - } - break; - 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(CheckConstraintExcludes("value", value, 5UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 11UL)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 12UL)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 12UL)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintExcludes("value", value, 9UL)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); - } - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - } - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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, "TS2: read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "TS3: Given TIMESYNC.S.F00(TZ) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "TS3: Given !TIMESYNC.S.F00(TZ) ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "TS3: Given TIMESYNC.S.F01(NTPC) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "TS3: Given !TIMESYNC.S.F01(NTPC) ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "TS3: Given TIMESYNC.S.F02(NTPS) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "TS3: Given !TIMESYNC.S.F02(NTPS) ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "TS3: Given TIMESYNC.S.F03(TSC) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "TS3: Given !TIMESYNC.S.F03(TSC) ensure featuremap has the correct bit clear"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "TS4: Check for mandatory attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "TS4: Check for mandatory attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "TS4: Check for optional attribute TimeSource in AttributeList"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "TS4: Check for optional attribute TimeSource not in AttributeList"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "TS4: Check for TZ feature-based attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "TS4: Check for TZ feature-based attributes not in AttributeList"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "TS4: Check for NTPC feature-based attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "TS4: Check for NTPC feature-based attributes not in AttributeList"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "TS4: Check for NTPS feature-based attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "TS4: Check for NTPS feature-based attributes not in AttributeList"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "TS4: Check for TSC feature-based attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "TS4: Check for TSC feature-based attributes not in AttributeList"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, - "TS4: Check for mandatory attributes in AttributeList. 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)"); - 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 23: { - LogStep(23, "TS5: Check for mandatory events in EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::EventList::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "TS5: Check for TZ feature-based events in EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && TIMESYNC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::EventList::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "TS5: Check for TZ feature-based events not in EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && !TIMESYNC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::EventList::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "TS5: Check for TSC feature-based events in EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && TIMESYNC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::EventList::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "TS5: Check for TSC feature-based events not in EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED && !TIMESYNC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::EventList::Id, true, chip::NullOptional); - } - case 28: { - LogStep(28, - "TS5: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 29: { - LogStep(29, "TS6: Check for mandatory commands in AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 30: { - LogStep(30, "TS6: Check for TZ feature-based commands in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, "TS6: Check for TZ feature-based commands in not AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, "TS6: Check for NTPC feature-based commands in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 33: { - LogStep(33, "TS6: Check for NTPC feature-based commands in not AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 34: { - LogStep(34, "TS6: Check for TSC feature-based commands in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 35: { - LogStep(35, "TS6: Check for TSC feature-based commands in not AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 36: { - LogStep(36, - "TS6: Check for mandatory commands in AcceptedCommandList. 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)"); - 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 37: { - LogStep(37, "TS7: Check for TZ feature-based commands in GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("TIMESYNC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 38: { - LogStep(38, "TS7: Check for TZ feature-based commands in not GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("!TIMESYNC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 39: { - LogStep(39, - "TS7: Check for mandatory commands in GeneratedCommandList. 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TIMESYNC_2_3Suite : public TestCommand -{ -public: - Test_TC_TIMESYNC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_TIMESYNC_2_3", 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_TIMESYNC_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::NodeId th_node_id; - uint8_t th_fabric_idx; - - 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)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - th_node_id = value.nodeId; - } - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - th_fabric_idx = value; - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable< - chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("trustedTimeSource", value)); - VerifyOrReturn(CheckValue("trustedTimeSource.Value().fabricIndex", value.Value().fabricIndex, th_fabric_idx)); - VerifyOrReturn(CheckValue("trustedTimeSource.Value().nodeID", value.Value().nodeID, th_node_id)); - VerifyOrReturn(CheckValue("trustedTimeSource.Value().endpoint", value.Value().endpoint, 0U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable< - chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("trustedTimeSource", value)); - } - 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 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 commissioner nodeID and saves as th_node_id"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 2: { - LogStep(2, - "Step 1: TH sends the SetTrustedTimeSource command to the DUT with the TrustedTimeSource fields set as " - "follows: NodeID: th_node_id, Endpoint: 0"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::Type value; - value.trustedTimeSource.SetNonNull(); - - value.trustedTimeSource.Value().nodeID = th_node_id; - value.trustedTimeSource.Value().endpoint = 0U; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetTrustedTimeSource::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, - "Step 2: TH reads from the DUT the CurrentFabricIndex attribute from the Node Operational Credentials Cluster " - "and saves as th_fabric_idx"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3: TH reads from the DUT the TrustedTimeSource attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::TrustedTimeSource::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4: TH sends the SetTrustedTimeSource command to the DUT with the TrustedTimeSource set to null."); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::Type value; - value.trustedTimeSource.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetTrustedTimeSource::Id, value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Step 5: TH reads from the DUT the TrustedTimeSource attribute."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::TrustedTimeSource::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ULABEL_1_1Suite : public TestCommand -{ -public: - Test_TC_ULABEL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ULABEL_1_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ULABEL_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, 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the global attribute: FeatureMap"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, - "Step 4b: Read the global attribute: AttributeList. 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)"); - 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 6: { - LogStep(6, - "Step 5: Read the global attribute: EventList. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 7: { - LogStep(7, - "Step 6: Read the global attribute: AcceptedCommandList. 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)"); - 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 8: { - LogStep(8, - "Step 7: Read the global attribute: GeneratedCommandList. 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ULABEL_2_1Suite : public TestCommand -{ -public: - Test_TC_ULABEL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ULABEL_2_1", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ULABEL_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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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, "Step 1: TH reads LabelList attribute of the DUT"); - VerifyOrDo(!ShouldSkip("ULABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::LabelList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ULABEL_2_2Suite : public TestCommand -{ -public: - Test_TC_ULABEL_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ULABEL_2_2", 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_ULABEL_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; - - 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::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 0)); - VerifyOrReturn( - CheckValueAsString("labelList[0].label", iter_0.GetValue().label, chip::CharSpan("roomName", 8))); - VerifyOrReturn( - CheckValueAsString("labelList[0].value", iter_0.GetValue().value, chip::CharSpan("master bedroom 1", 16))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 1)); - VerifyOrReturn( - CheckValueAsString("labelList[1].label", iter_0.GetValue().label, chip::CharSpan("Orientation", 11))); - VerifyOrReturn(CheckValueAsString("labelList[1].value", iter_0.GetValue().value, chip::CharSpan("east", 4))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 2)); - VerifyOrReturn(CheckValueAsString("labelList[2].label", iter_0.GetValue().label, chip::CharSpan("floor", 5))); - VerifyOrReturn(CheckValueAsString("labelList[2].value", iter_0.GetValue().value, chip::CharSpan("2", 1))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 3)); - VerifyOrReturn( - CheckValueAsString("labelList[3].label", iter_0.GetValue().label, chip::CharSpan("roomType", 8))); - VerifyOrReturn(CheckValueAsString("labelList[3].value", iter_0.GetValue().value, chip::CharSpan("bedroom", 7))); - VerifyOrReturn(CheckNoMoreListItems("labelList", iter_0, 4)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintMinLength("value", value, 4)); - } - 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, "Step 1: TH writes LabelList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("ULABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = chip::Span("roomNamegarbage: not in length on purpose", 8); - listHolder_0->mList[0].value = chip::Span("master bedroom 1garbage: not in length on purpose", 16); - - listHolder_0->mList[1].label = chip::Span("Orientationgarbage: not in length on purpose", 11); - listHolder_0->mList[1].value = chip::Span("eastgarbage: not in length on purpose", 4); - - listHolder_0->mList[2].label = chip::Span("floorgarbage: not in length on purpose", 5); - listHolder_0->mList[2].value = chip::Span("2garbage: not in length on purpose", 1); - - listHolder_0->mList[3].label = chip::Span("roomTypegarbage: not in length on purpose", 8); - listHolder_0->mList[3].value = chip::Span("bedroomgarbage: not in length on purpose", 7); - - value = - chip::app::DataModel::List(listHolder_0->mList, 4); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: TH reads LabelList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("ULABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::LabelList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ULABEL_2_3Suite : public TestCommand -{ -public: - Test_TC_ULABEL_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ULABEL_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_ULABEL_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), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - 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, "Step 1: TH writes LabelList attribute of the DUT"); - VerifyOrDo(!ShouldSkip("ULABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = chip::Span("roomgarbage: not in length on purpose", 4); - listHolder_0->mList[0].value = - chip::Span("17_bytesIsTooLongforuserlabelnotexpectedgarbage: not in length on purpose", 40); - - value = - chip::app::DataModel::List(listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: TH writes LabelList attribute of the DUT"); - VerifyOrDo(!ShouldSkip("ULABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = - chip::Span("17_bytesIsTooLongforuserlabelnotexpectedgarbage: not in length on purpose", 40); - listHolder_0->mList[0].value = chip::Span("foobargarbage: not in length on purpose", 6); - - value = - chip::app::DataModel::List(listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ULABEL_2_4Suite : public TestCommand -{ -public: - Test_TC_ULABEL_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ULABEL_2_4", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ULABEL_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)); - break; - case 2: - 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(CheckNextListItemDecodes("labelList", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("labelList[0].label", iter_0.GetValue().label, chip::CharSpan("room", 4))); - VerifyOrReturn( - CheckValueAsString("labelList[0].value", iter_0.GetValue().value, chip::CharSpan("bedroom 1", 9))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 1)); - VerifyOrReturn( - CheckValueAsString("labelList[1].label", iter_0.GetValue().label, chip::CharSpan("Orientation", 11))); - VerifyOrReturn(CheckValueAsString("labelList[1].value", iter_0.GetValue().value, chip::CharSpan("east", 4))); - VerifyOrReturn(CheckNoMoreListItems("labelList", iter_0, 2)); - } - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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(CheckNextListItemDecodes("labelList", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("labelList[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValueAsString("labelList[0].value", iter_0.GetValue().value, chip::CharSpan("", 0))); - VerifyOrReturn(CheckNoMoreListItems("labelList", iter_0, 1)); - } - } - 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, "Step 1: TH writes LabelList attribute of the DUT"); - VerifyOrDo(!ShouldSkip("ULABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = chip::Span("roomgarbage: not in length on purpose", 4); - listHolder_0->mList[0].value = chip::Span("bedroom 1garbage: not in length on purpose", 9); - - listHolder_0->mList[1].label = chip::Span("Orientationgarbage: not in length on purpose", 11); - listHolder_0->mList[1].value = chip::Span("eastgarbage: not in length on purpose", 4); - - value = - chip::app::DataModel::List(listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: TH reads LabelList attribute of the DUT"); - VerifyOrDo(!ShouldSkip("ULABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::LabelList::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: TH writes LabelList attribute of the DUT"); - VerifyOrDo(!ShouldSkip("ULABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = chip::Span("garbage: not in length on purpose", 0); - listHolder_0->mList[0].value = chip::Span("garbage: not in length on purpose", 0); - - value = - chip::app::DataModel::List(listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: TH reads LabelList attribute of the DUT"); - VerifyOrDo(!ShouldSkip("ULABEL.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UserLabel::Id, UserLabel::Attributes::LabelList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGWIFI_1_1Suite : public TestCommand -{ -public: - Test_TC_DGWIFI_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGWIFI_1_1", 17, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DGWIFI_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)); - { - 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)); - { - 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 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, 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, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 7: - 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, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - } - break; - case 8: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 12UL)); - } - break; - case 9: - 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 10: - 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")); - } - break; - 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, 0UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - } - break; - 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)); - } - break; - case 16: - 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, 2UL)); - } - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads the FeatureMap from DUT"); - VerifyOrDo(!ShouldSkip("( !DGWIFI.S.F00 && !DGWIFI.S.F01 )"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given DGWIFI.S.F00(PacketCounts) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given DGWIFI.S.F01(ErrorCounts) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4b: TH reads Feature dependent(DGWIFI.S.F00) attributes in attributeList from DUT"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4c: TH reads Feature dependent(DGWIFI.S.F01) attributes in attributeList from DUT"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4d: TH reads optional attribute (CurrentMaxRate) in AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 5a: TH reads AcceptedCommandList from DUT"); - VerifyOrDo(!ShouldSkip(" !DGWIFI.S.F01 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 5b: TH reads Feature dependent(DGWIFI.S.F01) command in AcceptedCommandList from DUT"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 6: TH reads GeneratedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 7a: TH reads EventList from DUT"); - VerifyOrDo(!ShouldSkip(" !DGWIFI.S.E00 && !DGWIFI.S.E01 && !DGWIFI.S.E02 && PICS_EVENT_LIST_ENABLED"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 7b: TH reads optional attribute (Disconnection) in EventList from DUT"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.E00 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 7c: TH reads optional attribute (AssociationFailure) in EventList from DUT"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.E01 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 7d: TH reads optional attribute (ConnectionStatus) in EventList from DUT"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.E02 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGWIFI_2_1Suite : public TestCommand -{ -public: - Test_TC_DGWIFI_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGWIFI_2_1", 14, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_DGWIFI_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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "octet_string", "octet_string")); - } - 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", "enum8", "enum8")); - } - 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(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 5U)); - } - break; - case 4: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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(CheckConstraintType("value", "int8s", "int8s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -120)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 0)); - } - 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(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 7: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 9: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 12: - 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", "int64u", "int64u")); - } - break; - case 13: - 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", "int64u", "int64u")); - } - 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 reads BSSID attribute from DUT"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::Bssid::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Reads SecurityType attribute constraints"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::SecurityType::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Reads WiFiVersion attribute constraints"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::WiFiVersion::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: Reads ChannelNumber attribute constraints"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::ChannelNumber::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: Reads RSSI attribute constraints"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::Rssi::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: Reads BeaconLostCount attribute constraints"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::BeaconLostCount::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 8: Reads BeaconRxCount attribute constraints"); - VerifyOrDo(!ShouldSkip("DGWIFI.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::BeaconRxCount::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 9: Reads PacketMulticastRxCount attribute constraints"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 10: Reads PacketMulticastTxCount attribute constraints"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 11: Reads PacketUnicastRxCount attribute constraints"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 12: Reads PacketUnicastTxCount attribute constraints"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 13: Reads CurrentMaxRate attribute constraints"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 14: Reads OverrunCount attribute constraints"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::OverrunCount::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGWIFI_2_3Suite : public TestCommand -{ -public: - Test_TC_DGWIFI_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGWIFI_2_3", 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_DGWIFI_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)); - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 4: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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(CheckConstraintType("value", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - break; - case 7: - 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", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967295UL)); - } - 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: TWait 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 sends ResetCounts command to DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WiFiNetworkDiagnostics::Commands::ResetCounts::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Commands::ResetCounts::Id, value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 2a: Reads BeaconLostCount attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.C00.Rsp && DGWIFI.S.A0005"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::BeaconLostCount::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: Reads BeaconRxCount attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.C00.Rsp && DGWIFI.S.A0006"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::BeaconRxCount::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2c: Reads PacketMulticastRxCount attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.C00.Rsp && DGWIFI.S.A0007"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 2d: Reads PacketMulticastTxCount attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.C00.Rsp && DGWIFI.S.A0008"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 2e: Reads PacketUnicastRxCount attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.C00.Rsp && DGWIFI.S.A0009"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2f: Reads PacketUnicastTxCount attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && DGWIFI.S.C00.Rsp && DGWIFI.S.A000a"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), WiFiNetworkDiagnostics::Id, - WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_1_1Suite : public TestCommand -{ -public: - Test_TC_WNCV_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_1_1", 21, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_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, 5U)); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 5U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 200U)); - } - 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)); - { - 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)); - { - 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, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 13UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 23UL)); - 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 9: - 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, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 13UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 23UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 10: - 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, 26UL)); - } - break; - 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, 16UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 17UL)); - } - 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, 11UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 14UL)); - } - 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, 18UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 19UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 12UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 15UL)); - } - break; - case 15: - 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 16: - 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)); - } - break; - case 17: - 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, 5UL)); - } - break; - case 18: - 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)); - } - break; - case 19: - 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, 8UL)); - } - break; - case 20: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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 reads from the DUT the (0xFFFD) ClusterRevision attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads from the DUT the (0xFFFC) FeatureMap attribute"); - VerifyOrDo(!ShouldSkip("!WNCV.S.F00 && !WNCV.S.F01 && !WNCV.S.F02 && !WNCV.S.F03 && !WNCV.S.F04 "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given WNCV.S.F00(LF) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given WNCV.S.F01(TL) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given WNCV.S.F02(PA_LF) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("WNCV.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given WNCV.S.F03(ABS) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("WNCV.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given WNCV.S.F04(PA_TL) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("WNCV.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4a: TH reads from the DUT the (0xFFFB) AttributeList attribute"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4a: TH reads from the DUT the (0xFFFB) AttributeList attribute"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4b: TH reads optional attribute(SafetyStatus) in AttributeList"); - VerifyOrDo(!ShouldSkip("WNCV.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4c: Read the Feature dependent(WNCV.S.F00 & WNCV.S.F02 & WNCV.S.F03) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4d: Read the Feature dependent(WNCV.S.F00 & WNCV.S.F02 ) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 4e: Read the Feature dependent(WNCV.S.F01 & WNCV.S.F04 & WNCV.S.F03) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 4f: Read the Feature dependent(WNCV.S.F01 & WNCV.S.F04 ) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::AttributeList::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 5: Read the global attribute: EventList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::EventList::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 6a: TH reads from the DUT the (0xFFF9) AcceptedCommandList attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 6b: TH reads Feature dependent(WNCV.S.F00 & WNCV.S.F02) command in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 6c: TH reads Feature dependent(WNCV.S.F01 & WNCV.S.F03) command in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 6d: TH reads Feature dependent(WNCV.S.F01 & WNCV.S.F04) command in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 7: TH reads from the DUT the (0xFFF8) GeneratedCommandList attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_2_1Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_2_1", 26, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_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; - - uint16_t InstalledOpenLimitLift; - uint16_t InstalledClosedLimitLift; - uint16_t InstalledOpenLimitTilt; - uint16_t InstalledClosedLimitTilt; - - 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)); - { - chip::app::Clusters::WindowCovering::Type value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::WindowCovering::EndProductType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 23U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 15U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - 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", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - 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(CheckConstraintType("value", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - break; - case 9: - 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", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - 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(CheckConstraintType("value", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - InstalledOpenLimitLift = value; - } - break; - case 12: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - InstalledClosedLimitLift = value; - } - break; - case 13: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - InstalledOpenLimitTilt = value; - } - break; - case 14: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - InstalledClosedLimitTilt = value; - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap16", "bitmap16")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2047U)); - } - break; - case 16: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 17: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 18: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 19: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, InstalledOpenLimitLift)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, InstalledClosedLimitLift)); - } - break; - case 20: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 21: - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, InstalledOpenLimitTilt)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, InstalledClosedLimitTilt)); - } - break; - case 22: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 23: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 24: - 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", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - break; - case 25: - 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", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - 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 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, "Step 1a: read the RO mandatory attribute default: Type"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Type::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: read the RO mandatory attribute default: ConfigStatus"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 1c: read the RO mandatory attribute default: OperationalStatus"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 1d: read the RO mandatory attribute default: EndProductType"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::EndProductType::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 1e: read the RW mandatory attribute default: Mode"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 1f: write a value into the RW mandatory attribute:: Mode"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(0U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2a: read the RO optional attribute default: TargetPositionLiftPercent100ths"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 2b: read the RO optional attribute default: TargetPositionTiltPercent100ths"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 2c: read the RO optional attribute default: CurrentPositionLiftPercent100ths"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 2d: read the RO optional attribute default: CurrentPositionTiltPercent100ths"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 2e: read the RO optional attribute default: InstalledOpenLimitLift"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0010"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::InstalledOpenLimitLift::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 2f: read the RO optional attribute default: InstalledClosedLimitLift"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::InstalledClosedLimitLift::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 2g: read the RO optional attribute default: InstalledOpenLimitTilt"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0012"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::InstalledOpenLimitTilt::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 2h: read the RO optional attribute default: InstalledClosedLimitTilt"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::InstalledClosedLimitTilt::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 3a: read the RO mandatory attribute default: SafetyStatus"); - VerifyOrDo(!ShouldSkip("WNCV.S.A001a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::SafetyStatus::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 3b: read the RO optional attribute default: PhysicalClosedLimitLift"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::PhysicalClosedLimitLift::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 3c: read the RO optional attribute default: PhysicalClosedLimitTilt"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::PhysicalClosedLimitTilt::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 3d: read the RO optional attribute default: CurrentPositionLift"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0003 && !WNCV.S.A0010 && !WNCV.S.A0011"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLift::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 3d: read the RO optional attribute default: CurrentPositionLift"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0003 && WNCV.S.A0010 && WNCV.S.A0011"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLift::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 3e: read the RO optional attribute default: CurrentPositionTilt"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0004 && !WNCV.S.A0012 && !WNCV.S.A0013"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTilt::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 3e: read the RO optional attribute default: CurrentPositionTilt"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0004 && WNCV.S.A0012 && WNCV.S.A0013"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTilt::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 3f: read the RO optional attribute default: NumberOfActuationsLift"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::NumberOfActuationsLift::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 3g: read the RO optional attribute default: NumberOfActuationsTilt"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::NumberOfActuationsTilt::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 3h: read the RO optional attribute default: CurrentPositionLiftPercentage"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, true, chip::NullOptional); - } - case 25: { - LogStep(25, "Step 3i:read the RO optional attribute default: CurrentPositionTiltPercentage"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_2_2Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_2_2", 6, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_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; - - 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)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", 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, "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 1a: Reads ConfigStatus attribute from DUT, if (WNCV.S.F00(LF) & WNCV.S.F02(PA_LF)) value of bit 3 must " - "be 1b else 0b"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0007 && WNCV.S.F00 && WNCV.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, - "Step 1b: Reads ConfigStatus attribute from DUT, if (WNCV.S.F00(LF) & WNCV.S.F02(PA_LF)) value of bit 3 must " - "be 1b else 0b"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0007 && !WNCV.S.F00 && !WNCV.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, - "Step 1c: Reads ConfigStatus attribute from DUT, if (WNCV.S.F01(TL) & WNCV.S.F04(PA_TL)) value of bit 4 must " - "be 1b else 0b,"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0007 && WNCV.S.F01 && WNCV.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, - "Step 1d: Reads ConfigStatus attribute from DUT, if (WNCV.S.F01(TL) & WNCV.S.F04(PA_TL)) value of bit 4 must " - "be 1b else 0b,"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0007 && !WNCV.S.F01 && !WNCV.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 1e: Reads ConfigStatus attribute from DUT, value of bit 0 must be 1b (operational)"); - VerifyOrDo(!ShouldSkip("WNCV.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_2_3Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_2_3", 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_WNCV_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::BitMask configStatusValA; - chip::BitMask configStatusValB; - - 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::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 4U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127U)); - configStatusValA = value; - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127U)); - } - 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), EMBER_ZCL_STATUS_BUSY)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127U)); - configStatusValB = value; - } - 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)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127U)); - } - 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 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 1a: TH set the Mode Attribute bit0 of the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Reversal && WNCV.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(1U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: TH reads ConfigStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Reversal && WNCV.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 1c: TH clear the Mode Attribute bit0 of the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Reversal && WNCV.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(0U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 1d: TH reads ConfigStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Reversal && WNCV.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 2a: TH set the Mode Attribute bit1 of the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Calibration && WNCV.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(2U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 2b: TH reads ConfigStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Calibration && WNCV.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2c: If (ConfigStatus bit0 == 0) TH send DownOrClose command to the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Calibration && WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 2d: TH clear the Mode Attribute bit1 of the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Calibration && WNCV.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(0U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 2e: TH reads ConfigStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Calibration && WNCV.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 2f: TH reads the Mode Attribute from the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Calibration && WNCV.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 2g: TH send DownOrClose command to the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Calibration && WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Step 3a: TH set the Mode Attribute bit2 of the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Maintenance && WNCV.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(4U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3b: TH send DownOrClose command to the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Maintenance && WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Step 3c: TH reads ConfigStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Maintenance && WNCV.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 3d: TH clear the Mode Attribute bit2 of the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Maintenance && WNCV.S.A0017"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(0U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::Mode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 3e: TH send DownOrClose command to the DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Maintenance && WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Step 3f: TH reads ConfigStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.M.Maintenance && WNCV.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::ConfigStatus::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_2_5Suite : public TestCommand -{ -public: - Test_TC_WNCV_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_2_5", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_2_5Suite() {} - - 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)); - { - chip::app::Clusters::WindowCovering::EndProductType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 23U)); - } - 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, "Step 1: TH reads EndProductType attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000d"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Attributes::EndProductType::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_3_1Suite : public TestCommand -{ -public: - Test_TC_WNCV_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_3_1", 30, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_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 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(CheckConstraintType("value", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - break; - case 4: - 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", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - 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(CheckConstraintType("value", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - 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(CheckConstraintType("value", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - } - 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(CheckValueNonNull("targetPositionLiftPercent100ths", value)); - VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", value.Value(), 0U)); - } - 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("targetPositionTiltPercent100ths", value)); - VerifyOrReturn(CheckValue("targetPositionTiltPercent100ths.Value()", value.Value(), 0U)); - } - 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)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1U)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4U)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4U)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16U)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16U)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32U)); - } - 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)); - shouldContinue = true; - break; - case 20: - 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", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); - } - break; - case 21: - 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", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 99U)); - } - break; - case 22: - 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", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); - } - break; - case 23: - 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", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 99U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalStatus", value, 0U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); - } - break; - case 29: - 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", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); - } - 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 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, "Step 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"); - VerifyOrDo(!ShouldSkip("WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1b: TH Waits for 10 seconds movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 1d: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 1e: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 1f: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2: Subscribe to DUT reports on OperationalStatus attribute"); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, 4, 5, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 8: { - LogStep(8, "Step 2a: TH sends UpOrOpen command to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 2b: DUT updates its attributes"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 2d: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 2e: TH leave the device moving for 2 seconds"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 3a: TH reads OperationalStatus attribute's bit 0..1"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3a: TH reads OperationalStatus attribute's bit 2..3 (WNCV.S.F00(LF))"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a && WNCV.S.F00 && PICS_SDK_CI_ONLY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 3a: TH reads OperationalStatus attribute's bit 2..3 (WNCV.S.F00(LF))"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a && !WNCV.S.F00 && PICS_SDK_CI_ONLY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 3a: TH reads OperationalStatus attribute's bit 4..5 (WNCV.S.F01(TL))"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a && WNCV.S.F01 && PICS_SDK_CI_ONLY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 3a: TH reads OperationalStatus attribute's bit 4..5 (WNCV.S.F01(TL))"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a && !WNCV.S.F01 && PICS_SDK_CI_ONLY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 3a: TH reads OperationalStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 3a2: DUT updates its attributes"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 3000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 3b: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 3c: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 3d: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 3e: If (PA & LF) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 4a: TH sends a StopMotion command to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::StopMotion::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::StopMotion::Id, value, - chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Step 4b: TH waits for 3 seconds the end of inertial movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 3000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 26: { - LogStep(26, "Step 4c: Verify DUT update OperationalStatus attribute to TH after a StopMotion"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 5a: TH waits for x seconds attributes update on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 28: { - LogStep(28, "Step 5b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 5c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_3_2Suite : public TestCommand -{ -public: - Test_TC_WNCV_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_3_2", 30, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_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 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(CheckConstraintType("value", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); - } - break; - case 4: - 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", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 99U)); - } - 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(CheckConstraintType("value", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); - } - 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(CheckConstraintType("value", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 99U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - } - 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(CheckValueNonNull("targetPositionLiftPercent100ths", value)); - VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", value.Value(), 10000U)); - } - 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("targetPositionTiltPercent100ths", value)); - VerifyOrReturn(CheckValue("targetPositionTiltPercent100ths.Value()", value.Value(), 10000U)); - } - 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)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2U)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8U)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4U)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32U)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16U)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32U)); - } - 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)); - shouldContinue = true; - break; - case 20: - 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", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - break; - case 21: - 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", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - break; - case 22: - 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", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - break; - case 23: - 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", "Percent", "Percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalStatus", value, 0U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - break; - case 29: - 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", "Percent100ths", "Percent100ths")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - 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 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, "Step 1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction"); - VerifyOrDo(!ShouldSkip("WNCV.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1b: TH Waits for 10 seconds movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 1d: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 1e: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 1f: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 2: Subscribe to DUT reports on OperationalStatus attribute"); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, 4, 5, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 8: { - LogStep(8, "Step 2a: TH sends DownOrClose command to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 2b: DUT updates its attributes"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 2d: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 2e: TH leave the device moving for 2 seconds"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 3a: TH reads OperationalStatus attribute's bit 0..1"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 3a: TH reads OperationalStatus attribute's bit 2..3 (WNCV.S.F00(LF))"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a && WNCV.S.F00 && PICS_SDK_CI_ONLY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 3a: TH reads OperationalStatus attribute's bit 2..3 (WNCV.S.F00(LF))"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a && !WNCV.S.F00 && PICS_SDK_CI_ONLY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 3a: TH reads OperationalStatus attribute's bit 4..5 (WNCV.S.F01(TL))"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a && WNCV.S.F01 && PICS_SDK_CI_ONLY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 3a: TH reads OperationalStatus attribute's bit 4..5 (WNCV.S.F01(TL))"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a && !WNCV.S.F01 && PICS_SDK_CI_ONLY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 3a: TH reads OperationalStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 3a2: DUT updates its attributes"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 3000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 3b: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 21: { - LogStep(21, "Step 3c: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 3d: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 3e: If (PA & LF) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 4a: TH sends a StopMotion command to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::StopMotion::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::StopMotion::Id, value, - chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Step 4b: TH waits for 3 seconds the end of inertial movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 3000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 26: { - LogStep(26, "Step 4c: Verify DUT update OperationalStatus attribute to TH after a StopMotion"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 5a: TH waits for x seconds attributes update on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 28: { - LogStep(28, "Step 5b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 5c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_3_3Suite : public TestCommand -{ -public: - Test_TC_WNCV_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_3_3", 17, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_3_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::app::DataModel::Nullable attrCurrentPositionLift; - chip::app::DataModel::Nullable attrCurrentPositionTilt; - - 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)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); - } - 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::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalStatus", value, 0U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalStatus", value, 0U)); - } - break; - case 13: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - attrCurrentPositionLift = value; - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (attrCurrentPositionLift.IsNull()) - { - VerifyOrReturn(CheckValueNull("targetPositionLiftPercent100ths", value)); - } - else - { - VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", value)); - VerifyOrReturn( - CheckValue("targetPositionLiftPercent100ths.Value()", value.Value(), attrCurrentPositionLift.Value())); - } - } - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - attrCurrentPositionTilt = value; - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (attrCurrentPositionTilt.IsNull()) - { - VerifyOrReturn(CheckValueNull("targetPositionTiltPercent100ths", value)); - } - else - { - VerifyOrReturn(CheckValueNonNull("targetPositionTiltPercent100ths", value)); - VerifyOrReturn( - CheckValue("targetPositionTiltPercent100ths.Value()", value.Value(), attrCurrentPositionTilt.Value())); - } - } - 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 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, "Step 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"); - VerifyOrDo(!ShouldSkip("WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1b: TH Waits for 6-8 seconds movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 6000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 1c: TH sends UpOrOpen command to preposition the DUT in the opposite direction"); - VerifyOrDo(!ShouldSkip("WNCV.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 1d: TH Waits for 2 seconds movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 1e: TH reads OperationalStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 1d: TH Waits for 2 seconds movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2: Subscribe to DUT reports on OperationalStatus attribute"); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, 4, 5, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 8: { - LogStep(8, "Step 2a: TH sends a StopMotion command to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::StopMotion::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::StopMotion::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 2b: TH waits for 3 seconds the end of inertial movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 3000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 2c: TH reads OperationalStatus attribute from DUT after a StopMotion"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 2d: TH waits for 100ms - 3s attributes update on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 2000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Step 2e: TH reads OperationalStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 3b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute 3c: it Must be equal with " - "CurrentPositionLiftPercent100ths from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000b && WNCV.S.A000e"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, - "Step 4b: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute 4c: it Must be equal with " - "CurrentPositionTiltPercent100ths from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000c && WNCV.S.A000f && PICS_SKIP_SAMPLE_APP"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_3_4Suite : public TestCommand -{ -public: - Test_TC_WNCV_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_3_4", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("fastMotionDuration", 0, UINT16_MAX, &mFastMotionDuration); - AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_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 mFastMotionDuration; - chip::Optional mFullMotionDuration; - 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)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalStatus", value, 0U)); - } - 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("currentPositionLiftPercent100ths", value)); - VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", value.Value(), 0U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercentage", value)); - VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", value.Value(), 0U)); - } - 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("currentPositionTiltPercent100ths", value)); - VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", value.Value(), 0U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercentage", value)); - VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", value.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 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, "Step 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"); - VerifyOrDo(!ShouldSkip("WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1b: TH Waits for fastMotionDuration seconds movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mFastMotionDuration.HasValue() ? mFastMotionDuration.Value() : 3000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2a: TH sends UpOrOpen command to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 2b: TH Waits for fullMotionDuration seconds movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2c: TH reads OperationalStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_3_5Suite : public TestCommand -{ -public: - Test_TC_WNCV_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_3_5", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("fastMotionDuration", 0, UINT16_MAX, &mFastMotionDuration); - AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_3_5Suite() {} - - 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 mFastMotionDuration; - chip::Optional mFullMotionDuration; - 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)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalStatus", value, 0U)); - } - 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("currentPositionLiftPercent100ths", value)); - VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", value.Value(), 10000U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercentage", value)); - VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", value.Value(), 100U)); - } - 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("currentPositionTiltPercent100ths", value)); - VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", value.Value(), 10000U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercentage", value)); - VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", value.Value(), 100U)); - } - 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 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, "Step 1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction"); - VerifyOrDo(!ShouldSkip("WNCV.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1b: TH Waits for fastMotionDuration seconds movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mFastMotionDuration.HasValue() ? mFastMotionDuration.Value() : 3000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2a: TH sends DownOrClose command to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 2b: TH Waits for fullMotionDuration seconds movement(s) on the device"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 2c: TH reads OperationalStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_4_1Suite : public TestCommand -{ -public: - Test_TC_WNCV_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_4_1", 18, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_4_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 mFullMotionDuration; - 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(CheckConstraintNotValue("value", value, 0U)); - } - 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("targetPositionLiftPercent100ths", value)); - VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", value.Value(), 2500U)); - } - 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)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalStatus", value, 0U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", value)); - VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", value.Value(), 2500U)); - } - 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(CheckValueNonNull("currentPositionLiftPercentage", value)); - VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", value.Value(), 25U)); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("targetPositionLiftPercent100ths", value)); - VerifyOrReturn(CheckValue("targetPositionLiftPercent100ths.Value()", value.Value(), 7520U)); - } - 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::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalStatus", value, 0U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", value)); - VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", value.Value(), 7520U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercentage", value)); - VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", value.Value(), 75U)); - } - 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 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, "Step 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"); - VerifyOrDo(!ShouldSkip("WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1b: TH waits for x seconds movement(s) on the DUT"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2a: TH sends GoToLiftPercentage command with 25 percent to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; - value.liftPercent100thsValue = 2500U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, - value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 2b: DUT updates its attributes"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3a: TH set a timeout of X minutes for failure"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 3b: TH reads OperationalStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3d: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4a: TH sends GoToLiftPercentage command with 75.20 percent to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; - value.liftPercent100thsValue = 7520U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, - value, chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Step 4b: DUT updates its attributes"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 4c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 5a: TH waits for x seconds movement(s) on the DUT"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "Step 5b: TH reads OperationalStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 5c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 5d: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_4_2Suite : public TestCommand -{ -public: - Test_TC_WNCV_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_4_2", 18, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_4_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 mFullMotionDuration; - 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(CheckConstraintNotValue("value", value, 0U)); - } - 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("targetPositionTiltPercent100ths", value)); - VerifyOrReturn(CheckValue("targetPositionTiltPercent100ths.Value()", value.Value(), 3000U)); - } - 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)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalStatus", value, 0U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", value)); - VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", value.Value(), 3000U)); - } - 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(CheckValueNonNull("currentPositionTiltPercentage", value)); - VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", value.Value(), 30U)); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("targetPositionTiltPercent100ths", value)); - VerifyOrReturn(CheckValue("targetPositionTiltPercent100ths.Value()", value.Value(), 6005U)); - } - 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::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalStatus", value, 0U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", value)); - VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", value.Value(), 6005U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercentage", value)); - VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", value.Value(), 60U)); - } - 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 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, "Step 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"); - VerifyOrDo(!ShouldSkip("WNCV.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::DownOrClose::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1b: TH waits for x seconds movement(s) on the DUT"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 1c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2a: TH sends GoToTiltPercentage command with 30 percent to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; - value.tiltPercent100thsValue = 3000U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, - value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 2b: DUT updates its attributes"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 2c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3a: TH set a timeout of X minutes for failure"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 3b: TH reads OperationalStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4a: TH sends GoToTiltPercentage command with 60.05 percent to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; - value.tiltPercent100thsValue = 6005U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, - value, chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Step 4b: DUT updates its attributes"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 4c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 5a: TH waits for x seconds movement(s) on the DUT"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "Step 5b: TH reads OperationalStatus attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::OperationalStatus::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 5c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 5d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_4_3Suite : public TestCommand -{ -public: - Test_TC_WNCV_4_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_4_3", 6, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_4_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::app::DataModel::Nullable attrCurrentPositionLiftPercent100ths; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - attrCurrentPositionLiftPercent100ths = 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(CheckValueNonNull("currentPositionLiftPercentage", value)); - VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", value.Value(), - static_cast(attrCurrentPositionLiftPercent100ths.Value() / 100))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - 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 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, "Step 1a: If (PA_LF & LF) TH reads CurrentPositionLiftPercent100ths from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, - "Step 1b 1c: If (PA_LF & LF) TH reads CurrentPositionLiftPercentage from DUT + assert " - "CurrentPositionLiftPercent100ths/100 equals CurrentPositionLiftPercentage"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A0008 && WNCV.S.A000e"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: TH sends GoToLiftPercentage command with BadParam to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 || WNCV.S.F00 && WNCV.S.C05.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; - value.liftPercent100thsValue = 12288U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 3a: TH sends GoToLiftPercentage command with 10001 to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 || WNCV.S.F00 && WNCV.S.C05.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; - value.liftPercent100thsValue = 10001U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, - value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 || WNCV.S.F00 && WNCV.S.C05.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; - value.liftPercent100thsValue = 65535U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, - value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_4_4Suite : public TestCommand -{ -public: - Test_TC_WNCV_4_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_4_4", 6, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_4_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::app::DataModel::Nullable attrCurrentPositionTiltPercent100ths; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - attrCurrentPositionTiltPercent100ths = 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(CheckValueNonNull("currentPositionTiltPercentage", value)); - VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", value.Value(), - static_cast(attrCurrentPositionTiltPercent100ths.Value() / 100))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - 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 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, "Step 1a: If (PA_TL & TL) TH reads CurrentPositionTiltPercent100ths from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, - "Step 1b 1c: If (PA_LF & LF) TH reads CurrentPositionTiltPercentage from DUT + assert " - "CurrentPositionTiltPercent100ths/100 equals CurrentPositionTiltPercentage"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f && WNCV.S.A0009"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2b: TH sends GoToTiltPercentage command with BadParam to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 || WNCV.S.F01 && WNCV.S.C08.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; - value.tiltPercent100thsValue = 12288U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 3a: TH sends GoToTiltPercentage command with 10001 to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 || WNCV.S.F01 && WNCV.S.C08.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; - value.tiltPercent100thsValue = 10001U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, - value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 || WNCV.S.F01 && WNCV.S.C08.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; - value.tiltPercent100thsValue = 65535U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, - value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WNCV_4_5Suite : public TestCommand -{ -public: - Test_TC_WNCV_4_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_WNCV_4_5", 17, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_WNCV_4_5Suite() {} - - 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::app::DataModel::Nullable attrCurrentPositionLiftPercent100ths; - chip::app::DataModel::Nullable attrCurrentPositionTiltPercent100ths; - - 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)); - shouldContinue = true; - 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)); - 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(CheckConstraintNotValue("value", value, 0U)); - attrCurrentPositionLiftPercent100ths = value; - } - 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(CheckConstraintNotValue("value", value, 0U)); - attrCurrentPositionTiltPercent100ths = value; - } - 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)); - shouldContinue = true; - 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))); - if (attrCurrentPositionLiftPercent100ths.IsNull()) - { - VerifyOrReturn(CheckValueNull("currentPositionLiftPercent100ths", value)); - } - else - { - VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", value)); - VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", value.Value(), - attrCurrentPositionLiftPercent100ths.Value())); - } - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (attrCurrentPositionTiltPercent100ths.IsNull()) - { - VerifyOrReturn(CheckValueNull("currentPositionTiltPercent100ths", value)); - } - else - { - VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", value)); - VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", value.Value(), - attrCurrentPositionTiltPercent100ths.Value())); - } - } - 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 0a: 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 0b: TH sends UpOrOpen command to preposition the DUT"); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::UpOrOpen::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Step 1a: If (PA_LF & LF) TH sends GoToLiftPercentage command with 90%% to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.C05.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type value; - value.liftPercent100thsValue = 9000U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToLiftPercentage::Id, - value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 1b: TH Waits for 100ms-1s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Step 1c: TH sends StopMotion command to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::StopMotion::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::StopMotion::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 1d: TH Waits for 100ms-1s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 500UL; - return WaitForMs(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 2a: If (PA_TL & TL) TH sends GoToTiltPercentage command with 90%% to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.C08.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type value; - value.tiltPercent100thsValue = 9000U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::GoToTiltPercentage::Id, - value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Step 2b: TH Waits for 100ms-1s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 2c: TH sends StopMotion command to DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::WindowCovering::Commands::StopMotion::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, WindowCovering::Commands::StopMotion::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 2d: TH Waits for 100ms-1s"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 500UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Step 3a: TH reads CurrentPositionLiftPercent100ths from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3b: TH reads CurrentPositionTiltPercent100ths from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3c: reboot/restart the DUT"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step Reboot target device(DUT)"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - 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(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 3d: 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 15: { - LogStep(15, "Step 3e: TH reads CurrentPositionLiftPercent100ths from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F00 && WNCV.S.F02 && WNCV.S.A000e"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 3f: TH reads CurrentPositionTiltPercent100ths from DUT"); - VerifyOrDo(!ShouldSkip("WNCV.S.F01 && WNCV.S.F04 && WNCV.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WindowCovering::Id, - WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_TargetNavigatorClusterSuite : public TestCommand -{ -public: - TV_TargetNavigatorClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_TargetNavigatorCluster", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_TargetNavigatorClusterSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("targetList", iter_0, 0)); - VerifyOrReturn(CheckValue("targetList[0].identifier", iter_0.GetValue().identifier, 1U)); - VerifyOrReturn( - CheckValueAsString("targetList[0].name", iter_0.GetValue().name, chip::CharSpan("exampleName", 11))); - VerifyOrReturn(CheckNextListItemDecodes("targetList", iter_0, 1)); - VerifyOrReturn(CheckValue("targetList[1].identifier", iter_0.GetValue().identifier, 2U)); - VerifyOrReturn( - CheckValueAsString("targetList[1].name", iter_0.GetValue().name, chip::CharSpan("exampleName", 11))); - VerifyOrReturn(CheckNoMoreListItems("targetList", iter_0, 2)); - } - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentTarget", value, 0U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - 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 attribute Target Navigator list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, TargetNavigator::Attributes::TargetList::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read attribute current navigator target"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, - TargetNavigator::Attributes::CurrentTarget::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Navigate Target Request Command"); - ListFreer listFreer; - chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Type value; - value.target = 1U; - value.data.Emplace(); - value.data.Value() = chip::Span("1garbage: not in length on purpose", 1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), TargetNavigator::Id, TargetNavigator::Commands::NavigateTarget::Id, - value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_AudioOutputClusterSuite : public TestCommand -{ -public: - TV_AudioOutputClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_AudioOutputCluster", 6, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_AudioOutputClusterSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 0)); - VerifyOrReturn(CheckValue("outputList[0].index", iter_0.GetValue().index, 1U)); - VerifyOrReturn(CheckValue("outputList[0].outputType", iter_0.GetValue().outputType, 0U)); - VerifyOrReturn(CheckValueAsString("outputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 1)); - VerifyOrReturn(CheckValue("outputList[1].index", iter_0.GetValue().index, 2U)); - VerifyOrReturn(CheckValue("outputList[1].outputType", iter_0.GetValue().outputType, 0U)); - VerifyOrReturn(CheckValueAsString("outputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 2)); - VerifyOrReturn(CheckValue("outputList[2].index", iter_0.GetValue().index, 3U)); - VerifyOrReturn(CheckValue("outputList[2].outputType", iter_0.GetValue().outputType, 0U)); - VerifyOrReturn(CheckValueAsString("outputList[2].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckNoMoreListItems("outputList", iter_0, 3)); - } - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentOutput", value, 1U)); - } - 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::DecodableList - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 0)); - VerifyOrReturn(CheckValue("outputList[0].index", iter_0.GetValue().index, 1U)); - VerifyOrReturn(CheckValue("outputList[0].outputType", iter_0.GetValue().outputType, 0U)); - VerifyOrReturn( - CheckValueAsString("outputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI Test", 9))); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 1)); - VerifyOrReturn(CheckValue("outputList[1].index", iter_0.GetValue().index, 2U)); - VerifyOrReturn(CheckValue("outputList[1].outputType", iter_0.GetValue().outputType, 0U)); - VerifyOrReturn(CheckValueAsString("outputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckNextListItemDecodes("outputList", iter_0, 2)); - VerifyOrReturn(CheckValue("outputList[2].index", iter_0.GetValue().index, 3U)); - VerifyOrReturn(CheckValue("outputList[2].outputType", iter_0.GetValue().outputType, 0U)); - VerifyOrReturn(CheckValueAsString("outputList[2].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckNoMoreListItems("outputList", iter_0, 3)); - } - } - 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 attribute Audio Output list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::OutputList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Read attribute current audio output"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::CurrentOutput::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Select Output Command"); - ListFreer listFreer; - chip::app::Clusters::AudioOutput::Commands::SelectOutput::Type value; - value.index = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Commands::SelectOutput::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Rename Output Command"); - ListFreer listFreer; - chip::app::Clusters::AudioOutput::Commands::RenameOutput::Type value; - value.index = 1U; - value.name = chip::Span("HDMI Testgarbage: not in length on purpose", 9); - return SendCommand(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Commands::RenameOutput::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Read attribute Audio Output list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), AudioOutput::Id, AudioOutput::Attributes::OutputList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_ApplicationLauncherClusterSuite : public TestCommand -{ -public: - TV_ApplicationLauncherClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_ApplicationLauncherCluster", 6, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_ApplicationLauncherClusterSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("catalogList", iter_0, 0)); - VerifyOrReturn(CheckValue("catalogList[0]", iter_0.GetValue(), 123U)); - VerifyOrReturn(CheckNextListItemDecodes("catalogList", iter_0, 1)); - VerifyOrReturn(CheckValue("catalogList[1]", iter_0.GetValue(), 456U)); - VerifyOrReturn(CheckNoMoreListItems("catalogList", iter_0, 2)); - } - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable< - chip::app::Clusters::ApplicationLauncher::Structs::ApplicationEPStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("currentApp", value)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), - chip::ByteSpan(chip::Uint8::from_const_char("data"), 4))); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), - chip::ByteSpan(chip::Uint8::from_const_char("data"), 4))); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), - chip::ByteSpan(chip::Uint8::from_const_char("data"), 4))); - } - 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 attribute Application Launcher list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::CatalogList::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read attribute application launcher app"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Attributes::CurrentApp::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Launch App Command"); - ListFreer listFreer; - chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type value; - value.application.Emplace(); - - value.application.Value().catalogVendorID = 123U; - value.application.Value().applicationID = chip::Span("applicationIdgarbage: not in length on purpose", 13); - - value.data.Emplace(); - value.data.Value() = chip::ByteSpan(chip::Uint8::from_const_char("datagarbage: not in length on purpose"), 4); - return SendCommand(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, - ApplicationLauncher::Commands::LaunchApp::Id, value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Stop App Command"); - ListFreer listFreer; - chip::app::Clusters::ApplicationLauncher::Commands::StopApp::Type value; - value.application.Emplace(); - - value.application.Value().catalogVendorID = 123U; - value.application.Value().applicationID = chip::Span("applicationIdgarbage: not in length on purpose", 13); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, ApplicationLauncher::Commands::StopApp::Id, - value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Hide App Command"); - ListFreer listFreer; - chip::app::Clusters::ApplicationLauncher::Commands::HideApp::Type value; - value.application.Emplace(); - - value.application.Value().catalogVendorID = 123U; - value.application.Value().applicationID = chip::Span("applicationIdgarbage: not in length on purpose", 13); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), ApplicationLauncher::Id, ApplicationLauncher::Commands::HideApp::Id, - value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_KeypadInputClusterSuite : public TestCommand -{ -public: - TV_KeypadInputClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_KeypadInputCluster", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_KeypadInputClusterSuite() {} - - 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)); - { - chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 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, "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, "Send Key Command"); - ListFreer listFreer; - chip::app::Clusters::KeypadInput::Commands::SendKey::Type value; - value.keyCode = static_cast(3); - return SendCommand(kIdentityAlpha, GetEndpoint(1), KeypadInput::Id, KeypadInput::Commands::SendKey::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_AccountLoginClusterSuite : public TestCommand -{ -public: - TV_AccountLoginClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_AccountLoginCluster", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_AccountLoginClusterSuite() {} - - 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)); - { - chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("setupPIN", value.setupPIN, chip::CharSpan("tempPin123", 10))); - } - 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; - 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, "Get Setup PIN Command"); - ListFreer listFreer; - chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Type value; - value.tempAccountIdentifier = chip::Span("asdfgarbage: not in length on purpose", 4); - return SendCommand(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Commands::GetSetupPIN::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Login Command"); - ListFreer listFreer; - chip::app::Clusters::AccountLogin::Commands::Login::Type value; - value.tempAccountIdentifier = chip::Span("asdfgarbage: not in length on purpose", 4); - value.setupPIN = chip::Span("tempPin123garbage: not in length on purpose", 10); - return SendCommand(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Commands::Login::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Logout Command"); - ListFreer listFreer; - chip::app::Clusters::AccountLogin::Commands::Logout::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(3), AccountLogin::Id, AccountLogin::Commands::Logout::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_WakeOnLanClusterSuite : public TestCommand -{ -public: - TV_WakeOnLanClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_WakeOnLanCluster", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_WakeOnLanClusterSuite() {} - - 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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value", value, 3)); - } - 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 mac address"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WakeOnLan::Id, WakeOnLan::Attributes::MACAddress::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_ApplicationBasicClusterSuite : public TestCommand -{ -public: - TV_ApplicationBasicClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_ApplicationBasicCluster", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_ApplicationBasicClusterSuite() {} - - 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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("vendorName", value, chip::CharSpan("exampleVendorName1", 18))); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorID", value, 1U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("applicationName", value, chip::CharSpan("exampleName1", 12))); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("productID", value, 1U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ApplicationBasic::Structs::ApplicationStruct::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("application.catalogVendorID", value.catalogVendorID, 123U)); - VerifyOrReturn( - CheckValueAsString("application.applicationID", value.applicationID, chip::CharSpan("applicationId", 13))); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("applicationVersion", value, chip::CharSpan("exampleVersion", 14))); - } - break; - case 8: - 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(CheckNextListItemDecodes("allowedVendorList", iter_0, 0)); - VerifyOrReturn(CheckValue("allowedVendorList[0]", iter_0.GetValue(), 1U)); - VerifyOrReturn(CheckNextListItemDecodes("allowedVendorList", iter_0, 1)); - VerifyOrReturn(CheckValue("allowedVendorList[1]", iter_0.GetValue(), 456U)); - VerifyOrReturn(CheckNoMoreListItems("allowedVendorList", iter_0, 2)); - } - } - 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 attribute vendor name"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::VendorName::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read attribute vendor id"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::VendorID::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Read attribute application name"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::ApplicationName::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Read attribute product id"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::ProductID::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Read attribute application status"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, ApplicationBasic::Attributes::Status::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Read attribute application status"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::Application::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Read attribute application version"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::ApplicationVersion::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Read attribute application allowed vendor list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), ApplicationBasic::Id, - ApplicationBasic::Attributes::AllowedVendorList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_MediaPlaybackClusterSuite : public TestCommand -{ -public: - TV_MediaPlaybackClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_MediaPlaybackCluster", 22, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_MediaPlaybackClusterSuite() {} - - 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)); - { - chip::app::Clusters::MediaPlayback::PlaybackStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentState", value, 0U)); - } - 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(CheckValueNonNull("startTime", value)); - VerifyOrReturn(CheckValue("startTime.Value()", value.Value(), 0ULL)); - } - 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("duration", value)); - VerifyOrReturn(CheckValue("duration.Value()", value.Value(), 80000ULL)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); - VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", value.Value().updatedAt, 0ULL)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 0ULL)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("playbackSpeed", value, 0.0f)); - } - 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("seekRangeEnd", value)); - VerifyOrReturn(CheckValue("seekRangeEnd.Value()", value.Value(), 80000ULL)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("seekRangeStart", value)); - VerifyOrReturn(CheckValue("seekRangeStart.Value()", value.Value(), 0ULL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); - VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", value.Value().updatedAt, 0ULL)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 500ULL)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); - VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", value.Value().updatedAt, 0ULL)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 400ULL)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("sampledPosition", value)); - VerifyOrReturn(CheckValue("sampledPosition.Value().updatedAt", value.Value().updatedAt, 0ULL)); - VerifyOrReturn(CheckValueNonNull("sampledPosition.Value().position", value.Value().position)); - VerifyOrReturn(CheckValue("sampledPosition.Value().position.Value()", value.Value().position.Value(), 1000ULL)); - } - 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 attribute playback state"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::CurrentState::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read attribute start time"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::StartTime::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Read attribute duration"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::Duration::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Read attribute position"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Read attribute playback speed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::PlaybackSpeed::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Read attribute seek range end"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SeekRangeEnd::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Read attribute seek range start"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SeekRangeStart::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Media Playback Play Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Play::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Play::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Media Playback Pause Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Pause::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Pause::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Media Playback Stop Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Stop::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Stop::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Media Playback Start Over Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::StartOver::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::StartOver::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Media Playback Previous Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Previous::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Previous::Id, value, - chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Media Playback Next Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Next::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Next::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Media Playback Rewind Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Rewind::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Rewind::Id, value, - chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Media Playback Fast Forward Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::FastForward::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::FastForward::Id, value, - chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Media Playback Skip Forward Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::SkipForward::Type value; - value.deltaPositionMilliseconds = 500ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::SkipForward::Id, value, - chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Read attribute position after skip forward"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, "Media Playback Skip Backward Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::SkipBackward::Type value; - value.deltaPositionMilliseconds = 100ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::SkipBackward::Id, value, - chip::NullOptional - - ); - } - case 19: { - LogStep(19, "Read attribute position after skip backward"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "Media Playback Seek Command"); - ListFreer listFreer; - chip::app::Clusters::MediaPlayback::Commands::Seek::Type value; - value.position = 1000ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Commands::Seek::Id, value, - chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Read attribute position after seek"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(3), MediaPlayback::Id, MediaPlayback::Attributes::SampledPosition::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_ChannelClusterSuite : public TestCommand -{ -public: - TV_ChannelClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TV_ChannelCluster", 60, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_ChannelClusterSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 0)); - VerifyOrReturn(CheckValue("channelList[0].majorNumber", iter_0.GetValue().majorNumber, 6U)); - VerifyOrReturn(CheckValue("channelList[0].minorNumber", iter_0.GetValue().minorNumber, 0U)); - VerifyOrReturn(CheckValuePresent("channelList[0].name", iter_0.GetValue().name)); - VerifyOrReturn(CheckValueAsString("channelList[0].name.Value()", iter_0.GetValue().name.Value(), - chip::CharSpan("ABC", 3))); - VerifyOrReturn(CheckValuePresent("channelList[0].callSign", iter_0.GetValue().callSign)); - VerifyOrReturn(CheckValueAsString("channelList[0].callSign.Value()", iter_0.GetValue().callSign.Value(), - chip::CharSpan("KAAL-TV", 7))); - VerifyOrReturn(CheckValuePresent("channelList[0].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("channelList[0].affiliateCallSign.Value()", - iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KAAL", 4))); - VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 1)); - VerifyOrReturn(CheckValue("channelList[1].majorNumber", iter_0.GetValue().majorNumber, 9U)); - VerifyOrReturn(CheckValue("channelList[1].minorNumber", iter_0.GetValue().minorNumber, 1U)); - VerifyOrReturn(CheckValuePresent("channelList[1].name", iter_0.GetValue().name)); - VerifyOrReturn(CheckValueAsString("channelList[1].name.Value()", iter_0.GetValue().name.Value(), - chip::CharSpan("PBS", 3))); - VerifyOrReturn(CheckValuePresent("channelList[1].callSign", iter_0.GetValue().callSign)); - VerifyOrReturn(CheckValueAsString("channelList[1].callSign.Value()", iter_0.GetValue().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("channelList[1].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("channelList[1].affiliateCallSign.Value()", - iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 2)); - VerifyOrReturn(CheckValue("channelList[2].majorNumber", iter_0.GetValue().majorNumber, 9U)); - VerifyOrReturn(CheckValue("channelList[2].minorNumber", iter_0.GetValue().minorNumber, 2U)); - VerifyOrReturn(CheckValuePresent("channelList[2].name", iter_0.GetValue().name)); - VerifyOrReturn(CheckValueAsString("channelList[2].name.Value()", iter_0.GetValue().name.Value(), - chip::CharSpan("PBS Kids", 8))); - VerifyOrReturn(CheckValuePresent("channelList[2].callSign", iter_0.GetValue().callSign)); - VerifyOrReturn(CheckValueAsString("channelList[2].callSign.Value()", iter_0.GetValue().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("channelList[2].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("channelList[2].affiliateCallSign.Value()", - iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - VerifyOrReturn(CheckNextListItemDecodes("channelList", iter_0, 3)); - VerifyOrReturn(CheckValue("channelList[3].majorNumber", iter_0.GetValue().majorNumber, 9U)); - VerifyOrReturn(CheckValue("channelList[3].minorNumber", iter_0.GetValue().minorNumber, 3U)); - VerifyOrReturn(CheckValuePresent("channelList[3].name", iter_0.GetValue().name)); - VerifyOrReturn(CheckValueAsString("channelList[3].name.Value()", iter_0.GetValue().name.Value(), - chip::CharSpan("World Channel", 13))); - VerifyOrReturn(CheckValuePresent("channelList[3].callSign", iter_0.GetValue().callSign)); - VerifyOrReturn(CheckValueAsString("channelList[3].callSign.Value()", iter_0.GetValue().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("channelList[3].affiliateCallSign", iter_0.GetValue().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("channelList[3].affiliateCallSign.Value()", - iter_0.GetValue().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - VerifyOrReturn(CheckNoMoreListItems("channelList", iter_0, 4)); - } - } - 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(CheckValueNonNull("lineup", value)); - VerifyOrReturn( - CheckValueAsString("lineup.Value().operatorName", value.Value().operatorName, chip::CharSpan("Comcast", 7))); - VerifyOrReturn(CheckValuePresent("lineup.Value().lineupName", value.Value().lineupName)); - VerifyOrReturn(CheckValueAsString("lineup.Value().lineupName.Value()", value.Value().lineupName.Value(), - chip::CharSpan("Comcast King County", 19))); - VerifyOrReturn(CheckValuePresent("lineup.Value().postalCode", value.Value().postalCode)); - VerifyOrReturn(CheckValueAsString("lineup.Value().postalCode.Value()", value.Value().postalCode.Value(), - chip::CharSpan("98052", 5))); - VerifyOrReturn(CheckValue("lineup.Value().lineupInfoType", value.Value().lineupInfoType, 0U)); - } - 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("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 6U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 0U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("ABC", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KAAL-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KAAL", 4))); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Channel::Commands::ChangeChannelResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("data response", 13))); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 2U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS Kids", 8))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 1U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 3U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("World Channel", 13))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 6U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 0U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("ABC", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KAAL-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KAAL", 4))); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 1U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - 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; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 2U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS Kids", 8))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 3U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("World Channel", 13))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 6U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 0U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("ABC", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KAAL-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KAAL", 4))); - } - 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), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 1U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 2U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS Kids", 8))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 1U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 6U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 0U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("ABC", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KAAL-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KAAL", 4))); - } - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 3U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("World Channel", 13))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 2U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS Kids", 8))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 1U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 6U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 0U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("ABC", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KAAL-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KAAL", 4))); - } - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 3U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("World Channel", 13))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 2U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS Kids", 8))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 1U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS", 3))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentChannel", value)); - VerifyOrReturn(CheckValue("currentChannel.Value().majorNumber", value.Value().majorNumber, 9U)); - VerifyOrReturn(CheckValue("currentChannel.Value().minorNumber", value.Value().minorNumber, 2U)); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().name", value.Value().name)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().name.Value()", value.Value().name.Value(), - chip::CharSpan("PBS Kids", 8))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().callSign", value.Value().callSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().callSign.Value()", value.Value().callSign.Value(), - chip::CharSpan("KCTS-TV", 7))); - VerifyOrReturn(CheckValuePresent("currentChannel.Value().affiliateCallSign", value.Value().affiliateCallSign)); - VerifyOrReturn(CheckValueAsString("currentChannel.Value().affiliateCallSign.Value()", - value.Value().affiliateCallSign.Value(), chip::CharSpan("KCTS", 4))); - } - 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 attribute Channel list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::ChannelList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Read attribute channel lineup"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::Lineup::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Read attribute current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Change Channel Command"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannel::Type value; - value.match = chip::Span("PBSgarbage: not in length on purpose", 3); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannel::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Change Channel By Number Command"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 6U; - value.minorNumber = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Skip Channel Command"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 2; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Skip Channel Command"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 123; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Test 1.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Test 1.2 - Skip Up By 1"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 1; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Test 1.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Test 2.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Test 2.2 - Skip Up By 2"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 2; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Test 2.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Test 3.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Test 3.2 - Skip Up By 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 3; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Test 3.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Test 4.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 20: { - LogStep(20, "Test 4.2 - Skip Up By 4"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 4; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Test 4.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Test 5.2 - Skip Up By 5"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 5; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 23: { - LogStep(23, "Test 5.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, "Test 6.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Test 6.2 - Skip Up By 6"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 6; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Test 6.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 27: { - LogStep(27, "Test 7.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 28: { - LogStep(28, "Test 7.2 - Skip Up By 7"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 7; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 29: { - LogStep(29, "Test 7.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 30: { - LogStep(30, "Test 8.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 31: { - LogStep(31, "Test 8.2 - Skip Up By 8"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 8; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 32: { - LogStep(32, "Test 8.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, "Test 1.2 - Skip Down By 1"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = -1; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 34: { - LogStep(34, "Test 1.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 35: { - LogStep(35, "Test 2.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 36: { - LogStep(36, "Test 2.2 - Skip Down By 2"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = -2; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 37: { - LogStep(37, "Test 2.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 38: { - LogStep(38, "Test 3.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 39: { - LogStep(39, "Test 3.2 - Skip Down By 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = -3; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 40: { - LogStep(40, "Test 3.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 41: { - LogStep(41, "Test 4.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 42: { - LogStep(42, "Test 4.2 - Skip Down By 4"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = -4; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 43: { - LogStep(43, "Test 4.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 44: { - LogStep(44, "Test 5.2 - Skip Down By 5"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = -5; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 45: { - LogStep(45, "Test 5.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 46: { - LogStep(46, "Test 6.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 47: { - LogStep(47, "Test 6.2 - Skip Down By 6"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = -6; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 48: { - LogStep(48, "Test 6.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 49: { - LogStep(49, "Test 7.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 50: { - LogStep(50, "Test 7.2 - Skip Down By 7"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = -7; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 51: { - LogStep(51, "Test 7.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 52: { - LogStep(52, "Test 8.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 53: { - LogStep(53, "Test 8.2 - Skip Down By 8"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = -8; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 54: { - LogStep(54, "Test 8.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 55: { - LogStep(55, "Test 1.2 - Skip Up By 32,767"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = 32767; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 56: { - LogStep(56, "Test 1.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - case 57: { - LogStep(57, "Test 1.1 - Start from Channel 3"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type value; - value.majorNumber = 9U; - value.minorNumber = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::ChangeChannelByNumber::Id, value, - chip::NullOptional - - ); - } - case 58: { - LogStep(58, "Test 1.2 - Skip Down By 32,768"); - ListFreer listFreer; - chip::app::Clusters::Channel::Commands::SkipChannel::Type value; - value.count = -32768; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Commands::SkipChannel::Id, value, - chip::NullOptional - - ); - } - case 59: { - LogStep(59, "Test 1.3 - Verify that Skip Channel Command set correct current channel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Channel::Id, Channel::Attributes::CurrentChannel::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_LowPowerClusterSuite : public TestCommand -{ -public: - TV_LowPowerClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TV_LowPowerCluster", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_LowPowerClusterSuite() {} - - 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; - 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, "Sleep Input Status Command"); - ListFreer listFreer; - chip::app::Clusters::LowPower::Commands::Sleep::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), LowPower::Id, LowPower::Commands::Sleep::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_ContentLauncherClusterSuite : public TestCommand -{ -public: - TV_ContentLauncherClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_ContentLauncherCluster", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_ContentLauncherClusterSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acceptHeader", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("acceptHeader[0]", iter_0.GetValue(), chip::CharSpan("example", 7))); - VerifyOrReturn(CheckNextListItemDecodes("acceptHeader", iter_0, 1)); - VerifyOrReturn(CheckValueAsString("acceptHeader[1]", iter_0.GetValue(), chip::CharSpan("example", 7))); - VerifyOrReturn(CheckNoMoreListItems("acceptHeader", iter_0, 2)); - } - } - 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("supportedStreamingProtocols", value, 0UL)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("exampleData", 11))); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("data", value.data)); - VerifyOrReturn(CheckValueAsString("data.Value()", value.data.Value(), chip::CharSpan("exampleData", 11))); - } - 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 attribute accept header list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Attributes::AcceptHeader::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read attribute supported streaming protocols"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, - ContentLauncher::Attributes::SupportedStreamingProtocols::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Launch Content Command"); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type value; - - { - auto * listHolder_1 = new ListHolder(1); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].type = static_cast(1); - listHolder_1->mList[0].value = chip::Span("exampleValuegarbage: not in length on purpose", 12); - listHolder_1->mList[0].externalIDList.Emplace(); - - { - auto * listHolder_4 = - new ListHolder(1); - listFreer.add(listHolder_4); - - listHolder_4->mList[0].name = chip::Span("namegarbage: not in length on purpose", 4); - listHolder_4->mList[0].value = chip::Span("valuegarbage: not in length on purpose", 5); - - listHolder_1->mList[0].externalIDList.Value() = - chip::app::DataModel::List( - listHolder_4->mList, 1); - } - - value.search.parameterList = - chip::app::DataModel::List( - listHolder_1->mList, 1); - } - - value.autoPlay = true; - value.data.Emplace(); - value.data.Value() = chip::Span("exampleDatagarbage: not in length on purpose", 11); - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchContent::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Launch URL Command"); - ListFreer listFreer; - chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type value; - value.contentURL = chip::Span("exampleUrlgarbage: not in length on purpose", 10); - value.displayString.Emplace(); - value.displayString.Value() = chip::Span("exampleDisplayStringgarbage: not in length on purpose", 20); - value.brandingInformation.Emplace(); - - value.brandingInformation.Value().providerName = - chip::Span("exampleNamegarbage: not in length on purpose", 11); - value.brandingInformation.Value().background.Emplace(); - - value.brandingInformation.Value().background.Value().imageURL.Emplace(); - value.brandingInformation.Value().background.Value().imageURL.Value() = - chip::Span("exampleUrlgarbage: not in length on purpose", 10); - value.brandingInformation.Value().background.Value().color.Emplace(); - value.brandingInformation.Value().background.Value().color.Value() = - chip::Span("exampleColorgarbage: not in length on purpose", 12); - value.brandingInformation.Value().background.Value().size.Emplace(); - - value.brandingInformation.Value().background.Value().size.Value().width = 0; - value.brandingInformation.Value().background.Value().size.Value().height = 0; - value.brandingInformation.Value().background.Value().size.Value().metric = - static_cast(0); - - value.brandingInformation.Value().logo.Emplace(); - - value.brandingInformation.Value().logo.Value().imageURL.Emplace(); - value.brandingInformation.Value().logo.Value().imageURL.Value() = - chip::Span("exampleUrlgarbage: not in length on purpose", 10); - value.brandingInformation.Value().logo.Value().color.Emplace(); - value.brandingInformation.Value().logo.Value().color.Value() = - chip::Span("exampleColorgarbage: not in length on purpose", 12); - value.brandingInformation.Value().logo.Value().size.Emplace(); - - value.brandingInformation.Value().logo.Value().size.Value().width = 0; - value.brandingInformation.Value().logo.Value().size.Value().height = 0; - value.brandingInformation.Value().logo.Value().size.Value().metric = - static_cast(0); - - value.brandingInformation.Value().progressBar.Emplace(); - - value.brandingInformation.Value().progressBar.Value().imageURL.Emplace(); - value.brandingInformation.Value().progressBar.Value().imageURL.Value() = - chip::Span("exampleUrlgarbage: not in length on purpose", 10); - value.brandingInformation.Value().progressBar.Value().color.Emplace(); - value.brandingInformation.Value().progressBar.Value().color.Value() = - chip::Span("exampleColorgarbage: not in length on purpose", 12); - value.brandingInformation.Value().progressBar.Value().size.Emplace(); - - value.brandingInformation.Value().progressBar.Value().size.Value().width = 0; - value.brandingInformation.Value().progressBar.Value().size.Value().height = 0; - value.brandingInformation.Value().progressBar.Value().size.Value().metric = - static_cast(0); - - value.brandingInformation.Value().splash.Emplace(); - - value.brandingInformation.Value().splash.Value().imageURL.Emplace(); - value.brandingInformation.Value().splash.Value().imageURL.Value() = - chip::Span("exampleUrlgarbage: not in length on purpose", 10); - value.brandingInformation.Value().splash.Value().color.Emplace(); - value.brandingInformation.Value().splash.Value().color.Value() = - chip::Span("exampleColorgarbage: not in length on purpose", 12); - value.brandingInformation.Value().splash.Value().size.Emplace(); - - value.brandingInformation.Value().splash.Value().size.Value().width = 0; - value.brandingInformation.Value().splash.Value().size.Value().height = 0; - value.brandingInformation.Value().splash.Value().size.Value().metric = - static_cast(0); - - value.brandingInformation.Value().waterMark.Emplace(); - - value.brandingInformation.Value().waterMark.Value().imageURL.Emplace(); - value.brandingInformation.Value().waterMark.Value().imageURL.Value() = - chip::Span("exampleUrlgarbage: not in length on purpose", 10); - value.brandingInformation.Value().waterMark.Value().color.Emplace(); - value.brandingInformation.Value().waterMark.Value().color.Value() = - chip::Span("exampleColorgarbage: not in length on purpose", 12); - value.brandingInformation.Value().waterMark.Value().size.Emplace(); - - value.brandingInformation.Value().waterMark.Value().size.Value().width = 0; - value.brandingInformation.Value().waterMark.Value().size.Value().height = 0; - value.brandingInformation.Value().waterMark.Value().size.Value().metric = - static_cast(0); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), ContentLauncher::Id, ContentLauncher::Commands::LaunchURL::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TV_MediaInputClusterSuite : public TestCommand -{ -public: - TV_MediaInputClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TV_MediaInputCluster", 8, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TV_MediaInputClusterSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 0)); - VerifyOrReturn(CheckValue("inputList[0].index", iter_0.GetValue().index, 1U)); - VerifyOrReturn(CheckValue("inputList[0].inputType", iter_0.GetValue().inputType, 4U)); - VerifyOrReturn(CheckValueAsString("inputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckValueAsString("inputList[0].description", iter_0.GetValue().description, - chip::CharSpan("High-Definition Multimedia Interface", 36))); - VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 1)); - VerifyOrReturn(CheckValue("inputList[1].index", iter_0.GetValue().index, 2U)); - VerifyOrReturn(CheckValue("inputList[1].inputType", iter_0.GetValue().inputType, 4U)); - VerifyOrReturn(CheckValueAsString("inputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckValueAsString("inputList[1].description", iter_0.GetValue().description, - chip::CharSpan("High-Definition Multimedia Interface", 36))); - VerifyOrReturn(CheckNoMoreListItems("inputList", iter_0, 2)); - } - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentInput", value, 1U)); - } - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 0)); - VerifyOrReturn(CheckValue("inputList[0].index", iter_0.GetValue().index, 1U)); - VerifyOrReturn(CheckValue("inputList[0].inputType", iter_0.GetValue().inputType, 4U)); - VerifyOrReturn(CheckValueAsString("inputList[0].name", iter_0.GetValue().name, chip::CharSpan("HDMI Test", 9))); - VerifyOrReturn(CheckValueAsString("inputList[0].description", iter_0.GetValue().description, - chip::CharSpan("High-Definition Multimedia Interface", 36))); - VerifyOrReturn(CheckNextListItemDecodes("inputList", iter_0, 1)); - VerifyOrReturn(CheckValue("inputList[1].index", iter_0.GetValue().index, 2U)); - VerifyOrReturn(CheckValue("inputList[1].inputType", iter_0.GetValue().inputType, 4U)); - VerifyOrReturn(CheckValueAsString("inputList[1].name", iter_0.GetValue().name, chip::CharSpan("HDMI", 4))); - VerifyOrReturn(CheckValueAsString("inputList[1].description", iter_0.GetValue().description, - chip::CharSpan("High-Definition Multimedia Interface", 36))); - VerifyOrReturn(CheckNoMoreListItems("inputList", iter_0, 2)); - } - } - 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 attribute media input list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::InputList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Read current media input"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::CurrentInput::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Select Input Command"); - ListFreer listFreer; - chip::app::Clusters::MediaInput::Commands::SelectInput::Type value; - value.index = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::SelectInput::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Hide Input Status Command"); - ListFreer listFreer; - chip::app::Clusters::MediaInput::Commands::HideInputStatus::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::HideInputStatus::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Show Input Status Command"); - ListFreer listFreer; - chip::app::Clusters::MediaInput::Commands::ShowInputStatus::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::ShowInputStatus::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Rename Input Command"); - ListFreer listFreer; - chip::app::Clusters::MediaInput::Commands::RenameInput::Type value; - value.index = 1U; - value.name = chip::Span("HDMI Testgarbage: not in length on purpose", 9); - return SendCommand(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Commands::RenameInput::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Read attribute media input list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), MediaInput::Id, MediaInput::Attributes::InputList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestCASERecoverySuite : public TestCommand -{ -public: - TestCASERecoverySuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestCASERecovery", 7, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestCASERecoverySuite() {} - - 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("dataModelRevision", value, 17U)); - } - 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)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("dataModelRevision", value, 17U)); - } - 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 an attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::DataModelRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Reboot the server"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Re-get our session, but without expiring sesssions"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - value.expireExistingSession.Emplace(); - value.expireExistingSession.Value() = false; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Read an attribute again"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::DataModelRevision::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Re-get our session, but without expiring sesssions"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - value.expireExistingSession.Emplace(); - value.expireExistingSession.Value() = false; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Read an attribute a third time"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::DataModelRevision::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestClusterSuite : public TestCommand -{ -public: - TestClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestCluster", 491, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestClusterSuite() - { - if (nullableOctetStrTestValueBuffer != nullptr) - { - chip::Platform::MemoryFree(nullableOctetStrTestValueBuffer); - nullableOctetStrTestValueBuffer = nullptr; - } - if (nullableCharStringSaveBuffer != nullptr) - { - chip::Platform::MemoryFree(nullableCharStringSaveBuffer); - nullableCharStringSaveBuffer = nullptr; - } - } - - 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::app::DataModel::Nullable booValueNull; - chip::app::DataModel::Nullable> nullableValue254; - chip::app::DataModel::Nullable nullableEnumAttr3; - uint8_t * nullableOctetStrTestValueBuffer = nullptr; - chip::app::DataModel::Nullable nullableOctetStrTestValue; - char * nullableCharStringSaveBuffer = nullptr; - chip::app::DataModel::Nullable nullableCharStringSave; - - 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), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestSpecificResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("returnValue", value.returnValue, 7U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestAddArgumentsResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("returnValue", value.returnValue, 20U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("boolean", value, 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("boolean", value, 1)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("boolean", value, 0)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap8", value, 0U)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap8", value, 255U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap8", value, 0U)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap16", value, 0U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap16", value, 65535U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap16", value, 0U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, 0UL)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, 4294967295UL)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, 0UL)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap64", value, 0ULL)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap64", value, 18446744073709551615ULL)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap64", value, 0ULL)); - } - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8u", value, 0U)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8u", value, 255U)); - } - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8u", value, 0U)); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16u", value, 0U)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16u", value, 65535U)); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16u", value, 0U)); - } - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32u", value, 0UL)); - } - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32u", value, 4294967295UL)); - } - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32u", value, 0UL)); - } - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64u", value, 0ULL)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64u", value, 18446744073709551615ULL)); - } - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64u", value, 0ULL)); - } - break; - case 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8s", value, 0)); - } - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8s", value, 127)); - } - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8s", value, -128)); - } - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8s", value, 0)); - } - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16s", value, 0)); - } - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 60: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16s", value, 32767)); - } - break; - case 61: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 62: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16s", value, -32768)); - } - break; - case 63: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 64: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16s", value, 0)); - } - break; - case 65: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32s", value, 0L)); - } - break; - case 66: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 67: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32s", value, 2147483647L)); - } - break; - case 68: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 69: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32s", value, -2147483648L)); - } - break; - case 70: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 71: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32s", value, 0L)); - } - break; - case 72: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64s", value, 0LL)); - } - break; - case 73: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 74: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64s", value, 9223372036854775807LL)); - } - break; - case 75: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 76: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64s", value, -9223372036854775807LL)); - } - break; - case 77: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 78: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64s", value, 0LL)); - } - break; - case 79: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("floatSingle", value, 0.0f)); - } - break; - case 80: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 81: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("floatSingle", value, 0.1f)); - } - break; - case 82: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 83: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("floatSingle", value, 17000000000.0f)); - } - break; - case 84: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 85: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("floatSingle", value, 1.7e-10f)); - } - break; - case 86: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 87: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - float value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("floatSingle", value, 0.0f)); - } - break; - case 88: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - double value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("floatDouble", value, 0)); - } - break; - case 89: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 90: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - double value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("floatDouble", value, 0.1234567890123)); - } - break; - case 91: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 92: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - double value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("floatDouble", value, 1.7e+200)); - } - break; - case 93: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 94: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - double value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("floatDouble", value, 1.7e-200)); - } - break; - case 95: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 96: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - double value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("floatDouble", value, 0)); - } - break; - case 97: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enum8", value, 0U)); - } - break; - case 98: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 99: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enum8", value, 255U)); - } - break; - case 100: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 101: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enum8", value, 0U)); - } - break; - case 102: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enum16", value, 0U)); - } - break; - case 103: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 104: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enum16", value, 65535U)); - } - break; - case 105: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 106: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enum16", value, 0U)); - } - break; - case 107: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - } - break; - case 108: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 109: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn( - CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char("Tes\000ti\000ng"), 9))); - } - break; - case 110: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 111: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("octetString", value, - chip::ByteSpan(chip::Uint8::from_const_char("\x00\x01\x02\x03\x04\x05"), 6))); - } - break; - case 112: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 113: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("octetString", value, - chip::ByteSpan(chip::Uint8::from_const_char("\x0d\x0a\xff\x22\xa0"), 5))); - } - break; - case 114: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 115: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn( - CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char("TestValue"), 9))); - } - break; - case 116: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 117: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn( - CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char("TestValue"), 9))); - } - break; - case 118: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 119: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("longOctetString", value, chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - } - break; - case 120: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 121: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString( - "longOctetString", value, - chip::ByteSpan( - chip::Uint8::from_const_char( - "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"), - 300))); - } - break; - case 122: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 123: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("", 0))); - } - break; - case 124: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 125: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("☉T☉", 7))); - } - break; - case 126: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 127: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("☉T☉", 7))); - } - break; - case 128: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 129: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("longCharString", value, chip::CharSpan("", 0))); - } - break; - case 130: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 131: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString( - "longCharString", value, - chip::CharSpan( - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉", - 900))); - } - break; - case 132: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 133: - 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(CheckNextListItemDecodes("listLongOctetString", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[0]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" - "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" - "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" - "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 1)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[1]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" - "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" - "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" - "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 2)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[2]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" - "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" - "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" - "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 3)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[3]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" - "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" - "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" - "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNoMoreListItems("listLongOctetString", iter_0, 4)); - } - } - break; - case 134: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 135: - 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(CheckNextListItemDecodes("listLongOctetString", iter_0, 0)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[0]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" - "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" - "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" - "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 1)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[1]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" - "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" - "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" - "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 2)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[2]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" - "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" - "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" - "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 3)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[3]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" - "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" - "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" - "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNextListItemDecodes("listLongOctetString", iter_0, 4)); - VerifyOrReturn(CheckValueAsString( - "listLongOctetString[4]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456" - "789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234" - "56789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab" - "cdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012" - "3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"), - 512))); - VerifyOrReturn(CheckNoMoreListItems("listLongOctetString", iter_0, 5)); - } - } - break; - case 136: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 137: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("epochUs", value, 0ULL)); - } - break; - case 138: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 139: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("epochUs", value, 18446744073709551615ULL)); - } - break; - case 140: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 141: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("epochUs", value, 0ULL)); - } - break; - case 142: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("epochS", value, 0UL)); - } - break; - case 143: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 144: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("epochS", value, 4294967295UL)); - } - break; - case 145: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 146: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("epochS", value, 0UL)); - } - break; - case 147: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE)); - break; - case 148: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE)); - break; - case 149: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT)); - break; - case 150: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER)); - break; - case 151: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorId", value, 0U)); - } - break; - case 152: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 153: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorId", value, 17U)); - } - break; - case 154: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 155: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestEnumsResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("arg1", value.arg1, 20003U)); - VerifyOrReturn(CheckValue("arg2", value.arg2, 1U)); - } - break; - case 156: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 157: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, true)); - } - break; - case 158: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, false)); - } - break; - case 159: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, true)); - } - break; - case 160: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, false)); - } - break; - case 161: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, true)); - } - break; - case 162: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, false)); - } - break; - case 163: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::SimpleStructResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("arg1.a", value.arg1.a, 17U)); - VerifyOrReturn(CheckValue("arg1.b", value.arg1.b, false)); - VerifyOrReturn(CheckValue("arg1.c", value.arg1.c, 2U)); - VerifyOrReturn( - CheckValueAsString("arg1.d", value.arg1.d, chip::ByteSpan(chip::Uint8::from_const_char("octet_string"), 12))); - VerifyOrReturn(CheckValueAsString("arg1.e", value.arg1.e, chip::CharSpan("char_string", 11))); - VerifyOrReturn(CheckValue("arg1.f", value.arg1.f, 1U)); - VerifyOrReturn(CheckValue("arg1.g", value.arg1.g, 0.1f)); - VerifyOrReturn(CheckValue("arg1.h", value.arg1.h, 0.1)); - } - break; - case 164: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, true)); - } - break; - case 165: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, false)); - } - break; - case 166: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.arg1.begin(); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 0)); - VerifyOrReturn(CheckValue("arg1[0]", iter_0.GetValue(), 9U)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 1)); - VerifyOrReturn(CheckValue("arg1[1]", iter_0.GetValue(), 8U)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 2)); - VerifyOrReturn(CheckValue("arg1[2]", iter_0.GetValue(), 7U)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 3)); - VerifyOrReturn(CheckValue("arg1[3]", iter_0.GetValue(), 6U)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 4)); - VerifyOrReturn(CheckValue("arg1[4]", iter_0.GetValue(), 5U)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 5)); - VerifyOrReturn(CheckValue("arg1[5]", iter_0.GetValue(), 4U)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 6)); - VerifyOrReturn(CheckValue("arg1[6]", iter_0.GetValue(), 3U)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 7)); - VerifyOrReturn(CheckValue("arg1[7]", iter_0.GetValue(), 2U)); - VerifyOrReturn(CheckNextListItemDecodes("arg1", iter_0, 8)); - VerifyOrReturn(CheckValue("arg1[8]", iter_0.GetValue(), 1U)); - VerifyOrReturn(CheckNoMoreListItems("arg1", iter_0, 9)); - } - } - break; - case 167: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.arg1.begin(); - VerifyOrReturn(CheckNoMoreListItems("arg1", iter_0, 0)); - } - } - break; - case 168: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, true)); - } - break; - case 169: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, false)); - } - break; - case 170: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, true)); - } - break; - case 171: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::BooleanResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, false)); - } - break; - case 172: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 173: - 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(CheckNextListItemDecodes("listInt8u", iter_0, 0)); - VerifyOrReturn(CheckValue("listInt8u[0]", iter_0.GetValue(), 1U)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 1)); - VerifyOrReturn(CheckValue("listInt8u[1]", iter_0.GetValue(), 2U)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 2)); - VerifyOrReturn(CheckValue("listInt8u[2]", iter_0.GetValue(), 3U)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 3)); - VerifyOrReturn(CheckValue("listInt8u[3]", iter_0.GetValue(), 4U)); - VerifyOrReturn(CheckNoMoreListItems("listInt8u", iter_0, 4)); - } - } - break; - case 174: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 175: - 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(CheckNextListItemDecodes("listOctetString", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("listOctetString[0]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char("Test0"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 1)); - VerifyOrReturn(CheckValueAsString("listOctetString[1]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char("Test1"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 2)); - VerifyOrReturn(CheckValueAsString("listOctetString[2]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char("Test2"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listOctetString", iter_0, 3)); - VerifyOrReturn(CheckValueAsString("listOctetString[3]", iter_0.GetValue(), - chip::ByteSpan(chip::Uint8::from_const_char("Test3"), 5))); - VerifyOrReturn(CheckNoMoreListItems("listOctetString", iter_0, 4)); - } - } - break; - case 176: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 177: - 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(CheckNextListItemDecodes("listStructOctetString", iter_0, 0)); - VerifyOrReturn(CheckValue("listStructOctetString[0].member1", iter_0.GetValue().member1, 0ULL)); - VerifyOrReturn(CheckValueAsString("listStructOctetString[0].member2", iter_0.GetValue().member2, - chip::ByteSpan(chip::Uint8::from_const_char("Test0"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 1)); - VerifyOrReturn(CheckValue("listStructOctetString[1].member1", iter_0.GetValue().member1, 1ULL)); - VerifyOrReturn(CheckValueAsString("listStructOctetString[1].member2", iter_0.GetValue().member2, - chip::ByteSpan(chip::Uint8::from_const_char("Test1"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 2)); - VerifyOrReturn(CheckValue("listStructOctetString[2].member1", iter_0.GetValue().member1, 2ULL)); - VerifyOrReturn(CheckValueAsString("listStructOctetString[2].member2", iter_0.GetValue().member2, - chip::ByteSpan(chip::Uint8::from_const_char("Test2"), 5))); - VerifyOrReturn(CheckNextListItemDecodes("listStructOctetString", iter_0, 3)); - VerifyOrReturn(CheckValue("listStructOctetString[3].member1", iter_0.GetValue().member1, 3ULL)); - VerifyOrReturn(CheckValueAsString("listStructOctetString[3].member2", iter_0.GetValue().member2, - chip::ByteSpan(chip::Uint8::from_const_char("Test3"), 5))); - VerifyOrReturn(CheckNoMoreListItems("listStructOctetString", iter_0, 4)); - } - } - break; - case 178: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("wasPresent", value.wasPresent, true)); - VerifyOrReturn(CheckValuePresent("wasNull", value.wasNull)); - VerifyOrReturn(CheckValue("wasNull.Value()", value.wasNull.Value(), false)); - VerifyOrReturn(CheckValuePresent("value", value.value)); - VerifyOrReturn(CheckValue("value.Value()", value.value.Value(), 5U)); - VerifyOrReturn(CheckValuePresent("originalValue", value.originalValue)); - VerifyOrReturn(CheckValueNonNull("originalValue.Value()", value.originalValue.Value())); - VerifyOrReturn(CheckValue("originalValue.Value().Value()", value.originalValue.Value().Value(), 5U)); - } - break; - case 179: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("wasPresent", value.wasPresent, false)); - } - break; - case 180: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::UnitTesting::Structs::NullablesAndOptionalsStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("listNullablesAndOptionalsStruct", iter_0, 0)); - VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableInt", iter_0.GetValue().nullableInt)); - VerifyOrReturn( - CheckValueNull("listNullablesAndOptionalsStruct[0].nullableString", iter_0.GetValue().nullableString)); - VerifyOrReturn( - CheckValueNull("listNullablesAndOptionalsStruct[0].nullableStruct", iter_0.GetValue().nullableStruct)); - VerifyOrReturn( - CheckValueNull("listNullablesAndOptionalsStruct[0].nullableList", iter_0.GetValue().nullableList)); - VerifyOrReturn(CheckNoMoreListItems("listNullablesAndOptionalsStruct", iter_0, 1)); - } - } - break; - case 181: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 182: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::UnitTesting::Structs::NullablesAndOptionalsStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("listNullablesAndOptionalsStruct", iter_0, 0)); - VerifyOrReturn(CheckValueNull("listNullablesAndOptionalsStruct[0].nullableInt", iter_0.GetValue().nullableInt)); - VerifyOrReturn( - CheckValueNull("listNullablesAndOptionalsStruct[0].nullableString", iter_0.GetValue().nullableString)); - VerifyOrReturn( - CheckValueNull("listNullablesAndOptionalsStruct[0].nullableStruct", iter_0.GetValue().nullableStruct)); - VerifyOrReturn( - CheckValueNonNull("listNullablesAndOptionalsStruct[0].nullableList", iter_0.GetValue().nullableList)); - { - auto iter_3 = iter_0.GetValue().nullableList.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "listNullablesAndOptionalsStruct[0].nullableList.Value()", iter_3, 0)); - VerifyOrReturn( - CheckValue("listNullablesAndOptionalsStruct[0].nullableList.Value()[0]", iter_3.GetValue(), 1U)); - VerifyOrReturn(CheckNextListItemDecodes( - "listNullablesAndOptionalsStruct[0].nullableList.Value()", iter_3, 1)); - VerifyOrReturn( - CheckValue("listNullablesAndOptionalsStruct[0].nullableList.Value()[1]", iter_3.GetValue(), 2U)); - VerifyOrReturn(CheckNoMoreListItems( - "listNullablesAndOptionalsStruct[0].nullableList.Value()", iter_3, 2)); - } - VerifyOrReturn(CheckNoMoreListItems("listNullablesAndOptionalsStruct", iter_0, 1)); - } - } - break; - case 183: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 184: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableBoolean", value)); - booValueNull = value; - } - break; - case 185: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 186: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableBoolean", value)); - VerifyOrReturn(CheckValue("nullableBoolean.Value()", value.Value(), true)); - } - break; - case 187: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, booValueNull)); - } - break; - case 188: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 189: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableBitmap8", value)); - VerifyOrReturn(CheckValue("nullableBitmap8.Value()", value.Value(), 254U)); - } - break; - case 190: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 191: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableBitmap8", value)); - VerifyOrReturn(CheckValue("nullableBitmap8.Value()", value.Value(), 254U)); - nullableValue254 = value; - } - break; - case 192: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 193: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableBitmap8", value)); - } - break; - case 194: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, nullableValue254)); - } - break; - case 195: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 196: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableBitmap16", value)); - VerifyOrReturn(CheckValue("nullableBitmap16.Value()", value.Value(), 65534U)); - } - break; - case 197: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 198: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableBitmap16", value)); - VerifyOrReturn(CheckValue("nullableBitmap16.Value()", value.Value(), 65534U)); - } - break; - case 199: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 200: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableBitmap16", value)); - } - break; - case 201: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 202: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableBitmap32", value)); - VerifyOrReturn(CheckValue("nullableBitmap32.Value()", value.Value(), 4294967294UL)); - } - break; - case 203: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 204: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableBitmap32", value)); - VerifyOrReturn(CheckValue("nullableBitmap32.Value()", value.Value(), 4294967294UL)); - } - break; - case 205: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 206: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableBitmap32", value)); - } - break; - case 207: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 208: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableBitmap64", value)); - VerifyOrReturn(CheckValue("nullableBitmap64.Value()", value.Value(), 18446744073709551614ULL)); - } - break; - case 209: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 210: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableBitmap64", value)); - VerifyOrReturn(CheckValue("nullableBitmap64.Value()", value.Value(), 18446744073709551614ULL)); - } - break; - case 211: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 212: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableBitmap64", value)); - } - break; - case 213: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 214: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt8u", value)); - VerifyOrReturn(CheckValue("nullableInt8u.Value()", value.Value(), 0U)); - } - break; - case 215: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 216: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt8u", value)); - VerifyOrReturn(CheckValue("nullableInt8u.Value()", value.Value(), 254U)); - } - break; - case 217: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 218: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt8u", value)); - VerifyOrReturn(CheckValue("nullableInt8u.Value()", value.Value(), 254U)); - } - break; - case 219: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("value", value)); - } - break; - case 220: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 221: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableInt8u", value)); - } - break; - case 222: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - break; - case 223: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, 254U)); - } - break; - case 224: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 225: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 254U)); - } - break; - case 226: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, 129U)); - } - break; - case 227: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 228: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt16u", value)); - VerifyOrReturn(CheckValue("nullableInt16u.Value()", value.Value(), 0U)); - } - break; - case 229: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 230: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt16u", value)); - VerifyOrReturn(CheckValue("nullableInt16u.Value()", value.Value(), 65534U)); - } - break; - case 231: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 232: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt16u", value)); - VerifyOrReturn(CheckValue("nullableInt16u.Value()", value.Value(), 65534U)); - } - break; - case 233: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 234: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableInt16u", value)); - } - break; - case 235: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - } - break; - case 236: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, 65534U)); - } - break; - case 237: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 238: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - } - break; - case 239: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, 32001U)); - } - break; - case 240: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 241: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt32u", value)); - VerifyOrReturn(CheckValue("nullableInt32u.Value()", value.Value(), 0UL)); - } - break; - case 242: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 243: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt32u", value)); - VerifyOrReturn(CheckValue("nullableInt32u.Value()", value.Value(), 4294967294UL)); - } - break; - case 244: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 245: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt32u", value)); - VerifyOrReturn(CheckValue("nullableInt32u.Value()", value.Value(), 4294967294UL)); - } - break; - case 246: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 247: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableInt32u", value)); - } - break; - case 248: - 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, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967294UL)); - } - break; - case 249: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, 4294967294UL)); - } - break; - case 250: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 251: - 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, 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 4294967294UL)); - } - break; - case 252: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, 2147483648UL)); - } - break; - case 253: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 254: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt64u", value)); - VerifyOrReturn(CheckValue("nullableInt64u.Value()", value.Value(), 0ULL)); - } - break; - case 255: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 256: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt64u", value)); - VerifyOrReturn(CheckValue("nullableInt64u.Value()", value.Value(), 18446744073709551614ULL)); - } - break; - case 257: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 258: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt64u", value)); - VerifyOrReturn(CheckValue("nullableInt64u.Value()", value.Value(), 18446744073709551614ULL)); - } - break; - case 259: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 260: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableInt64u", value)); - } - break; - case 261: - 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, 0ULL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 18446744073709551614ULL)); - } - break; - case 262: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, 18446744073709551614ULL)); - } - break; - case 263: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 264: - 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, 0ULL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 18446744073709551614ULL)); - } - break; - case 265: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, 18000000000000000001ULL)); - } - break; - case 266: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 267: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt8s", value)); - VerifyOrReturn(CheckValue("nullableInt8s.Value()", value.Value(), -127)); - } - break; - case 268: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 269: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt8s", value)); - VerifyOrReturn(CheckValue("nullableInt8s.Value()", value.Value(), -127)); - } - break; - case 270: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 271: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableInt8s", value)); - } - break; - case 272: - 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, -127)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); - } - break; - case 273: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, -127)); - } - break; - case 274: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 275: - 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, -127)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 127)); - } - break; - case 276: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, -126)); - } - break; - case 277: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 278: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt16s", value)); - VerifyOrReturn(CheckValue("nullableInt16s.Value()", value.Value(), -32767)); - } - break; - case 279: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 280: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt16s", value)); - VerifyOrReturn(CheckValue("nullableInt16s.Value()", value.Value(), -32767)); - } - break; - case 281: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 282: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableInt16s", value)); - } - break; - case 283: - 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, -32767)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 284: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, -32767)); - } - break; - case 285: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 286: - 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, -32767)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - break; - case 287: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, -32766)); - } - break; - case 288: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 289: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt32s", value)); - VerifyOrReturn(CheckValue("nullableInt32s.Value()", value.Value(), -2147483647L)); - } - break; - case 290: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 291: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt32s", value)); - VerifyOrReturn(CheckValue("nullableInt32s.Value()", value.Value(), -2147483647L)); - } - break; - case 292: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 293: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableInt32s", value)); - } - break; - case 294: - 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, -2147483647L)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2147483647L)); - } - break; - case 295: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, -2147483647L)); - } - break; - case 296: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 297: - 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, -2147483647L)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2147483647L)); - } - break; - case 298: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, -2147483646L)); - } - break; - case 299: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 300: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt64s", value)); - VerifyOrReturn(CheckValue("nullableInt64s.Value()", value.Value(), -9223372036854775807LL)); - } - break; - case 301: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 302: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt64s", value)); - VerifyOrReturn(CheckValue("nullableInt64s.Value()", value.Value(), -9223372036854775807LL)); - } - break; - case 303: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 304: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableInt64s", value)); - } - break; - case 305: - 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, -9223372036854775807LL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9223372036854775807LL)); - } - break; - case 306: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, -9223372036854775807LL)); - } - break; - case 307: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 308: - 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, -9223372036854775807LL)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9223372036854775807LL)); - } - break; - case 309: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, -9223372036854775806LL)); - } - break; - case 310: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 311: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", value)); - VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", value.Value(), 0.1f)); - } - break; - case 312: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 313: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", value)); - VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", value.Value(), INFINITY)); - } - break; - case 314: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 315: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", value)); - VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", value.Value(), -INFINITY)); - } - break; - case 316: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 317: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableFloatSingle", value)); - } - break; - case 318: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 319: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableFloatSingle", value)); - VerifyOrReturn(CheckValue("nullableFloatSingle.Value()", value.Value(), 0.0f)); - } - break; - case 320: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 321: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", value)); - VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", value.Value(), 0.1234567890123)); - } - break; - case 322: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 323: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", value)); - VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", value.Value(), INFINITY)); - } - break; - case 324: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 325: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", value)); - VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", value.Value(), -INFINITY)); - } - break; - case 326: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 327: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableFloatDouble", value)); - } - break; - case 328: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 329: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableFloatDouble", value)); - VerifyOrReturn(CheckValue("nullableFloatDouble.Value()", value.Value(), 0)); - } - break; - case 330: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 331: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableEnum8", value)); - VerifyOrReturn(CheckValue("nullableEnum8.Value()", value.Value(), 0U)); - } - break; - case 332: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 333: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableEnum8", value)); - VerifyOrReturn(CheckValue("nullableEnum8.Value()", value.Value(), 254U)); - } - break; - case 334: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 335: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableEnum8", value)); - VerifyOrReturn(CheckValue("nullableEnum8.Value()", value.Value(), 254U)); - } - break; - case 336: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 337: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableEnum8", value)); - } - break; - case 338: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 339: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableEnum16", value)); - VerifyOrReturn(CheckValue("nullableEnum16.Value()", value.Value(), 0U)); - } - break; - case 340: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 341: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableEnum16", value)); - VerifyOrReturn(CheckValue("nullableEnum16.Value()", value.Value(), 65534U)); - } - break; - case 342: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 343: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableEnum16", value)); - VerifyOrReturn(CheckValue("nullableEnum16.Value()", value.Value(), 65534U)); - } - break; - case 344: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 345: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableEnum16", value)); - } - break; - case 346: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 347: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableEnumAttr", value)); - VerifyOrReturn(CheckValue("nullableEnumAttr.Value()", value.Value(), 0U)); - } - break; - case 348: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 349: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableEnumAttr", value)); - VerifyOrReturn(CheckValue("nullableEnumAttr.Value()", value.Value(), 3U)); - } - break; - case 350: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 351: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableEnumAttr", value)); - VerifyOrReturn(CheckValue("nullableEnumAttr.Value()", value.Value(), 3U)); - nullableEnumAttr3 = value; - } - break; - case 352: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 353: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableEnumAttr", value)); - } - break; - case 354: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, nullableEnumAttr3)); - } - break; - case 355: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableOctetString", value)); - VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", value.Value(), - chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - } - break; - case 356: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 357: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableOctetString", value)); - VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", value.Value(), - chip::ByteSpan(chip::Uint8::from_const_char("TestValue"), 9))); - if (value.IsNull()) - { - nullableOctetStrTestValue.SetNull(); - } - else - { - if (nullableOctetStrTestValueBuffer != nullptr) - { - chip::Platform::MemoryFree(nullableOctetStrTestValueBuffer); - } - nullableOctetStrTestValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.Value().size())); - memcpy(nullableOctetStrTestValueBuffer, value.Value().data(), value.Value().size()); - nullableOctetStrTestValue.SetNonNull(nullableOctetStrTestValueBuffer, value.Value().size()); - } - } - break; - case 358: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 359: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableOctetString", value)); - } - break; - case 360: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 361: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableOctetString", value)); - VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", value.Value(), - chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - } - break; - case 362: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, nullableOctetStrTestValue)); - } - break; - case 363: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableCharString", value)); - VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", value.Value(), chip::CharSpan("", 0))); - } - break; - case 364: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 365: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableCharString", value)); - VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", value.Value(), chip::CharSpan("☉T☉", 7))); - if (value.IsNull()) - { - nullableCharStringSave.SetNull(); - } - else - { - if (nullableCharStringSaveBuffer != nullptr) - { - chip::Platform::MemoryFree(nullableCharStringSaveBuffer); - } - nullableCharStringSaveBuffer = static_cast(chip::Platform::MemoryAlloc(value.Value().size())); - memcpy(nullableCharStringSaveBuffer, value.Value().data(), value.Value().size()); - nullableCharStringSave.SetNonNull(nullableCharStringSaveBuffer, value.Value().size()); - } - } - break; - case 366: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (nullableCharStringSave.IsNull()) - { - VerifyOrReturn(CheckValueNull("nullableCharString", value)); - } - else - { - VerifyOrReturn(CheckValueNonNull("nullableCharString", value)); - VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", value.Value(), nullableCharStringSave.Value())); - } - } - break; - case 367: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 368: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableCharString", value)); - } - break; - case 369: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 370: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableCharString", value)); - VerifyOrReturn(CheckValueAsString("nullableCharString.Value()", value.Value(), chip::CharSpan("", 0))); - } - break; - case 371: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, nullableCharStringSave)); - } - break; - case 372: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ENDPOINT)); - break; - case 373: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER)); - break; - case 374: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 375: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 376: - 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(CheckNextListItemDecodes("listInt8u", iter_0, 0)); - VerifyOrReturn(CheckValue("listInt8u[0]", iter_0.GetValue(), 1U)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 1)); - VerifyOrReturn(CheckValue("listInt8u[1]", iter_0.GetValue(), 2U)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 2)); - VerifyOrReturn(CheckValue("listInt8u[2]", iter_0.GetValue(), 3U)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 3)); - VerifyOrReturn(CheckValue("listInt8u[3]", iter_0.GetValue(), 4U)); - VerifyOrReturn(CheckNoMoreListItems("listInt8u", iter_0, 4)); - } - } - break; - case 377: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 378: - 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(CheckNextListItemDecodes("listInt8u", iter_0, 0)); - VerifyOrReturn(CheckValue("listInt8u[0]", iter_0.GetValue(), 5U)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 1)); - VerifyOrReturn(CheckValue("listInt8u[1]", iter_0.GetValue(), 6U)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 2)); - VerifyOrReturn(CheckValue("listInt8u[2]", iter_0.GetValue(), 7U)); - VerifyOrReturn(CheckNextListItemDecodes("listInt8u", iter_0, 3)); - VerifyOrReturn(CheckValue("listInt8u[3]", iter_0.GetValue(), 8U)); - VerifyOrReturn(CheckNoMoreListItems("listInt8u", iter_0, 4)); - } - } - shouldContinue = true; - break; - case 379: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt8u", value, 70U)); - } - break; - case 380: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 381: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 382: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 383: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 384: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt8u", value, 70U)); - } - break; - case 385: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 386: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt8u", value, 20U)); - } - break; - case 387: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 388: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt8u", value, 100U)); - } - break; - case 389: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 390: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt8u", value, 50U)); - } - break; - case 391: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt16u", value, 200U)); - } - break; - case 392: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 393: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 394: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 395: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 396: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt16u", value, 200U)); - } - break; - case 397: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 398: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt16u", value, 100U)); - } - break; - case 399: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 400: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt16u", value, 1000U)); - } - break; - case 401: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 402: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt16u", value, 500U)); - } - break; - case 403: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt8s", value, -20)); - } - break; - case 404: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 405: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 406: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 407: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 408: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt8s", value, -20)); - } - break; - case 409: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 410: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt8s", value, -40)); - } - break; - case 411: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 412: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt8s", value, 50)); - } - break; - case 413: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 414: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt8s", value, 6)); - } - break; - case 415: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt16s", value, -100)); - } - break; - case 416: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 417: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 418: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 419: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 420: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt16s", value, -100)); - } - break; - case 421: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 422: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt16s", value, -150)); - } - break; - case 423: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 424: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt16s", value, 200)); - } - break; - case 425: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 426: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("rangeRestrictedInt16s", value, 7)); - } - break; - case 427: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", value.Value(), 70U)); - } - break; - case 428: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 429: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 430: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 431: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 432: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", value.Value(), 70U)); - } - break; - case 433: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 434: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", value.Value(), 20U)); - } - break; - case 435: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 436: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", value.Value(), 100U)); - } - break; - case 437: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 438: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8u", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8u.Value()", value.Value(), 50U)); - } - break; - case 439: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 440: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt8u", value)); - } - break; - case 441: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", value.Value(), 200U)); - } - break; - case 442: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 443: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 444: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 445: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 446: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", value.Value(), 200U)); - } - break; - case 447: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 448: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", value.Value(), 100U)); - } - break; - case 449: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 450: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", value.Value(), 1000U)); - } - break; - case 451: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 452: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16u", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16u.Value()", value.Value(), 500U)); - } - break; - case 453: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 454: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt16u", value)); - } - break; - case 455: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", value.Value(), -20)); - } - break; - case 456: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 457: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 458: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 459: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 460: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", value.Value(), -20)); - } - break; - case 461: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 462: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", value.Value(), -40)); - } - break; - case 463: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 464: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", value.Value(), 50)); - } - break; - case 465: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 466: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt8s", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt8s.Value()", value.Value(), 6)); - } - break; - case 467: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 468: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt8s", value)); - } - break; - case 469: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", value.Value(), -100)); - } - break; - case 470: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 471: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 472: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 473: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 474: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", value.Value(), -100)); - } - break; - case 475: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 476: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", value.Value(), -150)); - } - break; - case 477: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 478: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", value.Value(), 200)); - } - break; - case 479: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 480: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableRangeRestrictedInt16s", value)); - VerifyOrReturn(CheckValue("nullableRangeRestrictedInt16s.Value()", value.Value(), 7)); - } - break; - case 481: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 482: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("nullableRangeRestrictedInt16s", value)); - } - break; - case 483: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_DATA_TYPE)); - break; - case 484: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 485: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_DATA_TYPE)); - break; - case 486: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 487: - 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(CheckNextListItemDecodes("acceptedCommandList", iter_0, 0)); - VerifyOrReturn(CheckValue("acceptedCommandList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 1)); - VerifyOrReturn(CheckValue("acceptedCommandList[1]", iter_0.GetValue(), 1UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 2)); - VerifyOrReturn(CheckValue("acceptedCommandList[2]", iter_0.GetValue(), 2UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 3)); - VerifyOrReturn(CheckValue("acceptedCommandList[3]", iter_0.GetValue(), 4UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 4)); - VerifyOrReturn(CheckValue("acceptedCommandList[4]", iter_0.GetValue(), 7UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 5)); - VerifyOrReturn(CheckValue("acceptedCommandList[5]", iter_0.GetValue(), 8UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 6)); - VerifyOrReturn(CheckValue("acceptedCommandList[6]", iter_0.GetValue(), 9UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 7)); - VerifyOrReturn(CheckValue("acceptedCommandList[7]", iter_0.GetValue(), 10UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 8)); - VerifyOrReturn(CheckValue("acceptedCommandList[8]", iter_0.GetValue(), 11UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 9)); - VerifyOrReturn(CheckValue("acceptedCommandList[9]", iter_0.GetValue(), 12UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 10)); - VerifyOrReturn(CheckValue("acceptedCommandList[10]", iter_0.GetValue(), 13UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 11)); - VerifyOrReturn(CheckValue("acceptedCommandList[11]", iter_0.GetValue(), 14UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 12)); - VerifyOrReturn(CheckValue("acceptedCommandList[12]", iter_0.GetValue(), 15UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 13)); - VerifyOrReturn(CheckValue("acceptedCommandList[13]", iter_0.GetValue(), 17UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 14)); - VerifyOrReturn(CheckValue("acceptedCommandList[14]", iter_0.GetValue(), 18UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 15)); - VerifyOrReturn(CheckValue("acceptedCommandList[15]", iter_0.GetValue(), 19UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 16)); - VerifyOrReturn(CheckValue("acceptedCommandList[16]", iter_0.GetValue(), 20UL)); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 17)); - VerifyOrReturn(CheckValue("acceptedCommandList[17]", iter_0.GetValue(), 21UL)); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 18)); - } - } - break; - case 488: - 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(CheckNextListItemDecodes("generatedCommandList", iter_0, 0)); - VerifyOrReturn(CheckValue("generatedCommandList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 1)); - VerifyOrReturn(CheckValue("generatedCommandList[1]", iter_0.GetValue(), 1UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 2)); - VerifyOrReturn(CheckValue("generatedCommandList[2]", iter_0.GetValue(), 4UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 3)); - VerifyOrReturn(CheckValue("generatedCommandList[3]", iter_0.GetValue(), 5UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 4)); - VerifyOrReturn(CheckValue("generatedCommandList[4]", iter_0.GetValue(), 6UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 5)); - VerifyOrReturn(CheckValue("generatedCommandList[5]", iter_0.GetValue(), 8UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 6)); - VerifyOrReturn(CheckValue("generatedCommandList[6]", iter_0.GetValue(), 9UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 7)); - VerifyOrReturn(CheckValue("generatedCommandList[7]", iter_0.GetValue(), 10UL)); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 8)); - VerifyOrReturn(CheckValue("generatedCommandList[8]", iter_0.GetValue(), 11UL)); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 9)); - } - } - break; - case 489: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 490: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Structs::SimpleStruct::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("structAttr.a", value.a, 5U)); - VerifyOrReturn(CheckValue("structAttr.b", value.b, true)); - VerifyOrReturn(CheckValue("structAttr.c", value.c, 2U)); - VerifyOrReturn(CheckValueAsString("structAttr.d", value.d, chip::ByteSpan(chip::Uint8::from_const_char("abc"), 3))); - VerifyOrReturn(CheckValueAsString("structAttr.e", value.e, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("structAttr.f", value.f, 17U)); - VerifyOrReturn(CheckValue("structAttr.g", value.g, 1.5f)); - VerifyOrReturn(CheckValue("structAttr.h", value.h, 3.14159265358979)); - } - 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, "Send Test Command"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::Test::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::Test::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Send Test Not Handled Command"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestNotHandled::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestNotHandled::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Send Test Specific Command"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestSpecific::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestSpecific::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Send Test Add Arguments Command"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type value; - value.arg1 = 3U; - value.arg2 = 17U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestAddArguments::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Send failing Test Add Arguments Command"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type value; - value.arg1 = 250U; - value.arg2 = 6U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestAddArguments::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Read attribute BOOLEAN Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Write attribute BOOLEAN True"); - ListFreer listFreer; - bool value; - value = 1; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 8: { - LogStep(8, "Read attribute BOOLEAN True"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Write attribute BOOLEAN False"); - ListFreer listFreer; - bool value; - value = 0; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 10: { - LogStep(10, "Read attribute BOOLEAN False"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Read attribute BITMAP8 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap8::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Write attribute BITMAP8 Max Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(255U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap8::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "Read attribute BITMAP8 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap8::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Write attribute BITMAP8 Min Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(0U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap8::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 15: { - LogStep(15, "Read attribute BITMAP8 Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap8::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Read attribute BITMAP16 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap16::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Write attribute BITMAP16 Max Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(65535U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap16::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 18: { - LogStep(18, "Read attribute BITMAP16 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap16::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Write attribute BITMAP16 Min Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(0U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap16::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 20: { - LogStep(20, "Read attribute BITMAP16 Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap16::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "Read attribute BITMAP32 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Write attribute BITMAP32 Max Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(4294967295UL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 23: { - LogStep(23, "Read attribute BITMAP32 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, "Write attribute BITMAP32 Min Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(0UL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 25: { - LogStep(25, "Read attribute BITMAP32 Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 26: { - LogStep(26, "Read attribute BITMAP64 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap64::Id, true, - chip::NullOptional); - } - case 27: { - LogStep(27, "Write attribute BITMAP64 Max Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(18446744073709551615ULL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap64::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 28: { - LogStep(28, "Read attribute BITMAP64 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap64::Id, true, - chip::NullOptional); - } - case 29: { - LogStep(29, "Write attribute BITMAP64 Min Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(0ULL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap64::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 30: { - LogStep(30, "Read attribute BITMAP64 Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap64::Id, true, - chip::NullOptional); - } - case 31: { - LogStep(31, "Read attribute INT8U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8u::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Write attribute INT8U Max Value"); - ListFreer listFreer; - uint8_t value; - value = 255U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 33: { - LogStep(33, "Read attribute INT8U Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8u::Id, true, - chip::NullOptional); - } - case 34: { - LogStep(34, "Write attribute INT8U Min Value"); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 35: { - LogStep(35, "Read attribute INT8U Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8u::Id, true, - chip::NullOptional); - } - case 36: { - LogStep(36, "Read attribute INT16U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16u::Id, true, - chip::NullOptional); - } - case 37: { - LogStep(37, "Write attribute INT16U Max Value"); - ListFreer listFreer; - uint16_t value; - value = 65535U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 38: { - LogStep(38, "Read attribute INT16U Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16u::Id, true, - chip::NullOptional); - } - case 39: { - LogStep(39, "Write attribute INT16U Min Value"); - ListFreer listFreer; - uint16_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 40: { - LogStep(40, "Read attribute INT16U Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16u::Id, true, - chip::NullOptional); - } - case 41: { - LogStep(41, "Read attribute INT32U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, true, - chip::NullOptional); - } - case 42: { - LogStep(42, "Write attribute INT32U Max Value"); - ListFreer listFreer; - uint32_t value; - value = 4294967295UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 43: { - LogStep(43, "Read attribute INT32U Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, true, - chip::NullOptional); - } - case 44: { - LogStep(44, "Write attribute INT32U Min Value"); - ListFreer listFreer; - uint32_t value; - value = 0UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 45: { - LogStep(45, "Read attribute INT32U Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, true, - chip::NullOptional); - } - case 46: { - LogStep(46, "Read attribute INT64U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64u::Id, true, - chip::NullOptional); - } - case 47: { - LogStep(47, "Write attribute INT64U Max Value"); - ListFreer listFreer; - uint64_t value; - value = 18446744073709551615ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 48: { - LogStep(48, "Read attribute INT64U Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64u::Id, true, - chip::NullOptional); - } - case 49: { - LogStep(49, "Write attribute INT64U Min Value"); - ListFreer listFreer; - uint64_t value; - value = 0ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 50: { - LogStep(50, "Read attribute INT64U Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64u::Id, true, - chip::NullOptional); - } - case 51: { - LogStep(51, "Read attribute INT8S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, true, - chip::NullOptional); - } - case 52: { - LogStep(52, "Write attribute INT8S Max Value"); - ListFreer listFreer; - int8_t value; - value = 127; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 53: { - LogStep(53, "Read attribute INT8S Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, true, - chip::NullOptional); - } - case 54: { - LogStep(54, "Write attribute INT8S Min Value"); - ListFreer listFreer; - int8_t value; - value = -128; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 55: { - LogStep(55, "Read attribute INT8S Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, true, - chip::NullOptional); - } - case 56: { - LogStep(56, "Write attribute INT8S Default Value"); - ListFreer listFreer; - int8_t value; - value = 0; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 57: { - LogStep(57, "Read attribute INT8S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, true, - chip::NullOptional); - } - case 58: { - LogStep(58, "Read attribute INT16S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, true, - chip::NullOptional); - } - case 59: { - LogStep(59, "Write attribute INT16S Max Value"); - ListFreer listFreer; - int16_t value; - value = 32767; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 60: { - LogStep(60, "Read attribute INT16S Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, true, - chip::NullOptional); - } - case 61: { - LogStep(61, "Write attribute INT16S Min Value"); - ListFreer listFreer; - int16_t value; - value = -32768; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 62: { - LogStep(62, "Read attribute INT16S Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, true, - chip::NullOptional); - } - case 63: { - LogStep(63, "Write attribute INT16S Default Value"); - ListFreer listFreer; - int16_t value; - value = 0; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 64: { - LogStep(64, "Read attribute INT16S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, true, - chip::NullOptional); - } - case 65: { - LogStep(65, "Read attribute INT32S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, true, - chip::NullOptional); - } - case 66: { - LogStep(66, "Write attribute INT32S Max Value"); - ListFreer listFreer; - int32_t value; - value = 2147483647L; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 67: { - LogStep(67, "Read attribute INT32S Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, true, - chip::NullOptional); - } - case 68: { - LogStep(68, "Write attribute INT32S Min Value"); - ListFreer listFreer; - int32_t value; - value = -2147483648L; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 69: { - LogStep(69, "Read attribute INT32S Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, true, - chip::NullOptional); - } - case 70: { - LogStep(70, "Write attribute INT32S Default Value"); - ListFreer listFreer; - int32_t value; - value = 0L; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 71: { - LogStep(71, "Read attribute INT32S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, true, - chip::NullOptional); - } - case 72: { - LogStep(72, "Read attribute INT64S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, true, - chip::NullOptional); - } - case 73: { - LogStep(73, "Write attribute INT64S Max Value"); - ListFreer listFreer; - int64_t value; - value = 9223372036854775807LL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 74: { - LogStep(74, "Read attribute INT64S Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, true, - chip::NullOptional); - } - case 75: { - LogStep(75, "Write attribute INT64S Min Value"); - ListFreer listFreer; - int64_t value; - value = -9223372036854775807LL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 76: { - LogStep(76, "Read attribute INT64S Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, true, - chip::NullOptional); - } - case 77: { - LogStep(77, "Write attribute INT64S Default Value"); - ListFreer listFreer; - int64_t value; - value = 0LL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 78: { - LogStep(78, "Read attribute INT64S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, true, - chip::NullOptional); - } - case 79: { - LogStep(79, "Read attribute SINGLE Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatSingle::Id, true, - chip::NullOptional); - } - case 80: { - LogStep(80, "Write attribute SINGLE medium Value"); - ListFreer listFreer; - float value; - value = 0.1f; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatSingle::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 81: { - LogStep(81, "Read attribute SINGLE medium Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatSingle::Id, true, - chip::NullOptional); - } - case 82: { - LogStep(82, "Write attribute SINGLE large Value"); - ListFreer listFreer; - float value; - value = 17000000000.0f; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatSingle::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 83: { - LogStep(83, "Read attribute SINGLE large Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatSingle::Id, true, - chip::NullOptional); - } - case 84: { - LogStep(84, "Write attribute SINGLE small Value"); - ListFreer listFreer; - float value; - value = 1.7e-10f; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatSingle::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 85: { - LogStep(85, "Read attribute SINGLE small Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatSingle::Id, true, - chip::NullOptional); - } - case 86: { - LogStep(86, "Write attribute SINGLE Default Value"); - ListFreer listFreer; - float value; - value = 0.0f; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatSingle::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 87: { - LogStep(87, "Read attribute SINGLE Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatSingle::Id, true, - chip::NullOptional); - } - case 88: { - LogStep(88, "Read attribute DOUBLE Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatDouble::Id, true, - chip::NullOptional); - } - case 89: { - LogStep(89, "Write attribute DOUBLE medium Value"); - ListFreer listFreer; - double value; - value = 0.1234567890123; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatDouble::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 90: { - LogStep(90, "Read attribute DOUBLE medium Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatDouble::Id, true, - chip::NullOptional); - } - case 91: { - LogStep(91, "Write attribute DOUBLE large Value"); - ListFreer listFreer; - double value; - value = 1.7e+200; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatDouble::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 92: { - LogStep(92, "Read attribute DOUBLE large Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatDouble::Id, true, - chip::NullOptional); - } - case 93: { - LogStep(93, "Write attribute DOUBLE small Value"); - ListFreer listFreer; - double value; - value = 1.7e-200; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatDouble::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 94: { - LogStep(94, "Read attribute DOUBLE small Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatDouble::Id, true, - chip::NullOptional); - } - case 95: { - LogStep(95, "Write attribute DOUBLE Default Value"); - ListFreer listFreer; - double value; - value = 0; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatDouble::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 96: { - LogStep(96, "Read attribute DOUBLE Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::FloatDouble::Id, true, - chip::NullOptional); - } - case 97: { - LogStep(97, "Read attribute ENUM8 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum8::Id, true, - chip::NullOptional); - } - case 98: { - LogStep(98, "Write attribute ENUM8 Max Value"); - ListFreer listFreer; - uint8_t value; - value = 255U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum8::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 99: { - LogStep(99, "Read attribute ENUM8 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum8::Id, true, - chip::NullOptional); - } - case 100: { - LogStep(100, "Write attribute ENUM8 Min Value"); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum8::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 101: { - LogStep(101, "Read attribute ENUM8 Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum8::Id, true, - chip::NullOptional); - } - case 102: { - LogStep(102, "Read attribute ENUM16 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum16::Id, true, - chip::NullOptional); - } - case 103: { - LogStep(103, "Write attribute ENUM16 Max Value"); - ListFreer listFreer; - uint16_t value; - value = 65535U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum16::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 104: { - LogStep(104, "Read attribute ENUM16 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum16::Id, true, - chip::NullOptional); - } - case 105: { - LogStep(105, "Write attribute ENUM16 Min Value"); - ListFreer listFreer; - uint16_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum16::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 106: { - LogStep(106, "Read attribute ENUM16 Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum16::Id, true, - chip::NullOptional); - } - case 107: { - LogStep(107, "Read attribute OCTET_STRING Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 108: { - LogStep(108, "Write attribute OCTET_STRING with embedded null"); - ListFreer listFreer; - chip::ByteSpan value; - value = chip::ByteSpan(chip::Uint8::from_const_char("Tes\000ti\000nggarbage: not in length on purpose"), 9); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 109: { - LogStep(109, "Read attribute OCTET_STRING with embedded null"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 110: { - LogStep(110, "Write attribute OCTET_STRING with hex: format"); - ListFreer listFreer; - chip::ByteSpan value; - value = chip::ByteSpan(chip::Uint8::from_const_char("\x00\x01\x02\x03\x04\x05garbage: not in length on purpose"), 6); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 111: { - LogStep(111, "Read attribute OCTET_STRING with hex: format"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 112: { - LogStep(112, "Write attribute OCTET_STRING with weird chars"); - ListFreer listFreer; - chip::ByteSpan value; - value = chip::ByteSpan(chip::Uint8::from_const_char("\015\012\377\042\240garbage: not in length on purpose"), 5); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 113: { - LogStep(113, "Read attribute OCTET_STRING with weird chars"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 114: { - LogStep(114, "Write attribute OCTET_STRING"); - ListFreer listFreer; - chip::ByteSpan value; - value = chip::ByteSpan(chip::Uint8::from_const_char("TestValuegarbage: not in length on purpose"), 9); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 115: { - LogStep(115, "Read attribute OCTET_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 116: { - LogStep(116, "Write attribute OCTET_STRING"); - ListFreer listFreer; - chip::ByteSpan value; - value = chip::ByteSpan(chip::Uint8::from_const_char("TestValueLongerThan10garbage: not in length on purpose"), 21); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 117: { - LogStep(117, "Read attribute OCTET_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 118: { - LogStep(118, "Write attribute OCTET_STRING"); - ListFreer listFreer; - chip::ByteSpan value; - value = chip::ByteSpan(chip::Uint8::from_const_char("garbage: not in length on purpose"), 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 119: { - LogStep(119, "Read attribute LONG_OCTET_STRING Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::LongOctetString::Id, - true, chip::NullOptional); - } - case 120: { - LogStep(120, "Write attribute LONG_OCTET_STRING"); - ListFreer listFreer; - chip::ByteSpan value; - value = chip::ByteSpan( - chip::Uint8::from_const_char("1111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111" - "111111111111111111111111111111111111111111111garbage: not in length on purpose"), - 300); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::LongOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 121: { - LogStep(121, "Read attribute LONG_OCTET_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::LongOctetString::Id, - true, chip::NullOptional); - } - case 122: { - LogStep(122, "Write attribute LONG_OCTET_STRING"); - ListFreer listFreer; - chip::ByteSpan value; - value = chip::ByteSpan(chip::Uint8::from_const_char("garbage: not in length on purpose"), 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::LongOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 123: { - LogStep(123, "Read attribute CHAR_STRING Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 124: { - LogStep(124, "Write attribute CHAR_STRING"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("☉T☉garbage: not in length on purpose", 7); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 125: { - LogStep(125, "Read attribute CHAR_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 126: { - LogStep(126, "Write attribute CHAR_STRING - Value too long"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("☉TestValueLongerThan10☉garbage: not in length on purpose", 27); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 127: { - LogStep(127, "Read attribute CHAR_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 128: { - LogStep(128, "Write attribute CHAR_STRING - Empty"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("garbage: not in length on purpose", 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 129: { - LogStep(129, "Read attribute LONG_CHAR_STRING Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::LongCharString::Id, true, - chip::NullOptional); - } - case 130: { - LogStep(130, "Write attribute LONG_CHAR_STRING"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span( - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉" - "☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉☉garbage: not in length on purpose", - 900); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::LongCharString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 131: { - LogStep(131, "Read attribute LONG_CHAR_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::LongCharString::Id, true, - chip::NullOptional); - } - case 132: { - LogStep(132, "Write attribute LONG_CHAR_STRING"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("garbage: not in length on purpose", 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::LongCharString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 133: { - LogStep(133, "Read attribute LIST_LONG_OCTET_STRING (for chunked read)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListLongOctetString::Id, - true, chip::NullOptional); - } - case 134: { - LogStep(134, "Write attribute LIST_LONG_OCTET_STRING (for chunked write)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(5); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " - "length on purpose"), - 512); - listHolder_0->mList[1] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " - "length on purpose"), - 512); - listHolder_0->mList[2] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " - "length on purpose"), - 512); - listHolder_0->mList[3] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " - "length on purpose"), - 512); - listHolder_0->mList[4] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " - "length on purpose"), - 512); - value = chip::app::DataModel::List(listHolder_0->mList, 5); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListLongOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 135: { - LogStep(135, "Read attribute LIST_LONG_OCTET_STRING (for chunked read)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListLongOctetString::Id, - true, chip::NullOptional); - } - case 136: { - LogStep(136, "Write attribute LIST_LONG_OCTET_STRING (for chunked write)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " - "length on purpose"), - 512); - listHolder_0->mList[1] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " - "length on purpose"), - 512); - listHolder_0->mList[2] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " - "length on purpose"), - 512); - listHolder_0->mList[3] = chip::ByteSpan( - chip::Uint8::from_const_char( - "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" - "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123" - "456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcd" - "ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567" - "89abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdefgarbage: not in " - "length on purpose"), - 512); - value = chip::app::DataModel::List(listHolder_0->mList, 4); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListLongOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 137: { - LogStep(137, "Read attribute EPOCH_US Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochUs::Id, true, - chip::NullOptional); - } - case 138: { - LogStep(138, "Write attribute EPOCH_US Max Value"); - ListFreer listFreer; - uint64_t value; - value = 18446744073709551615ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochUs::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 139: { - LogStep(139, "Read attribute EPOCH_US Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochUs::Id, true, - chip::NullOptional); - } - case 140: { - LogStep(140, "Write attribute EPOCH_US Min Value"); - ListFreer listFreer; - uint64_t value; - value = 0ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochUs::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 141: { - LogStep(141, "Read attribute EPOCH_US Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochUs::Id, true, - chip::NullOptional); - } - case 142: { - LogStep(142, "Read attribute EPOCH_S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochS::Id, true, - chip::NullOptional); - } - case 143: { - LogStep(143, "Write attribute EPOCH_S Max Value"); - ListFreer listFreer; - uint32_t value; - value = 4294967295UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochS::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 144: { - LogStep(144, "Read attribute EPOCH_S Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochS::Id, true, - chip::NullOptional); - } - case 145: { - LogStep(145, "Write attribute EPOCH_S Min Value"); - ListFreer listFreer; - uint32_t value; - value = 0UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochS::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 146: { - LogStep(146, "Read attribute EPOCH_S Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochS::Id, true, - chip::NullOptional); - } - case 147: { - LogStep(147, "Read attribute UNSUPPORTED"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Unsupported::Id, true, - chip::NullOptional); - } - case 148: { - LogStep(148, "Writeattribute UNSUPPORTED"); - ListFreer listFreer; - bool value; - value = 0; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Unsupported::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 149: { - LogStep(149, "Send Test Command to unsupported endpoint"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::Test::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(200), UnitTesting::Id, UnitTesting::Commands::Test::Id, value, - chip::NullOptional - - ); - } - case 150: { - LogStep(150, "Send Test Command to unsupported cluster"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::Test::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), UnitTesting::Id, UnitTesting::Commands::Test::Id, value, - chip::NullOptional - - ); - } - case 151: { - LogStep(151, "Read attribute vendor_id Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::VendorId::Id, true, - chip::NullOptional); - } - case 152: { - LogStep(152, "Write attribute vendor_id"); - ListFreer listFreer; - chip::VendorId value; - value = static_cast(17); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::VendorId::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 153: { - LogStep(153, "Read attribute vendor_id"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::VendorId::Id, true, - chip::NullOptional); - } - case 154: { - LogStep(154, "Restore attribute vendor_id"); - ListFreer listFreer; - chip::VendorId value; - value = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::VendorId::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 155: { - LogStep(155, "Send a command with a vendor_id and enum"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestEnumsRequest::Type value; - value.arg1 = static_cast(20003); - value.arg2 = static_cast(1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestEnumsRequest::Id, value, - chip::NullOptional - - ); - } - case 156: { - LogStep(156, "Send a command with a vendor_id and invalid enum"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestEnumsRequest::Type value; - value.arg1 = static_cast(20003); - value.arg2 = static_cast(101); - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestEnumsRequest::Id, value, - chip::NullOptional - - ); - } - case 157: { - LogStep(157, "Send Test Command With Struct Argument and arg1.b is true"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestStructArgumentRequest::Type value; - - value.arg1.a = 0U; - value.arg1.b = true; - value.arg1.c = static_cast(2); - value.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - value.arg1.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - value.arg1.f = static_cast>(1U); - value.arg1.g = 0.0f; - value.arg1.h = 0; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestStructArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 158: { - LogStep(158, "Send Test Command With Struct Argument and arg1.b is false"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestStructArgumentRequest::Type value; - - value.arg1.a = 0U; - value.arg1.b = false; - value.arg1.c = static_cast(2); - value.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - value.arg1.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - value.arg1.f = static_cast>(1U); - value.arg1.g = 0.0f; - value.arg1.h = 0; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestStructArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 159: { - LogStep(159, "Send Test Command With Nested Struct Argument and arg1.c.b is true"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestNestedStructArgumentRequest::Type value; - - value.arg1.a = 0U; - value.arg1.b = true; - - value.arg1.c.a = 0U; - value.arg1.c.b = true; - value.arg1.c.c = static_cast(2); - value.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - value.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - value.arg1.c.f = static_cast>(1U); - value.arg1.c.g = 0.0f; - value.arg1.c.h = 0; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestNestedStructArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 160: { - LogStep(160, "Send Test Command With Nested Struct Argument arg1.c.b is false"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestNestedStructArgumentRequest::Type value; - - value.arg1.a = 0U; - value.arg1.b = true; - - value.arg1.c.a = 0U; - value.arg1.c.b = false; - value.arg1.c.c = static_cast(2); - value.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - value.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - value.arg1.c.f = static_cast>(1U); - value.arg1.c.g = 0.0f; - value.arg1.c.h = 0; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestNestedStructArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 161: { - LogStep(161, "Send Test Command With Nested Struct List Argument and all fields b of arg1.d are true"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestNestedStructListArgumentRequest::Type value; - - value.arg1.a = 0U; - value.arg1.b = true; - - value.arg1.c.a = 0U; - value.arg1.c.b = true; - value.arg1.c.c = static_cast(2); - value.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - value.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - value.arg1.c.f = static_cast>(1U); - value.arg1.c.g = 0.0f; - value.arg1.c.h = 0; - - { - auto * listHolder_1 = new ListHolder(2); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].a = 1U; - listHolder_1->mList[0].b = true; - listHolder_1->mList[0].c = static_cast(3); - listHolder_1->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_1->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_1->mList[0].f = static_cast>(1U); - listHolder_1->mList[0].g = 0.0f; - listHolder_1->mList[0].h = 0; - - listHolder_1->mList[1].a = 2U; - listHolder_1->mList[1].b = true; - listHolder_1->mList[1].c = static_cast(3); - listHolder_1->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_1->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_1->mList[1].f = static_cast>(1U); - listHolder_1->mList[1].g = 0.0f; - listHolder_1->mList[1].h = 0; - - value.arg1.d = chip::app::DataModel::List( - listHolder_1->mList, 2); - } - - { - auto * listHolder_1 = new ListHolder(3); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = 1UL; - listHolder_1->mList[1] = 2UL; - listHolder_1->mList[2] = 3UL; - value.arg1.e = chip::app::DataModel::List(listHolder_1->mList, 3); - } - - { - auto * listHolder_1 = new ListHolder(3); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); - listHolder_1->mList[1] = - chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); - listHolder_1->mList[2] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); - value.arg1.f = chip::app::DataModel::List(listHolder_1->mList, 3); - } - - { - auto * listHolder_1 = new ListHolder(2); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = 0U; - listHolder_1->mList[1] = 255U; - value.arg1.g = chip::app::DataModel::List(listHolder_1->mList, 2); - } - - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestNestedStructListArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 162: { - LogStep(162, "Send Test Command With Nested Struct List Argument and some fields b of arg1.d are false"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestNestedStructListArgumentRequest::Type value; - - value.arg1.a = 0U; - value.arg1.b = true; - - value.arg1.c.a = 0U; - value.arg1.c.b = true; - value.arg1.c.c = static_cast(2); - value.arg1.c.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - value.arg1.c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - value.arg1.c.f = static_cast>(1U); - value.arg1.c.g = 0.0f; - value.arg1.c.h = 0; - - { - auto * listHolder_1 = new ListHolder(2); - listFreer.add(listHolder_1); - - listHolder_1->mList[0].a = 1U; - listHolder_1->mList[0].b = true; - listHolder_1->mList[0].c = static_cast(3); - listHolder_1->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_1->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_1->mList[0].f = static_cast>(1U); - listHolder_1->mList[0].g = 0.0f; - listHolder_1->mList[0].h = 0; - - listHolder_1->mList[1].a = 2U; - listHolder_1->mList[1].b = false; - listHolder_1->mList[1].c = static_cast(3); - listHolder_1->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_1->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_1->mList[1].f = static_cast>(1U); - listHolder_1->mList[1].g = 0.0f; - listHolder_1->mList[1].h = 0; - - value.arg1.d = chip::app::DataModel::List( - listHolder_1->mList, 2); - } - - { - auto * listHolder_1 = new ListHolder(3); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = 1UL; - listHolder_1->mList[1] = 2UL; - listHolder_1->mList[2] = 3UL; - value.arg1.e = chip::app::DataModel::List(listHolder_1->mList, 3); - } - - { - auto * listHolder_1 = new ListHolder(3); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); - listHolder_1->mList[1] = - chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); - listHolder_1->mList[2] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); - value.arg1.f = chip::app::DataModel::List(listHolder_1->mList, 3); - } - - { - auto * listHolder_1 = new ListHolder(2); - listFreer.add(listHolder_1); - listHolder_1->mList[0] = 0U; - listHolder_1->mList[1] = 255U; - value.arg1.g = chip::app::DataModel::List(listHolder_1->mList, 2); - } - - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestNestedStructListArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 163: { - LogStep(163, "Send Test Command With Struct Argument and see what we get back"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::SimpleStructEchoRequest::Type value; - - value.arg1.a = 17U; - value.arg1.b = false; - value.arg1.c = static_cast(2); - value.arg1.d = chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - value.arg1.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - value.arg1.f = static_cast>(1U); - value.arg1.g = 0.1f; - value.arg1.h = 0.1; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::SimpleStructEchoRequest::Id, - value, chip::NullOptional - - ); - } - case 164: { - LogStep(164, "Send Test Command With List of INT8U and none of them is set to 0"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestListInt8UArgumentRequest::Type value; - - { - auto * listHolder_0 = new ListHolder(9); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 2U; - listHolder_0->mList[2] = 3U; - listHolder_0->mList[3] = 4U; - listHolder_0->mList[4] = 5U; - listHolder_0->mList[5] = 6U; - listHolder_0->mList[6] = 7U; - listHolder_0->mList[7] = 8U; - listHolder_0->mList[8] = 9U; - value.arg1 = chip::app::DataModel::List(listHolder_0->mList, 9); - } - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestListInt8UArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 165: { - LogStep(165, "Send Test Command With List of INT8U and one of them is set to 0"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestListInt8UArgumentRequest::Type value; - - { - auto * listHolder_0 = new ListHolder(10); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 2U; - listHolder_0->mList[2] = 3U; - listHolder_0->mList[3] = 4U; - listHolder_0->mList[4] = 5U; - listHolder_0->mList[5] = 6U; - listHolder_0->mList[6] = 7U; - listHolder_0->mList[7] = 8U; - listHolder_0->mList[8] = 9U; - listHolder_0->mList[9] = 0U; - value.arg1 = chip::app::DataModel::List(listHolder_0->mList, 10); - } - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestListInt8UArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 166: { - LogStep(166, "Send Test Command With List of INT8U and get it reversed"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseRequest::Type value; - - { - auto * listHolder_0 = new ListHolder(9); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 2U; - listHolder_0->mList[2] = 3U; - listHolder_0->mList[3] = 4U; - listHolder_0->mList[4] = 5U; - listHolder_0->mList[5] = 6U; - listHolder_0->mList[6] = 7U; - listHolder_0->mList[7] = 8U; - listHolder_0->mList[8] = 9U; - value.arg1 = chip::app::DataModel::List(listHolder_0->mList, 9); - } - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestListInt8UReverseRequest::Id, value, chip::NullOptional - - ); - } - case 167: { - LogStep(167, "Send Test Command With empty List of INT8U and get an empty list back"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseRequest::Type value; - - value.arg1 = chip::app::DataModel::List(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestListInt8UReverseRequest::Id, value, chip::NullOptional - - ); - } - case 168: { - LogStep(168, "Send Test Command With List of Struct Argument and arg1.b of first item is true"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestListStructArgumentRequest::Type value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].a = 0U; - listHolder_0->mList[0].b = true; - listHolder_0->mList[0].c = static_cast(2); - listHolder_0->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("first_octet_stringgarbage: not in length on purpose"), 18); - listHolder_0->mList[0].e = chip::Span("first_char_stringgarbage: not in length on purpose", 17); - listHolder_0->mList[0].f = static_cast>(1U); - listHolder_0->mList[0].g = 0.0f; - listHolder_0->mList[0].h = 0; - - listHolder_0->mList[1].a = 1U; - listHolder_0->mList[1].b = true; - listHolder_0->mList[1].c = static_cast(3); - listHolder_0->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("second_octet_stringgarbage: not in length on purpose"), 19); - listHolder_0->mList[1].e = chip::Span("second_char_stringgarbage: not in length on purpose", 18); - listHolder_0->mList[1].f = static_cast>(1U); - listHolder_0->mList[1].g = 0.0f; - listHolder_0->mList[1].h = 0; - - value.arg1 = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestListStructArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 169: { - LogStep(169, "Send Test Command With List of Struct Argument and arg1.b of first item is false"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestListStructArgumentRequest::Type value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].a = 1U; - listHolder_0->mList[0].b = true; - listHolder_0->mList[0].c = static_cast(3); - listHolder_0->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("second_octet_stringgarbage: not in length on purpose"), 19); - listHolder_0->mList[0].e = chip::Span("second_char_stringgarbage: not in length on purpose", 18); - listHolder_0->mList[0].f = static_cast>(1U); - listHolder_0->mList[0].g = 0.0f; - listHolder_0->mList[0].h = 0; - - listHolder_0->mList[1].a = 0U; - listHolder_0->mList[1].b = false; - listHolder_0->mList[1].c = static_cast(2); - listHolder_0->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("first_octet_stringgarbage: not in length on purpose"), 18); - listHolder_0->mList[1].e = chip::Span("first_char_stringgarbage: not in length on purpose", 17); - listHolder_0->mList[1].f = static_cast>(1U); - listHolder_0->mList[1].g = 0.0f; - listHolder_0->mList[1].h = 0; - - value.arg1 = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestListStructArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 170: { - LogStep(170, - "Send Test Command With List of Nested Struct List Argument and all fields b of elements of arg1.d are true"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestListNestedStructListArgumentRequest::Type value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].a = 0U; - listHolder_0->mList[0].b = true; - - listHolder_0->mList[0].c.a = 0U; - listHolder_0->mList[0].c.b = true; - listHolder_0->mList[0].c.c = static_cast(2); - listHolder_0->mList[0].c.d = - chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - listHolder_0->mList[0].c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - listHolder_0->mList[0].c.f = static_cast>(1U); - listHolder_0->mList[0].c.g = 0.0f; - listHolder_0->mList[0].c.h = 0; - - { - auto * listHolder_2 = new ListHolder(2); - listFreer.add(listHolder_2); - - listHolder_2->mList[0].a = 1U; - listHolder_2->mList[0].b = true; - listHolder_2->mList[0].c = static_cast(3); - listHolder_2->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_2->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_2->mList[0].f = static_cast>(1U); - listHolder_2->mList[0].g = 0.0f; - listHolder_2->mList[0].h = 0; - - listHolder_2->mList[1].a = 2U; - listHolder_2->mList[1].b = true; - listHolder_2->mList[1].c = static_cast(3); - listHolder_2->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_2->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_2->mList[1].f = static_cast>(1U); - listHolder_2->mList[1].g = 0.0f; - listHolder_2->mList[1].h = 0; - - listHolder_0->mList[0].d = - chip::app::DataModel::List( - listHolder_2->mList, 2); - } - - { - auto * listHolder_2 = new ListHolder(3); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = 1UL; - listHolder_2->mList[1] = 2UL; - listHolder_2->mList[2] = 3UL; - listHolder_0->mList[0].e = chip::app::DataModel::List(listHolder_2->mList, 3); - } - - { - auto * listHolder_2 = new ListHolder(3); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); - listHolder_2->mList[1] = - chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); - listHolder_2->mList[2] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); - listHolder_0->mList[0].f = chip::app::DataModel::List(listHolder_2->mList, 3); - } - - { - auto * listHolder_2 = new ListHolder(2); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = 0U; - listHolder_2->mList[1] = 255U; - listHolder_0->mList[0].g = chip::app::DataModel::List(listHolder_2->mList, 2); - } - - value.arg1 = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestListNestedStructListArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 171: { - LogStep(171, "Send Test Command With Nested Struct List Argument and some fields b of elements of arg1.d are false"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestListNestedStructListArgumentRequest::Type value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].a = 0U; - listHolder_0->mList[0].b = true; - - listHolder_0->mList[0].c.a = 0U; - listHolder_0->mList[0].c.b = true; - listHolder_0->mList[0].c.c = static_cast(2); - listHolder_0->mList[0].c.d = - chip::ByteSpan(chip::Uint8::from_const_char("octet_stringgarbage: not in length on purpose"), 12); - listHolder_0->mList[0].c.e = chip::Span("char_stringgarbage: not in length on purpose", 11); - listHolder_0->mList[0].c.f = static_cast>(1U); - listHolder_0->mList[0].c.g = 0.0f; - listHolder_0->mList[0].c.h = 0; - - { - auto * listHolder_2 = new ListHolder(2); - listFreer.add(listHolder_2); - - listHolder_2->mList[0].a = 1U; - listHolder_2->mList[0].b = true; - listHolder_2->mList[0].c = static_cast(3); - listHolder_2->mList[0].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_2->mList[0].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_2->mList[0].f = static_cast>(1U); - listHolder_2->mList[0].g = 0.0f; - listHolder_2->mList[0].h = 0; - - listHolder_2->mList[1].a = 2U; - listHolder_2->mList[1].b = false; - listHolder_2->mList[1].c = static_cast(3); - listHolder_2->mList[1].d = - chip::ByteSpan(chip::Uint8::from_const_char("nested_octet_stringgarbage: not in length on purpose"), 19); - listHolder_2->mList[1].e = chip::Span("nested_char_stringgarbage: not in length on purpose", 18); - listHolder_2->mList[1].f = static_cast>(1U); - listHolder_2->mList[1].g = 0.0f; - listHolder_2->mList[1].h = 0; - - listHolder_0->mList[0].d = - chip::app::DataModel::List( - listHolder_2->mList, 2); - } - - { - auto * listHolder_2 = new ListHolder(3); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = 1UL; - listHolder_2->mList[1] = 2UL; - listHolder_2->mList[2] = 3UL; - listHolder_0->mList[0].e = chip::app::DataModel::List(listHolder_2->mList, 3); - } - - { - auto * listHolder_2 = new ListHolder(3); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_1garbage: not in length on purpose"), 14); - listHolder_2->mList[1] = - chip::ByteSpan(chip::Uint8::from_const_char("octect_string_2garbage: not in length on purpose"), 15); - listHolder_2->mList[2] = - chip::ByteSpan(chip::Uint8::from_const_char("octet_string_3garbage: not in length on purpose"), 14); - listHolder_0->mList[0].f = chip::app::DataModel::List(listHolder_2->mList, 3); - } - - { - auto * listHolder_2 = new ListHolder(2); - listFreer.add(listHolder_2); - listHolder_2->mList[0] = 0U; - listHolder_2->mList[1] = 255U; - listHolder_0->mList[0].g = chip::app::DataModel::List(listHolder_2->mList, 2); - } - - value.arg1 = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestListNestedStructListArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 172: { - LogStep(172, "Write attribute LIST With List of INT8U and none of them is set to 0"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 2U; - listHolder_0->mList[2] = 3U; - listHolder_0->mList[3] = 4U; - value = chip::app::DataModel::List(listHolder_0->mList, 4); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListInt8u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 173: { - LogStep(173, "Read attribute LIST With List of INT8U"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListInt8u::Id, true, - chip::NullOptional); - } - case 174: { - LogStep(174, "Write attribute LIST With List of OCTET_STRING"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = chip::ByteSpan(chip::Uint8::from_const_char("Test0garbage: not in length on purpose"), 5); - listHolder_0->mList[1] = chip::ByteSpan(chip::Uint8::from_const_char("Test1garbage: not in length on purpose"), 5); - listHolder_0->mList[2] = chip::ByteSpan(chip::Uint8::from_const_char("Test2garbage: not in length on purpose"), 5); - listHolder_0->mList[3] = chip::ByteSpan(chip::Uint8::from_const_char("Test3garbage: not in length on purpose"), 5); - value = chip::app::DataModel::List(listHolder_0->mList, 4); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 175: { - LogStep(175, "Read attribute LIST With List of OCTET_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListOctetString::Id, - true, chip::NullOptional); - } - case 176: { - LogStep(176, "Write attribute LIST With List of LIST_STRUCT_OCTET_STRING"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].member1 = 0ULL; - listHolder_0->mList[0].member2 = - chip::ByteSpan(chip::Uint8::from_const_char("Test0garbage: not in length on purpose"), 5); - - listHolder_0->mList[1].member1 = 1ULL; - listHolder_0->mList[1].member2 = - chip::ByteSpan(chip::Uint8::from_const_char("Test1garbage: not in length on purpose"), 5); - - listHolder_0->mList[2].member1 = 2ULL; - listHolder_0->mList[2].member2 = - chip::ByteSpan(chip::Uint8::from_const_char("Test2garbage: not in length on purpose"), 5); - - listHolder_0->mList[3].member1 = 3ULL; - listHolder_0->mList[3].member2 = - chip::ByteSpan(chip::Uint8::from_const_char("Test3garbage: not in length on purpose"), 5); - - value = chip::app::DataModel::List( - listHolder_0->mList, 4); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::ListStructOctetString::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 177: { - LogStep(177, "Read attribute LIST With List of LIST_STRUCT_OCTET_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::ListStructOctetString::Id, true, chip::NullOptional); - } - case 178: { - LogStep(178, "Send Test Command with optional arg set."); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalRequest::Type value; - value.arg1.Emplace(); - value.arg1.Value().SetNonNull(); - value.arg1.Value().Value() = 5U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestNullableOptionalRequest::Id, value, chip::NullOptional - - ); - } - case 179: { - LogStep(179, "Send Test Command without its optional arg."); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalRequest::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestNullableOptionalRequest::Id, value, chip::NullOptional - - ); - } - case 180: { - LogStep(180, "Read list of structs containing nullables and optionals"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::ListNullablesAndOptionalsStruct::Id, true, chip::NullOptional); - } - case 181: { - LogStep(181, "Write list of structs containing nullables and optionals"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].nullableInt.SetNull(); - listHolder_0->mList[0].nullableString.SetNull(); - listHolder_0->mList[0].nullableStruct.SetNull(); - listHolder_0->mList[0].nullableList.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(2); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = static_cast(1); - listHolder_3->mList[1] = static_cast(2); - listHolder_0->mList[0].nullableList.Value() = - chip::app::DataModel::List(listHolder_3->mList, 2); - } - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::ListNullablesAndOptionalsStruct::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 182: { - LogStep(182, "Read list of structs containing nullables and optionals after writing"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::ListNullablesAndOptionalsStruct::Id, true, chip::NullOptional); - } - case 183: { - LogStep(183, "Write attribute NULLABLE_BOOLEAN null"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBoolean::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 184: { - LogStep(184, "Read attribute NULLABLE_BOOLEAN null"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBoolean::Id, - true, chip::NullOptional); - } - case 185: { - LogStep(185, "Write attribute NULLABLE_BOOLEAN True"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBoolean::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 186: { - LogStep(186, "Read attribute NULLABLE_BOOLEAN True"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBoolean::Id, - true, chip::NullOptional); - } - case 187: { - LogStep(187, "Read attribute NULLABLE_BOOLEAN not null"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBoolean::Id, - true, chip::NullOptional); - } - case 188: { - LogStep(188, "Write attribute NULLABLE_BITMAP8 Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNonNull(); - value.Value() = static_cast>(254U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap8::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 189: { - LogStep(189, "Read attribute NULLABLE_BITMAP8 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap8::Id, - true, chip::NullOptional); - } - case 190: { - LogStep(190, "Write attribute NULLABLE_BITMAP8 Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNonNull(); - value.Value() = static_cast>(255U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap8::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 191: { - LogStep(191, "Read attribute NULLABLE_BITMAP8 unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap8::Id, - true, chip::NullOptional); - } - case 192: { - LogStep(192, "Write attribute NULLABLE_BITMAP8 null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap8::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 193: { - LogStep(193, "Read attribute NULLABLE_BITMAP8 null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap8::Id, - true, chip::NullOptional); - } - case 194: { - LogStep(194, "Read attribute NULLABLE_BITMAP8 not 254 Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap8::Id, - true, chip::NullOptional); - } - case 195: { - LogStep(195, "Write attribute NULLABLE_BITMAP16 Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNonNull(); - value.Value() = static_cast>(65534U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap16::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 196: { - LogStep(196, "Read attribute NULLABLE_BITMAP16 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap16::Id, - true, chip::NullOptional); - } - case 197: { - LogStep(197, "Write attribute NULLABLE_BITMAP16 Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNonNull(); - value.Value() = static_cast>(65535U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap16::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 198: { - LogStep(198, "Read attribute NULLABLE_BITMAP16 unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap16::Id, - true, chip::NullOptional); - } - case 199: { - LogStep(199, "Write attribute NULLABLE_BITMAP16 null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap16::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 200: { - LogStep(200, "Read attribute NULLABLE_BITMAP16 null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap16::Id, - true, chip::NullOptional); - } - case 201: { - LogStep(201, "Write attribute NULLABLE_BITMAP32 Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNonNull(); - value.Value() = static_cast>(4294967294UL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap32::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 202: { - LogStep(202, "Read attribute NULLABLE_BITMAP32 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap32::Id, - true, chip::NullOptional); - } - case 203: { - LogStep(203, "Write attribute NULLABLE_BITMAP32 Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNonNull(); - value.Value() = static_cast>(4294967295UL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap32::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 204: { - LogStep(204, "Read attribute NULLABLE_BITMAP32 unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap32::Id, - true, chip::NullOptional); - } - case 205: { - LogStep(205, "Write attribute NULLABLE_BITMAP32 null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap32::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 206: { - LogStep(206, "Read attribute NULLABLE_BITMAP32 null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap32::Id, - true, chip::NullOptional); - } - case 207: { - LogStep(207, "Write attribute NULLABLE_BITMAP64 Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNonNull(); - value.Value() = static_cast>(18446744073709551614ULL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap64::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 208: { - LogStep(208, "Read attribute NULLABLE_BITMAP64 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap64::Id, - true, chip::NullOptional); - } - case 209: { - LogStep(209, "Write attribute NULLABLE_BITMAP64 Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNonNull(); - value.Value() = static_cast>(18446744073709551615ULL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap64::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 210: { - LogStep(210, "Read attribute NULLABLE_BITMAP64 unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap64::Id, - true, chip::NullOptional); - } - case 211: { - LogStep(211, "Write attribute NULLABLE_BITMAP64 null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable> value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap64::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 212: { - LogStep(212, "Read attribute NULLABLE_BITMAP64 null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableBitmap64::Id, - true, chip::NullOptional); - } - case 213: { - LogStep(213, "Write attribute NULLABLE_INT8U Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 214: { - LogStep(214, "Read attribute NULLABLE_INT8U Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 215: { - LogStep(215, "Write attribute NULLABLE_INT8U Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 254U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 216: { - LogStep(216, "Read attribute NULLABLE_INT8U Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 217: { - LogStep(217, "Write attribute NULLABLE_INT8U Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 255U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 218: { - LogStep(218, "Read attribute NULLABLE_INT8U unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 219: { - LogStep(219, "Read attribute NULLABLE_INT8U unchanged Value with constraint"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 220: { - LogStep(220, "Write attribute NULLABLE_INT8U null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 221: { - LogStep(221, "Read attribute NULLABLE_INT8U null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 222: { - LogStep(222, "Read attribute NULLABLE_INT8U null Value & range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 223: { - LogStep(223, "Read attribute NULLABLE_INT8U null Value & not"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 224: { - LogStep(224, "Write attribute NULLABLE_INT8U Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 128U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 225: { - LogStep(225, "Read attribute NULLABLE_INT8U Value in range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 226: { - LogStep(226, "Read attribute NULLABLE_INT8U notValue OK"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 227: { - LogStep(227, "Write attribute NULLABLE_INT16U Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 228: { - LogStep(228, "Read attribute NULLABLE_INT16U Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, true, - chip::NullOptional); - } - case 229: { - LogStep(229, "Write attribute NULLABLE_INT16U Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 65534U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 230: { - LogStep(230, "Read attribute NULLABLE_INT16U Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, true, - chip::NullOptional); - } - case 231: { - LogStep(231, "Write attribute NULLABLE_INT16U Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 65535U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 232: { - LogStep(232, "Read attribute NULLABLE_INT16U unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, true, - chip::NullOptional); - } - case 233: { - LogStep(233, "Write attribute NULLABLE_INT16U null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 234: { - LogStep(234, "Read attribute NULLABLE_INT16U null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, true, - chip::NullOptional); - } - case 235: { - LogStep(235, "Read attribute NULLABLE_INT16U null Value & range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, true, - chip::NullOptional); - } - case 236: { - LogStep(236, "Read attribute NULLABLE_INT16U null Value & not"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, true, - chip::NullOptional); - } - case 237: { - LogStep(237, "Write attribute NULLABLE_INT16U Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 32000U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 238: { - LogStep(238, "Read attribute NULLABLE_INT16U Value in range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, true, - chip::NullOptional); - } - case 239: { - LogStep(239, "Read attribute NULLABLE_INT16U notValue OK"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16u::Id, true, - chip::NullOptional); - } - case 240: { - LogStep(240, "Write attribute NULLABLE_INT32U Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 241: { - LogStep(241, "Read attribute NULLABLE_INT32U Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, true, - chip::NullOptional); - } - case 242: { - LogStep(242, "Write attribute NULLABLE_INT32U Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 4294967294UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 243: { - LogStep(243, "Read attribute NULLABLE_INT32U Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, true, - chip::NullOptional); - } - case 244: { - LogStep(244, "Write attribute NULLABLE_INT32U Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 4294967295UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 245: { - LogStep(245, "Read attribute NULLABLE_INT32U unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, true, - chip::NullOptional); - } - case 246: { - LogStep(246, "Write attribute NULLABLE_INT32U null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 247: { - LogStep(247, "Read attribute NULLABLE_INT32U null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, true, - chip::NullOptional); - } - case 248: { - LogStep(248, "Read attribute NULLABLE_INT32U null Value & range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, true, - chip::NullOptional); - } - case 249: { - LogStep(249, "Read attribute NULLABLE_INT32U null Value & not"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, true, - chip::NullOptional); - } - case 250: { - LogStep(250, "Write attribute NULLABLE_INT32U Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 2147483647UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 251: { - LogStep(251, "Read attribute NULLABLE_INT32U Value in range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, true, - chip::NullOptional); - } - case 252: { - LogStep(252, "Read attribute NULLABLE_INT32U notValue OK"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32u::Id, true, - chip::NullOptional); - } - case 253: { - LogStep(253, "Write attribute NULLABLE_INT64U Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 254: { - LogStep(254, "Read attribute NULLABLE_INT64U Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, true, - chip::NullOptional); - } - case 255: { - LogStep(255, "Write attribute NULLABLE_INT64U Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 18446744073709551614ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 256: { - LogStep(256, "Read attribute NULLABLE_INT64U Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, true, - chip::NullOptional); - } - case 257: { - LogStep(257, "Write attribute NULLABLE_INT64U Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 18446744073709551615ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 258: { - LogStep(258, "Read attribute NULLABLE_INT64U unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, true, - chip::NullOptional); - } - case 259: { - LogStep(259, "Write attribute NULLABLE_INT64U null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 260: { - LogStep(260, "Read attribute NULLABLE_INT64U null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, true, - chip::NullOptional); - } - case 261: { - LogStep(261, "Read attribute NULLABLE_INT64U null Value & range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, true, - chip::NullOptional); - } - case 262: { - LogStep(262, "Read attribute NULLABLE_INT64U null Value & not"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, true, - chip::NullOptional); - } - case 263: { - LogStep(263, "Write attribute NULLABLE_INT64U Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 18000000000000000000ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 264: { - LogStep(264, "Read attribute NULLABLE_INT64U Value in range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, true, - chip::NullOptional); - } - case 265: { - LogStep(265, "Read attribute NULLABLE_INT64U notValue OK"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64u::Id, true, - chip::NullOptional); - } - case 266: { - LogStep(266, "Write attribute NULLABLE_INT8S Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -127; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 267: { - LogStep(267, "Read attribute NULLABLE_INT8S Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, true, - chip::NullOptional); - } - case 268: { - LogStep(268, "Write attribute NULLABLE_INT8S Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -128; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 269: { - LogStep(269, "Read attribute NULLABLE_INT8S unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, true, - chip::NullOptional); - } - case 270: { - LogStep(270, "Write attribute NULLABLE_INT8S null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 271: { - LogStep(271, "Read attribute NULLABLE_INT8S null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, true, - chip::NullOptional); - } - case 272: { - LogStep(272, "Read attribute NULLABLE_INT8S null Value & range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, true, - chip::NullOptional); - } - case 273: { - LogStep(273, "Read attribute NULLABLE_INT8S null Value & not"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, true, - chip::NullOptional); - } - case 274: { - LogStep(274, "Write attribute NULLABLE_INT8S Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -127; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 275: { - LogStep(275, "Read attribute NULLABLE_INT8S Value in range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, true, - chip::NullOptional); - } - case 276: { - LogStep(276, "Read attribute NULLABLE_INT8S notValue OK"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8s::Id, true, - chip::NullOptional); - } - case 277: { - LogStep(277, "Write attribute NULLABLE_INT16S Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -32767; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 278: { - LogStep(278, "Read attribute NULLABLE_INT16S Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, true, - chip::NullOptional); - } - case 279: { - LogStep(279, "Write attribute NULLABLE_INT16S Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -32768; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 280: { - LogStep(280, "Read attribute NULLABLE_INT16S unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, true, - chip::NullOptional); - } - case 281: { - LogStep(281, "Write attribute NULLABLE_INT16S null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 282: { - LogStep(282, "Read attribute NULLABLE_INT16S null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, true, - chip::NullOptional); - } - case 283: { - LogStep(283, "Read attribute NULLABLE_INT16S null Value & range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, true, - chip::NullOptional); - } - case 284: { - LogStep(284, "Read attribute NULLABLE_INT16S null Value & not"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, true, - chip::NullOptional); - } - case 285: { - LogStep(285, "Write attribute NULLABLE_INT16S Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -32767; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 286: { - LogStep(286, "Read attribute NULLABLE_INT16S Value in range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, true, - chip::NullOptional); - } - case 287: { - LogStep(287, "Read attribute NULLABLE_INT16S notValue OK"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt16s::Id, true, - chip::NullOptional); - } - case 288: { - LogStep(288, "Write attribute NULLABLE_INT32S Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -2147483647L; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 289: { - LogStep(289, "Read attribute NULLABLE_INT32S Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, true, - chip::NullOptional); - } - case 290: { - LogStep(290, "Write attribute NULLABLE_INT32S Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -2147483648L; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 291: { - LogStep(291, "Read attribute NULLABLE_INT32S unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, true, - chip::NullOptional); - } - case 292: { - LogStep(292, "Write attribute NULLABLE_INT32S null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 293: { - LogStep(293, "Read attribute NULLABLE_INT32S null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, true, - chip::NullOptional); - } - case 294: { - LogStep(294, "Read attribute NULLABLE_INT32S null Value & range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, true, - chip::NullOptional); - } - case 295: { - LogStep(295, "Read attribute NULLABLE_INT32S null Value & not"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, true, - chip::NullOptional); - } - case 296: { - LogStep(296, "Write attribute NULLABLE_INT32S Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -2147483647L; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 297: { - LogStep(297, "Read attribute NULLABLE_INT32S Value in range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, true, - chip::NullOptional); - } - case 298: { - LogStep(298, "Read attribute NULLABLE_INT32S notValue OK"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt32s::Id, true, - chip::NullOptional); - } - case 299: { - LogStep(299, "Write attribute NULLABLE_INT64S Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -9223372036854775807LL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 300: { - LogStep(300, "Read attribute NULLABLE_INT64S Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, true, - chip::NullOptional); - } - case 301: { - LogStep(301, "Write attribute NULLABLE_INT64S Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = static_cast(-9223372036854775807LL - 1); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 302: { - LogStep(302, "Read attribute NULLABLE_INT64S unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, true, - chip::NullOptional); - } - case 303: { - LogStep(303, "Write attribute NULLABLE_INT64S null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 304: { - LogStep(304, "Read attribute NULLABLE_INT64S null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, true, - chip::NullOptional); - } - case 305: { - LogStep(305, "Read attribute NULLABLE_INT64S null Value & range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, true, - chip::NullOptional); - } - case 306: { - LogStep(306, "Read attribute NULLABLE_INT64S null Value & not"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, true, - chip::NullOptional); - } - case 307: { - LogStep(307, "Write attribute NULLABLE_INT64S Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -9223372036854775807LL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 308: { - LogStep(308, "Read attribute NULLABLE_INT64S Value in range"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, true, - chip::NullOptional); - } - case 309: { - LogStep(309, "Read attribute NULLABLE_INT64S notValue OK"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt64s::Id, true, - chip::NullOptional); - } - case 310: { - LogStep(310, "Write attribute NULLABLE_SINGLE medium Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0.1f; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatSingle::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 311: { - LogStep(311, "Read attribute NULLABLE_SINGLE medium Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatSingle::Id, - true, chip::NullOptional); - } - case 312: { - LogStep(312, "Write attribute NULLABLE_SINGLE largest Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = INFINITY; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatSingle::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 313: { - LogStep(313, "Read attribute NULLABLE_SINGLE largest Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatSingle::Id, - true, chip::NullOptional); - } - case 314: { - LogStep(314, "Write attribute NULLABLE_SINGLE smallest Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -INFINITY; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatSingle::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 315: { - LogStep(315, "Read attribute NULLABLE_SINGLE smallest Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatSingle::Id, - true, chip::NullOptional); - } - case 316: { - LogStep(316, "Write attribute NULLABLE_SINGLE null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatSingle::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 317: { - LogStep(317, "Read attribute NULLABLE_SINGLE null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatSingle::Id, - true, chip::NullOptional); - } - case 318: { - LogStep(318, "Write attribute NULLABLE_SINGLE 0 Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0.0f; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatSingle::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 319: { - LogStep(319, "Read attribute NULLABLE_SINGLE 0 Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatSingle::Id, - true, chip::NullOptional); - } - case 320: { - LogStep(320, "Write attribute NULLABLE_DOUBLE medium Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0.1234567890123; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatDouble::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 321: { - LogStep(321, "Read attribute NULLABLE_DOUBLE medium Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatDouble::Id, - true, chip::NullOptional); - } - case 322: { - LogStep(322, "Write attribute NULLABLE_DOUBLE largest Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = INFINITY; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatDouble::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 323: { - LogStep(323, "Read attribute NULLABLE_DOUBLE largest Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatDouble::Id, - true, chip::NullOptional); - } - case 324: { - LogStep(324, "Write attribute NULLABLE_DOUBLE smallest Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -INFINITY; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatDouble::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 325: { - LogStep(325, "Read attribute NULLABLE_DOUBLE smallest Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatDouble::Id, - true, chip::NullOptional); - } - case 326: { - LogStep(326, "Write attribute NULLABLE_DOUBLE null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatDouble::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 327: { - LogStep(327, "Read attribute NULLABLE_DOUBLE null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatDouble::Id, - true, chip::NullOptional); - } - case 328: { - LogStep(328, "Write attribute NULLABLE_DOUBLE 0 Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatDouble::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 329: { - LogStep(329, "Read attribute NULLABLE_DOUBLE 0 Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableFloatDouble::Id, - true, chip::NullOptional); - } - case 330: { - LogStep(330, "Write attribute NULLABLE_ENUM8 Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum8::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 331: { - LogStep(331, "Read attribute NULLABLE_ENUM8 Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum8::Id, true, - chip::NullOptional); - } - case 332: { - LogStep(332, "Write attribute NULLABLE_ENUM8 Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 254U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum8::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 333: { - LogStep(333, "Read attribute NULLABLE_ENUM8 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum8::Id, true, - chip::NullOptional); - } - case 334: { - LogStep(334, "Write attribute NULLABLE_ENUM8 Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 255U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum8::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 335: { - LogStep(335, "Read attribute NULLABLE_ENUM8 unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum8::Id, true, - chip::NullOptional); - } - case 336: { - LogStep(336, "Write attribute NULLABLE_ENUM8 null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum8::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 337: { - LogStep(337, "Read attribute NULLABLE_ENUM8 null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum8::Id, true, - chip::NullOptional); - } - case 338: { - LogStep(338, "Write attribute NULLABLE_ENUM16 Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum16::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 339: { - LogStep(339, "Read attribute NULLABLE_ENUM16 Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum16::Id, true, - chip::NullOptional); - } - case 340: { - LogStep(340, "Write attribute NULLABLE_ENUM16 Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 65534U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum16::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 341: { - LogStep(341, "Read attribute NULLABLE_ENUM16 Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum16::Id, true, - chip::NullOptional); - } - case 342: { - LogStep(342, "Write attribute NULLABLE_ENUM16 Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 65535U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum16::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 343: { - LogStep(343, "Read attribute NULLABLE_ENUM16 unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum16::Id, true, - chip::NullOptional); - } - case 344: { - LogStep(344, "Write attribute NULLABLE_ENUM16 null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum16::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 345: { - LogStep(345, "Read attribute NULLABLE_ENUM16 null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnum16::Id, true, - chip::NullOptional); - } - case 346: { - LogStep(346, "Write attribute NULLABLE_SIMPLE_ENUM Min Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnumAttr::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 347: { - LogStep(347, "Read attribute NULLABLE_SIMPLE_ENUM Min Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnumAttr::Id, - true, chip::NullOptional); - } - case 348: { - LogStep(348, "Write attribute NULLABLE_SIMPLE_ENUM Max Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = static_cast(3); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnumAttr::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 349: { - LogStep(349, "Read attribute NULLABLE_SIMPLE_ENUM Max Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnumAttr::Id, - true, chip::NullOptional); - } - case 350: { - LogStep(350, "Write attribute NULLABLE_SIMPLE_ENUM Invalid Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = static_cast(255); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnumAttr::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 351: { - LogStep(351, "Read attribute NULLABLE_SIMPLE_ENUM unchanged Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnumAttr::Id, - true, chip::NullOptional); - } - case 352: { - LogStep(352, "Write attribute NULLABLE_SIMPLE_ENUM null Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnumAttr::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 353: { - LogStep(353, "Read attribute NULLABLE_SIMPLE_ENUM null Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnumAttr::Id, - true, chip::NullOptional); - } - case 354: { - LogStep(354, "Read attribute NULLABLE_SIMPLE_ENUM not 3 Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableEnumAttr::Id, - true, chip::NullOptional); - } - case 355: { - LogStep(355, "Read attribute NULLABLE_OCTET_STRING Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - true, chip::NullOptional); - } - case 356: { - LogStep(356, "Write attribute NULLABLE_OCTET_STRING"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = chip::ByteSpan(chip::Uint8::from_const_char("TestValuegarbage: not in length on purpose"), 9); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 357: { - LogStep(357, "Read attribute NULLABLE_OCTET_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - true, chip::NullOptional); - } - case 358: { - LogStep(358, "Write attribute NULLABLE_OCTET_STRING"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 359: { - LogStep(359, "Read attribute NULLABLE_OCTET_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - true, chip::NullOptional); - } - case 360: { - LogStep(360, "Write attribute NULLABLE_OCTET_STRING"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = chip::ByteSpan(chip::Uint8::from_const_char("garbage: not in length on purpose"), 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 361: { - LogStep(361, "Read attribute NULLABLE_OCTET_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - true, chip::NullOptional); - } - case 362: { - LogStep(362, "Read attribute NULLABLE_OCTET_STRING not TestValue"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - true, chip::NullOptional); - } - case 363: { - LogStep(363, "Read attribute NULLABLE_CHAR_STRING Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - true, chip::NullOptional); - } - case 364: { - LogStep(364, "Write attribute NULLABLE_CHAR_STRING"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = chip::Span("☉T☉garbage: not in length on purpose", 7); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 365: { - LogStep(365, "Read attribute NULLABLE_CHAR_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - true, chip::NullOptional); - } - case 366: { - LogStep(366, "Read attribute NULLABLE_CHAR_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - true, chip::NullOptional); - } - case 367: { - LogStep(367, "Write attribute NULLABLE_CHAR_STRING - Value too long"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 368: { - LogStep(368, "Read attribute NULLABLE_CHAR_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - true, chip::NullOptional); - } - case 369: { - LogStep(369, "Write attribute NULLABLE_CHAR_STRING - Empty"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = chip::Span("garbage: not in length on purpose", 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 370: { - LogStep(370, "Read attribute NULLABLE_CHAR_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - true, chip::NullOptional); - } - case 371: { - LogStep(371, "Read attribute NULLABLE_CHAR_STRING not ☉T☉"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - true, chip::NullOptional); - } - case 372: { - LogStep(372, "Read attribute from nonexistent endpoint."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(200), UnitTesting::Id, UnitTesting::Attributes::ListInt8u::Id, true, - chip::NullOptional); - } - case 373: { - LogStep(373, "Read attribute from nonexistent cluster."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UnitTesting::Id, UnitTesting::Attributes::ListInt8u::Id, true, - chip::NullOptional); - } - case 374: { - LogStep(374, "Send a command that takes an optional parameter but do not set it."); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestSimpleOptionalArgumentRequest::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestSimpleOptionalArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 375: { - LogStep(375, "Send a command that takes an optional parameter but do not set it."); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestSimpleOptionalArgumentRequest::Type value; - value.arg1.Emplace(); - value.arg1.Value() = 1; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestSimpleOptionalArgumentRequest::Id, value, chip::NullOptional - - ); - } - case 376: { - LogStep(376, "Subscribe to list attribute"); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListInt8u::Id, 2, 5, - true, chip::NullOptional, chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 377: { - LogStep(377, "Write subscribed-to list attribute"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 5U; - listHolder_0->mList[1] = 6U; - listHolder_0->mList[2] = 7U; - listHolder_0->mList[3] = 8U; - value = chip::app::DataModel::List(listHolder_0->mList, 4); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListInt8u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 378: { - LogStep(378, "Check for list attribute report"); - return WaitForReport(); - } - case 379: { - LogStep(379, "Read range-restricted unsigned 8-bit integer"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::RangeRestrictedInt8u::Id, - true, chip::NullOptional); - } - case 380: { - LogStep(380, "Write min value to a range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8u::Id, value, chip::NullOptional, chip::NullOptional); - } - case 381: { - LogStep(381, "Write just-below-range value to a range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - uint8_t value; - value = 19U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8u::Id, value, chip::NullOptional, chip::NullOptional); - } - case 382: { - LogStep(382, "Write just-above-range value to a range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - uint8_t value; - value = 101U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8u::Id, value, chip::NullOptional, chip::NullOptional); - } - case 383: { - LogStep(383, "Write max value to a range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - uint8_t value; - value = 255U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8u::Id, value, chip::NullOptional, chip::NullOptional); - } - case 384: { - LogStep(384, "Verify range-restricted unsigned 8-bit integer value has not changed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::RangeRestrictedInt8u::Id, - true, chip::NullOptional); - } - case 385: { - LogStep(385, "Write min valid value to a range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - uint8_t value; - value = 20U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8u::Id, value, chip::NullOptional, chip::NullOptional); - } - case 386: { - LogStep(386, "Verify range-restricted unsigned 8-bit integer value is at min valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::RangeRestrictedInt8u::Id, - true, chip::NullOptional); - } - case 387: { - LogStep(387, "Write max valid value to a range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - uint8_t value; - value = 100U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8u::Id, value, chip::NullOptional, chip::NullOptional); - } - case 388: { - LogStep(388, "Verify range-restricted unsigned 8-bit integer value is at max valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::RangeRestrictedInt8u::Id, - true, chip::NullOptional); - } - case 389: { - LogStep(389, "Write middle valid value to a range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - uint8_t value; - value = 50U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8u::Id, value, chip::NullOptional, chip::NullOptional); - } - case 390: { - LogStep(390, "Verify range-restricted unsigned 8-bit integer value is at mid valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::RangeRestrictedInt8u::Id, - true, chip::NullOptional); - } - case 391: { - LogStep(391, "Read range-restricted unsigned 16-bit integer"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 392: { - LogStep(392, "Write min value to a range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - uint16_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 393: { - LogStep(393, "Write just-below-range value to a range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - uint16_t value; - value = 99U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 394: { - LogStep(394, "Write just-above-range value to a range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - uint16_t value; - value = 1001U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 395: { - LogStep(395, "Write max value to a range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - uint16_t value; - value = 65535U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 396: { - LogStep(396, "Verify range-restricted unsigned 16-bit integer value has not changed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 397: { - LogStep(397, "Write min valid value to a range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - uint16_t value; - value = 100U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 398: { - LogStep(398, "Verify range-restricted unsigned 16-bit integer value is at min valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 399: { - LogStep(399, "Write max valid value to a range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - uint16_t value; - value = 1000U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 400: { - LogStep(400, "Verify range-restricted unsigned 16-bit integer value is at max valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 401: { - LogStep(401, "Write middle valid value to a range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - uint16_t value; - value = 500U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 402: { - LogStep(402, "Verify range-restricted unsigned 16-bit integer value is at mid valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 403: { - LogStep(403, "Read range-restricted signed 8-bit integer"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::RangeRestrictedInt8s::Id, - true, chip::NullOptional); - } - case 404: { - LogStep(404, "Write min value to a range-restricted signed 8-bit integer"); - ListFreer listFreer; - int8_t value; - value = -128; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8s::Id, value, chip::NullOptional, chip::NullOptional); - } - case 405: { - LogStep(405, "Write just-below-range value to a range-restricted signed 8-bit integer"); - ListFreer listFreer; - int8_t value; - value = -41; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8s::Id, value, chip::NullOptional, chip::NullOptional); - } - case 406: { - LogStep(406, "Write just-above-range value to a range-restricted signed 8-bit integer"); - ListFreer listFreer; - int8_t value; - value = 51; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8s::Id, value, chip::NullOptional, chip::NullOptional); - } - case 407: { - LogStep(407, "Write max value to a range-restricted signed 8-bit integer"); - ListFreer listFreer; - int8_t value; - value = 127; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8s::Id, value, chip::NullOptional, chip::NullOptional); - } - case 408: { - LogStep(408, "Verify range-restricted signed 8-bit integer value has not changed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::RangeRestrictedInt8s::Id, - true, chip::NullOptional); - } - case 409: { - LogStep(409, "Write min valid value to a range-restricted signed 8-bit integer"); - ListFreer listFreer; - int8_t value; - value = -40; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8s::Id, value, chip::NullOptional, chip::NullOptional); - } - case 410: { - LogStep(410, "Verify range-restricted signed 8-bit integer value is at min valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::RangeRestrictedInt8s::Id, - true, chip::NullOptional); - } - case 411: { - LogStep(411, "Write max valid value to a range-restricted signed 8-bit integer"); - ListFreer listFreer; - int8_t value; - value = 50; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8s::Id, value, chip::NullOptional, chip::NullOptional); - } - case 412: { - LogStep(412, "Verify range-restricted signed 8-bit integer value is at max valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::RangeRestrictedInt8s::Id, - true, chip::NullOptional); - } - case 413: { - LogStep(413, "Write middle valid value to a range-restricted signed 8-bit integer"); - ListFreer listFreer; - int8_t value; - value = 6; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt8s::Id, value, chip::NullOptional, chip::NullOptional); - } - case 414: { - LogStep(414, "Verify range-restricted signed 8-bit integer value is at mid valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::RangeRestrictedInt8s::Id, - true, chip::NullOptional); - } - case 415: { - LogStep(415, "Read range-restricted signed 16-bit integer"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 416: { - LogStep(416, "Write min value to a range-restricted signed 16-bit integer"); - ListFreer listFreer; - int16_t value; - value = -32768; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 417: { - LogStep(417, "Write just-below-range value to a range-restricted signed 16-bit integer"); - ListFreer listFreer; - int16_t value; - value = -151; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 418: { - LogStep(418, "Write just-above-range value to a range-restricted signed 16-bit integer"); - ListFreer listFreer; - int16_t value; - value = 201; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 419: { - LogStep(419, "Write max value to a range-restricted signed 16-bit integer"); - ListFreer listFreer; - int16_t value; - value = 32767; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 420: { - LogStep(420, "Verify range-restricted signed 16-bit integer value has not changed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 421: { - LogStep(421, "Write min valid value to a range-restricted signed 16-bit integer"); - ListFreer listFreer; - int16_t value; - value = -150; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 422: { - LogStep(422, "Verify range-restricted signed 16-bit integer value is at min valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 423: { - LogStep(423, "Write max valid value to a range-restricted signed 16-bit integer"); - ListFreer listFreer; - int16_t value; - value = 200; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 424: { - LogStep(424, "Verify range-restricted signed 16-bit integer value is at max valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 425: { - LogStep(425, "Write middle valid value to a range-restricted signed 16-bit integer"); - ListFreer listFreer; - int16_t value; - value = 7; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 426: { - LogStep(426, "Verify range-restricted signed 16-bit integer value is at mid valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::RangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 427: { - LogStep(427, "Read nullable range-restricted unsigned 8-bit integer"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, true, chip::NullOptional); - } - case 428: { - LogStep(428, "Write min value to a nullable range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 429: { - LogStep(429, "Write just-below-range value to a nullable range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 19U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 430: { - LogStep(430, "Write just-above-range value to a nullable range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 101U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 431: { - LogStep(431, "Write max value to a nullable range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 254U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 432: { - LogStep(432, "Verify nullable range-restricted unsigned 8-bit integer value has not changed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, true, chip::NullOptional); - } - case 433: { - LogStep(433, "Write min valid value to a nullable range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 20U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 434: { - LogStep(434, "Verify nullable range-restricted unsigned 8-bit integer value is at min valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, true, chip::NullOptional); - } - case 435: { - LogStep(435, "Write max valid value to a nullable range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 100U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 436: { - LogStep(436, "Verify nullable range-restricted unsigned 8-bit integer value is at max valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, true, chip::NullOptional); - } - case 437: { - LogStep(437, "Write middle valid value to a nullable range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 50U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 438: { - LogStep(438, "Verify nullable range-restricted unsigned 8-bit integer value is at mid valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, true, chip::NullOptional); - } - case 439: { - LogStep(439, "Write null value to a nullable range-restricted unsigned 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 440: { - LogStep(440, "Verify nullable range-restricted unsigned 8-bit integer value is null"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id, true, chip::NullOptional); - } - case 441: { - LogStep(441, "Read nullable range-restricted unsigned 16-bit integer"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 442: { - LogStep(442, "Write min value to a nullable range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 443: { - LogStep(443, "Write just-below-range value to a nullable range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 99U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 444: { - LogStep(444, "Write just-above-range value to a nullable range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 1001U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 445: { - LogStep(445, "Write max value to a nullable range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 65534U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 446: { - LogStep(446, "Verify nullable range-restricted unsigned 16-bit integer value has not changed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 447: { - LogStep(447, "Write min valid value to a nullable range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 100U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 448: { - LogStep(448, "Verify nullable range-restricted unsigned 16-bit integer value is at min valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 449: { - LogStep(449, "Write max valid value to a nullable range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 1000U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 450: { - LogStep(450, "Verify nullable range-restricted unsigned 16-bit integer value is at max valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 451: { - LogStep(451, "Write middle valid value to a nullable range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 500U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 452: { - LogStep(452, "Verify nullable range-restricted unsigned 16-bit integer value is at mid valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 453: { - LogStep(453, "Write null value to a nullable range-restricted unsigned 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 454: { - LogStep(454, "Verify nullable range-restricted unsigned 16-bit integer value is null"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id, true, chip::NullOptional); - } - case 455: { - LogStep(455, "Read nullable range-restricted signed 8-bit integer"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, true, chip::NullOptional); - } - case 456: { - LogStep(456, "Write min value to a nullable range-restricted signed 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -127; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 457: { - LogStep(457, "Write just-below-range value to a nullable range-restricted signed 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -41; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 458: { - LogStep(458, "Write just-above-range value to a nullable range-restricted signed 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 51; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 459: { - LogStep(459, "Write max value to a nullable range-restricted signed 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 127; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 460: { - LogStep(460, "Verify nullable range-restricted signed 8-bit integer value has not changed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, true, chip::NullOptional); - } - case 461: { - LogStep(461, "Write min valid value to a nullable range-restricted signed 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -40; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 462: { - LogStep(462, "Verify nullable range-restricted signed 8-bit integer value is at min valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, true, chip::NullOptional); - } - case 463: { - LogStep(463, "Write max valid value to a nullable range-restricted signed 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 50; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 464: { - LogStep(464, "Verify nullable range-restricted signed 8-bit integer value is at max valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, true, chip::NullOptional); - } - case 465: { - LogStep(465, "Write middle valid value to a nullable range-restricted signed 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 6; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 466: { - LogStep(466, "Verify nullable range-restricted signed 8-bit integer value is at mid valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, true, chip::NullOptional); - } - case 467: { - LogStep(467, "Write null value to a nullable range-restricted signed 8-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 468: { - LogStep(468, "Verify nullable range-restricted signed 8-bit integer value is at null"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id, true, chip::NullOptional); - } - case 469: { - LogStep(469, "Read nullable range-restricted signed 16-bit integer"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 470: { - LogStep(470, "Write min value to a nullable range-restricted signed 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -32767; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 471: { - LogStep(471, "Write just-below-range value to a nullable range-restricted signed 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -151; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 472: { - LogStep(472, "Write just-above-range value to a nullable range-restricted signed 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 201; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 473: { - LogStep(473, "Write max value to a nullable range-restricted signed 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 32767; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 474: { - LogStep(474, "Verify nullable range-restricted signed 16-bit integer value has not changed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 475: { - LogStep(475, "Write min valid value to a nullable range-restricted signed 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = -150; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 476: { - LogStep(476, "Verify nullable range-restricted signed 16-bit integer value is at min valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 477: { - LogStep(477, "Write max valid value to a nullable range-restricted signed 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 200; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 478: { - LogStep(478, "Verify nullable range-restricted signed 16-bit integer value is at max valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 479: { - LogStep(479, "Write middle valid value to a nullable range-restricted signed 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 7; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 480: { - LogStep(480, "Verify nullable range-restricted signed 16-bit integer value is at mid valid"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 481: { - LogStep(481, "Write null value to a nullable range-restricted signed 16-bit integer"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 482: { - LogStep(482, "Verify nullable range-restricted signed 16-bit integer value is null"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id, true, chip::NullOptional); - } - case 483: { - LogStep(483, "Write attribute that returns general status on write"); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::GeneralErrorBoolean::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 484: { - LogStep(484, "Write attribute that returns cluster-specific status on write"); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ClusterErrorBoolean::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 485: { - LogStep(485, "Read attribute that returns general status on read"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::GeneralErrorBoolean::Id, - true, chip::NullOptional); - } - case 486: { - LogStep(486, "read attribute that returns cluster-specific status on read"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ClusterErrorBoolean::Id, - true, chip::NullOptional); - } - case 487: { - LogStep(487, "read AcceptedCommandList attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 488: { - LogStep(488, "read GeneratedCommandList attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 489: { - LogStep(489, "Write struct-typed attribute"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type value; - - value.a = 5U; - value.b = true; - value.c = static_cast(2); - value.d = chip::ByteSpan(chip::Uint8::from_const_char("abcgarbage: not in length on purpose"), 3); - value.e = chip::Span("garbage: not in length on purpose", 0); - value.f = static_cast>(17U); - value.g = 1.5f; - value.h = 3.14159265358979; - - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::StructAttr::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 490: { - LogStep(490, "Read struct-typed attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::StructAttr::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestClusterComplexTypesSuite : public TestCommand -{ -public: - TestClusterComplexTypesSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestClusterComplexTypes", 21, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestClusterComplexTypesSuite() {} - - 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)); - { - chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("wasPresent", value.wasPresent, true)); - VerifyOrReturn(CheckValuePresent("wasNull", value.wasNull)); - VerifyOrReturn(CheckValue("wasNull.Value()", value.wasNull.Value(), true)); - VerifyOrReturn(CheckValuePresent("originalValue", value.originalValue)); - VerifyOrReturn(CheckValueNull("originalValue.Value()", value.originalValue.Value())); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NEEDS_TIMED_INTERACTION)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - 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_ACCESS)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("timedWriteBoolean", value, false)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NEEDS_TIMED_INTERACTION)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("timedWriteBoolean", value, false)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("timedWriteBoolean", value, false)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("timedWriteBoolean", value, true)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("boolean", value, false)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_ACCESS)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("boolean", value, false)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("boolean", value, true)); - } - break; - case 20: - 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, "Send Test Command with optional arg set to null."); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalRequest::Type value; - value.arg1.Emplace(); - value.arg1.Value().SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TestNullableOptionalRequest::Id, value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Send command that needs timed invoke without a timeout value"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TimedInvokeRequest::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TimedInvokeRequest::Id, - value, chip::NullOptional, chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Send command that needs timed invoke with a long timeout value"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TimedInvokeRequest::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TimedInvokeRequest::Id, - value, chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Send command that needs timed invoke with a too-short timeout value"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TimedInvokeRequest::Type value; - ReturnErrorOnFailure(SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Commands::TimedInvokeRequest::Id, value, chip::Optional(1), - chip::NullOptional - - )); - - using namespace chip::System::Clock::Literals; - return BusyWaitFor(100_ms); - } - case 5: { - LogStep(5, "Send command that does not need timed invoke with a long timeout value"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::Test::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::Test::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Send command that does not need timed invoke with a too-short timeout value"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::Test::Type value; - ReturnErrorOnFailure(SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::Test::Id, - value, chip::Optional(1), chip::NullOptional - - )); - - using namespace chip::System::Clock::Literals; - return BusyWaitFor(100_ms); - } - case 7: { - LogStep(7, "Read attribute that needs timed write initial state"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::TimedWriteBoolean::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Write attribute that needs timed write without a timeout value"); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::TimedWriteBoolean::Id, - value, chip::NullOptional, chip::NullOptional, chip::NullOptional); - } - case 9: { - LogStep(9, "Read attribute that needs timed write state unchanged 1"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::TimedWriteBoolean::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Write attribute that needs timed write with a too-short timeout value"); - ListFreer listFreer; - bool value; - value = true; - ReturnErrorOnFailure(WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::TimedWriteBoolean::Id, value, chip::Optional(1), - chip::NullOptional, chip::NullOptional)); - - using namespace chip::System::Clock::Literals; - return BusyWaitFor(100_ms); - } - case 11: { - LogStep(11, "Read attribute that needs timed write state unchanged 2"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::TimedWriteBoolean::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Write attribute that needs timed write with a long timeout value"); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::TimedWriteBoolean::Id, - value, chip::Optional(10000), chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "Read attribute that needs timed write state changed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::TimedWriteBoolean::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Write attribute that needs timed write reset to default"); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::TimedWriteBoolean::Id, - value, chip::Optional(10000), chip::NullOptional, chip::NullOptional); - } - case 15: { - LogStep(15, "Read attribute that does not need timed write initial value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Write attribute that does not need timed write with a too-short timeout value"); - ListFreer listFreer; - bool value; - value = true; - ReturnErrorOnFailure(WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, - UnitTesting::Attributes::Boolean::Id, value, chip::Optional(1), - chip::NullOptional, chip::NullOptional)); - - using namespace chip::System::Clock::Literals; - return BusyWaitFor(100_ms); - } - case 17: { - LogStep(17, "Read attribute that does not need timed write unchanged value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Write attribute that does not need timed write with a long timeout value"); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, value, - chip::Optional(10000), chip::NullOptional, chip::NullOptional); - } - case 19: { - LogStep(19, "Read attribute that does not need timed write changed value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Write attribute that does not need timed write reset to default"); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestConstraintsSuite : public TestCommand -{ -public: - TestConstraintsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestConstraints", 61, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestConstraintsSuite() {} - - 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::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintContains("value", value, 2U)); - VerifyOrReturn(CheckConstraintContains("value", value, 3U)); - VerifyOrReturn(CheckConstraintContains("value", value, 4U)); - } - 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(CheckConstraintExcludes("value", value, 0U)); - VerifyOrReturn(CheckConstraintExcludes("value", value, 5U)); - } - 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::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, 0UL)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, 5UL)); - VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, 5UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, 5UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, 5UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, 1UL)); - VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 5UL)); - } - 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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 5UL)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 5UL)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, 6UL)); - } - 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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value", value, 5)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 20)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintStartsWith("value", value, "**")); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintEndsWith("value", value, "**")); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintIsLowerCase("value", value, true)); - VerifyOrReturn(CheckConstraintIsUpperCase("value", value, false)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintIsUpperCase("value", value, true)); - VerifyOrReturn(CheckConstraintIsLowerCase("value", value, false)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintIsUpperCase("value", value, false)); - VerifyOrReturn(CheckConstraintIsLowerCase("value", value, false)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintIsUpperCase("value", value, true)); - VerifyOrReturn(CheckConstraintIsLowerCase("value", value, true)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintIsUpperCase("value", value, true)); - VerifyOrReturn(CheckConstraintIsLowerCase("value", value, true)); - } - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintIsUpperCase("value", value, true)); - VerifyOrReturn(CheckConstraintIsLowerCase("value", value, false)); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintIsUpperCase("value", value, false)); - VerifyOrReturn(CheckConstraintIsLowerCase("value", value, true)); - } - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintIsUpperCase("value", value, true)); - VerifyOrReturn(CheckConstraintIsLowerCase("value", value, true)); - } - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintIsHexString("value", value, false)); - } - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintIsHexString("value", value, true)); - } - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value", value, 5)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 20)); - } - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableInt8u", value)); - VerifyOrReturn(CheckValue("nullableInt8u.Value()", value.Value(), 0U)); - } - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("nullableOctetString", value)); - VerifyOrReturn(CheckValueAsString("nullableOctetString.Value()", value.Value(), - chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - } - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 60: - 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, "Write attribute LIST With List of INT8U"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 2U; - listHolder_0->mList[2] = 3U; - listHolder_0->mList[3] = 4U; - value = chip::app::DataModel::List(listHolder_0->mList, 4); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListInt8u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Read attribute LIST With Partial List of INT8U that should be in it"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListInt8u::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Read attribute LIST With Partial List of INT8U that should not be included"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListInt8u::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Write attribute LIST Back to Default Value"); - ListFreer listFreer; - chip::app::DataModel::List value; - - value = chip::app::DataModel::List(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::ListInt8u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Read attribute BITMAP32 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Write attribute BITMAP32 with MaskVal1 and MaskVal3"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(5UL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "Read attribute BITMAP32 with MaskVal1 and MaskVal3 and ensure MaskVal2 is not set"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Read attribute BITMAP32 with MaskVal1 and MaskVal3 and ensure MaskVal1 is set"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Read attribute BITMAP32 with MaskVal1 and MaskVal3 and ensure MaskVal3 is set"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Read attribute BITMAP32 with MaskVal1 and MaskVal3 and ensure Maskval1 and MaskVal3 are set"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Write attribute BITMAP32 with MaskVal1"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(1UL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 12: { - LogStep(12, "Read attribute BITMAP32 with MaskVal1 and ensure Maskval1 or MaskVal3 are set"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Write attribute BITMAP32 Back to Default Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(0UL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 14: { - LogStep(14, "Write attribute INT32U Value"); - ListFreer listFreer; - uint32_t value; - value = 5UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 15: { - LogStep(15, "Read attribute INT32U Value MinValue Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Read attribute INT32U Value MaxValue Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Read attribute INT32U Value NotValue Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Write attribute INT32U Value Back to Default Value"); - ListFreer listFreer; - uint32_t value; - value = 0UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 19: { - LogStep(19, "Write attribute CHAR_STRING Value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("** Test **garbage: not in length on purpose", 10); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 20: { - LogStep(20, "Read attribute CHAR_STRING Value MinLength Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "Read attribute CHAR_STRING Value MaxLength Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Read attribute CHAR_STRING Value StartsWith Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 23: { - LogStep(23, "Read attribute CHAR_STRING Value EndsWith Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, "Write attribute CHAR_STRING Value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("lowercasegarbage: not in length on purpose", 9); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 25: { - LogStep(25, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 26: { - LogStep(26, "Write attribute CHAR_STRING Value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("UPPERCASEgarbage: not in length on purpose", 9); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 27: { - LogStep(27, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 28: { - LogStep(28, "Write attribute CHAR_STRING Value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("lowUPPERgarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 29: { - LogStep(29, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 30: { - LogStep(30, "Write attribute CHAR_STRING Value with only digits"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("1234567890garbage: not in length on purpose", 10); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 31: { - LogStep(31, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Write attribute CHAR_STRING Value with only non-letters"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("12.4,76:garbage: not in length on purpose", 8); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 33: { - LogStep(33, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 34: { - LogStep(34, "Write attribute CHAR_STRING Value with uppercase letters and symbols"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("ABC;.* garbage: not in length on purpose", 7); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 35: { - LogStep(35, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 36: { - LogStep(36, "Write attribute CHAR_STRING Value with lowercase letters and symbols"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("abc;.* garbage: not in length on purpose", 7); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 37: { - LogStep(37, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 38: { - LogStep(38, "Write attribute CHAR_STRING Value which is empty"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("garbage: not in length on purpose", 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 39: { - LogStep(39, "Read attribute CHAR_STRING Value isLowerCase/isUpperCase Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 40: { - LogStep(40, "Write attribute CHAR_STRING Value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("ABCDEF012Vgarbage: not in length on purpose", 10); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 41: { - LogStep(41, "Read attribute CHAR_STRING Value isHexString Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 42: { - LogStep(42, "Write attribute CHAR_STRING Value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("ABCDEF0123garbage: not in length on purpose", 10); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 43: { - LogStep(43, "Read attribute CHAR_STRING Value isHexString Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 44: { - LogStep(44, "Write attribute CHAR_STRING Value Back to Default Value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("garbage: not in length on purpose", 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 45: { - LogStep(45, "Write attribute NULLABLE_CHAR_STRING Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 46: { - LogStep(46, "Read attribute NULLABLE_CHAR_STRING Value MinLength Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - true, chip::NullOptional); - } - case 47: { - LogStep(47, "Read attribute NULLABLE_CHAR_STRING Value MaxLength Constraints"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - true, chip::NullOptional); - } - case 48: { - LogStep(48, "Write attribute NULLABLE_CHAR_STRING Value Back to Default Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = chip::Span("garbage: not in length on purpose", 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableCharString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 49: { - LogStep(49, "Read attribute NULLABLE_INT8U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 50: { - LogStep(50, "Write attribute NULLABLE_INT8U with a value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 51: { - LogStep(51, "Read attribute NULLABLE_INT8U with a value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 52: { - LogStep(52, "Write attribute NULLABLE_INT8U without a value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 53: { - LogStep(53, "Read attribute NULLABLE_INT8U with a value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, true, - chip::NullOptional); - } - case 54: { - LogStep(54, "Write attribute NULLABLE_INT8U back to Default Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableInt8u::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 55: { - LogStep(55, "Read attribute NULLABLE_OCTET_STRING Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - true, chip::NullOptional); - } - case 56: { - LogStep(56, "Write attribute NULLABLE_OCTET_STRING"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = chip::ByteSpan(chip::Uint8::from_const_char("TestValuegarbage: not in length on purpose"), 9); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 57: { - LogStep(57, "Read attribute NULLABLE_OCTET_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - true, chip::NullOptional); - } - case 58: { - LogStep(58, "Write attribute NULLABLE_OCTET_STRING"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 59: { - LogStep(59, "Read attribute NULLABLE_OCTET_STRING"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - true, chip::NullOptional); - } - case 60: { - LogStep(60, "Write attribute NULLABLE_OCTET_STRING back to Default Value"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = chip::ByteSpan(chip::Uint8::from_const_char("garbage: not in length on purpose"), 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::NullableOctetString::Id, - value, chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestDelayCommandsSuite : public TestCommand -{ -public: - TestDelayCommandsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestDelayCommands", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestDelayCommandsSuite() {} - - 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)); - shouldContinue = true; - 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, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestEventsSuite : public TestCommand -{ -public: - TestEventsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestEvents", 12, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestEventsSuite() {} - - 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; - - uint64_t eventNumber; - - 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: - switch (mTestSubStepIndex) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 2: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER)); - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - eventNumber = value.value; - } - break; - case 4: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Events::TestEvent::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEvent.arg1", value.arg1, 1U)); - VerifyOrReturn(CheckValue("testEvent.arg2", value.arg2, 2U)); - VerifyOrReturn(CheckValue("testEvent.arg3", value.arg3, true)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 5: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Events::TestEvent::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEvent.arg1", value.arg1, 1U)); - VerifyOrReturn(CheckValue("testEvent.arg2", value.arg2, 2U)); - VerifyOrReturn(CheckValue("testEvent.arg3", value.arg3, true)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 6: - switch (mTestSubStepIndex) - { - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, static_cast(eventNumber + 1))); - } - break; - case 8: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Events::TestEvent::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEvent.arg1", value.arg1, 1U)); - VerifyOrReturn(CheckValue("testEvent.arg2", value.arg2, 2U)); - VerifyOrReturn(CheckValue("testEvent.arg3", value.arg3, true)); - } - mTestSubStepIndex++; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Events::TestEvent::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEvent.arg1", value.arg1, 3U)); - VerifyOrReturn(CheckValue("testEvent.arg2", value.arg2, 1U)); - VerifyOrReturn(CheckValue("testEvent.arg3", value.arg3, false)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 9: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Events::TestEvent::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEvent.arg1", value.arg1, 1U)); - VerifyOrReturn(CheckValue("testEvent.arg2", value.arg2, 2U)); - VerifyOrReturn(CheckValue("testEvent.arg3", value.arg3, true)); - } - mTestSubStepIndex++; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Events::TestEvent::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEvent.arg1", value.arg1, 3U)); - VerifyOrReturn(CheckValue("testEvent.arg2", value.arg2, 1U)); - VerifyOrReturn(CheckValue("testEvent.arg3", value.arg3, false)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("value", value.value, static_cast(eventNumber + 2))); - } - break; - case 11: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Events::TestEvent::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("testEvent.arg1", value.arg1, 4U)); - VerifyOrReturn(CheckValue("testEvent.arg2", value.arg2, 3U)); - VerifyOrReturn(CheckValue("testEvent.arg3", value.arg3, true)); - } - shouldContinue = true; - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - 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, "Check there is no event on the target endpoint"); - mTestSubStepCount = 0; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Events::TestEvent::Id, false, - chip::NullOptional); - } - case 2: { - LogStep(2, "Check reading events from an invalid endpoint"); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(0), UnitTesting::Id, UnitTesting::Events::TestEvent::Id, false, - chip::NullOptional); - } - case 3: { - LogStep(3, "Generate an event on the accessory"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventRequest::Type value; - value.arg1 = 1U; - value.arg2 = static_cast(2); - value.arg3 = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestEmitTestEventRequest::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Read the event back"); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Events::TestEvent::Id, false, - chip::NullOptional); - } - case 5: { - LogStep(5, "Read the event with eventNumber set to the event value"); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Events::TestEvent::Id, false, - chip::Optional(eventNumber)); - } - case 6: { - LogStep(6, "Read the event with eventNumber set to the event value + 1"); - mTestSubStepCount = 0; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Events::TestEvent::Id, false, - chip::Optional(eventNumber + 1)); - } - case 7: { - LogStep(7, "Generate a second event on the accessory"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventRequest::Type value; - value.arg1 = 3U; - value.arg2 = static_cast(1); - value.arg3 = false; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestEmitTestEventRequest::Id, - value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Read the event back"); - mTestSubStepCount = 2; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Events::TestEvent::Id, false, - chip::NullOptional); - } - case 9: { - LogStep(9, "Subscribe to the event"); - mTestSubStepCount = 2; - return SubscribeEvent(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Events::TestEvent::Id, 3, 5, false, - chip::NullOptional, chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 10: { - LogStep(10, "Generate a third event on the accessory"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventRequest::Type value; - value.arg1 = 4U; - value.arg2 = static_cast(3); - value.arg3 = true; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestEmitTestEventRequest::Id, - value, chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Check for event report"); - mTestSubStepCount = 1; - return WaitForReport(); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestDiscoverySuite : public TestCommand -{ -public: - TestDiscoverySuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestDiscovery", 30, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("shortDiscriminator", 0, UINT16_MAX, &mShortDiscriminator); - AddArgument("vendorId", 0, UINT16_MAX, &mVendorId); - AddArgument("productId", 0, UINT16_MAX, &mProductId); - AddArgument("deviceType", 0, UINT16_MAX, &mDeviceType); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestDiscoverySuite() - { - if (deviceInstanceNameBeforeRebootBuffer != nullptr) - { - chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); - deviceInstanceNameBeforeRebootBuffer = nullptr; - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mShortDiscriminator; - chip::Optional mVendorId; - chip::Optional mProductId; - chip::Optional mDeviceType; - chip::Optional mTimeout; - - char * deviceInstanceNameBeforeRebootBuffer = nullptr; - chip::CharSpan deviceInstanceNameBeforeReboot; - - 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)); - shouldContinue = true; - 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), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); - if (deviceInstanceNameBeforeRebootBuffer != nullptr) - { - chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); - } - deviceInstanceNameBeforeRebootBuffer = static_cast(chip::Platform::MemoryAlloc(value.instanceName.size())); - memcpy(deviceInstanceNameBeforeRebootBuffer, value.instanceName.data(), value.instanceName.size()); - deviceInstanceNameBeforeReboot = chip::CharSpan(deviceInstanceNameBeforeRebootBuffer, value.instanceName.size()); - } - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); - VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); - } - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); - } - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("longDiscriminator", value.longDiscriminator, - mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U)); - VerifyOrReturn(CheckConstraintMinValue("value.longDiscriminator", value.longDiscriminator, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value.longDiscriminator", value.longDiscriminator, 4096U)); - } - shouldContinue = true; - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); - } - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (value.mrpRetryIntervalIdle.HasValue()) - { - VerifyOrReturn( - CheckConstraintMinValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), - 3600000UL)); - } - } - shouldContinue = true; - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (value.mrpRetryIntervalActive.HasValue()) - { - VerifyOrReturn( - CheckConstraintMinValue("value.mrpRetryIntervalActive.Value()", value.mrpRetryIntervalActive.Value(), 0UL)); - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", - value.mrpRetryIntervalActive.Value(), 3600000UL)); - } - } - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 1U)); - } - shouldContinue = true; - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceType", value.deviceType, mDeviceType.HasValue() ? mDeviceType.Value() : 65535UL)); - } - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName, 32)); - } - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); - } - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); - } - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction, 128)); - } - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1U)); - } - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintNotValue("value.instanceName", value.instanceName, deviceInstanceNameBeforeReboot)); - } - shouldContinue = true; - 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, "Stop target device"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Stop::Type value; - return Stop(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Start target device with the provided discriminator for basic commissioning advertisement"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.discriminator.Emplace(); - value.discriminator.Value() = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - return Start(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "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 3: { - LogStep(3, "Open Commissioning Window with too-short timeout"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 120U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Open Commissioning Window with too-long timeout"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 1000U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Open Commissioning Window"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Check Instance Name"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Check Hostname"); - VerifyOrDo(!ShouldSkip("(MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Check Hostname"); - VerifyOrDo(!ShouldSkip("(!MCORE.COM.WIFI && !MCORE.COM.ETH) && MCORE.COM.THR"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Check Long Discriminator _L"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByLongDiscriminator::Type value; - value.value = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840ULL; - return FindCommissionableByLongDiscriminator(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Check Short Discriminator (_S)"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByShortDiscriminator::Type value; - value.value = mShortDiscriminator.HasValue() ? mShortDiscriminator.Value() : 15ULL; - return FindCommissionableByShortDiscriminator(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Check Commissioning Mode (_CM)"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByCommissioningMode::Type value; - return FindCommissionableByCommissioningMode(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Check Vendor ID (_V)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByVendorId::Type value; - value.value = mVendorId.HasValue() ? mVendorId.Value() : 65521ULL; - return FindCommissionableByVendorId(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Check Device Type ID (_T)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DEVTYPE_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByDeviceType::Type value; - value.value = mDeviceType.HasValue() ? mDeviceType.Value() : 65535ULL; - return FindCommissionableByDeviceType(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "TXT key for discriminator (D)"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "TXT key for Vendor ID and Product ID (VP)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 16: { - LogStep(16, "Optional TXT key for MRP Sleepy Idle Interval (SII)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.SII_COMM_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Optional TXT key for MRP Sleepy Active Interval (SAI)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_COMM_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "TXT key for commissioning mode (CM)"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Optional TXT key for device type (DT)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DT_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Optional TXT key for device name (DN)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DN_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Optional TXT key for rotating device identifier (RI)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.RI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 22: { - LogStep(22, "Optional TXT key for pairing hint (PH)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.PH_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Optional TXT key for pairing instructions (PI)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.PI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 24: { - LogStep(24, "Check IPs"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 25: { - LogStep(25, "Stop target device"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Stop::Type value; - return Stop(kIdentityAlpha, value); - } - case 26: { - LogStep(26, "Start target device with the provided discriminator for basic commissioning advertisement"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.discriminator.Emplace(); - value.discriminator.Value() = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - return Start(kIdentityAlpha, value); - } - case 27: { - LogStep(27, "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 28: { - LogStep(28, "Open Commissioning Window"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 29: { - LogStep(29, "Check Instance Name"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestLogCommandsSuite : public TestCommand -{ -public: - TestLogCommandsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestLogCommands", 3, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestLogCommandsSuite() {} - - 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)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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, "Log a simple message"); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::Log::Type value; - value.message = chip::Span("This is a simple messagegarbage: not in length on purpose", 24); - return Log(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Do a simple user prompt message"); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("This is a simple messagegarbage: not in length on purpose", 24); - return UserPrompt(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestSaveAsSuite : public TestCommand -{ -public: - TestSaveAsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestSaveAs", 110, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestSaveAsSuite() - { - if (readAttributeCharStringDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeCharStringDefaultValueBuffer); - readAttributeCharStringDefaultValueBuffer = nullptr; - } - if (readAttributeCharStringNotDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeCharStringNotDefaultValueBuffer); - readAttributeCharStringNotDefaultValueBuffer = nullptr; - } - if (readAttributeOctetStringDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeOctetStringDefaultValueBuffer); - readAttributeOctetStringDefaultValueBuffer = nullptr; - } - if (readAttributeOctetStringNotDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeOctetStringNotDefaultValueBuffer); - readAttributeOctetStringNotDefaultValueBuffer = nullptr; - } - } - - 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 TestAddArgumentDefaultValue; - bool readAttributeBooleanDefaultValue; - chip::BitMask readAttributeBitmap8DefaultValue; - chip::BitMask readAttributeBitmap16DefaultValue; - chip::BitMask readAttributeBitmap32DefaultValue; - chip::BitMask readAttributeBitmap64DefaultValue; - uint8_t readAttributeInt8uDefaultValue; - uint16_t readAttributeInt16uDefaultValue; - uint32_t readAttributeInt32uDefaultValue; - uint64_t readAttributeInt64uDefaultValue; - int8_t readAttributeInt8sDefaultValue; - int16_t readAttributeInt16sDefaultValue; - int32_t readAttributeInt32sDefaultValue; - int64_t readAttributeInt64sDefaultValue; - uint8_t readAttributeEnum8DefaultValue; - uint16_t readAttributeEnum16DefaultValue; - uint64_t readAttributeEpochUSDefaultValue; - uint32_t readAttributeEpochSDefaultValue; - chip::VendorId readAttributeVendorIdDefaultValue; - char * readAttributeCharStringDefaultValueBuffer = nullptr; - chip::CharSpan readAttributeCharStringDefaultValue; - char * readAttributeCharStringNotDefaultValueBuffer = nullptr; - chip::CharSpan readAttributeCharStringNotDefaultValue; - uint8_t * readAttributeOctetStringDefaultValueBuffer = nullptr; - chip::ByteSpan readAttributeOctetStringDefaultValue; - uint8_t * readAttributeOctetStringNotDefaultValueBuffer = nullptr; - chip::ByteSpan readAttributeOctetStringNotDefaultValue; - - 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)); - { - chip::app::Clusters::UnitTesting::Commands::TestAddArgumentsResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("returnValue", value.returnValue, 20U)); - TestAddArgumentDefaultValue = value.returnValue; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestAddArgumentsResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("returnValue", value.returnValue, TestAddArgumentDefaultValue)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestAddArgumentsResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value.returnValue", value.returnValue, TestAddArgumentDefaultValue)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("boolean", value, 0)); - readAttributeBooleanDefaultValue = value; - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeBooleanDefaultValue)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("boolean", value, readAttributeBooleanDefaultValue)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap8", value, 0U)); - readAttributeBitmap8DefaultValue = value; - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeBitmap8DefaultValue)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap8", value, readAttributeBitmap8DefaultValue)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap16", value, 0U)); - readAttributeBitmap16DefaultValue = value; - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeBitmap16DefaultValue)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap16", value, readAttributeBitmap16DefaultValue)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, 0UL)); - readAttributeBitmap32DefaultValue = value; - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeBitmap32DefaultValue)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap32", value, readAttributeBitmap32DefaultValue)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap64", value, 0ULL)); - readAttributeBitmap64DefaultValue = value; - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeBitmap64DefaultValue)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("bitmap64", value, readAttributeBitmap64DefaultValue)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8u", value, 0U)); - readAttributeInt8uDefaultValue = value; - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt8uDefaultValue)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8u", value, readAttributeInt8uDefaultValue)); - } - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16u", value, 0U)); - readAttributeInt16uDefaultValue = value; - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt16uDefaultValue)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16u", value, readAttributeInt16uDefaultValue)); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32u", value, 0UL)); - readAttributeInt32uDefaultValue = value; - } - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt32uDefaultValue)); - } - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32u", value, readAttributeInt32uDefaultValue)); - } - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64u", value, 0ULL)); - readAttributeInt64uDefaultValue = value; - } - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt64uDefaultValue)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64u", value, readAttributeInt64uDefaultValue)); - } - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8s", value, 0)); - readAttributeInt8sDefaultValue = value; - } - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt8sDefaultValue)); - } - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int8s", value, readAttributeInt8sDefaultValue)); - } - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16s", value, 0)); - readAttributeInt16sDefaultValue = value; - } - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt16sDefaultValue)); - } - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int16s", value, readAttributeInt16sDefaultValue)); - } - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32s", value, 0L)); - readAttributeInt32sDefaultValue = value; - } - break; - case 60: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 61: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt32sDefaultValue)); - } - break; - case 62: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 63: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int32s", value, readAttributeInt32sDefaultValue)); - } - break; - case 64: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64s", value, 0LL)); - readAttributeInt64sDefaultValue = value; - } - break; - case 65: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 66: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeInt64sDefaultValue)); - } - break; - case 67: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 68: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - int64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("int64s", value, readAttributeInt64sDefaultValue)); - } - break; - case 69: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enum8", value, 0U)); - readAttributeEnum8DefaultValue = value; - } - break; - case 70: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 71: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeEnum8DefaultValue)); - } - break; - case 72: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 73: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enum8", value, readAttributeEnum8DefaultValue)); - } - break; - case 74: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enum16", value, 0U)); - readAttributeEnum16DefaultValue = value; - } - break; - case 75: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 76: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeEnum16DefaultValue)); - } - break; - case 77: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 78: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enum16", value, readAttributeEnum16DefaultValue)); - } - break; - case 79: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("epochUs", value, 0ULL)); - readAttributeEpochUSDefaultValue = value; - } - break; - case 80: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 81: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeEpochUSDefaultValue)); - } - break; - case 82: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 83: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("epochUs", value, readAttributeEpochUSDefaultValue)); - } - break; - case 84: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("epochS", value, 0UL)); - readAttributeEpochSDefaultValue = value; - } - break; - case 85: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 86: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeEpochSDefaultValue)); - } - break; - case 87: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 88: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("epochS", value, readAttributeEpochSDefaultValue)); - } - break; - case 89: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorId", value, 0U)); - readAttributeVendorIdDefaultValue = value; - } - break; - case 90: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 91: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeVendorIdDefaultValue)); - } - break; - case 92: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 93: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::VendorId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorId", value, readAttributeVendorIdDefaultValue)); - } - break; - case 94: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("", 0))); - if (readAttributeCharStringDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeCharStringDefaultValueBuffer); - } - readAttributeCharStringDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(readAttributeCharStringDefaultValueBuffer, value.data(), value.size()); - readAttributeCharStringDefaultValue = chip::CharSpan(readAttributeCharStringDefaultValueBuffer, value.size()); - } - break; - case 95: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("charString", value, readAttributeCharStringDefaultValue)); - } - break; - case 96: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 97: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("NotDefault", 10))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeCharStringDefaultValue)); - if (readAttributeCharStringNotDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeCharStringNotDefaultValueBuffer); - } - readAttributeCharStringNotDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(readAttributeCharStringNotDefaultValueBuffer, value.data(), value.size()); - readAttributeCharStringNotDefaultValue = chip::CharSpan(readAttributeCharStringNotDefaultValueBuffer, value.size()); - } - break; - case 98: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("charString", value, readAttributeCharStringNotDefaultValue)); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeCharStringDefaultValue)); - } - break; - case 99: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 100: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("charString", value, chip::CharSpan("NotDefault", 10))); - } - break; - case 101: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 102: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char(""), 0))); - if (readAttributeOctetStringDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeOctetStringDefaultValueBuffer); - } - readAttributeOctetStringDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(readAttributeOctetStringDefaultValueBuffer, value.data(), value.size()); - readAttributeOctetStringDefaultValue = chip::ByteSpan(readAttributeOctetStringDefaultValueBuffer, value.size()); - } - break; - case 103: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("octetString", value, readAttributeOctetStringDefaultValue)); - } - break; - case 104: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 105: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn( - CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char("NotDefault"), 10))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeOctetStringDefaultValue)); - if (readAttributeOctetStringNotDefaultValueBuffer != nullptr) - { - chip::Platform::MemoryFree(readAttributeOctetStringNotDefaultValueBuffer); - } - readAttributeOctetStringNotDefaultValueBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(readAttributeOctetStringNotDefaultValueBuffer, value.data(), value.size()); - readAttributeOctetStringNotDefaultValue = - chip::ByteSpan(readAttributeOctetStringNotDefaultValueBuffer, value.size()); - } - break; - case 106: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("octetString", value, readAttributeOctetStringNotDefaultValue)); - VerifyOrReturn(CheckConstraintNotValue("value", value, readAttributeOctetStringDefaultValue)); - } - break; - case 107: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 108: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::ByteSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn( - CheckValueAsString("octetString", value, chip::ByteSpan(chip::Uint8::from_const_char("NotDefault"), 10))); - } - break; - case 109: - 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, "Send Test Add Arguments Command"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type value; - value.arg1 = 3U; - value.arg2 = 17U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestAddArguments::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Send Test Add Arguments Command"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type value; - value.arg1 = 3U; - value.arg2 = 17U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestAddArguments::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Send Test Add Arguments Command"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type value; - value.arg1 = 3U; - value.arg2 = TestAddArgumentDefaultValue; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestAddArguments::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Read attribute BOOLEAN Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Write attribute BOOLEAN Not Default Value"); - ListFreer listFreer; - bool value; - value = 1; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Read attribute BOOLEAN Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Write attribute BOOLEAN DefaultValue"); - ListFreer listFreer; - bool value; - value = readAttributeBooleanDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 8: { - LogStep(8, "Read attribute BOOLEAN False"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Boolean::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Read attribute BITMAP8 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap8::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Write attribute BITMAP8 Not Default Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(1U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap8::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 11: { - LogStep(11, "Read attribute BITMAP8 Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap8::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Write attribute BITMAP8 Default Value"); - ListFreer listFreer; - chip::BitMask value; - value = readAttributeBitmap8DefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap8::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "Read attribute BITMAP8 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap8::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Read attribute BITMAP16 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap16::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Write attribute BITMAP16 Not Default Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(1U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap16::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 16: { - LogStep(16, "Read attribute BITMAP16 Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap16::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Write attribute BITMAP16 Default Value"); - ListFreer listFreer; - chip::BitMask value; - value = readAttributeBitmap16DefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap16::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 18: { - LogStep(18, "Read attribute BITMAP16 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap16::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Read attribute BITMAP32 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Write attribute BITMAP32 Not Default Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(1UL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 21: { - LogStep(21, "Read attribute BITMAP32 Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Write attribute BITMAP32 Default Value"); - ListFreer listFreer; - chip::BitMask value; - value = readAttributeBitmap32DefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 23: { - LogStep(23, "Read attribute BITMAP32 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap32::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, "Read attribute BITMAP64 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap64::Id, true, - chip::NullOptional); - } - case 25: { - LogStep(25, "Write attribute BITMAP64 Not Default Value"); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(1ULL); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap64::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 26: { - LogStep(26, "Read attribute BITMAP64 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap64::Id, true, - chip::NullOptional); - } - case 27: { - LogStep(27, "Write attribute BITMAP64 Default Value"); - ListFreer listFreer; - chip::BitMask value; - value = readAttributeBitmap64DefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap64::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 28: { - LogStep(28, "Read attribute BITMAP64 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Bitmap64::Id, true, - chip::NullOptional); - } - case 29: { - LogStep(29, "Read attribute INT8U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8u::Id, true, - chip::NullOptional); - } - case 30: { - LogStep(30, "Write attribute INT8U Not Default Value"); - ListFreer listFreer; - uint8_t value; - value = 1U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 31: { - LogStep(31, "Read attribute INT8U Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8u::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Write attribute INT8U Default Value"); - ListFreer listFreer; - uint8_t value; - value = readAttributeInt8uDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 33: { - LogStep(33, "Read attribute INT8U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8u::Id, true, - chip::NullOptional); - } - case 34: { - LogStep(34, "Read attribute INT16U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16u::Id, true, - chip::NullOptional); - } - case 35: { - LogStep(35, "Write attribute INT16U Not Default Value"); - ListFreer listFreer; - uint16_t value; - value = 1U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 36: { - LogStep(36, "Read attribute INT16U Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16u::Id, true, - chip::NullOptional); - } - case 37: { - LogStep(37, "Write attribute INT16U Default Value"); - ListFreer listFreer; - uint16_t value; - value = readAttributeInt16uDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 38: { - LogStep(38, "Read attribute INT16U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16u::Id, true, - chip::NullOptional); - } - case 39: { - LogStep(39, "Read attribute INT32U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, true, - chip::NullOptional); - } - case 40: { - LogStep(40, "Write attribute INT32U Not Default Value"); - ListFreer listFreer; - uint32_t value; - value = 1UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 41: { - LogStep(41, "Read attribute INT32U Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, true, - chip::NullOptional); - } - case 42: { - LogStep(42, "Write attribute INT32U Default Value"); - ListFreer listFreer; - uint32_t value; - value = readAttributeInt32uDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 43: { - LogStep(43, "Read attribute INT32U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32u::Id, true, - chip::NullOptional); - } - case 44: { - LogStep(44, "Read attribute INT64U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64u::Id, true, - chip::NullOptional); - } - case 45: { - LogStep(45, "Write attribute INT64U Not Default Value"); - ListFreer listFreer; - uint64_t value; - value = 1ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 46: { - LogStep(46, "Read attribute INT64U Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64u::Id, true, - chip::NullOptional); - } - case 47: { - LogStep(47, "Write attribute INT64U Default Value"); - ListFreer listFreer; - uint64_t value; - value = readAttributeInt64uDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64u::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 48: { - LogStep(48, "Read attribute INT64U Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64u::Id, true, - chip::NullOptional); - } - case 49: { - LogStep(49, "Read attribute INT8S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, true, - chip::NullOptional); - } - case 50: { - LogStep(50, "Write attribute INT8S Not Default Value"); - ListFreer listFreer; - int8_t value; - value = 1; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 51: { - LogStep(51, "Read attribute INT8S Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, true, - chip::NullOptional); - } - case 52: { - LogStep(52, "Write attribute INT8S Default Value"); - ListFreer listFreer; - int8_t value; - value = readAttributeInt8sDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 53: { - LogStep(53, "Read attribute INT8S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int8s::Id, true, - chip::NullOptional); - } - case 54: { - LogStep(54, "Read attribute INT16S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, true, - chip::NullOptional); - } - case 55: { - LogStep(55, "Write attribute INT16S Not Default Value"); - ListFreer listFreer; - int16_t value; - value = 1; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 56: { - LogStep(56, "Read attribute INT16S Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, true, - chip::NullOptional); - } - case 57: { - LogStep(57, "Write attribute INT16S Default Value"); - ListFreer listFreer; - int16_t value; - value = readAttributeInt16sDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 58: { - LogStep(58, "Read attribute INT16S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int16s::Id, true, - chip::NullOptional); - } - case 59: { - LogStep(59, "Read attribute INT32S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, true, - chip::NullOptional); - } - case 60: { - LogStep(60, "Write attribute INT32S Not Default Value"); - ListFreer listFreer; - int32_t value; - value = 1L; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 61: { - LogStep(61, "Read attribute INT32S Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, true, - chip::NullOptional); - } - case 62: { - LogStep(62, "Write attribute INT32S Default Value"); - ListFreer listFreer; - int32_t value; - value = readAttributeInt32sDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 63: { - LogStep(63, "Read attribute INT32S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int32s::Id, true, - chip::NullOptional); - } - case 64: { - LogStep(64, "Read attribute INT64S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, true, - chip::NullOptional); - } - case 65: { - LogStep(65, "Write attribute INTS Not Default Value"); - ListFreer listFreer; - int64_t value; - value = 1LL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 66: { - LogStep(66, "Read attribute INT64S Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, true, - chip::NullOptional); - } - case 67: { - LogStep(67, "Write attribute INT64S Default Value"); - ListFreer listFreer; - int64_t value; - value = readAttributeInt64sDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 68: { - LogStep(68, "Read attribute INT64S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Int64s::Id, true, - chip::NullOptional); - } - case 69: { - LogStep(69, "Read attribute ENUM8 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum8::Id, true, - chip::NullOptional); - } - case 70: { - LogStep(70, "Write attribute ENUM8 Not Default Value"); - ListFreer listFreer; - uint8_t value; - value = 1U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum8::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 71: { - LogStep(71, "Read attribute ENUM8 Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum8::Id, true, - chip::NullOptional); - } - case 72: { - LogStep(72, "Write attribute ENUM8 Default Value"); - ListFreer listFreer; - uint8_t value; - value = readAttributeEnum8DefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum8::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 73: { - LogStep(73, "Read attribute ENUM8 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum8::Id, true, - chip::NullOptional); - } - case 74: { - LogStep(74, "Read attribute ENUM16 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum16::Id, true, - chip::NullOptional); - } - case 75: { - LogStep(75, "Write attribute ENUM16 Not Default Value"); - ListFreer listFreer; - uint16_t value; - value = 1U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum16::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 76: { - LogStep(76, "Read attribute ENUM16 Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum16::Id, true, - chip::NullOptional); - } - case 77: { - LogStep(77, "Write attribute ENUM16 Default Value"); - ListFreer listFreer; - uint16_t value; - value = readAttributeEnum16DefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum16::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 78: { - LogStep(78, "Read attribute ENUM16 Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::Enum16::Id, true, - chip::NullOptional); - } - case 79: { - LogStep(79, "Read attribute EPOCH_US Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochUs::Id, true, - chip::NullOptional); - } - case 80: { - LogStep(80, "Write attribute EPOCH_US Not Default Value"); - ListFreer listFreer; - uint64_t value; - value = 1ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochUs::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 81: { - LogStep(81, "Read attribute EPOCH_US Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochUs::Id, true, - chip::NullOptional); - } - case 82: { - LogStep(82, "Write attribute EPOCH_US Default Value"); - ListFreer listFreer; - uint64_t value; - value = readAttributeEpochUSDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochUs::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 83: { - LogStep(83, "Read attribute EPOCH_US Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochUs::Id, true, - chip::NullOptional); - } - case 84: { - LogStep(84, "Read attribute EPOCH_S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochS::Id, true, - chip::NullOptional); - } - case 85: { - LogStep(85, "Write attribute EPOCH_S Not Default Value"); - ListFreer listFreer; - uint32_t value; - value = 1UL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochS::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 86: { - LogStep(86, "Read attribute EPOCH_S Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochS::Id, true, - chip::NullOptional); - } - case 87: { - LogStep(87, "Write attribute EPOCH_S Default Value"); - ListFreer listFreer; - uint32_t value; - value = readAttributeEpochSDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochS::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 88: { - LogStep(88, "Read attribute EPOCH_S Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::EpochS::Id, true, - chip::NullOptional); - } - case 89: { - LogStep(89, "Read attribute vendor_id Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::VendorId::Id, true, - chip::NullOptional); - } - case 90: { - LogStep(90, "Write attribute vendor_id Not Default Value"); - ListFreer listFreer; - chip::VendorId value; - value = static_cast(1); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::VendorId::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 91: { - LogStep(91, "Read attribute vendor_id Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::VendorId::Id, true, - chip::NullOptional); - } - case 92: { - LogStep(92, "Write attribute vendor_id Default Value"); - ListFreer listFreer; - chip::VendorId value; - value = readAttributeVendorIdDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::VendorId::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 93: { - LogStep(93, "Read attribute vendor_id Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::VendorId::Id, true, - chip::NullOptional); - } - case 94: { - LogStep(94, "Read attribute char_string Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 95: { - LogStep(95, "Read attribute char_string Default Value and compare to saved value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 96: { - LogStep(96, "Write attribute char_string Not Default Value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("NotDefaultgarbage: not in length on purpose", 10); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 97: { - LogStep(97, "Read attribute char_string Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 98: { - LogStep(98, "Read attribute char_string Not Default Value and compare to saved value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 99: { - LogStep(99, "Write attribute char_string Not Default Value from saved value"); - ListFreer listFreer; - chip::CharSpan value; - value = readAttributeCharStringNotDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 100: { - LogStep(100, "Read attribute char_string Not Default Value and compare to expected value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, true, - chip::NullOptional); - } - case 101: { - LogStep(101, "Write attribute char_string Default Value"); - ListFreer listFreer; - chip::CharSpan value; - value = readAttributeCharStringDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::CharString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 102: { - LogStep(102, "Read attribute octet_string Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 103: { - LogStep(103, "Read attribute octet_string Default Value and compare to saved value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 104: { - LogStep(104, "Write attribute octet_string Not Default Value"); - ListFreer listFreer; - chip::ByteSpan value; - value = chip::ByteSpan(chip::Uint8::from_const_char("NotDefaultgarbage: not in length on purpose"), 10); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 105: { - LogStep(105, "Read attribute octet_string Not Default Value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 106: { - LogStep(106, "Read attribute octet_string Not Default Value and compare to saved value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 107: { - LogStep(107, "Write attribute octet_string Not Default Value from saved value"); - ListFreer listFreer; - chip::ByteSpan value; - value = readAttributeOctetStringNotDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 108: { - LogStep(108, "Read attribute octet_string Not Default Value and compare to expected value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, true, - chip::NullOptional); - } - case 109: { - LogStep(109, "Write attribute octet_string Default Value"); - ListFreer listFreer; - chip::ByteSpan value; - value = readAttributeOctetStringDefaultValue; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Attributes::OctetString::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestConfigVariablesSuite : public TestCommand -{ -public: - TestConfigVariablesSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestConfigVariables", 3, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("arg1", 0, UINT8_MAX, &mArg1); - AddArgument("returnValueWithArg1", 0, UINT8_MAX, &mReturnValueWithArg1); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestConfigVariablesSuite() {} - - 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 mArg1; - chip::Optional mReturnValueWithArg1; - chip::Optional mTimeout; - - uint8_t TestAddArgumentDefaultValue; - - 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)); - { - chip::app::Clusters::UnitTesting::Commands::TestAddArgumentsResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("returnValue", value.returnValue, 20U)); - TestAddArgumentDefaultValue = value.returnValue; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::UnitTesting::Commands::TestAddArgumentsResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("returnValue", value.returnValue, - mReturnValueWithArg1.HasValue() ? mReturnValueWithArg1.Value() : 25U)); - } - 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, "Send Test Add Arguments Command"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type value; - value.arg1 = 3U; - value.arg2 = 17U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestAddArguments::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Send Test Add Arguments Command"); - ListFreer listFreer; - chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type value; - value.arg1 = mArg1.HasValue() ? mArg1.Value() : 5U; - value.arg2 = TestAddArgumentDefaultValue; - return SendCommand(kIdentityAlpha, GetEndpoint(1), UnitTesting::Id, UnitTesting::Commands::TestAddArguments::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestDescriptorClusterSuite : public TestCommand -{ -public: - TestDescriptorClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestDescriptorCluster", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestDescriptorClusterSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("deviceTypeList", iter_0, 0)); - VerifyOrReturn(CheckValue("deviceTypeList[0].deviceType", iter_0.GetValue().deviceType, 17UL)); - VerifyOrReturn(CheckValue("deviceTypeList[0].revision", iter_0.GetValue().revision, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("deviceTypeList", iter_0, 1)); - VerifyOrReturn(CheckValue("deviceTypeList[1].deviceType", iter_0.GetValue().deviceType, 22UL)); - VerifyOrReturn(CheckValue("deviceTypeList[1].revision", iter_0.GetValue().revision, 1U)); - VerifyOrReturn(CheckNoMoreListItems("deviceTypeList", iter_0, 2)); - } - } - break; - case 2: - 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(CheckNextListItemDecodes("serverList", iter_0, 0)); - VerifyOrReturn(CheckValue("serverList[0]", iter_0.GetValue(), 3UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 1)); - VerifyOrReturn(CheckValue("serverList[1]", iter_0.GetValue(), 4UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 2)); - VerifyOrReturn(CheckValue("serverList[2]", iter_0.GetValue(), 29UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 3)); - VerifyOrReturn(CheckValue("serverList[3]", iter_0.GetValue(), 30UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 4)); - VerifyOrReturn(CheckValue("serverList[4]", iter_0.GetValue(), 31UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 5)); - VerifyOrReturn(CheckValue("serverList[5]", iter_0.GetValue(), 40UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 6)); - VerifyOrReturn(CheckValue("serverList[6]", iter_0.GetValue(), 42UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 7)); - VerifyOrReturn(CheckValue("serverList[7]", iter_0.GetValue(), 43UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 8)); - VerifyOrReturn(CheckValue("serverList[8]", iter_0.GetValue(), 44UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 9)); - VerifyOrReturn(CheckValue("serverList[9]", iter_0.GetValue(), 45UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 10)); - VerifyOrReturn(CheckValue("serverList[10]", iter_0.GetValue(), 46UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 11)); - VerifyOrReturn(CheckValue("serverList[11]", iter_0.GetValue(), 47UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 12)); - VerifyOrReturn(CheckValue("serverList[12]", iter_0.GetValue(), 48UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 13)); - VerifyOrReturn(CheckValue("serverList[13]", iter_0.GetValue(), 49UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 14)); - VerifyOrReturn(CheckValue("serverList[14]", iter_0.GetValue(), 50UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 15)); - VerifyOrReturn(CheckValue("serverList[15]", iter_0.GetValue(), 51UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 16)); - VerifyOrReturn(CheckValue("serverList[16]", iter_0.GetValue(), 52UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 17)); - VerifyOrReturn(CheckValue("serverList[17]", iter_0.GetValue(), 53UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 18)); - VerifyOrReturn(CheckValue("serverList[18]", iter_0.GetValue(), 54UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 19)); - VerifyOrReturn(CheckValue("serverList[19]", iter_0.GetValue(), 55UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 20)); - VerifyOrReturn(CheckValue("serverList[20]", iter_0.GetValue(), 56UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 21)); - VerifyOrReturn(CheckValue("serverList[21]", iter_0.GetValue(), 60UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 22)); - VerifyOrReturn(CheckValue("serverList[22]", iter_0.GetValue(), 62UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 23)); - VerifyOrReturn(CheckValue("serverList[23]", iter_0.GetValue(), 63UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 24)); - VerifyOrReturn(CheckValue("serverList[24]", iter_0.GetValue(), 64UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 25)); - VerifyOrReturn(CheckValue("serverList[25]", iter_0.GetValue(), 65UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 26)); - VerifyOrReturn(CheckValue("serverList[26]", iter_0.GetValue(), 70UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 27)); - VerifyOrReturn(CheckValue("serverList[27]", iter_0.GetValue(), 1029UL)); - VerifyOrReturn(CheckNextListItemDecodes("serverList", iter_0, 28)); - VerifyOrReturn(CheckValue("serverList[28]", iter_0.GetValue(), 4294048774UL)); - VerifyOrReturn(CheckNoMoreListItems("serverList", iter_0, 29)); - } - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("clientList", iter_0, 0)); - VerifyOrReturn(CheckValue("clientList[0]", iter_0.GetValue(), 41UL)); - VerifyOrReturn(CheckNoMoreListItems("clientList", iter_0, 1)); - } - } - 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(CheckNextListItemDecodes("partsList", iter_0, 0)); - VerifyOrReturn(CheckValue("partsList[0]", iter_0.GetValue(), 1U)); - VerifyOrReturn(CheckNextListItemDecodes("partsList", iter_0, 1)); - VerifyOrReturn(CheckValue("partsList[1]", iter_0.GetValue(), 2U)); - VerifyOrReturn(CheckNoMoreListItems("partsList", iter_0, 2)); - } - } - 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 attribute Device list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::DeviceTypeList::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Read attribute Server list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::ServerList::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Read attribute Client list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::ClientList::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Read attribute Parts list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Descriptor::Id, Descriptor::Attributes::PartsList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestBasicInformationSuite : public TestCommand -{ -public: - TestBasicInformationSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestBasicInformation", 20, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestBasicInformationSuite() {} - - 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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("location", value, chip::CharSpan("XX", 2))); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("location", value, chip::CharSpan("US", 2))); - } - 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::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 0)); - VerifyOrReturn(CheckValue("attributeList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 1)); - VerifyOrReturn(CheckValue("attributeList[1]", iter_0.GetValue(), 1UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 2)); - VerifyOrReturn(CheckValue("attributeList[2]", iter_0.GetValue(), 2UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 3)); - VerifyOrReturn(CheckValue("attributeList[3]", iter_0.GetValue(), 3UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 4)); - VerifyOrReturn(CheckValue("attributeList[4]", iter_0.GetValue(), 4UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 5)); - VerifyOrReturn(CheckValue("attributeList[5]", iter_0.GetValue(), 5UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 6)); - VerifyOrReturn(CheckValue("attributeList[6]", iter_0.GetValue(), 6UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 7)); - VerifyOrReturn(CheckValue("attributeList[7]", iter_0.GetValue(), 7UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 8)); - VerifyOrReturn(CheckValue("attributeList[8]", iter_0.GetValue(), 8UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 9)); - VerifyOrReturn(CheckValue("attributeList[9]", iter_0.GetValue(), 9UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 10)); - VerifyOrReturn(CheckValue("attributeList[10]", iter_0.GetValue(), 10UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 11)); - VerifyOrReturn(CheckValue("attributeList[11]", iter_0.GetValue(), 11UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 12)); - VerifyOrReturn(CheckValue("attributeList[12]", iter_0.GetValue(), 12UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 13)); - VerifyOrReturn(CheckValue("attributeList[13]", iter_0.GetValue(), 13UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 14)); - VerifyOrReturn(CheckValue("attributeList[14]", iter_0.GetValue(), 14UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 15)); - VerifyOrReturn(CheckValue("attributeList[15]", iter_0.GetValue(), 15UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 16)); - VerifyOrReturn(CheckValue("attributeList[16]", iter_0.GetValue(), 16UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 17)); - VerifyOrReturn(CheckValue("attributeList[17]", iter_0.GetValue(), 18UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 18)); - VerifyOrReturn(CheckValue("attributeList[18]", iter_0.GetValue(), 19UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 19)); - VerifyOrReturn(CheckValue("attributeList[19]", iter_0.GetValue(), 20UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 20)); - VerifyOrReturn(CheckValue("attributeList[20]", iter_0.GetValue(), 65528UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 21)); - VerifyOrReturn(CheckValue("attributeList[21]", iter_0.GetValue(), 65529UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 22)); - VerifyOrReturn(CheckValue("attributeList[22]", iter_0.GetValue(), 65530UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 23)); - VerifyOrReturn(CheckValue("attributeList[23]", iter_0.GetValue(), 65531UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 24)); - VerifyOrReturn(CheckValue("attributeList[24]", iter_0.GetValue(), 65532UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 25)); - VerifyOrReturn(CheckValue("attributeList[25]", iter_0.GetValue(), 65533UL)); - VerifyOrReturn(CheckNoMoreListItems("attributeList", iter_0, 26)); - } - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 0)); - VerifyOrReturn(CheckValue("attributeList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 1)); - VerifyOrReturn(CheckValue("attributeList[1]", iter_0.GetValue(), 1UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 2)); - VerifyOrReturn(CheckValue("attributeList[2]", iter_0.GetValue(), 2UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 3)); - VerifyOrReturn(CheckValue("attributeList[3]", iter_0.GetValue(), 3UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 4)); - VerifyOrReturn(CheckValue("attributeList[4]", iter_0.GetValue(), 4UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 5)); - VerifyOrReturn(CheckValue("attributeList[5]", iter_0.GetValue(), 5UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 6)); - VerifyOrReturn(CheckValue("attributeList[6]", iter_0.GetValue(), 6UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 7)); - VerifyOrReturn(CheckValue("attributeList[7]", iter_0.GetValue(), 7UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 8)); - VerifyOrReturn(CheckValue("attributeList[8]", iter_0.GetValue(), 8UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 9)); - VerifyOrReturn(CheckValue("attributeList[9]", iter_0.GetValue(), 9UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 10)); - VerifyOrReturn(CheckValue("attributeList[10]", iter_0.GetValue(), 10UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 11)); - VerifyOrReturn(CheckValue("attributeList[11]", iter_0.GetValue(), 11UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 12)); - VerifyOrReturn(CheckValue("attributeList[12]", iter_0.GetValue(), 12UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 13)); - VerifyOrReturn(CheckValue("attributeList[13]", iter_0.GetValue(), 13UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 14)); - VerifyOrReturn(CheckValue("attributeList[14]", iter_0.GetValue(), 14UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 15)); - VerifyOrReturn(CheckValue("attributeList[15]", iter_0.GetValue(), 15UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 16)); - VerifyOrReturn(CheckValue("attributeList[16]", iter_0.GetValue(), 16UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 17)); - VerifyOrReturn(CheckValue("attributeList[17]", iter_0.GetValue(), 18UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 18)); - VerifyOrReturn(CheckValue("attributeList[18]", iter_0.GetValue(), 19UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 19)); - VerifyOrReturn(CheckValue("attributeList[19]", iter_0.GetValue(), 20UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 20)); - VerifyOrReturn(CheckValue("attributeList[20]", iter_0.GetValue(), 65528UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 21)); - VerifyOrReturn(CheckValue("attributeList[21]", iter_0.GetValue(), 65529UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 22)); - VerifyOrReturn(CheckValue("attributeList[22]", iter_0.GetValue(), 65531UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 23)); - VerifyOrReturn(CheckValue("attributeList[23]", iter_0.GetValue(), 65532UL)); - VerifyOrReturn(CheckNextListItemDecodes("attributeList", iter_0, 24)); - VerifyOrReturn(CheckValue("attributeList[24]", iter_0.GetValue(), 65533UL)); - VerifyOrReturn(CheckNoMoreListItems("attributeList", iter_0, 25)); - } - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("My node", 7))); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("localConfigDisabled", value, false)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("localConfigDisabled", value, true)); - } - 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)); - shouldContinue = true; - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("My node", 7))); - } - 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("localConfigDisabled", value, true)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::BasicInformation::Structs::ProductAppearanceStruct::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("productAppearance.finish", value.finish, 2U)); - VerifyOrReturn(CheckValueNonNull("productAppearance.primaryColor", value.primaryColor)); - VerifyOrReturn(CheckValue("productAppearance.primaryColor.Value()", value.primaryColor.Value(), 5U)); - } - 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 location"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Write location"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("USgarbage: not in length on purpose", 2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 3: { - LogStep(3, "Read back location"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - true, chip::NullOptional); - } - case 4: { - LogStep(4, "Restore initial location value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("XXgarbage: not in length on purpose", 2); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Read AttributeList value"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Read AttributeList value"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Read NodeLabel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Write NodeLabel"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("My nodegarbage: not in length on purpose", 7); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 9: { - LogStep(9, "Read back NodeLabel"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Read LocalConfigDisabled"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::LocalConfigDisabled::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Write LocalConfigDisabled"); - ListFreer listFreer; - bool value; - value = true; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::LocalConfigDisabled::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 12: { - LogStep(12, "Read back LocalConfigDisabled"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::LocalConfigDisabled::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Reboot the device"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Connect to the device again"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "Read back NodeLabel after reboot"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Restore initial NodeLabel value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("garbage: not in length on purpose", 0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 17: { - LogStep(17, "Read back LocalConfigDisabled after reboot"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::LocalConfigDisabled::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Restore initial LocalConfigDisabled value"); - ListFreer listFreer; - bool value; - value = false; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::LocalConfigDisabled::Id, value, chip::NullOptional, - chip::NullOptional); - } - case 19: { - LogStep(19, "Read the ProductApppearance value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, - BasicInformation::Attributes::ProductAppearance::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestFabricRemovalWhileSubscribedSuite : public TestCommand -{ -public: - TestFabricRemovalWhileSubscribedSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestFabricRemovalWhileSubscribed", 8, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestFabricRemovalWhileSubscribedSuite() {} - - 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 mDiscriminator; - chip::Optional mPayload; - chip::Optional mTimeout; - - uint8_t ourFabricIndex; - - 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(CheckValue("commissionedFabrics", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); - } - 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", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - ourFabricIndex = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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 number of commissioned fabrics"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CommissionedFabrics::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read current fabric index"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Open commissioning window from alpha"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Commission from beta"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = 74565ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 5: { - LogStep(5, "Wait for the commissioned device to be retrieved for beta"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = 74565ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 6: { - LogStep(6, "Subscribe Fabrics Attribute from beta"); - return SubscribeAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::Fabrics::Id, 2, 5, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 7: { - LogStep(7, "Remove single own fabric"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = ourFabricIndex; - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestGeneralCommissioningSuite : public TestCommand -{ -public: - TestGeneralCommissioningSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGeneralCommissioning", 40, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestGeneralCommissioningSuite() - { - if (originalLocationBuffer != nullptr) - { - chip::Platform::MemoryFree(originalLocationBuffer); - originalLocationBuffer = nullptr; - } - } - - 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 mDiscriminator; - chip::Optional mPayload; - chip::Optional mTimeout; - - chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum originalRegulatoryConfig; - char * originalLocationBuffer = nullptr; - chip::CharSpan originalLocation; - - 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)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 137438953472ULL)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 81ULL)); - } - 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)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 0ULL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - 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 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("errorCode", value.errorCode, 3U)); - } - break; - case 11: - 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 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("errorCode", value.errorCode, 4U)); - } - break; - case 14: - 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 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 2ULL)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("errorCode", value.errorCode, 4U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 2ULL)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("errorCode", value.errorCode, 2U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 2ULL)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 0ULL)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 3ULL)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0U)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint64_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("breadcrumb", value, 0ULL)); - } - break; - case 30: - 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; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::RegulatoryLocationTypeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - originalRegulatoryConfig = value; - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("location", value, chip::CharSpan("XX", 2))); - if (originalLocationBuffer != nullptr) - { - chip::Platform::MemoryFree(originalLocationBuffer); - } - originalLocationBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(originalLocationBuffer, value.data(), value.size()); - originalLocation = chip::CharSpan(originalLocationBuffer, value.size()); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("location", value, originalLocation)); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("location", value, originalLocation)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfigResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0U)); - VerifyOrReturn(CheckValueAsString("debugText", value.debugText, chip::CharSpan("", 0))); - } - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("location", value, chip::CharSpan("US", 2))); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfigResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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, "Write Breadcrumb (1/2)"); - ListFreer listFreer; - uint64_t value; - value = 137438953472ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, value, chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Read back Breadcrumb (1/2)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Write Breadcrumb (2/2)"); - ListFreer listFreer; - uint64_t value; - value = 81ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, value, chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Read back Breadcrumb (2/2)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Reboot to reset Breadcrumb"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Connect to the device again"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Read back Breadcrumb after reboot and ensure it was not persisted"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Set Breadcrumb to nonzero value"); - ListFreer listFreer; - uint64_t value; - value = 1ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, value, chip::NullOptional, chip::NullOptional); - } - case 9: { - LogStep(9, "Check Breadcrumb set worked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Send CommissioningComplete without armed fail-safe"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::CommissioningComplete::Id, value, chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Check Breadcrumb was not touched by invalid CommissioningComplete"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Open Commissioning Window from alpha"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Try to arm fail-safe"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; - value.expiryLengthSeconds = 10U; - value.breadcrumb = 5000ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::ArmFailSafe::Id, value, chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Check Breadcrumb was not touched by ArmFailSafe with commissioning window open"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Reset Breadcrumb to 0 so we can commission"); - ListFreer listFreer; - uint64_t value; - value = 0ULL; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, value, chip::NullOptional, chip::NullOptional); - } - case 16: { - LogStep(16, "Commission from beta"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = 74565ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 17: { - LogStep(17, "Wait for the commissioned device to be retrieved for beta"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = 74565ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 18: { - LogStep(18, "Arm fail-safe"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; - value.expiryLengthSeconds = 500U; - value.breadcrumb = 2ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::ArmFailSafe::Id, value, chip::NullOptional - - ); - } - case 19: { - LogStep(19, "Check Breadcrumb was properly set by ArmFailSafe"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Try to arm fail-safe from wrong fabric"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; - value.expiryLengthSeconds = 10U; - value.breadcrumb = 5000ULL; - return SendCommand(kIdentityBeta, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::ArmFailSafe::Id, value, chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Check Breadcrumb was not touched by ArmFailSafe with existing fail-safe armed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Send CommissioningComplete from wrong fabric"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Type value; - return SendCommand(kIdentityBeta, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::CommissioningComplete::Id, value, chip::NullOptional - - ); - } - case 23: { - LogStep(23, "Check Breadcrumb was not touched by CommissioningComplete from wrong fabric"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Close out the fail-safe gracefully"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::CommissioningComplete::Id, value, chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Check Breadcrumb was reset to 0 by CommissioningComplete"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Arm fail-safe again"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; - value.expiryLengthSeconds = 500U; - value.breadcrumb = 3ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::ArmFailSafe::Id, value, chip::NullOptional - - ); - } - case 27: { - LogStep(27, "Check Breadcrumb was set by arming fail-safe again"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 28: { - LogStep(28, "Force-expire the fail-safe"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; - value.expiryLengthSeconds = 0U; - value.breadcrumb = 4ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::ArmFailSafe::Id, value, chip::NullOptional - - ); - } - case 29: { - LogStep(29, "Check Breadcrumb was reset by expiring the fail-safe"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::Breadcrumb::Id, true, chip::NullOptional); - } - case 30: { - LogStep(30, "Validate presence of SupportsConcurrentConnection"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::SupportsConcurrentConnection::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, "Read original regulatory location"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Attributes::RegulatoryConfig::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, "Read original location"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - true, chip::NullOptional); - } - case 33: { - LogStep(33, "Try to SetRegulatoryConfig with 0-length country code"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Type value; - value.newRegulatoryConfig = static_cast(0); - value.countryCode = chip::Span("garbage: not in length on purpose", 0); - value.breadcrumb = 0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::SetRegulatoryConfig::Id, value, chip::NullOptional - - ); - } - case 34: { - LogStep(34, "Read back location"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - true, chip::NullOptional); - } - case 35: { - LogStep(35, "Try to SetRegulatoryConfig with length-1 country code"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Type value; - value.newRegulatoryConfig = static_cast(0); - value.countryCode = chip::Span("Ugarbage: not in length on purpose", 1); - value.breadcrumb = 0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::SetRegulatoryConfig::Id, value, chip::NullOptional - - ); - } - case 36: { - LogStep(36, "Read back location second time"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - true, chip::NullOptional); - } - case 37: { - LogStep(37, "Try to SetRegulatoryConfig with length-2 country code"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Type value; - value.newRegulatoryConfig = static_cast(0); - value.countryCode = chip::Span("USgarbage: not in length on purpose", 2); - value.breadcrumb = 0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::SetRegulatoryConfig::Id, value, chip::NullOptional - - ); - } - case 38: { - LogStep(38, "Read back location third time"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::Location::Id, - true, chip::NullOptional); - } - case 39: { - LogStep(39, "Restore initial values"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Type value; - value.newRegulatoryConfig = originalRegulatoryConfig; - value.countryCode = originalLocation; - value.breadcrumb = 0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::SetRegulatoryConfig::Id, value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestIdentifyClusterSuite : public TestCommand -{ -public: - TestIdentifyClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestIdentifyCluster", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestIdentifyClusterSuite() {} - - 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; - 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, "Send Identify command and expect success response"); - ListFreer listFreer; - chip::app::Clusters::Identify::Commands::Identify::Type value; - value.identifyTime = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), Identify::Id, Identify::Commands::Identify::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestOperationalCredentialsClusterSuite : public TestCommand -{ -public: - TestOperationalCredentialsClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestOperationalCredentialsCluster", 8, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestOperationalCredentialsClusterSuite() {} - - 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 ourFabricIndex; - - 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, 4U)); - } - 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", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - } - 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, 1U)); - ourFabricIndex = value; - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("statusCode", value.statusCode, 11U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, ourFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("statusCode", value.statusCode, 0U)); - VerifyOrReturn(CheckValuePresent("fabricIndex", value.fabricIndex)); - VerifyOrReturn(CheckValue("fabricIndex.Value()", value.fabricIndex.Value(), ourFabricIndex)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("Batcave", 7))); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, ourFabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - } - 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 number of supported fabrics"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::SupportedFabrics::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read number of commissioned fabrics"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CommissionedFabrics::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Read current fabric index"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Remove nonexistent fabric"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = 243U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Read fabric list before setting label"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::Fabrics::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Set the fabric label"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type value; - value.label = chip::Span("Batcavegarbage: not in length on purpose", 7); - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::UpdateFabricLabel::Id, value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Read fabric list after setting label"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::Fabrics::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestModeSelectClusterSuite : public TestCommand -{ -public: - TestModeSelectClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestModeSelectCluster", 32, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestModeSelectClusterSuite() {} - - 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 currentModeBeforeToggle; - chip::app::DataModel::Nullable OnModeValue; - - 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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("description", value, chip::CharSpan("Coffee", 6))); - } - 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(CheckValueNonNull("standardNamespace", value)); - VerifyOrReturn(CheckValue("standardNamespace.Value()", value.Value(), 0U)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 0)); - VerifyOrReturn( - CheckValueAsString("supportedModes[0].label", iter_0.GetValue().label, chip::CharSpan("Black", 5))); - VerifyOrReturn(CheckValue("supportedModes[0].mode", iter_0.GetValue().mode, 0U)); - { - auto iter_2 = iter_0.GetValue().semanticTags.begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "supportedModes[0].semanticTags", iter_2, 0)); - VerifyOrReturn(CheckValue("supportedModes[0].semanticTags[0].value", iter_2.GetValue().value, 0U)); - VerifyOrReturn(CheckNoMoreListItems( - "supportedModes[0].semanticTags", iter_2, 1)); - } - VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 1)); - VerifyOrReturn( - CheckValueAsString("supportedModes[1].label", iter_0.GetValue().label, chip::CharSpan("Cappuccino", 10))); - VerifyOrReturn(CheckValue("supportedModes[1].mode", iter_0.GetValue().mode, 4U)); - { - auto iter_2 = iter_0.GetValue().semanticTags.begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "supportedModes[1].semanticTags", iter_2, 0)); - VerifyOrReturn(CheckValue("supportedModes[1].semanticTags[0].value", iter_2.GetValue().value, 0U)); - VerifyOrReturn(CheckNoMoreListItems( - "supportedModes[1].semanticTags", iter_2, 1)); - } - VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 2)); - VerifyOrReturn( - CheckValueAsString("supportedModes[2].label", iter_0.GetValue().label, chip::CharSpan("Espresso", 8))); - VerifyOrReturn(CheckValue("supportedModes[2].mode", iter_0.GetValue().mode, 7U)); - { - auto iter_2 = iter_0.GetValue().semanticTags.begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "supportedModes[2].semanticTags", iter_2, 0)); - VerifyOrReturn(CheckValue("supportedModes[2].semanticTags[0].value", iter_2.GetValue().value, 0U)); - VerifyOrReturn(CheckNoMoreListItems( - "supportedModes[2].semanticTags", iter_2, 1)); - } - VerifyOrReturn(CheckNoMoreListItems("supportedModes", iter_0, 3)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintMinLength("value", value, 3)); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 3)); - } - 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("currentMode", value, 0U)); - } - 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("startUpMode", value)); - VerifyOrReturn(CheckValue("startUpMode.Value()", value.Value(), 0U)); - } - 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(CheckValueNull("onMode", value)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentMode", value, 4U)); - currentModeBeforeToggle = value; - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentMode", value, currentModeBeforeToggle)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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(CheckValueNonNull("onMode", value)); - VerifyOrReturn(CheckValue("onMode.Value()", value.Value(), 7U)); - OnModeValue = value; - } - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentMode", value, OnModeValue)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("startUpMode", value)); - VerifyOrReturn(CheckValue("startUpMode.Value()", value.Value(), 7U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentMode", value, 4U)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("currentMode", value, 7U)); - } - 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 Description"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::Description::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Read StandardNamespace"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::StandardNamespace::Id, - true, chip::NullOptional); - } - case 3: { - LogStep(3, "Read SupportedModes"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::SupportedModes::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Read CurrentMode"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Read StartUpMode"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::StartUpMode::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Read OnMode"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Change to Supported Mode"); - ListFreer listFreer; - chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type value; - value.newMode = 4U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Commands::ChangeToMode::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Verify Current Mode Change"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Change to Unsupported Mode"); - ListFreer listFreer; - chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type value; - value.newMode = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Commands::ChangeToMode::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Toggle OnOff"); - 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 11: { - LogStep(11, "Toggle OnOff"); - 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 12: { - LogStep(12, "Verify Current Mode does not change when OnMode is null"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Change to Unsupported OnMode"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 2U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 14: { - LogStep(14, "Change OnMode"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 7U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 15: { - LogStep(15, "Verify OnMode"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Toggle OnOff"); - 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 17: { - LogStep(17, "Toggle OnOff"); - 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 18: { - LogStep(18, "Verify Current Mode Changes if OnMode is not null"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Change to Unsupported StartUp Mode"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 2U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::StartUpMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 20: { - LogStep(20, "Change to Supported StartUp Mode"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 7U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::StartUpMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 21: { - LogStep(21, "Verify StartUp Mode Change"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::StartUpMode::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Change CurrentMode to another value"); - ListFreer listFreer; - chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type value; - value.newMode = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Commands::ChangeToMode::Id, value, - chip::NullOptional - - ); - } - case 23: { - LogStep(23, "Change On Mode"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 4U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 24: { - LogStep(24, "Set StartUpOnOff"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = static_cast(1); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::StartUpOnOff::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 25: { - LogStep(25, "Reboot target device"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 26: { - LogStep(26, "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 27: { - LogStep(27, "Verify Current Mode Change based on OnMode, as it overwrites StartUpMode"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id, true, - chip::NullOptional); - } - case 28: { - LogStep(28, "Change On Mode to Null"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::OnMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 29: { - LogStep(29, "Reboot target device"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 30: { - LogStep(30, "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 31: { - LogStep(31, "Verify Current Mode Change based on new StartUp Mode"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ModeSelect::Id, ModeSelect::Attributes::CurrentMode::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestTemperatureControlSuite : public TestCommand -{ -public: - TestTemperatureControlSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestTemperatureControl", 7, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestTemperatureControlSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("supportedTemperatureLevels", iter_0, 0)); - VerifyOrReturn( - CheckValueAsString("supportedTemperatureLevels[0]", iter_0.GetValue(), chip::CharSpan("Hot", 3))); - VerifyOrReturn(CheckNextListItemDecodes("supportedTemperatureLevels", iter_0, 1)); - VerifyOrReturn( - CheckValueAsString("supportedTemperatureLevels[1]", iter_0.GetValue(), chip::CharSpan("Warm", 4))); - VerifyOrReturn(CheckNextListItemDecodes("supportedTemperatureLevels", iter_0, 2)); - VerifyOrReturn( - CheckValueAsString("supportedTemperatureLevels[2]", iter_0.GetValue(), chip::CharSpan("Freezing", 8))); - VerifyOrReturn(CheckNoMoreListItems("supportedTemperatureLevels", iter_0, 3)); - } - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("selectedTemperatureLevel", value, 0U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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("selectedTemperatureLevel", value, 1U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("selectedTemperatureLevel", 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, "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 supported temperature levels"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::SupportedTemperatureLevels::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read selected temperature level"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::SelectedTemperatureLevel::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Set temperature level to different level"); - ListFreer listFreer; - chip::app::Clusters::TemperatureControl::Commands::SetTemperature::Type value; - value.targetTemperatureLevel.Emplace(); - value.targetTemperatureLevel.Value() = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Commands::SetTemperature::Id, value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Read back selected temperature level"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::SelectedTemperatureLevel::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Set temperature level to different level"); - ListFreer listFreer; - chip::app::Clusters::TemperatureControl::Commands::SetTemperature::Type value; - value.targetTemperatureLevel.Emplace(); - value.targetTemperatureLevel.Value() = 3U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Commands::SetTemperature::Id, value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Read back selected temperature level"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureControl::Id, - TemperatureControl::Attributes::SelectedTemperatureLevel::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestSelfFabricRemovalSuite : public TestCommand -{ -public: - TestSelfFabricRemovalSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestSelfFabricRemoval", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestSelfFabricRemovalSuite() {} - - 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 ourFabricIndex; - - 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(CheckValue("commissionedFabrics", value, 1U)); - VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); - } - 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", "int8u", "int8u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - ourFabricIndex = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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 number of commissioned fabrics"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CommissionedFabrics::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read current fabric index"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Remove single own fabric"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = ourFabricIndex; - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestSystemCommandsSuite : public TestCommand -{ -public: - TestSystemCommandsSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestSystemCommands", 22, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestSystemCommandsSuite() {} - - 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 mPayload; - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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, "Stop the default accessory"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Stop::Type value; - return Stop(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Start the default accessory with no command line options"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - return Start(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Stop the default accessory by key"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Stop::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("defaultgarbage: not in length on purpose", 7); - return Stop(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Start the default accessory with discriminator command line option"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.discriminator.Emplace(); - value.discriminator.Value() = 1111U; - return Start(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Stop the default accessory"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Stop::Type value; - return Stop(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Start the default accessory with discriminator and port command line options"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.discriminator.Emplace(); - value.discriminator.Value() = 1111U; - value.port.Emplace(); - value.port.Value() = 5560U; - return Start(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Stop the default accessory"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Stop::Type value; - return Stop(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Start the default accessory with minCommissioningTimeout only"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.minCommissioningTimeout.Emplace(); - value.minCommissioningTimeout.Value() = 10U; - return Start(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Stop the default accessory"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Stop::Type value; - return Stop(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Start the default accessory by key with all command line options"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("defaultgarbage: not in length on purpose", 7); - value.discriminator.Emplace(); - value.discriminator.Value() = 1111U; - value.port.Emplace(); - value.port.Value() = 5560U; - value.kvs.Emplace(); - value.kvs.Value() = chip::Span("/tmp/chip_kvs_defaultgarbage: not in length on purpose", 21); - value.minCommissioningTimeout.Emplace(); - value.minCommissioningTimeout.Value() = 10U; - return Start(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Start a second accessory with all command line options"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("chip-lock-appgarbage: not in length on purpose", 13); - value.discriminator.Emplace(); - value.discriminator.Value() = 50U; - value.port.Emplace(); - value.port.Value() = 5561U; - value.kvs.Emplace(); - value.kvs.Value() = chip::Span("/tmp/chip_kvs_lockgarbage: not in length on purpose", 18); - return Start(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Commission second accessory from alpha"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = 3735928559ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0IX4122-.548G00", 22); - return PairWithCode(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Wait for the second commissioned device to be retrieved for alpha"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = 3735928559ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Stop the second accessory"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Stop::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("chip-lock-appgarbage: not in length on purpose", 13); - return Stop(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "Start a second accessory with different KVS"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("chip-lock-appgarbage: not in length on purpose", 13); - value.discriminator.Emplace(); - value.discriminator.Value() = 50U; - value.port.Emplace(); - value.port.Value() = 5561U; - value.kvs.Emplace(); - value.kvs.Value() = chip::Span("/tmp/chip_kvs_lock2garbage: not in length on purpose", 19); - return Start(kIdentityAlpha, value); - } - case 16: { - LogStep(16, "Reboot the default accessory"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Reboot the default accessory by key"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("defaultgarbage: not in length on purpose", 7); - return Reboot(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Reboot the second accessory"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("chip-lock-appgarbage: not in length on purpose", 13); - return Reboot(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Factory Reset the default accessory"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - return FactoryReset(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Factory Reset the default accessory by key"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("defaultgarbage: not in length on purpose", 7); - return FactoryReset(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Factory Reset the second accessory"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - value.registerKey.Emplace(); - value.registerKey.Value() = chip::Span("chip-lock-appgarbage: not in length on purpose", 13); - return FactoryReset(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestBindingSuite : public TestCommand -{ -public: - TestBindingSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestBinding", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestBindingSuite() {} - - 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::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 0)); - } - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - 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::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 0)); - VerifyOrReturn(CheckValuePresent("binding[0].group", iter_0.GetValue().group)); - VerifyOrReturn(CheckValue("binding[0].group.Value()", iter_0.GetValue().group.Value(), 1U)); - VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 1)); - VerifyOrReturn(CheckValuePresent("binding[1].node", iter_0.GetValue().node)); - VerifyOrReturn(CheckValue("binding[1].node.Value()", iter_0.GetValue().node.Value(), 1ULL)); - VerifyOrReturn(CheckValuePresent("binding[1].endpoint", iter_0.GetValue().endpoint)); - VerifyOrReturn(CheckValue("binding[1].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("binding[1].cluster", iter_0.GetValue().cluster)); - VerifyOrReturn(CheckValue("binding[1].cluster.Value()", iter_0.GetValue().cluster.Value(), 6UL)); - VerifyOrReturn(CheckValue("binding[1].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 2)); - VerifyOrReturn(CheckValuePresent("binding[2].node", iter_0.GetValue().node)); - VerifyOrReturn(CheckValue("binding[2].node.Value()", iter_0.GetValue().node.Value(), 2ULL)); - VerifyOrReturn(CheckValuePresent("binding[2].endpoint", iter_0.GetValue().endpoint)); - VerifyOrReturn(CheckValue("binding[2].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); - VerifyOrReturn(CheckValue("binding[2].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 3)); - } - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - 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(CheckNextListItemDecodes("binding", iter_0, 0)); - VerifyOrReturn(CheckValuePresent("binding[0].node", iter_0.GetValue().node)); - VerifyOrReturn(CheckValue("binding[0].node.Value()", iter_0.GetValue().node.Value(), 3ULL)); - VerifyOrReturn(CheckValuePresent("binding[0].endpoint", iter_0.GetValue().endpoint)); - VerifyOrReturn(CheckValue("binding[0].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); - VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 1)); - } - } - break; - case 8: - 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(CheckNextListItemDecodes("binding", iter_0, 0)); - VerifyOrReturn(CheckValuePresent("binding[0].group", iter_0.GetValue().group)); - VerifyOrReturn(CheckValue("binding[0].group.Value()", iter_0.GetValue().group.Value(), 1U)); - VerifyOrReturn(CheckValue("binding[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 1)); - VerifyOrReturn(CheckValuePresent("binding[1].node", iter_0.GetValue().node)); - VerifyOrReturn(CheckValue("binding[1].node.Value()", iter_0.GetValue().node.Value(), 1ULL)); - VerifyOrReturn(CheckValuePresent("binding[1].endpoint", iter_0.GetValue().endpoint)); - VerifyOrReturn(CheckValue("binding[1].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("binding[1].cluster", iter_0.GetValue().cluster)); - VerifyOrReturn(CheckValue("binding[1].cluster.Value()", iter_0.GetValue().cluster.Value(), 6UL)); - VerifyOrReturn(CheckValue("binding[1].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("binding", iter_0, 2)); - VerifyOrReturn(CheckValuePresent("binding[2].node", iter_0.GetValue().node)); - VerifyOrReturn(CheckValue("binding[2].node.Value()", iter_0.GetValue().node.Value(), 2ULL)); - VerifyOrReturn(CheckValuePresent("binding[2].endpoint", iter_0.GetValue().endpoint)); - VerifyOrReturn(CheckValue("binding[2].endpoint.Value()", iter_0.GetValue().endpoint.Value(), 1U)); - VerifyOrReturn(CheckValue("binding[2].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("binding", iter_0, 3)); - } - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED)); - 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, "Write empty binding table"); - ListFreer listFreer; - chip::app::DataModel::List value; - - value = chip::app::DataModel::List(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Read empty binding table"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Write invalid binding table"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].node.Emplace(); - listHolder_0->mList[1].node.Value() = 1ULL; - listHolder_0->mList[1].group.Emplace(); - listHolder_0->mList[1].group.Value() = 1U; - listHolder_0->mList[1].endpoint.Emplace(); - listHolder_0->mList[1].endpoint.Value() = 1U; - listHolder_0->mList[1].cluster.Emplace(); - listHolder_0->mList[1].cluster.Value() = 6UL; - listHolder_0->mList[1].fabricIndex = 0U; - - value = - chip::app::DataModel::List(listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Write binding table (endpoint 1)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(3); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].group.Emplace(); - listHolder_0->mList[0].group.Value() = 1U; - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].node.Emplace(); - listHolder_0->mList[1].node.Value() = 1ULL; - listHolder_0->mList[1].endpoint.Emplace(); - listHolder_0->mList[1].endpoint.Value() = 1U; - listHolder_0->mList[1].cluster.Emplace(); - listHolder_0->mList[1].cluster.Value() = 6UL; - listHolder_0->mList[1].fabricIndex = 0U; - - listHolder_0->mList[2].node.Emplace(); - listHolder_0->mList[2].node.Value() = 2ULL; - listHolder_0->mList[2].endpoint.Emplace(); - listHolder_0->mList[2].endpoint.Value() = 1U; - listHolder_0->mList[2].fabricIndex = 0U; - - value = - chip::app::DataModel::List(listHolder_0->mList, 3); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Read binding table (endpoint 1)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Write binding table (endpoint 0)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].node.Emplace(); - listHolder_0->mList[0].node.Value() = 3ULL; - listHolder_0->mList[0].endpoint.Emplace(); - listHolder_0->mList[0].endpoint.Value() = 1U; - listHolder_0->mList[0].fabricIndex = 0U; - - value = - chip::app::DataModel::List(listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), Binding::Id, Binding::Attributes::Binding::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "Read binding table (endpoint 0)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), Binding::Id, Binding::Attributes::Binding::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Verify endpoint 1 not changed"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Write over-long binding table on endpoint 1"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(11); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].node.Emplace(); - listHolder_0->mList[0].node.Value() = 1ULL; - listHolder_0->mList[0].endpoint.Emplace(); - listHolder_0->mList[0].endpoint.Value() = 1U; - listHolder_0->mList[0].cluster.Emplace(); - listHolder_0->mList[0].cluster.Value() = 6UL; - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].node.Emplace(); - listHolder_0->mList[1].node.Value() = 2ULL; - listHolder_0->mList[1].endpoint.Emplace(); - listHolder_0->mList[1].endpoint.Value() = 2U; - listHolder_0->mList[1].cluster.Emplace(); - listHolder_0->mList[1].cluster.Value() = 6UL; - listHolder_0->mList[1].fabricIndex = 0U; - - listHolder_0->mList[2].node.Emplace(); - listHolder_0->mList[2].node.Value() = 3ULL; - listHolder_0->mList[2].endpoint.Emplace(); - listHolder_0->mList[2].endpoint.Value() = 3U; - listHolder_0->mList[2].cluster.Emplace(); - listHolder_0->mList[2].cluster.Value() = 6UL; - listHolder_0->mList[2].fabricIndex = 0U; - - listHolder_0->mList[3].node.Emplace(); - listHolder_0->mList[3].node.Value() = 4ULL; - listHolder_0->mList[3].endpoint.Emplace(); - listHolder_0->mList[3].endpoint.Value() = 4U; - listHolder_0->mList[3].cluster.Emplace(); - listHolder_0->mList[3].cluster.Value() = 6UL; - listHolder_0->mList[3].fabricIndex = 0U; - - listHolder_0->mList[4].node.Emplace(); - listHolder_0->mList[4].node.Value() = 5ULL; - listHolder_0->mList[4].endpoint.Emplace(); - listHolder_0->mList[4].endpoint.Value() = 5U; - listHolder_0->mList[4].cluster.Emplace(); - listHolder_0->mList[4].cluster.Value() = 6UL; - listHolder_0->mList[4].fabricIndex = 0U; - - listHolder_0->mList[5].node.Emplace(); - listHolder_0->mList[5].node.Value() = 6ULL; - listHolder_0->mList[5].endpoint.Emplace(); - listHolder_0->mList[5].endpoint.Value() = 6U; - listHolder_0->mList[5].cluster.Emplace(); - listHolder_0->mList[5].cluster.Value() = 6UL; - listHolder_0->mList[5].fabricIndex = 0U; - - listHolder_0->mList[6].node.Emplace(); - listHolder_0->mList[6].node.Value() = 7ULL; - listHolder_0->mList[6].endpoint.Emplace(); - listHolder_0->mList[6].endpoint.Value() = 7U; - listHolder_0->mList[6].cluster.Emplace(); - listHolder_0->mList[6].cluster.Value() = 6UL; - listHolder_0->mList[6].fabricIndex = 0U; - - listHolder_0->mList[7].node.Emplace(); - listHolder_0->mList[7].node.Value() = 8ULL; - listHolder_0->mList[7].endpoint.Emplace(); - listHolder_0->mList[7].endpoint.Value() = 8U; - listHolder_0->mList[7].cluster.Emplace(); - listHolder_0->mList[7].cluster.Value() = 6UL; - listHolder_0->mList[7].fabricIndex = 0U; - - listHolder_0->mList[8].node.Emplace(); - listHolder_0->mList[8].node.Value() = 9ULL; - listHolder_0->mList[8].endpoint.Emplace(); - listHolder_0->mList[8].endpoint.Value() = 9U; - listHolder_0->mList[8].cluster.Emplace(); - listHolder_0->mList[8].cluster.Value() = 6UL; - listHolder_0->mList[8].fabricIndex = 0U; - - listHolder_0->mList[9].node.Emplace(); - listHolder_0->mList[9].node.Value() = 10ULL; - listHolder_0->mList[9].endpoint.Emplace(); - listHolder_0->mList[9].endpoint.Value() = 10U; - listHolder_0->mList[9].cluster.Emplace(); - listHolder_0->mList[9].cluster.Value() = 6UL; - listHolder_0->mList[9].fabricIndex = 0U; - - listHolder_0->mList[10].node.Emplace(); - listHolder_0->mList[10].node.Value() = 11ULL; - listHolder_0->mList[10].endpoint.Emplace(); - listHolder_0->mList[10].endpoint.Value() = 11U; - listHolder_0->mList[10].cluster.Emplace(); - listHolder_0->mList[10].cluster.Value() = 6UL; - listHolder_0->mList[10].fabricIndex = 0U; - - value = - chip::app::DataModel::List(listHolder_0->mList, 11); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Binding::Id, Binding::Attributes::Binding::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestUserLabelClusterSuite : public TestCommand -{ -public: - TestUserLabelClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestUserLabelCluster", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestUserLabelClusterSuite() {} - - 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::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("labelList[0].label", iter_0.GetValue().label, chip::CharSpan("room", 4))); - VerifyOrReturn( - CheckValueAsString("labelList[0].value", iter_0.GetValue().value, chip::CharSpan("bedroom 1", 9))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 1)); - VerifyOrReturn( - CheckValueAsString("labelList[1].label", iter_0.GetValue().label, chip::CharSpan("orientation", 11))); - VerifyOrReturn(CheckValueAsString("labelList[1].value", iter_0.GetValue().value, chip::CharSpan("South", 5))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 2)); - VerifyOrReturn(CheckValueAsString("labelList[2].label", iter_0.GetValue().label, chip::CharSpan("floor", 5))); - VerifyOrReturn(CheckValueAsString("labelList[2].value", iter_0.GetValue().value, chip::CharSpan("2", 1))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 3)); - VerifyOrReturn( - CheckValueAsString("labelList[3].label", iter_0.GetValue().label, chip::CharSpan("direction", 9))); - VerifyOrReturn(CheckValueAsString("labelList[3].value", iter_0.GetValue().value, chip::CharSpan("down", 4))); - VerifyOrReturn(CheckNoMoreListItems("labelList", iter_0, 4)); - } - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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("labelList", iter_0, 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)); - shouldContinue = true; - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("labelList[0].label", iter_0.GetValue().label, chip::CharSpan("room", 4))); - VerifyOrReturn( - CheckValueAsString("labelList[0].value", iter_0.GetValue().value, chip::CharSpan("bedroom 2", 9))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 1)); - VerifyOrReturn( - CheckValueAsString("labelList[1].label", iter_0.GetValue().label, chip::CharSpan("orientation", 11))); - VerifyOrReturn(CheckValueAsString("labelList[1].value", iter_0.GetValue().value, chip::CharSpan("North", 5))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 2)); - VerifyOrReturn(CheckValueAsString("labelList[2].label", iter_0.GetValue().label, chip::CharSpan("floor", 5))); - VerifyOrReturn(CheckValueAsString("labelList[2].value", iter_0.GetValue().value, chip::CharSpan("5", 1))); - VerifyOrReturn(CheckNextListItemDecodes("labelList", iter_0, 3)); - VerifyOrReturn( - CheckValueAsString("labelList[3].label", iter_0.GetValue().label, chip::CharSpan("direction", 9))); - VerifyOrReturn(CheckValueAsString("labelList[3].value", iter_0.GetValue().value, chip::CharSpan("up", 2))); - VerifyOrReturn(CheckNoMoreListItems("labelList", iter_0, 4)); - } - } - 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, "Commit User Label List"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = chip::Span("roomgarbage: not in length on purpose", 4); - listHolder_0->mList[0].value = chip::Span("bedroom 1garbage: not in length on purpose", 9); - - listHolder_0->mList[1].label = chip::Span("orientationgarbage: not in length on purpose", 11); - listHolder_0->mList[1].value = chip::Span("Southgarbage: not in length on purpose", 5); - - listHolder_0->mList[2].label = chip::Span("floorgarbage: not in length on purpose", 5); - listHolder_0->mList[2].value = chip::Span("2garbage: not in length on purpose", 1); - - listHolder_0->mList[3].label = chip::Span("directiongarbage: not in length on purpose", 9); - listHolder_0->mList[3].value = chip::Span("downgarbage: not in length on purpose", 4); - - value = - chip::app::DataModel::List(listHolder_0->mList, 4); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Verify committed User Label List"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Clear User Label List"); - ListFreer listFreer; - chip::app::DataModel::List value; - - value = chip::app::DataModel::List(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Read User Label List"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Write User Label List"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = chip::Span("roomgarbage: not in length on purpose", 4); - listHolder_0->mList[0].value = chip::Span("bedroom 2garbage: not in length on purpose", 9); - - listHolder_0->mList[1].label = chip::Span("orientationgarbage: not in length on purpose", 11); - listHolder_0->mList[1].value = chip::Span("Northgarbage: not in length on purpose", 5); - - listHolder_0->mList[2].label = chip::Span("floorgarbage: not in length on purpose", 5); - listHolder_0->mList[2].value = chip::Span("5garbage: not in length on purpose", 1); - - listHolder_0->mList[3].label = chip::Span("directiongarbage: not in length on purpose", 9); - listHolder_0->mList[3].value = chip::Span("upgarbage: not in length on purpose", 2); - - value = - chip::app::DataModel::List(listHolder_0->mList, 4); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Reboot target device"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "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 8: { - LogStep(8, "Verify User Label List after reboot"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestUserLabelClusterConstraintsSuite : public TestCommand -{ -public: - TestUserLabelClusterConstraintsSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestUserLabelClusterConstraints", 3, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestUserLabelClusterConstraintsSuite() {} - - 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), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - 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, "Attempt to write overly long item for label"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = - chip::Span("this is longer than sixteen charactersgarbage: not in length on purpose", 38); - listHolder_0->mList[0].value = chip::Span("bedroom 2garbage: not in length on purpose", 9); - - value = - chip::app::DataModel::List(listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Attempt to write overly long item for value"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].label = chip::Span("testgarbage: not in length on purpose", 4); - listHolder_0->mList[0].value = - chip::Span("this is longer than sixteen charactersgarbage: not in length on purpose", 38); - - value = - chip::app::DataModel::List(listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), UserLabel::Id, UserLabel::Attributes::LabelList::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestArmFailSafeSuite : public TestCommand -{ -public: - TestArmFailSafeSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestArmFailSafe", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestArmFailSafeSuite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - 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)); - shouldContinue = true; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValue("fabrics[0].nodeID", iter_0.GetValue().nodeID, - mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 0))); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILSAFE_REQUIRED)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILSAFE_REQUIRED)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILSAFE_REQUIRED)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILSAFE_REQUIRED)); - 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, "Reboot target device"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Wait for the alpha 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 2: { - LogStep(2, "Query fabrics list"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::Fabrics::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "ArmFailSafe on target device with timeout 0"); - ListFreer listFreer; - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; - value.expiryLengthSeconds = 0U; - value.breadcrumb = 0ULL; - return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, - GeneralCommissioning::Commands::ArmFailSafe::Id, value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Reads NodeLabel mandatory attribute of target device"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 5: { - LogStep(5, "Invoke AddTrustedRootCertificate without fail-safe"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::AddTrustedRootCertificate::Type value; - value.rootCACertificate = chip::ByteSpan(chip::Uint8::from_const_char("00000000garbage: not in length on purpose"), 8); - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::AddTrustedRootCertificate::Id, value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Invoke AddNOC without fail-safe"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::AddNOC::Type value; - value.NOCValue = chip::ByteSpan(chip::Uint8::from_const_char("00112233garbage: not in length on purpose"), 8); - value.IPKValue = chip::ByteSpan( - chip::Uint8::from_const_char( - "\000\001\002\003\004\005\006\007\000\001\002\003\004\005\006\007garbage: not in length on purpose"), - 16); - value.caseAdminSubject = 1234ULL; - value.adminVendorId = static_cast(65521); - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::AddNOC::Id, value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Invoke UpdateNOC without fail-safe"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::UpdateNOC::Type value; - value.NOCValue = chip::ByteSpan(chip::Uint8::from_const_char("00112233garbage: not in length on purpose"), 8); - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::UpdateNOC::Id, value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Invoke CSRRequest without fail-safe"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::CSRRequest::Type value; - value.CSRNonce = chip::ByteSpan( - chip::Uint8::from_const_char("\000\001\002\003\004\005\006\007\000\001\002\003\004\005\006\007\000\001\002\003\004" - "\005\006\007\000\001\002\003\004\005\006\007garbage: not in length on purpose"), - 32); - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::CSRRequest::Id, value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestFanControlSuite : public TestCommand -{ -public: - TestFanControlSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestFanControl", 25, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestFanControlSuite() {} - - 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::FanControl::FanModeEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("fanMode", value, 3U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::FanControl::FanModeSequenceEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("fanModeSequence", value, 5U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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(), 84U)); - } - break; - case 7: - 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(), 84U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("speedCurrent", value, 84U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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(CheckValueNonNull("percentSetting", value)); - VerifyOrReturn(CheckValue("percentSetting.Value()", value.Value(), 84U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - 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(), 73U)); - } - break; - case 13: - 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(), 73U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::Percent value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("percentCurrent", value, 73U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - 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(), 73U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - 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 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::Percent value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("percentCurrent", value, 0U)); - } - break; - case 20: - 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(), 0U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("speedCurrent", value, 0U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("percentSetting", value)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("speedSetting", value)); - } - 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, "Write fan mode"); - ListFreer listFreer; - chip::app::Clusters::FanControl::FanModeEnum 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, "Read back fan mode"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Write fan mode sequence"); - ListFreer listFreer; - chip::app::Clusters::FanControl::FanModeSequenceEnum value; - value = static_cast(5); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanModeSequence::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Read back fan mode sequence"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanModeSequence::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Write percent setting"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 84U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Read back percent setting"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Read back speed setting"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Read back speed current"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedCurrent::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Write percent setting"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 10: { - LogStep(10, "Read back percent setting"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Write speed setting"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 73U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 12: { - LogStep(12, "Read back speed setting"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Read back percent setting"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Read back percent current"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentCurrent::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Write speed setting"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 16: { - LogStep(16, "Read back speed setting"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Write fan mode"); - ListFreer listFreer; - chip::app::Clusters::FanControl::FanModeEnum value; - value = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 18: { - LogStep(18, "Read back percent setting"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Read back percent current"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentCurrent::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Read back speed setting"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "Read back speed current"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedCurrent::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Write fan mode"); - ListFreer listFreer; - chip::app::Clusters::FanControl::FanModeEnum value; - value = static_cast(5); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::FanMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 23: { - LogStep(23, "Read back percent setting"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::PercentSetting::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, "Read back speed setting"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FanControl::Id, FanControl::Attributes::SpeedSetting::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestAccessControlConstraintsSuite : public TestCommand -{ -public: - TestAccessControlConstraintsSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestAccessControlConstraints", 11, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestAccessControlConstraintsSuite() {} - - 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), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - 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, "Constraint error: PASE reserved for future (TC-ACL-2.4 step 29)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(1); - listHolder_0->mList[1].subjects.SetNonNull(); - - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Constraint error: Invalid combination administer + group (TC-ACL-2.4 step 31)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(5); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNonNull(); - - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 3: { - LogStep(3, "Constraint error: Invalid auth mode (TC-ACL-2.4 step 33)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(4); - listHolder_0->mList[1].subjects.SetNonNull(); - - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Constraint error: Invalid subject (TC-ACL-2.4 step 34)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 0ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Constraint error: Invalid target (TC-ACL-2.4 step 38)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNull(); - listHolder_3->mList[0].deviceType.SetNull(); - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Constraint error: target has both endpoint and device type (TC-ACL-2.4 step 42)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNonNull(); - - { - auto * listHolder_3 = - new ListHolder(1); - listFreer.add(listHolder_3); - - listHolder_3->mList[0].cluster.SetNull(); - listHolder_3->mList[0].endpoint.SetNonNull(); - listHolder_3->mList[0].endpoint.Value() = 22U; - listHolder_3->mList[0].deviceType.SetNonNull(); - listHolder_3->mList[0].deviceType.Value() = 33UL; - - listHolder_0->mList[1].targets.Value() = - chip::app::DataModel::List( - listHolder_3->mList, 1); - } - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "Constraint error: Invalid privilege value step 32)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(6); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 8: { - LogStep(8, "Constraint error: invalid subject 0xFFFF_FFFF_FFFF_FFFF (TC-ACL-2.4 step 35)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 18446744073709551615ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 9: { - LogStep(9, "Constraint error: invalid subject 0xFFFF_FFFD_0000_0000 (TC-ACL-2.4 step 36)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 18446744060824649728ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 10: { - LogStep(10, "Constraint error: invalid subject 0xFFFF_FFFF_FFFF_0000 (TC-ACL-2.4 step 37)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 112233ULL; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(2); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 18446744073709486080ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestLevelControlWithOnOffDependencySuite : public TestCommand -{ -public: - TestLevelControlWithOnOffDependencySuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestLevelControlWithOnOffDependency", 33, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestLevelControlWithOnOffDependencySuite() {} - - 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)); - 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("currentLevel", value)); - VerifyOrReturn(CheckValue("currentLevel.Value()", value.Value(), 1U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOffTransitionTime", value, 0U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("onLevel", value)); - VerifyOrReturn(CheckValue("onLevel.Value()", value.Value(), 254U)); - } - 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("minLevel", value, 1U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - 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::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("currentLevel", value)); - VerifyOrReturn(CheckValue("currentLevel.Value()", value.Value(), 254U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - 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; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - 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(), 1U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - 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(), 127U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("onLevel", value)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 28: - 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(), 127U)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - 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; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - 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(), 127U)); - } - 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, "Sends a MoveToLevel command to set CurrentLevel to min value"); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 1U; - value.transitionTime.SetNonNull(); - value.transitionTime.Value() = 0U; - value.optionsMask = static_cast>(1U); - value.optionsOverride = static_cast>(1U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Wait 100 ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Reads CurrentLevel attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Write OnOffTransitionTime attribute"); - ListFreer listFreer; - uint16_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::OnOffTransitionTime::Id, value, chip::NullOptional, chip::NullOptional); - } - case 5: { - LogStep(5, "Wait 100 ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Read OnOffTransitionTime attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, - LevelControl::Attributes::OnOffTransitionTime::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Write OnLevel attribute"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNonNull(); - value.Value() = 254U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 8: { - LogStep(8, "Wait 100 ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Read OnLevel attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Read MinValue attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::MinLevel::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Send On Command"); - 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 12: { - LogStep(12, "Check on/off attribute value is true after on command"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Wait OnOffTransitionTime"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "If OnLevel is defined, check CurrentLevel is OnLevel value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Send Off Command"); - 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 16: { - LogStep(16, "Check on/off attribute value is false after off command"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Wait OnOffTransitionTime"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 0UL; - return WaitForMs(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "If OnLevel is defined, check CurrentLevel is min value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Sends a MoveToLevel command to set CurrentLevel to a mid value"); - ListFreer listFreer; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type value; - value.level = 127U; - value.transitionTime.SetNonNull(); - value.transitionTime.Value() = 0U; - value.optionsMask = static_cast>(1U); - value.optionsOverride = static_cast>(1U); - return SendCommand(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Commands::MoveToLevel::Id, value, - chip::NullOptional - - ); - } - case 20: { - LogStep(20, "Wait 100 ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Reads CurrentLevel attribute from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Set OnLevel attribute to null"); - ListFreer listFreer; - chip::app::DataModel::Nullable value; - value.SetNull(); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 23: { - LogStep(23, "Wait 100 ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 24: { - LogStep(24, "Read OnLevel attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::OnLevel::Id, true, - chip::NullOptional); - } - case 25: { - LogStep(25, "Send On Command"); - 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 26: { - LogStep(26, "Check on/off attribute value is true after on command"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "Wait OnOffTransitionTime"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 28: { - LogStep(28, "If OnLevel is not defined, check CurrentLevel is restored"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - case 29: { - LogStep(29, "Send Off Command"); - 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 30: { - LogStep(30, "Check on/off attribute value is false after off command"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 31: { - LogStep(31, "Wait OnOffTransitionTime"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 0UL; - return WaitForMs(kIdentityAlpha, value); - } - case 32: { - LogStep(32, "If OnLevel is not defined, check CurrentLevel is restored"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), LevelControl::Id, LevelControl::Attributes::CurrentLevel::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestCommissioningWindowSuite : public TestCommand -{ -public: - TestCommissioningWindowSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestCommissioningWindow", 28, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("cluster", &mCluster); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestCommissioningWindowSuite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mNodeId2; - chip::Optional mEndpoint; - chip::Optional mCluster; - chip::Optional mDiscriminator; - chip::Optional mPayload; - chip::Optional mTimeout; - - uint8_t alphaIndex; - uint8_t betaIndex; - chip::app::DataModel::Nullable adminVendorId; - - 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))); - alphaIndex = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 0U)); - } - 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(CheckValueNull("adminFabricIndex", value)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("adminVendorId", value)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 2U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("adminFabricIndex", value)); - VerifyOrReturn(CheckValue("adminFabricIndex.Value()", value.Value(), alphaIndex)); - } - 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("value", value)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 0U)); - } - 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(CheckValueNull("adminFabricIndex", value)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("adminVendorId", value)); - } - 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)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 0U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("adminFabricIndex", value)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("adminVendorId", value)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - betaIndex = value; - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 2U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("adminFabricIndex", value)); - VerifyOrReturn(CheckValue("adminFabricIndex.Value()", value.Value(), betaIndex)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("value", value)); - adminVendorId = value; - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 2U)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("adminFabricIndex", value)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (adminVendorId.IsNull()) - { - VerifyOrReturn(CheckValueNull("adminVendorId", value)); - } - else - { - VerifyOrReturn(CheckValueNonNull("adminVendorId", value)); - VerifyOrReturn(CheckValue("adminVendorId.Value()", value.Value(), adminVendorId.Value())); - } - } - 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 for alpha"); - 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, "Get alpha's fabric index"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Check that commissioning window is not open"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Check that there is no AdminFabricIndex"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminFabricIndex::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Check that there is no AdminVendorId"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminVendorId::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Open Commissioning Window from alpha"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Check that commissioning window is open"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Check the AdminFabricIndex"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminFabricIndex::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Check the AdminVendorId is not null"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminVendorId::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Close Commissioning Window"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Check that commissioning window is again not open"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Check that again there is no AdminFabricIndex"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminFabricIndex::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Check that again there is no AdminVendorId"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminVendorId::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Open Commissioning Window from alpha again"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Commission from beta"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 15: { - LogStep(15, "Wait for the commissioned device to be retrieved for beta"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 16: { - LogStep(16, "Check that commissioning window is not open for the third time"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 17: { - LogStep(17, "Check that there is no AdminFabricIndex for the third time"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminFabricIndex::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Check that there is no AdminVendorId for the third time"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminVendorId::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Get beta's fabric index"); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Open Commissioning Window from beta"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityBeta, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Check that commissioning window is open again"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Check the AdminFabricIndex again"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminFabricIndex::Id, true, chip::NullOptional); - } - case 23: { - LogStep(23, "Check the AdminVendorId is not null again"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminVendorId::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Remove beta fabric"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = betaIndex; - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Check that commissioning window is still open"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 26: { - LogStep(26, "Check the AdminFabricIndex got reset"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminFabricIndex::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "Check the AdminVendorId did not get reset"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminVendorId::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestCommissionerNodeIdSuite : public TestCommand -{ -public: - TestCommissionerNodeIdSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestCommissionerNodeId", 22, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("cluster", &mCluster); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestCommissionerNodeIdSuite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mEndpoint; - chip::Optional mCluster; - chip::Optional mPayload; - chip::Optional mTimeout; - - uint8_t alphaIndex; - chip::NodeId commissionerNodeIdAlpha; - uint8_t betaIndex; - chip::NodeId commissionerNodeIdBeta; - uint8_t gammaIndex; - chip::NodeId commissionerNodeIdGamma; - - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - alphaIndex = value; - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - commissionerNodeIdAlpha = value.nodeId; - } - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - betaIndex = value; - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - commissionerNodeIdBeta = value.nodeId; - } - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - gammaIndex = value; - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeIdResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - commissionerNodeIdGamma = value.nodeId; - } - shouldContinue = true; - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), commissionerNodeIdAlpha)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, alphaIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), commissionerNodeIdBeta)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, betaIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), commissionerNodeIdGamma)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, gammaIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - 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)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), commissionerNodeIdBeta)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, betaIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::AccessControl::Structs::AccessControlEntryStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acl", iter_0, 0)); - VerifyOrReturn(CheckValue("acl[0].privilege", iter_0.GetValue().privilege, 5U)); - VerifyOrReturn(CheckValue("acl[0].authMode", iter_0.GetValue().authMode, 2U)); - VerifyOrReturn(CheckValueNonNull("acl[0].subjects", iter_0.GetValue().subjects)); - { - auto iter_3 = iter_0.GetValue().subjects.Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "acl[0].subjects.Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("acl[0].subjects.Value()[0]", iter_3.GetValue(), commissionerNodeIdGamma)); - VerifyOrReturn(CheckNoMoreListItems("acl[0].subjects.Value()", - iter_3, 1)); - } - VerifyOrReturn(CheckValueNull("acl[0].targets", iter_0.GetValue().targets)); - VerifyOrReturn(CheckValue("acl[0].fabricIndex", iter_0.GetValue().fabricIndex, gammaIndex)); - VerifyOrReturn(CheckNoMoreListItems("acl", iter_0, 1)); - } - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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 for alpha"); - 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, "Open Commissioning Window from alpha"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Commission from beta"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 3: { - LogStep(3, "Wait for the commissioned device to be retrieved for beta"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 4: { - LogStep(4, "Open Commissioning Window from alpha"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Commission from gamma"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityGamma, value); - } - case 6: { - LogStep(6, "Wait for the commissioned device to be retrieved for gamma"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityGamma, value); - } - case 7: { - LogStep(7, "Read the fabric ID from the alpha fabric"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Read the commissioner node ID from the alpha fabric"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Read the fabric ID from the beta fabric"); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Read the commissioner node ID from the beta fabric"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityBeta, value); - } - case 11: { - LogStep(11, "Read the fabric ID from the gamma fabric"); - return ReadAttribute(kIdentityGamma, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Read the commissioner node ID from the gamma fabric"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::GetCommissionerNodeId::Type value; - return GetCommissionerNodeId(kIdentityGamma, value); - } - case 13: { - LogStep(13, "Read the ACL from alpha and check commissioner node id"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Read the ACL from beta and check commissioner node id"); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Read the ACL from gamma and check commissioner node id"); - return ReadAttribute(kIdentityGamma, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Write the ACL using the commissioner node id value"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeIdBeta; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = betaIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 17: { - LogStep(17, "Write the ACL using the commissioner node id value"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = commissionerNodeIdGamma; - listHolder_0->mList[0].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = gammaIndex; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityGamma, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 18: { - LogStep(18, "Read the ACL from beta and check commissioner node id"); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Read the ACL from gamma and check commissioner node id"); - return ReadAttribute(kIdentityGamma, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Remove beta fabric"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = betaIndex; - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Remove gamma fabric"); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = gammaIndex; - return SendCommand(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestTimeSynchronizationSuite : public TestCommand -{ -public: - TestTimeSynchronizationSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestTimeSynchronization", 21, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestTimeSynchronizationSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("timeZone", iter_0, 0)); - VerifyOrReturn(CheckValue("timeZone[0].offset", iter_0.GetValue().offset, 0L)); - VerifyOrReturn(CheckValue("timeZone[0].validAt", iter_0.GetValue().validAt, 0ULL)); - VerifyOrReturn(CheckNoMoreListItems("timeZone", iter_0, 1)); - } - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::TimeSynchronization::Commands::SetTimeZoneResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("DSTOffsetRequired", value.DSTOffsetRequired, true)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("timeZone", iter_0, 0)); - VerifyOrReturn(CheckValue("timeZone[0].offset", iter_0.GetValue().offset, 100L)); - VerifyOrReturn(CheckValue("timeZone[0].validAt", iter_0.GetValue().validAt, 0ULL)); - VerifyOrReturn(CheckValuePresent("timeZone[0].name", iter_0.GetValue().name)); - VerifyOrReturn( - CheckValueAsString("timeZone[0].name.Value()", iter_0.GetValue().name.Value(), chip::CharSpan("CET", 3))); - VerifyOrReturn(CheckNoMoreListItems("timeZone", iter_0, 1)); - } - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::TimeSynchronization::Commands::SetTimeZoneResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("DSTOffsetRequired", value.DSTOffsetRequired, true)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("timeZone", iter_0, 0)); - VerifyOrReturn(CheckValue("timeZone[0].offset", iter_0.GetValue().offset, 100L)); - VerifyOrReturn(CheckValue("timeZone[0].validAt", iter_0.GetValue().validAt, 0ULL)); - VerifyOrReturn(CheckNoMoreListItems("timeZone", iter_0, 1)); - } - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::TimeSynchronization::Commands::SetTimeZoneResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("DSTOffsetRequired", value.DSTOffsetRequired, true)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("timeZone", iter_0, 0)); - VerifyOrReturn(CheckValue("timeZone[0].offset", iter_0.GetValue().offset, 0L)); - VerifyOrReturn(CheckValue("timeZone[0].validAt", iter_0.GetValue().validAt, 0ULL)); - VerifyOrReturn(CheckNoMoreListItems("timeZone", iter_0, 1)); - } - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::TimeSynchronization::Structs::DSTOffsetStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("DSTOffset", iter_0, 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), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::TimeSynchronization::Structs::DSTOffsetStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("DSTOffset", iter_0, 0)); - VerifyOrReturn(CheckValue("DSTOffset[0].offset", iter_0.GetValue().offset, 1L)); - VerifyOrReturn(CheckValue("DSTOffset[0].validStarting", iter_0.GetValue().validStarting, 1ULL)); - VerifyOrReturn(CheckValueNonNull("DSTOffset[0].validUntil", iter_0.GetValue().validUntil)); - VerifyOrReturn(CheckValue("DSTOffset[0].validUntil.Value()", iter_0.GetValue().validUntil.Value(), 2ULL)); - VerifyOrReturn(CheckNextListItemDecodes("DSTOffset", iter_0, 1)); - VerifyOrReturn(CheckValue("DSTOffset[1].offset", iter_0.GetValue().offset, 0L)); - VerifyOrReturn(CheckValue("DSTOffset[1].validStarting", iter_0.GetValue().validStarting, 3ULL)); - VerifyOrReturn(CheckValueNull("DSTOffset[1].validUntil", iter_0.GetValue().validUntil)); - VerifyOrReturn(CheckNoMoreListItems("DSTOffset", iter_0, 2)); - } - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED)); - 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 Time Zone"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::TimeZone::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Set Time Zone list"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Type value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 100L; - listHolder_0->mList[0].validAt = 0ULL; - listHolder_0->mList[0].name.Emplace(); - listHolder_0->mList[0].name.Value() = chip::Span("CETgarbage: not in length on purpose", 3); - - value.timeZone = - chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetTimeZone::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Read Time Zone"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::TimeZone::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Set Time Zone with missing optional name field"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Type value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 100L; - listHolder_0->mList[0].validAt = 0ULL; - - value.timeZone = - chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetTimeZone::Id, value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Read Time Zone"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::TimeZone::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Set Time Zone with very long name"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Type value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 100L; - listHolder_0->mList[0].validAt = 0ULL; - listHolder_0->mList[0].name.Emplace(); - listHolder_0->mList[0].name.Value() = chip::Span( - "MunichOnTheLongRiverOfIsarInNiceSummerWeatherWithAugustinerBeerssgarbage: not in length on purpose", 65); - - value.timeZone = - chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetTimeZone::Id, value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Set Time Zone with first item validAt not zero"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Type value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 100L; - listHolder_0->mList[0].validAt = 1ULL; - listHolder_0->mList[0].name.Emplace(); - listHolder_0->mList[0].name.Value() = chip::Span("CDTgarbage: not in length on purpose", 3); - - value.timeZone = - chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetTimeZone::Id, value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Set Time Zone with second item validAt zero"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Type value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 100L; - listHolder_0->mList[0].validAt = 0ULL; - listHolder_0->mList[0].name.Emplace(); - listHolder_0->mList[0].name.Value() = chip::Span("CSTgarbage: not in length on purpose", 3); - - listHolder_0->mList[1].offset = 200L; - listHolder_0->mList[1].validAt = 0ULL; - listHolder_0->mList[1].name.Emplace(); - listHolder_0->mList[1].name.Value() = chip::Span("CDTgarbage: not in length on purpose", 3); - - value.timeZone = - chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetTimeZone::Id, value, chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Set Time Zone with more than supported list count"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Type value; - - { - auto * listHolder_0 = new ListHolder(3); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 100L; - listHolder_0->mList[0].validAt = 0ULL; - listHolder_0->mList[0].name.Emplace(); - listHolder_0->mList[0].name.Value() = chip::Span("CSTgarbage: not in length on purpose", 3); - - listHolder_0->mList[1].offset = 200L; - listHolder_0->mList[1].validAt = 1ULL; - listHolder_0->mList[1].name.Emplace(); - listHolder_0->mList[1].name.Value() = chip::Span("CDTgarbage: not in length on purpose", 3); - - listHolder_0->mList[2].offset = 200L; - listHolder_0->mList[2].validAt = 2ULL; - listHolder_0->mList[2].name.Emplace(); - listHolder_0->mList[2].name.Value() = chip::Span("CETgarbage: not in length on purpose", 3); - - value.timeZone = - chip::app::DataModel::List( - listHolder_0->mList, 3); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetTimeZone::Id, value, chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Set Time Zone empty"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Type value; - - value.timeZone = chip::app::DataModel::List(); - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetTimeZone::Id, value, chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Read Time Zone"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::TimeZone::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Read DSTOffset"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::DSTOffset::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Set DSTOffset single item"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Type value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 1L; - listHolder_0->mList[0].validStarting = 1ULL; - listHolder_0->mList[0].validUntil.SetNonNull(); - listHolder_0->mList[0].validUntil.Value() = 2ULL; - - value.DSTOffset = - chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetDSTOffset::Id, value, chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Set DSTOffset empty"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Type value; - - value.DSTOffset = - chip::app::DataModel::List(); - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetDSTOffset::Id, value, chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Set DSTOffset with more than 1 null value"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Type value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 1L; - listHolder_0->mList[0].validStarting = 1ULL; - listHolder_0->mList[0].validUntil.SetNull(); - - listHolder_0->mList[1].offset = 0L; - listHolder_0->mList[1].validStarting = 2ULL; - listHolder_0->mList[1].validUntil.SetNull(); - - value.DSTOffset = - chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetDSTOffset::Id, value, chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Set unsorted DSTOffset entries"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Type value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 1L; - listHolder_0->mList[0].validStarting = 2ULL; - listHolder_0->mList[0].validUntil.SetNonNull(); - listHolder_0->mList[0].validUntil.Value() = 3ULL; - - listHolder_0->mList[1].offset = 0L; - listHolder_0->mList[1].validStarting = 1ULL; - listHolder_0->mList[1].validUntil.SetNull(); - - value.DSTOffset = - chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetDSTOffset::Id, value, chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Set DSTOffset with multiple entries"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Type value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 1L; - listHolder_0->mList[0].validStarting = 1ULL; - listHolder_0->mList[0].validUntil.SetNonNull(); - listHolder_0->mList[0].validUntil.Value() = 2ULL; - - listHolder_0->mList[1].offset = 0L; - listHolder_0->mList[1].validStarting = 3ULL; - listHolder_0->mList[1].validUntil.SetNull(); - - value.DSTOffset = - chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetDSTOffset::Id, value, chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Read DSTOffset"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Attributes::DSTOffset::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, "Set DSTOffset with same validStarting and validUntil"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Type value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 0L; - listHolder_0->mList[0].validStarting = 1ULL; - listHolder_0->mList[0].validUntil.SetNonNull(); - listHolder_0->mList[0].validUntil.Value() = 1ULL; - - value.DSTOffset = - chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetDSTOffset::Id, value, chip::NullOptional - - ); - } - case 20: { - LogStep(20, "Set DSTOffset with more than supported list count"); - ListFreer listFreer; - chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Type value; - - { - auto * listHolder_0 = new ListHolder(3); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].offset = 1L; - listHolder_0->mList[0].validStarting = 1ULL; - listHolder_0->mList[0].validUntil.SetNonNull(); - listHolder_0->mList[0].validUntil.Value() = 2ULL; - - listHolder_0->mList[1].offset = 0L; - listHolder_0->mList[1].validStarting = 3ULL; - listHolder_0->mList[1].validUntil.SetNonNull(); - listHolder_0->mList[1].validUntil.Value() = 5ULL; - - listHolder_0->mList[2].offset = 0L; - listHolder_0->mList[2].validStarting = 6ULL; - listHolder_0->mList[2].validUntil.SetNull(); - - value.DSTOffset = - chip::app::DataModel::List( - listHolder_0->mList, 3); - } - return SendCommand(kIdentityAlpha, GetEndpoint(0), TimeSynchronization::Id, - TimeSynchronization::Commands::SetDSTOffset::Id, value, chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestOperationalStateSuite : public TestCommand -{ -public: - TestOperationalStateSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestOperationalState", 15, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestOperationalStateSuite() {} - - 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)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("phaseList", 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(CheckValueNull("currentPhase", value)); - } - 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(CheckValueNull("countdownTime", value)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalState::Structs::OperationalStateStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 0)); - VerifyOrReturn( - CheckValue("operationalStateList[0].operationalStateID", iter_0.GetValue().operationalStateID, 0U)); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 1)); - VerifyOrReturn( - CheckValue("operationalStateList[1].operationalStateID", iter_0.GetValue().operationalStateID, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 2)); - VerifyOrReturn( - CheckValue("operationalStateList[2].operationalStateID", iter_0.GetValue().operationalStateID, 2U)); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 3)); - VerifyOrReturn( - CheckValue("operationalStateList[3].operationalStateID", iter_0.GetValue().operationalStateID, 3U)); - VerifyOrReturn(CheckNoMoreListItems("operationalStateList", iter_0, 4)); - } - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalState::Structs::ErrorStateStruct::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalError.errorStateID", value.errorStateID, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalState::OperationalStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalState", value, 0U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commandResponseState.errorStateID", value.commandResponseState.errorStateID, 0U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalState::OperationalStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalState", value, 1U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commandResponseState.errorStateID", value.commandResponseState.errorStateID, 0U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalState::OperationalStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalState", value, 2U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commandResponseState.errorStateID", value.commandResponseState.errorStateID, 0U)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalState::OperationalStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalState", value, 1U)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commandResponseState.errorStateID", value.commandResponseState.errorStateID, 0U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalState::OperationalStateEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalState", 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, "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 Phase List"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, OperationalState::Attributes::PhaseList::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read current Phase"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::CurrentPhase::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Read Countdown Time"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::CountdownTime::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Read Operational State List"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::OperationalStateList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Read current Operational Error"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::OperationalError::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Read current Operational State"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Start Command"); - ListFreer listFreer; - chip::app::Clusters::OperationalState::Commands::Start::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, OperationalState::Commands::Start::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Read current Operational State"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Pause Command"); - ListFreer listFreer; - chip::app::Clusters::OperationalState::Commands::Pause::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, OperationalState::Commands::Pause::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Read current Operational State"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Resume Command"); - ListFreer listFreer; - chip::app::Clusters::OperationalState::Commands::Resume::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, OperationalState::Commands::Resume::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Read current Operational State"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Stop Command"); - ListFreer listFreer; - chip::app::Clusters::OperationalState::Commands::Stop::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, OperationalState::Commands::Stop::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Read current Operational State"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OperationalState::Id, - OperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestRVCOperationalStateSuite : public TestCommand -{ -public: - TestRVCOperationalStateSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestRVCOperationalState", 15, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestRVCOperationalStateSuite() {} - - 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)); - { - chip::app::DataModel::Nullable> value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("phaseList", 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(CheckValueNull("currentPhase", value)); - } - 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(CheckValueNull("countdownTime", value)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::RvcOperationalState::Structs::OperationalStateStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 0)); - VerifyOrReturn( - CheckValue("operationalStateList[0].operationalStateID", iter_0.GetValue().operationalStateID, 0U)); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 1)); - VerifyOrReturn( - CheckValue("operationalStateList[1].operationalStateID", iter_0.GetValue().operationalStateID, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 2)); - VerifyOrReturn( - CheckValue("operationalStateList[2].operationalStateID", iter_0.GetValue().operationalStateID, 2U)); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 3)); - VerifyOrReturn( - CheckValue("operationalStateList[3].operationalStateID", iter_0.GetValue().operationalStateID, 3U)); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 4)); - VerifyOrReturn( - CheckValue("operationalStateList[4].operationalStateID", iter_0.GetValue().operationalStateID, 64U)); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 5)); - VerifyOrReturn( - CheckValue("operationalStateList[5].operationalStateID", iter_0.GetValue().operationalStateID, 65U)); - VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 6)); - VerifyOrReturn( - CheckValue("operationalStateList[6].operationalStateID", iter_0.GetValue().operationalStateID, 66U)); - VerifyOrReturn(CheckNoMoreListItems("operationalStateList", iter_0, 7)); - } - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::RvcOperationalState::Structs::ErrorStateStruct::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalError.errorStateID", value.errorStateID, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalState", value, 0U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalState", value, 0U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commandResponseState.errorStateID", value.commandResponseState.errorStateID, 3U)); - } - 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("operationalState", value, 0U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commandResponseState.errorStateID", value.commandResponseState.errorStateID, 3U)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalState", value, 0U)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("operationalState", 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, "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 Phase List"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::PhaseList::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read current Phase"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::CurrentPhase::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Read Countdown Time"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::CountdownTime::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Read Operational State List"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::OperationalStateList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Read current Operational Error"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::OperationalError::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Read current Operational State"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Start Command"); - ListFreer listFreer; - chip::app::Clusters::RvcOperationalState::Commands::Start::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, RvcOperationalState::Commands::Start::Id, - value, chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Read current Operational State"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Pause Command"); - ListFreer listFreer; - chip::app::Clusters::RvcOperationalState::Commands::Pause::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, RvcOperationalState::Commands::Pause::Id, - value, chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Read current Operational State"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Resume Command"); - ListFreer listFreer; - chip::app::Clusters::RvcOperationalState::Commands::Resume::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, RvcOperationalState::Commands::Resume::Id, - value, chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Read current Operational State"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Stop Command"); - ListFreer listFreer; - chip::app::Clusters::RvcOperationalState::Commands::Stop::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, RvcOperationalState::Commands::Stop::Id, - value, chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Read current Operational State"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, - RvcOperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestDishwasherAlarmSuite : public TestCommand -{ -public: - TestDishwasherAlarmSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestDishwasherAlarm", 22, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestDishwasherAlarmSuite() {} - - 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)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("supported", value, 47UL)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("mask", value, 47UL)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("latch", value, 3UL)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("state", value, 7UL)); - } - 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, 1UL)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("mask", value, 41UL)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("latch", value, 3UL)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("state", value, 1UL)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("mask", value, 41UL)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("latch", value, 3UL)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("state", value, 1UL)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("mask", value, 41UL)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("latch", value, 3UL)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("state", value, 1UL)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("mask", value, 41UL)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("latch", value, 3UL)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("state", value, 0UL)); - } - 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 Supported Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Supported::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Read Mask Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Mask::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Read Latch Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Latch::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Read State Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::State::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Read feature map Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::FeatureMap::Id, - true, chip::NullOptional); - } - case 6: { - LogStep(6, "Modify enabled alarms Command"); - ListFreer listFreer; - chip::app::Clusters::DishwasherAlarm::Commands::ModifyEnabledAlarms::Type value; - value.mask = static_cast>(41UL); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, - DishwasherAlarm::Commands::ModifyEnabledAlarms::Id, value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Read Mask Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Mask::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Read Latch Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Latch::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Read State Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::State::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Modify enabled alarms Command"); - ListFreer listFreer; - chip::app::Clusters::DishwasherAlarm::Commands::ModifyEnabledAlarms::Type value; - value.mask = static_cast>(105UL); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, - DishwasherAlarm::Commands::ModifyEnabledAlarms::Id, value, chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Read Mask Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Mask::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Read Latch Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Latch::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Read State Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::State::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Modify enabled alarms Command"); - ListFreer listFreer; - chip::app::Clusters::DishwasherAlarm::Commands::ModifyEnabledAlarms::Type value; - value.mask = static_cast>(59UL); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, - DishwasherAlarm::Commands::ModifyEnabledAlarms::Id, value, chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Read Mask Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Mask::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Read Latch Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Latch::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Read State Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::State::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Reset Command"); - ListFreer listFreer; - chip::app::Clusters::DishwasherAlarm::Commands::Reset::Type value; - value.alarms = static_cast>(1UL); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Commands::Reset::Id, value, - chip::NullOptional - - ); - } - case 19: { - LogStep(19, "Read Mask Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Mask::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Read Latch Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::Latch::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "Read State Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DishwasherAlarm::Id, DishwasherAlarm::Attributes::State::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestMultiAdminSuite : public TestCommand -{ -public: - TestMultiAdminSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestMultiAdmin", 18, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("nodeIdForDuplicateCommissioning", 0, UINT64_MAX, &mNodeIdForDuplicateCommissioning); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("nodeId3", 0, UINT64_MAX, &mNodeId3); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestMultiAdminSuite() - { - if (readFromAlphaBuffer != nullptr) - { - chip::Platform::MemoryFree(readFromAlphaBuffer); - readFromAlphaBuffer = nullptr; - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mNodeIdForDuplicateCommissioning; - chip::Optional mNodeId2; - chip::Optional mNodeId3; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mPayload; - chip::Optional mTimeout; - - char * readFromAlphaBuffer = nullptr; - chip::CharSpan readFromAlpha; - - 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)); - shouldContinue = true; - 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), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValue("fabrics[0].nodeID", iter_0.GetValue().nodeID, - mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); - } - } - 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)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 0))); - if (readFromAlphaBuffer != nullptr) - { - chip::Platform::MemoryFree(readFromAlphaBuffer); - } - readFromAlphaBuffer = static_cast(chip::Platform::MemoryAlloc(value.size())); - memcpy(readFromAlphaBuffer, value.data(), value.size()); - readFromAlpha = chip::CharSpan(readFromAlphaBuffer, value.size()); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, readFromAlpha)); - } - break; - case 17: - 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, "Stop target device"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Stop::Type value; - return Stop(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Start target device with the provided discriminator for basic commissioning advertisement"); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Start::Type value; - value.discriminator.Emplace(); - value.discriminator.Value() = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - return Start(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Wait for the commissioned device to be retrieved for alpha"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Commission from alpha when the commissioning window is not opened"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeIdForDuplicateCommissioning.HasValue() ? mNodeIdForDuplicateCommissioning.Value() : 17ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Open Commissioning Window from alpha"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Commission from alpha again"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeIdForDuplicateCommissioning.HasValue() ? mNodeIdForDuplicateCommissioning.Value() : 17ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Check that we just have the one fabric and did not add a new one"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::Fabrics::Id, false, chip::NullOptional); - } - case 7: { - LogStep(7, "Close Commissioning Window after failed commissioning"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Open Commissioning Window from alpha again"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Commission from beta"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 10: { - LogStep(10, "Wait for the commissioned device to be retrieved for beta"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 11: { - LogStep(11, "Open Commissioning Window from beta"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityBeta, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Commission from gamma"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityGamma, value); - } - case 13: { - LogStep(13, "Wait for the commissioned device to be retrieved for gamma"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL; - return WaitForCommissionee(kIdentityGamma, value); - } - case 14: { - LogStep(14, "read the mandatory attribute: NodeLabel from alpha"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "write the mandatory attribute NodeLabel from beta"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("written from betagarbage: not in length on purpose", 17); - return WriteAttribute(kIdentityBeta, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 16: { - LogStep(16, "read the mandatory attribute: NodeLabel from gamma"); - return ReadAttribute(kIdentityGamma, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "write the mandatory attribute NodeLabel back to default"); - ListFreer listFreer; - chip::CharSpan value; - value = readFromAlpha; - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DGSW_1_1Suite : public TestCommand -{ -public: - Test_TC_DGSW_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGSW_1_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_DGSW_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)); - { - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - 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 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 0UL)); - } - break; - case 7: - 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)); - } - break; - case 8: - 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, 2UL)); - } - break; - case 9: - 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, 3UL)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - 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, 0UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - } - break; - case 15: - 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")); - } - 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)); - shouldContinue = true; - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads the FeatureMap from DUT"); - VerifyOrDo(!ShouldSkip(" !DGSW.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given DGSW.S.F00(Watermarks) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DGSW.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4b: TH reads optional attribute(ThreadMetrics) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGSW.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4c: TH reads optional attribute(CurrentHeapFree) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGSW.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4d: TH reads optional attribute(CurrentHeapUsed) in AttributeList"); - VerifyOrDo(!ShouldSkip("DGSW.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4e: TH reads Feature dependent attribute(CurrentHeapHighWatermark) in AttributeList"); - VerifyOrDo(!ShouldSkip("( DGSW.S.F00 || DGSW.S.A0003 )"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 4f: 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)"); - 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 11: { - LogStep(11, "Step 5a: TH reads EventList from DUT"); - VerifyOrDo(!ShouldSkip("DGSW.S.E00 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 5b: TH reads EventList from DUT"); - VerifyOrDo(!ShouldSkip(" !DGSW.S.E00 && PICS_EVENT_LIST_ENABLED "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::EventList::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, - "Step 5c: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 14: { - LogStep(14, "Step 6a: TH reads AcceptedCommandList from DUT"); - VerifyOrDo(!ShouldSkip("DGSW.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 6b: TH reads AcceptedCommandList from DUT"); - VerifyOrDo(!ShouldSkip(" !DGSW.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), SoftwareDiagnostics::Id, - SoftwareDiagnostics::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, - "Step 6c: 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)"); - 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 17: { - LogStep(17, - "Step 7: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestSubscribe_OnOffSuite : public TestCommand -{ -public: - TestSubscribe_OnOffSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestSubscribe_OnOff", 7, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestSubscribe_OnOffSuite() {} - - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, false)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, true)); - } - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, false)); - } - shouldContinue = true; - 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, "Set OnOff Attribute to false"); - 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 2: { - LogStep(2, "Subscribe OnOff Attribute"); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, 2, 5, true, - chip::NullOptional, chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 3: { - LogStep(3, "Turn On the light to see attribute change"); - 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 4: { - LogStep(4, "Check for attribute report"); - return WaitForReport(); - } - case 5: { - LogStep(5, "Turn Off the light to see attribute change"); - 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, "Check for attribute report"); - return WaitForReport(); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestSubscribe_AdministratorCommissioningSuite : public TestCommand -{ -public: - TestSubscribe_AdministratorCommissioningSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestSubscribe_AdministratorCommissioning", 17, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("ourVendorId", 0, UINT16_MAX, &mOurVendorId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestSubscribe_AdministratorCommissioningSuite() {} - - 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 mOurVendorId; - chip::Optional mTimeout; - - uint8_t ourFabricIndex; - - 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))); - ourFabricIndex = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 0U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 2U)); - } - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 0U)); - } - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("adminVendorId", value)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("adminVendorId", value)); - VerifyOrReturn( - CheckValue("adminVendorId.Value()", value.Value(), mOurVendorId.HasValue() ? mOurVendorId.Value() : 65521U)); - } - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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(CheckValueNull("adminVendorId", value)); - } - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("adminFabricIndex", value)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("adminFabricIndex", value)); - VerifyOrReturn(CheckValue("adminFabricIndex.Value()", value.Value(), ourFabricIndex)); - } - shouldContinue = true; - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("adminFabricIndex", value)); - } - shouldContinue = true; - 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, "Get ourfabric index"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Subscribe WindowStatus Attribute"); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, 2, 50, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 3: { - LogStep(3, "Open the commissioning window 1"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Check for first attribute report for WindowStatus"); - return WaitForReport(); - } - case 5: { - LogStep(5, "Close the commissioning window 1"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Check for second attribute report for WindowStatus"); - return WaitForReport(); - } - case 7: { - LogStep(7, "Subscribe AdminVendorId Attribute"); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminVendorId::Id, 2, 50, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 8: { - LogStep(8, "Open the commissioning window 2"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Check for first attribute report for AdminVendorId"); - return WaitForReport(); - } - case 10: { - LogStep(10, "Close the commissioning window 2"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Check for second attribute report for AdminVendorId"); - return WaitForReport(); - } - case 12: { - LogStep(12, "Subscribe AdminFabricIndex Attribute"); - return SubscribeAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::AdminFabricIndex::Id, 2, 50, true, chip::NullOptional, - chip::NullOptional, /* autoResubscribe = */ chip::NullOptional); - } - case 13: { - LogStep(13, "Open the commissioning window 3"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Check for first attribute report for AdminFabricIndex"); - return WaitForReport(); - } - case 15: { - LogStep(15, "Close the commissioning window 2"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Check for second attribute report for AdminFabricIndex"); - return WaitForReport(); - } - } - return CHIP_NO_ERROR; - } -}; - -class DL_UsersAndCredentialsSuite : public TestCommand -{ -public: - DL_UsersAndCredentialsSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("DL_UsersAndCredentials", 128, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~DL_UsersAndCredentialsSuite() {} - - 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; - - uint16_t NumberOfTotalUsersSupported; - uint16_t NumberOfPINUsersSupported; - uint16_t NumberOfRFIDUsersSupported; - - 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)); - { - chip::app::Clusters::DoorLock::Commands::GetUserResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("numberOfTotalUsersSupported", value, 10U)); - NumberOfTotalUsersSupported = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - 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("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - 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("new_user", 8))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - 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("new_user", 8))); - VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 305441741UL)); - 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 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - 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("new_user", 8))); - VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 305441741UL)); - VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 3U)); - 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 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - 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("new_user", 8))); - VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 305441741UL)); - VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 3U)); - VerifyOrReturn(CheckValueNonNull("userType", value.userType)); - VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 6U)); - 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 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - 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("new_user", 8))); - VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 305441741UL)); - VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 3U)); - VerifyOrReturn(CheckValueNonNull("userType", value.userType)); - VerifyOrReturn(CheckValue("userType.Value()", value.userType.Value(), 6U)); - VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 2U)); - 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 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - 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("test_user", 9))); - VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 466460832UL)); - 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(), 1U)); - 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 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - 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, 2U)); - VerifyOrReturn(CheckValueNonNull("userName", value.userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("test_user2", 10))); - VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 12648430UL)); - 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(), 1U)); - VerifyOrReturn(CheckValueNonNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValue("credentialRule.Value()", value.credentialRule.Value(), 2U)); - 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 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 23: - 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, 3U)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 25: - 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, 3U)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 27: - 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, 3U)); - VerifyOrReturn(CheckValueNonNull("userName", value.userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("test_user3", 10))); - VerifyOrReturn(CheckValueNonNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValue("userUniqueID.Value()", value.userUniqueID.Value(), 47802UL)); - VerifyOrReturn(CheckValueNonNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValue("userStatus.Value()", value.userStatus.Value(), 3U)); - 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 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - 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, NumberOfTotalUsersSupported)); - VerifyOrReturn(CheckValueNonNull("userName", value.userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("last_user", 9))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 33: - 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(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); - } - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 35: - 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("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 39: - 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, 2U)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 40: - 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, NumberOfTotalUsersSupported)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("numberOfPINUsersSupported", value, 10U)); - NumberOfPINUsersSupported = value; - } - break; - case 42: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 43: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 44: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 45: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 46: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 47: - 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(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 48: - 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("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 1U)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 1)); - } - 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 49: - 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 50: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 51: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("numberOfRFIDUsersSupported", value, 10U)); - NumberOfRFIDUsersSupported = value; - } - break; - case 53: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 54: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 55: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 56: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 57: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 58: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 59: - 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 60: - 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("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 1U)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 1)); - VerifyOrReturn(CheckValue("credentials.Value()[1].credentialType", iter_1.GetValue().credentialType, 2U)); - VerifyOrReturn(CheckValue("credentials.Value()[1].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 2)); - } - 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 61: - 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 62: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 63: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 64: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 65: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 66: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 67: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 68: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 69: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 70: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 71: - 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, 2U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); - } - break; - case 72: - 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, 2U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 73: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 74: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 75: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 76: - 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 77: - 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(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 2U)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 78: - 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, 2U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); - } - break; - case 79: - 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(), 3U)); - } - break; - case 80: - 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("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 1U)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 1)); - VerifyOrReturn(CheckValue("credentials.Value()[1].credentialType", iter_1.GetValue().credentialType, 2U)); - VerifyOrReturn(CheckValue("credentials.Value()[1].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 2)); - VerifyOrReturn(CheckValue("credentials.Value()[2].credentialType", iter_1.GetValue().credentialType, 2U)); - VerifyOrReturn(CheckValue("credentials.Value()[2].credentialIndex", iter_1.GetValue().credentialIndex, 2U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 3)); - } - 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(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); - } - break; - case 81: - 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(), 4U)); - } - break; - case 82: - 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("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 1U)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 1)); - VerifyOrReturn(CheckValue("credentials.Value()[1].credentialType", iter_1.GetValue().credentialType, 2U)); - VerifyOrReturn(CheckValue("credentials.Value()[1].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 2)); - VerifyOrReturn(CheckValue("credentials.Value()[2].credentialType", iter_1.GetValue().credentialType, 2U)); - VerifyOrReturn(CheckValue("credentials.Value()[2].credentialIndex", iter_1.GetValue().credentialIndex, 2U)); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 3)); - VerifyOrReturn(CheckValue("credentials.Value()[3].credentialType", iter_1.GetValue().credentialType, 1U)); - VerifyOrReturn(CheckValue("credentials.Value()[3].credentialIndex", iter_1.GetValue().credentialIndex, 3U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 4)); - } - 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(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); - } - break; - case 83: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 84: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 85: - 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("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 2U)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 1)); - VerifyOrReturn(CheckValue("credentials.Value()[1].credentialType", iter_1.GetValue().credentialType, 2U)); - VerifyOrReturn(CheckValue("credentials.Value()[1].credentialIndex", iter_1.GetValue().credentialIndex, 2U)); - VerifyOrReturn(CheckNextListItemDecodes("credentials.Value()", iter_1, 2)); - VerifyOrReturn(CheckValue("credentials.Value()[2].credentialType", iter_1.GetValue().credentialType, 1U)); - VerifyOrReturn(CheckValue("credentials.Value()[2].credentialIndex", iter_1.GetValue().credentialIndex, 3U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 3)); - } - 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(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); - } - break; - case 86: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 87: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 88: - 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, 2U)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 89: - 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(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 2U)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); - } - break; - case 90: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 91: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 92: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 93: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 94: - 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("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 1U)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 3U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 1)); - } - 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 95: - 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, 2U)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 96: - 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(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 2U)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 97: - 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(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 3U)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 3U)); - } - break; - case 98: - 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(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 4U)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 7U)); - } - break; - case 99: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 100: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 101: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 102: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 103: - 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(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 104: - 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, 2U)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 105: - 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, 3U)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 106: - 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, 4U)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 107: - 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, 133U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 108: - 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(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 109: - 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("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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(CheckNextListItemDecodes("credentials.Value()", iter_1, 0)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialType", iter_1.GetValue().credentialType, 0U)); - VerifyOrReturn(CheckValue("credentials.Value()[0].credentialIndex", iter_1.GetValue().credentialIndex, 0U)); - VerifyOrReturn(CheckNoMoreListItems("credentials.Value()", iter_1, 1)); - } - 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 110: - 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 111: - 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(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 112: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 113: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 114: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 115: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 116: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 117: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 118: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 119: - 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(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - break; - case 120: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 121: - 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(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 122: - 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(), 3U)); - } - break; - case 123: - 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(), 4U)); - } - break; - case 124: - 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(), 5U)); - } - break; - case 125: - 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(), 6U)); - } - break; - case 126: - 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, 137U)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 7U)); - } - break; - case 127: - 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, "Read available user slot and verify response 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 2: { - LogStep(2, "Get number of supported users and verify default value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::NumberOfTotalUsersSupported::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Read fails for user with index 0"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Read fails for user with index greater than Number Of Users Supported"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "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.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 6: { - LogStep(6, "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 7: { - LogStep(7, "Set user at the occupied index fails with appropriate response"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 1U; - value.userName.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Modify userName for existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(2); - value.userIndex = 1U; - value.userName.SetNonNull(); - value.userName.Value() = chip::Span("new_usergarbage: not in length on purpose", 8); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Read the modified 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 10: { - LogStep(10, "Modify userUniqueId for existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(2); - value.userIndex = 1U; - value.userName.SetNull(); - value.userUniqueID.SetNonNull(); - value.userUniqueID.Value() = 305441741UL; - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Read the modified 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 12: { - LogStep(12, "Modify userStatus for existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(2); - value.userIndex = 1U; - value.userName.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(3); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Read the modified 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 14: { - LogStep(14, "Modify userType for existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(2); - value.userIndex = 1U; - value.userName.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNonNull(); - value.userType.Value() = static_cast(6); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Read the modified 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 16: { - LogStep(16, "Modify credentialRule for existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(2); - value.userIndex = 1U; - value.userName.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNonNull(); - value.credentialRule.Value() = static_cast(2); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Read the modified 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 18: { - LogStep(18, "Modify all fields for existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(2); - value.userIndex = 1U; - value.userName.SetNonNull(); - value.userName.Value() = chip::Span("test_usergarbage: not in length on purpose", 9); - value.userUniqueID.SetNonNull(); - value.userUniqueID.Value() = 466460832UL; - 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(1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 19: { - LogStep(19, "Read the modified 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 20: { - LogStep(20, "Add another user with non-default fields"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 2U; - value.userName.SetNonNull(); - value.userName.Value() = chip::Span("test_user2garbage: not in length on purpose", 10); - value.userUniqueID.SetNonNull(); - value.userUniqueID.Value() = 12648430UL; - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(1); - value.userType.SetNonNull(); - value.userType.Value() = static_cast(1); - value.credentialRule.SetNonNull(); - value.credentialRule.Value() = static_cast(2); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Read the new user back and verify its fields"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Try to add a user with userStatus 0"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 3U; - value.userName.SetNonNull(); - value.userName.Value() = chip::Span("test_user3garbage: not in length on purpose", 10); - value.userUniqueID.SetNonNull(); - value.userUniqueID.Value() = 47802UL; - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(0); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 23: { - LogStep(23, "Make sure the user did not get created"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 3U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Try to add a user with userStatus 2"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 3U; - value.userName.SetNonNull(); - value.userName.Value() = chip::Span("test_user3garbage: not in length on purpose", 10); - value.userUniqueID.SetNonNull(); - value.userUniqueID.Value() = 47802UL; - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(2); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Make sure the user did not get created"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 3U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Try to add a user with userStatus 3"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 3U; - value.userName.SetNonNull(); - value.userName.Value() = chip::Span("test_user3garbage: not in length on purpose", 10); - value.userUniqueID.SetNonNull(); - value.userUniqueID.Value() = 47802UL; - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(3); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 27: { - LogStep(27, "Read the new third user back and verify its fields"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 3U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 28: { - LogStep(28, "Create user in the last slot"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = NumberOfTotalUsersSupported; - value.userName.SetNonNull(); - value.userName.Value() = chip::Span("last_usergarbage: not in length on purpose", 9); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 29: { - LogStep(29, "Read the last user back and verify its fields"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = NumberOfTotalUsersSupported; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 30: { - LogStep(30, "User creation in the 0 slot fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 0U; - value.userName.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 31: { - LogStep(31, "User creation in the out-of-bounds slot fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - value.userName.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 32: { - LogStep(32, "Clear first 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(10000), chip::NullOptional - - ); - } - case 33: { - LogStep(33, "Read cleared user and verify it is available"); - 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 34: { - LogStep(34, "Create new user in the cleared slot"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 1U; - value.userName.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 35: { - LogStep(35, "Read the user in the previously cleared slot 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 36: { - LogStep(36, "Clear user with index 0 fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 37: { - LogStep(37, "Clear user with out-of-bounds index fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 38: { - LogStep(38, "Clear all users"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = 65534U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 39: { - LogStep(39, "Read first cleared user and verify it is available"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 40: { - LogStep(40, "Read last cleared user and verify it is available"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = NumberOfTotalUsersSupported; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 41: { - LogStep(41, "Get number of supported PIN credentials and verify default value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::NumberOfPINUsersSupported::Id, - true, chip::NullOptional); - } - case 42: { - LogStep(42, "Check that PIN credential does not exist"); - 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 43: { - LogStep(43, "Reading PIN credential with index 0 returns no credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 0U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 44: { - LogStep(44, "Reading PIN credential with out-of-bounds index returns no credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = static_cast(NumberOfPINUsersSupported + 1); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 45: { - LogStep(45, "Verify that a user with UserStatus = 0 cannot be added via SetCredential"); - 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 = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(0); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 46: { - LogStep(46, "Verify that a user with UserStatus = 2 cannot be added via SetCredential"); - 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 = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(2); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 47: { - LogStep(47, "Create new PIN credential and user"); - 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 = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 48: { - LogStep(48, "Verify created user"); - 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 49: { - LogStep(49, "Verify created PIN credential"); - 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 50: { - LogStep(50, "Create new PIN credential and user with index 0 fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 0U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 51: { - LogStep(51, "Create new PIN credential and user with out-of-bounds index fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = static_cast(NumberOfPINUsersSupported + 1); - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 52: { - LogStep(52, "Get number of supported RFID credentials and verify default value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::NumberOfRFIDUsersSupported::Id, - true, chip::NullOptional); - } - case 53: { - LogStep(53, "Reading RFID credential with index 0 returns no credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 0U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 54: { - LogStep(54, "Reading RFID credential with out-of-bounds index returns no credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = static_cast(NumberOfRFIDUsersSupported + 1); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 55: { - LogStep(55, "Check that RFID credential does not exist"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 2U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 56: { - LogStep(56, "Create new RFID credential and add it to existing user with non-null UserStatus should fail"); - 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 = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_123456garbage: not in length on purpose"), 16); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 1U; - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(1); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 57: { - LogStep(57, "Create new RFID credential and add it to existing user with non-null UserType should fail"); - 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 = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_123456garbage: not in length on purpose"), 16); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 1U; - value.userStatus.SetNull(); - value.userType.SetNonNull(); - value.userType.Value() = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 58: { - LogStep(58, "Create new RFID credential and add it to existing user with non-null UserType and UserStatus should fail"); - 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 = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_123456garbage: not in length on purpose"), 16); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 1U; - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(1); - value.userType.SetNonNull(); - value.userType.Value() = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 59: { - LogStep(59, "Create new RFID credential and add it to existing user"); - 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 = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_123456garbage: not in length on purpose"), 16); - 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 60: { - LogStep(60, "Verify modified user"); - 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 61: { - LogStep(61, "Verify created credential"); - 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 62: { - LogStep(62, "Create new RFID credential and user with index 0 fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 0U; - - value.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("new_rfid_data_fieldgarbage: not in length on purpose"), 19); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 63: { - LogStep(63, "Create new RFID credential and user with out-of-bounds index fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = static_cast(NumberOfRFIDUsersSupported + 1); - - value.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("new_rfid_data_fieldgarbage: not in length on purpose"), 19); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 64: { - LogStep(64, "Create new credential and try to add it to 0 user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 2U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123465garbage: not in length on purpose"), 6); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 0U; - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 65: { - LogStep(65, "Create new credential and try to add it to out-of-bounds user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 2U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123465garbage: not in length on purpose"), 6); - value.userIndex.SetNonNull(); - value.userIndex.Value() = static_cast(NumberOfTotalUsersSupported + 1); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 66: { - LogStep(66, "Create new PIN with too short data"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 2U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("12345garbage: not in length on purpose"), 5); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 0U; - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 67: { - LogStep(67, "Create new PIN with too long data"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 2U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456789garbage: not in length on purpose"), 9); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 0U; - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 68: { - LogStep(68, "Create new RFID with too short data"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 2U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("rfid_datagarbage: not in length on purpose"), 9); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 0U; - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 69: { - LogStep(69, "Create new PIN with Programming user type fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 2U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 0U; - value.userStatus.SetNull(); - value.userType.SetNonNull(); - value.userType.Value() = static_cast(3); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 70: { - LogStep(70, "Create new RFID with too short data"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 2U; - - value.credentialData = chip::ByteSpan( - chip::Uint8::from_const_char("very_long_rfid_data_to_test_boundariesgarbage: not in length on purpose"), 38); - value.userIndex.SetNonNull(); - value.userIndex.Value() = 0U; - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 71: { - LogStep(71, "Create new PIN credential with data the would cause duplicate"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 3U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 72: { - LogStep(72, "Create new RFID credential with data the would cause duplicate"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 2U; - - value.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_123456garbage: not in length on purpose"), 16); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 73: { - LogStep(73, "Modify credentialData of existing PIN credential with non-null UserStatus should fail"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(2); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - 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.SetNonNull(); - value.userStatus.Value() = static_cast(1); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 74: { - LogStep(74, "Modify credentialData of existing PIN credential with non-null UserType should fail"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(2); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - 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.SetNonNull(); - value.userType.Value() = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 75: { - LogStep(75, "Modify credentialData of existing PIN credential with non-null UserStatus and UserType should fail"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(2); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - 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.SetNonNull(); - value.userStatus.Value() = static_cast(1); - value.userType.SetNonNull(); - value.userType.Value() = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 76: { - LogStep(76, "Modify credentialData of existing PIN credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(2); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 1U; - - 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 - - ); - } - case 77: { - LogStep(77, "Verify that credential was changed by creating new credential with old data"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 2U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 78: { - LogStep(78, "Verify that credential was changed by creating new credential with new data"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 3U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 79: { - LogStep(79, "Create new RFID credential and add it to existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 2U; - - value.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_7890garbage: not in length on purpose"), 14); - 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 80: { - LogStep(80, "Verify modified user"); - 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 81: { - LogStep(81, "Create new RFID credential and add it to existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 3U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("789012garbage: 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 - - ); - } - case 82: { - LogStep(82, "Verify modified user"); - 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 83: { - LogStep(83, "Clear first PIN credential"); - 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 84: { - LogStep(84, "Read back the credential and make sure it is deleted"); - 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 85: { - LogStep(85, "Read the user back and make sure PIN credential is deleted"); - 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 86: { - LogStep(86, "Clear the second PIN credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(1); - value.credential.Value().credentialIndex = 2U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 87: { - LogStep(87, "Read back the credential and make sure it is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 2U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 88: { - LogStep(88, "Read the user back and make sure related user is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 89: { - LogStep(89, "Create new RFID credential with user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 3U; - - value.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_12345garbage: not in length on purpose"), 15); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 90: { - LogStep(90, "Clear all the RFID credentials"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(2); - value.credential.Value().credentialIndex = 65534U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 91: { - LogStep(91, "Read back the fist RFID credential and make sure it is deleted"); - 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 92: { - LogStep(92, "Read back the second RFID credential and make sure it is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 2U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 93: { - LogStep(93, "Read back the third RFID credential and make sure it is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 3U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 94: { - LogStep(94, "Read the user related with first RFID back and make sure it has only PIN credential"); - 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 95: { - LogStep(95, "Read the user related with second RFID back and make sure it is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 96: { - LogStep(96, "Create new PIN credential with user"); - 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 = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 97: { - LogStep(97, "Create new RFID credential with user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 2U; - - value.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_1234garbage: not in length on purpose"), 14); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 98: { - LogStep(98, "Create another RFID credential with user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 6U; - - value.credentialData = - chip::ByteSpan(chip::Uint8::from_const_char("rfid_data_9876garbage: not in length on purpose"), 14); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 99: { - LogStep(99, "Clear all the credentials"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 100: { - LogStep(100, "Read back the first PIN credential and make sure it is deleted"); - 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 101: { - LogStep(101, "Read back the first RFID credential and make sure it is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(2); - value.credential.credentialIndex = 2U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 102: { - LogStep(102, "Read back the second PIN credential and make sure it is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 6U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 103: { - LogStep(103, "Read the user related with first PIN back and make sure it is deleted"); - 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 104: { - LogStep(104, "Read the user related with first RFID back and make sure it is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 105: { - LogStep(105, "Read the user related with second PIN back and make sure it is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 3U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 106: { - LogStep(106, "Read the user related with last RFID back and make sure it is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 4U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 107: { - LogStep(107, "Create new Programming PIN credential with invalid index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(0); - value.credential.credentialIndex = 1U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 108: { - LogStep(108, "Create new Programming PIN credential with valid index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(0); - value.credential.credentialIndex = 0U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 109: { - LogStep(109, "Verify created user"); - 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 110: { - LogStep(110, "Verify created programming PIN credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(0); - value.credential.credentialIndex = 0U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 111: { - LogStep(111, "Modify the Programming PIN credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(2); - - value.credential.credentialType = static_cast(0); - value.credential.credentialIndex = 0U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("654321garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 112: { - LogStep(112, "Clearing Programming PIN fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(0); - value.credential.Value().credentialIndex = 0U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 113: { - LogStep(113, "Clearing Programming PIN with invalid index fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(0); - value.credential.Value().credentialIndex = 1U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 114: { - LogStep(114, "Clearing PIN credential with zero index fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(1); - value.credential.Value().credentialIndex = 0U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 115: { - LogStep(115, "Clearing PIN credential with out-of-bound index fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(1); - value.credential.Value().credentialIndex = static_cast(NumberOfPINUsersSupported + 1); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 116: { - LogStep(116, "Clearing RFID credential with zero index fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(2); - value.credential.Value().credentialIndex = 0U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 117: { - LogStep(117, "Clearing RFID credential with out-of-bound index fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearCredential::Type value; - value.credential.SetNonNull(); - - value.credential.Value().credentialType = static_cast(2); - value.credential.Value().credentialIndex = static_cast(NumberOfRFIDUsersSupported + 1); - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 118: { - LogStep(118, "Clear the Programming PIN 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(10000), chip::NullOptional - - ); - } - case 119: { - LogStep(119, "Make sure Programming PIN user is deleted"); - 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 120: { - LogStep(120, "Make sure programming PIN credential is deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type value; - - value.credential.credentialType = static_cast(0); - value.credential.credentialIndex = 0U; - - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetCredentialStatus::Id, value, - chip::NullOptional - - ); - } - case 121: { - LogStep(121, "Create new PIN credential and user"); - 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 = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 122: { - LogStep(122, "Create second PIN credential and add it to existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 2U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000001garbage: 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 - - ); - } - case 123: { - LogStep(123, "Create third PIN credential and add it to existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 3U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000002garbage: 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 - - ); - } - case 124: { - LogStep(124, "Create fourth PIN credential and add it to existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 4U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000003garbage: 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 - - ); - } - case 125: { - LogStep(125, "Create fifth PIN credential and add it to existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 5U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000004garbage: 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 - - ); - } - case 126: { - LogStep(126, "Try to create sixth PIN credential and make sure it fails"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 6U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("000005garbage: 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 - - ); - } - case 127: { - LogStep(127, "Final clean-up"); - 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(10000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class DL_LockUnlockSuite : public TestCommand -{ -public: - DL_LockUnlockSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("DL_LockUnlock", 58, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~DL_LockUnlockSuite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(25)); } - -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::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNonNull("lockState", value)); - VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - 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 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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("lockState", value)); - VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 2U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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("lockState", value)); - VerifyOrReturn(CheckValue("lockState.Value()", value.Value(), 1U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - 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(), 3U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 13: - 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 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Events::LockOperation::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lockOperation.lockOperationType", value.lockOperationType, 4U)); - VerifyOrReturn(CheckValue("lockOperation.operationSource", value.operationSource, 7U)); - VerifyOrReturn(CheckValueNull("lockOperation.userIndex", value.userIndex)); - VerifyOrReturn(CheckValuePresent("lockOperation.credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("lockOperation.credentials.Value()", value.credentials.Value())); - } - mTestSubStepIndex++; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Events::LockOperation::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lockOperation.lockOperationType", value.lockOperationType, 1U)); - VerifyOrReturn(CheckValue("lockOperation.operationSource", value.operationSource, 7U)); - VerifyOrReturn(CheckValueNull("lockOperation.userIndex", value.userIndex)); - VerifyOrReturn(CheckValuePresent("lockOperation.credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("lockOperation.credentials.Value()", value.credentials.Value())); - } - mTestSubStepIndex++; - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Events::LockOperation::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lockOperation.lockOperationType", value.lockOperationType, 0U)); - VerifyOrReturn(CheckValue("lockOperation.operationSource", value.operationSource, 7U)); - VerifyOrReturn(CheckValueNull("lockOperation.userIndex", value.userIndex)); - VerifyOrReturn(CheckValuePresent("lockOperation.credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("lockOperation.credentials.Value()", value.credentials.Value())); - } - mTestSubStepIndex++; - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Events::LockOperation::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lockOperation.lockOperationType", value.lockOperationType, 1U)); - VerifyOrReturn(CheckValue("lockOperation.operationSource", value.operationSource, 7U)); - VerifyOrReturn(CheckValueNull("lockOperation.userIndex", value.userIndex)); - VerifyOrReturn(CheckValuePresent("lockOperation.credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("lockOperation.credentials.Value()", value.credentials.Value())); - } - mTestSubStepIndex++; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Events::LockOperation::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lockOperation.lockOperationType", value.lockOperationType, 0U)); - VerifyOrReturn(CheckValue("lockOperation.operationSource", value.operationSource, 7U)); - VerifyOrReturn(CheckValueNull("lockOperation.userIndex", value.userIndex)); - VerifyOrReturn(CheckValuePresent("lockOperation.credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("lockOperation.credentials.Value()", value.credentials.Value())); - } - mTestSubStepIndex++; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Events::LockOperation::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lockOperation.lockOperationType", value.lockOperationType, 4U)); - VerifyOrReturn(CheckValue("lockOperation.operationSource", value.operationSource, 7U)); - VerifyOrReturn(CheckValueNonNull("lockOperation.userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("lockOperation.userIndex.Value()", value.userIndex.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("lockOperation.credentials", value.credentials)); - VerifyOrReturn(CheckValueNonNull("lockOperation.credentials.Value()", value.credentials.Value())); - { - auto iter_3 = value.credentials.Value().Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "lockOperation.credentials.Value().Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("lockOperation.credentials.Value().Value()[0].credentialType", - iter_3.GetValue().credentialType, 1U)); - VerifyOrReturn(CheckValue("lockOperation.credentials.Value().Value()[0].credentialIndex", - iter_3.GetValue().credentialIndex, 2U)); - VerifyOrReturn(CheckNoMoreListItems( - "lockOperation.credentials.Value().Value()", iter_3, 1)); - } - } - mTestSubStepIndex++; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Events::LockOperation::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lockOperation.lockOperationType", value.lockOperationType, 1U)); - VerifyOrReturn(CheckValue("lockOperation.operationSource", value.operationSource, 7U)); - VerifyOrReturn(CheckValueNonNull("lockOperation.userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("lockOperation.userIndex.Value()", value.userIndex.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("lockOperation.credentials", value.credentials)); - VerifyOrReturn(CheckValueNonNull("lockOperation.credentials.Value()", value.credentials.Value())); - { - auto iter_3 = value.credentials.Value().Value().begin(); - VerifyOrReturn(CheckNextListItemDecodes( - "lockOperation.credentials.Value().Value()", iter_3, 0)); - VerifyOrReturn(CheckValue("lockOperation.credentials.Value().Value()[0].credentialType", - iter_3.GetValue().credentialType, 1U)); - VerifyOrReturn(CheckValue("lockOperation.credentials.Value().Value()[0].credentialIndex", - iter_3.GetValue().credentialIndex, 2U)); - VerifyOrReturn(CheckNoMoreListItems( - "lockOperation.credentials.Value().Value()", iter_3, 1)); - } - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 16: - 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(), 2U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 18: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Events::LockOperationError::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lockOperationError.lockOperationType", value.lockOperationType, 1U)); - VerifyOrReturn(CheckValue("lockOperationError.operationSource", value.operationSource, 7U)); - VerifyOrReturn(CheckValue("lockOperationError.operationError", value.operationError, 1U)); - VerifyOrReturn(CheckValueNull("lockOperationError.userIndex", value.userIndex)); - VerifyOrReturn(CheckValuePresent("lockOperationError.credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("lockOperationError.credentials.Value()", value.credentials.Value())); - } - mTestSubStepIndex++; - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Events::LockOperationError::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("lockOperationError.lockOperationType", value.lockOperationType, 0U)); - VerifyOrReturn(CheckValue("lockOperationError.operationSource", value.operationSource, 7U)); - VerifyOrReturn(CheckValue("lockOperationError.operationError", value.operationError, 1U)); - VerifyOrReturn(CheckValueNull("lockOperationError.userIndex", value.userIndex)); - VerifyOrReturn(CheckValuePresent("lockOperationError.credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("lockOperationError.credentials.Value()", value.credentials.Value())); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 19: - 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(), 2U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 21: - 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 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - 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(), 2U)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 31: - 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 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 35: - 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(), 2U)); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 37: - 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 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("userCodeTemporaryDisableTime", value, 10U)); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 43: - switch (mTestSubStepIndex) - { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Events::DoorLockAlarm::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("doorLockAlarm.alarmCode", value.alarmCode, 4U)); - } - mTestSubStepIndex++; - break; - default: - LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); - break; - } - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 46: - 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(), 2U)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 48: - 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(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 2U)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 4U)); - } - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 50: - 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 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 52: - 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(), 2U)); - } - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 54: - 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(), 2U)); - } - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 56: - 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 57: - 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, "Try to unlock the door without PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Verify that lock state attribute value is set to Unlocked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Try to lock the door without a PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Verify that lock state attribute value is set to Locked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Try to unbolt the door without PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnboltDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Verify that lock state attribute value is set to Unlocked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Try to lock the door without a PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Verify that lock state attribute value is set to Locked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Create new lock/unlock user"); - 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 10: { - LogStep(10, "Create new PIN credential and associate it with lock/unlock user, with userIndex != credentialIndex"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 2U; - - 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 - - ); - } - case 11: { - LogStep(11, "Set the WrongCodeEntryLimit to big value so that we can test incorrect PIN entry"); - ListFreer listFreer; - uint8_t value; - value = 20U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 12: { - LogStep(12, "Try to unlock the door with invalid PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Verify that lock state attribute value is set to Locked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Try to unlock the door with valid PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::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::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Read the LockOperation event list"); - mTestSubStepCount = 7; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Events::LockOperation::Id, false, - chip::NullOptional); - } - case 16: { - LogStep(16, "Verify that lock state attribute value is set to Unlocked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Try to lock the door with invalid PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Read the LockOperationError event list; verify null UserIndex and Credentials"); - mTestSubStepCount = 2; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Events::LockOperationError::Id, false, - chip::NullOptional); - } - case 19: { - LogStep(19, "Verify that lock state attribute value is set to Unlocked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Try to lock the door with valid PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::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::LockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Verify that lock state attribute value is set to Locked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Set OperatingMode to NoRemoteLockUnlock"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::OperatingModeEnum value; - value = static_cast(3); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::OperatingMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 23: { - LogStep(23, "Try to unlock the door when OperatingMode is NoRemoteLockUnlock"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Set OperatingMode to Normal"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::OperatingModeEnum value; - value = static_cast(0); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::OperatingMode::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 25: { - LogStep(25, "Set the WrongCodeEntryLimit to small value so we can test lockout"); - ListFreer listFreer; - uint8_t value; - value = 3U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::WrongCodeEntryLimit::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 26: { - LogStep(26, "Try to unlock the door with invalid PIN for the first time"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 27: { - LogStep(27, "Try to unlock the door with invalid PIN for the second time"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 28: { - LogStep(28, "Try to unlock the door with valid PIN for the third time"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::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::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 29: { - LogStep(29, "Verify that lock state attribute value is set to Unlocked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 30: { - LogStep(30, "Lock the door back prior to next tests"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::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::LockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 31: { - LogStep(31, "Verify that lock state attribute value is set to Locked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Try to unlock the door with invalid PIN for the first time"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 33: { - LogStep(33, "Try to unlock the door with invalid PIN for the second time"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 34: { - LogStep(34, "Try to unlock the door with valid PIN for the third time"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::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::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 35: { - LogStep(35, "Verify that lock state attribute value is set to Unlocked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 36: { - LogStep(36, "Lock the door back prior to next tests"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::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::LockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 37: { - LogStep(37, "Verify that lock state attribute value is set to Locked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 38: { - LogStep(38, "Read the lockout timeout"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, true, chip::NullOptional); - } - case 39: { - LogStep(39, "Try to unlock the door with invalid PIN for the first time"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 40: { - LogStep(40, "Try to unlock the door with invalid PIN for the second time"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 41: { - LogStep(41, "Try to unlock the door with invalid PIN for the third time"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("000000garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 42: { - LogStep(42, "Try to unlock the door with valid PIN and make sure it fails due to lockout"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::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::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 43: { - LogStep(43, "Read the DoorLockAlarm event list; verify WrongEntryCodeLimit alarm has been generated"); - mTestSubStepCount = 1; - return ReadEvent(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Events::DoorLockAlarm::Id, false, - chip::NullOptional); - } - case 44: { - LogStep(44, "Wait for the lockout to end"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 45: { - LogStep(45, "Try to unlock the door with valid PIN and make sure it succeeds"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::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::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 46: { - LogStep(46, "Verify that lock state attribute value is set to Unlocked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 47: { - LogStep(47, "Lock the door back prior to next tests"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::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::LockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 48: { - LogStep(48, "Create a disabled user and credential"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetCredential::Type value; - value.operationType = static_cast(0); - - value.credential.credentialType = static_cast(1); - value.credential.credentialIndex = 3U; - - value.credentialData = chip::ByteSpan(chip::Uint8::from_const_char("654321garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNonNull(); - value.userStatus.Value() = static_cast(3); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 49: { - LogStep(49, "Try to unlock the door with disabled user PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("654321garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 50: { - LogStep(50, "Verify that lock state attribute value is set to Locked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 51: { - LogStep(51, "Unlock the door with enabled user PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockDoor::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::UnlockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 52: { - LogStep(52, "Verify that lock state attribute value is set to Unlocked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 53: { - LogStep(53, "Try to lock the door with disabled user PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::Type value; - value.PINCode.Emplace(); - value.PINCode.Value() = chip::ByteSpan(chip::Uint8::from_const_char("654321garbage: not in length on purpose"), 6); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::LockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 54: { - LogStep(54, "Verify that lock state attribute value stays Unlocked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 55: { - LogStep(55, "Lock the door with enabled user PIN"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::LockDoor::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::LockDoor::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 56: { - LogStep(56, "Verify that lock state attribute value is set to Locked"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 57: { - LogStep(57, "Clean all the users and credentials"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = 65534U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class DL_SchedulesSuite : public TestCommand -{ -public: - DL_SchedulesSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("DL_Schedules", 127, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~DL_SchedulesSuite() {} - - 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; - - uint16_t NumberOfTotalUsersSupported; - uint8_t NumberOfWeekDaySchedulesSupportedPerUser; - uint8_t NumberOfYearDaySchedulesSupportedPerUser; - uint8_t NumberOfHolidaySchedulesSupported; - - 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)); - { - chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("numberOfTotalUsersSupported", value, 10U)); - NumberOfTotalUsersSupported = value; - } - 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("numberOfWeekDaySchedulesSupportedPerUser", value, 10U)); - NumberOfWeekDaySchedulesSupportedPerUser = value; - } - 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("numberOfYearDaySchedulesSupportedPerUser", value, 10U)); - NumberOfYearDaySchedulesSupportedPerUser = value; - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("numberOfHolidaySchedulesSupported", value, 10U)); - NumberOfHolidaySchedulesSupported = value; - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - 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), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 0U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, - static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1))); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 0U)); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, static_cast(NumberOfTotalUsersSupported + 1))); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - VerifyOrReturn(CheckValue("status", value.status, 1U)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 0U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, - static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1))); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 0U)); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, static_cast(NumberOfTotalUsersSupported + 1))); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - VerifyOrReturn(CheckValue("status", value.status, 1U)); - } - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 0U)); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn( - CheckValue("holidayIndex", value.holidayIndex, static_cast(NumberOfHolidaySchedulesSupported + 1))); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 0U)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 15U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 16U)); - VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 18U)); - VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 0U)); - } - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - } - break; - case 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 15U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 16U)); - VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 18U)); - VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 0U)); - } - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - } - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 0U)); - } - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 60: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 61: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 62: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 63: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 64: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 15U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 16U)); - VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 18U)); - VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 0U)); - } - break; - case 65: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - } - break; - case 66: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 0U)); - } - break; - case 67: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 68: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 69: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 15U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 16U)); - VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 18U)); - VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 0U)); - } - break; - case 70: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - } - break; - case 71: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 0U)); - } - break; - case 72: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 73: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 2U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 2U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 23U)); - VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 59U)); - } - break; - case 74: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 75: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 2U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 9000UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 888888888UL)); - } - break; - case 76: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 77: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 2U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 123456UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 1234567UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 1U)); - } - break; - case 78: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 79: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 80: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 81: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 2U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 82: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - } - break; - case 83: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 2U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 9000UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 888888888UL)); - } - break; - case 84: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 0U)); - } - break; - case 85: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 2U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 123456UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 1234567UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 1U)); - } - break; - case 86: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 87: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 88: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 89: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 90: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 2U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 91: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 2U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 23U)); - VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 59U)); - } - break; - case 92: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 93: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 94: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 95: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 23U)); - VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 59U)); - } - break; - case 96: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 97: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 4U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 9000UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 888888888UL)); - } - break; - case 98: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 99: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 4U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 64U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 23U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 23U)); - VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 59U)); - } - break; - case 100: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 101: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 55555UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 7777777UL)); - } - break; - case 102: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 103: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 1U)); - } - break; - case 104: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 4U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 1U)); - } - break; - case 105: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 4U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - VerifyOrReturn(CheckValue("status", value.status, 1U)); - } - break; - case 106: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); - VerifyOrReturn(CheckValue("status", value.status, 1U)); - } - break; - case 107: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 0U)); - } - break; - case 108: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 2U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 123456UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 1234567UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 1U)); - } - break; - case 109: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 110: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, NumberOfHolidaySchedulesSupported)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 1UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 100UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 4U)); - } - break; - case 111: - 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(CheckValueNonNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValue("userIndex.Value()", value.userIndex.Value(), 1U)); - VerifyOrReturn(CheckValueNonNull("nextCredentialIndex", value.nextCredentialIndex)); - VerifyOrReturn(CheckValue("nextCredentialIndex.Value()", value.nextCredentialIndex.Value(), 2U)); - } - break; - case 112: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 113: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 114: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 115: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 12345UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 12345689UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 0U)); - } - break; - case 116: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 2U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 117: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, NumberOfHolidaySchedulesSupported)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 1UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 100UL)); - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 4U)); - } - break; - case 118: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 23U)); - VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 59U)); - } - break; - case 119: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 9000UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 888888888UL)); - } - break; - case 120: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 121: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 122: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 2U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 123: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, NumberOfHolidaySchedulesSupported)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 124: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 1U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 0U)); - VerifyOrReturn(CheckValuePresent("endHour", value.endHour)); - VerifyOrReturn(CheckValue("endHour.Value()", value.endHour.Value(), 23U)); - VerifyOrReturn(CheckValuePresent("endMinute", value.endMinute)); - VerifyOrReturn(CheckValue("endMinute.Value()", value.endMinute.Value(), 59U)); - } - break; - case 125: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 9000UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 888888888UL)); - } - break; - case 126: - 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 PIN credential and schedule user"); - 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 = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Get number of supported users"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::NumberOfTotalUsersSupported::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Get Max number of Week Day schedules for user and verify default value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Get Max number of Year Day schedules for user and verify default value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Get Max number of Holiday schedules and verify default value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::NumberOfHolidaySchedulesSupported::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Create Week Day schedule with 0 index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 0U; - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Create Week Day schedule with out-of-bounds index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Create Week Day schedule with 0 user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 0U; - value.daysMask = static_cast>(1U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Create Week Day schedule with out-of-bounds user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - value.daysMask = static_cast>(1U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Create Week Day schedule for non-existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 2U; - value.daysMask = static_cast>(1U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Create Week Day schedule with 0 days mask"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(0U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Create Week Day schedule for Sunday and Monday"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(3U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Create Week Day schedule for Sunday Wednesday and Saturday"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(73U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Create Week Day schedule with invalid start hour"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 24U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Create Week Day schedule with invalid start minute"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 15U; - value.startMinute = 60U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Create Week Day schedule with invalid end hour"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 24U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Create Week Day schedule with invalid end minute"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 60U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Create Week Day schedule with start hour later that end hour"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 19U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 19: { - LogStep(19, "Create Week Day schedule with start minute later that end minute when hours are equal"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 15U; - value.startMinute = 50U; - value.endHour = 15U; - value.endMinute = 49U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 20: { - LogStep(20, "Make sure that previous operations did not create a schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Get Week Day schedule with 0 index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 0U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Get Week Day schedule with out-of-bounds index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 23: { - LogStep(23, "Get Week Day schedule with 0 user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Get Week Day schedule with out-of-bounds user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Get Week Day schedule with non-existing user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Create Year Day schedule with 0 index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 0U; - value.userIndex = 1U; - value.localStartTime = 12345UL; - value.localEndTime = 12345689UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 27: { - LogStep(27, "Create Year Day schedule with out-of-bounds index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); - value.userIndex = 1U; - value.localStartTime = 12345UL; - value.localEndTime = 12345689UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 28: { - LogStep(28, "Create Year Day schedule with 0 user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 0U; - value.localStartTime = 12345UL; - value.localEndTime = 12345689UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 29: { - LogStep(29, "Create Year Day schedule with out-of-bounds user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - value.localStartTime = 12345UL; - value.localEndTime = 12345689UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 30: { - LogStep(30, "Create Year Day schedule for non-existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 2U; - value.localStartTime = 12345UL; - value.localEndTime = 12345689UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 31: { - LogStep(31, "Create Year Day schedule with start hour later that end hour"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - value.localStartTime = 12345689UL; - value.localEndTime = 12345688UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 32: { - LogStep(32, "Make sure that previous operations did not create a schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 33: { - LogStep(33, "Get Year Day schedule with 0 index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 0U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 34: { - LogStep(34, "Get Year Day schedule with out-of-bounds index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 35: { - LogStep(35, "Get Year Day schedule with 0 user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 36: { - LogStep(36, "Get Year Day schedule with out-of-bounds user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 37: { - LogStep(37, "Get Year Day schedule with non-existing user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 38: { - LogStep(38, "Create Holiday schedule with 0 index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type value; - value.holidayIndex = 0U; - value.localStartTime = 12345UL; - value.localEndTime = 12345689UL; - value.operatingMode = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 39: { - LogStep(39, "Create Holiday schedule with out-of-bounds index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type value; - value.holidayIndex = static_cast(NumberOfHolidaySchedulesSupported + 1); - value.localStartTime = 12345UL; - value.localEndTime = 12345689UL; - value.operatingMode = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 40: { - LogStep(40, "Create Holiday schedule with start hour later that end hour"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type value; - value.holidayIndex = 1U; - value.localStartTime = 12345689UL; - value.localEndTime = 12345688UL; - value.operatingMode = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 41: { - LogStep(41, "Create Holiday schedule with invalid operating mode"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type value; - value.holidayIndex = 1U; - value.localStartTime = 12345UL; - value.localEndTime = 12345689UL; - value.operatingMode = static_cast(5); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 42: { - LogStep(42, "Make sure that previous operations did not create a schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 43: { - LogStep(43, "Get Holiday schedule with 0 index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 44: { - LogStep(44, "Get Holiday schedule with out-of-bounds index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = static_cast(NumberOfHolidaySchedulesSupported + 1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 45: { - LogStep(45, "Create Holiday schedule with valid parameters"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type value; - value.holidayIndex = 1U; - value.localStartTime = 12345UL; - value.localEndTime = 12345689UL; - value.operatingMode = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 46: { - LogStep(46, "Verify created schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 47: { - LogStep(47, "Create Week Day schedule with valid parameters"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 15U; - value.startMinute = 16U; - value.endHour = 18U; - value.endMinute = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 48: { - LogStep(48, "Verify created schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 49: { - LogStep(49, "Create Year Day schedule with valid parameters"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - value.localStartTime = 12345UL; - value.localEndTime = 12345689UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 50: { - LogStep(50, "Verify created schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 51: { - LogStep(51, "Clear Week Day schedule with 0 index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; - value.weekDayIndex = 0U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 52: { - LogStep(52, "Clear Week Day schedule with out-of-bounds index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; - value.weekDayIndex = static_cast(NumberOfWeekDaySchedulesSupportedPerUser + 1); - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 53: { - LogStep(53, "Clear Week Day schedule with 0 user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 54: { - LogStep(54, "Clear Week Day schedule with out-of-bounds user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 55: { - LogStep(55, "Clear Week Day schedule with non-existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 56: { - LogStep(56, "Make sure that week day schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 57: { - LogStep(57, "Make sure that year day schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 58: { - LogStep(58, "Make sure that holiday schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 59: { - LogStep(59, "Clear Year Day schedule with 0 index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; - value.yearDayIndex = 0U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 60: { - LogStep(60, "Clear Year Day schedule with out-of-bounds index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; - value.yearDayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 61: { - LogStep(61, "Clear Year Day schedule with 0 user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 62: { - LogStep(62, "Clear Year Day schedule with out-of-bounds user index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = static_cast(NumberOfTotalUsersSupported + 1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 63: { - LogStep(63, "Clear Year Day schedule with non-existing user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 64: { - LogStep(64, "Make sure that week day schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 65: { - LogStep(65, "Make sure that year day schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 66: { - LogStep(66, "Make sure that holiday schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 67: { - LogStep(67, "Clear Holiday schedule with 0 index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Type value; - value.holidayIndex = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 68: { - LogStep(68, "Clear Holiday schedule with out-of-bounds index"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Type value; - value.holidayIndex = static_cast(NumberOfYearDaySchedulesSupportedPerUser + 1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 69: { - LogStep(69, "Make sure that week day schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 70: { - LogStep(70, "Make sure that year day schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 71: { - LogStep(71, "Make sure that holiday schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 72: { - LogStep(72, "Create another Week Day schedule with valid parameters"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 2U; - value.userIndex = 1U; - value.daysMask = static_cast>(2U); - value.startHour = 0U; - value.startMinute = 0U; - value.endHour = 23U; - value.endMinute = 59U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 73: { - LogStep(73, "Verify created week day schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 2U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 74: { - LogStep(74, "Create another Year Day schedule with valid parameters"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 2U; - value.userIndex = 1U; - value.localStartTime = 9000UL; - value.localEndTime = 888888888UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 75: { - LogStep(75, "Verify created year day schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 2U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 76: { - LogStep(76, "Create another Holiday schedule with valid parameters"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type value; - value.holidayIndex = 2U; - value.localStartTime = 123456UL; - value.localEndTime = 1234567UL; - value.operatingMode = static_cast(1); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 77: { - LogStep(77, "Verify created holiday schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 78: { - LogStep(78, "Clear a single week day schedule for the first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 79: { - LogStep(79, "Verify cleared week day schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 80: { - LogStep(80, "Clear all remaining week day schedules for the first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; - value.weekDayIndex = 254U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 81: { - LogStep(81, "Verify cleared week schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 2U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 82: { - LogStep(82, "Make sure that first year day schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 83: { - LogStep(83, "Make sure that second year day schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 2U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 84: { - LogStep(84, "Make sure that first holiday schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 85: { - LogStep(85, "Make sure that second holiday schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 86: { - LogStep(86, "Create another Week Day schedule with valid parameters"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(2U); - value.startHour = 0U; - value.startMinute = 0U; - value.endHour = 23U; - value.endMinute = 59U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 87: { - LogStep(87, "Clear a single year day schedule for the first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 88: { - LogStep(88, "Verify cleared year day schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 89: { - LogStep(89, "Clear all remaining year schedules for the first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; - value.yearDayIndex = 254U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 90: { - LogStep(90, "Verify that second year day schedule was cleared"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 2U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 91: { - LogStep(91, "Verify created week day schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 92: { - LogStep(92, "Clear all remaining week day schedules for the first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; - value.weekDayIndex = 254U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 93: { - LogStep(93, "Create new user without credential so we can add more schedules to it"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 2U; - value.userName.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 94: { - LogStep(94, "Create Week Day schedule with valid parameters for first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 0U; - value.startMinute = 0U; - value.endHour = 23U; - value.endMinute = 59U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 95: { - LogStep(95, "Verify created week day schedule for first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 96: { - LogStep(96, "Create Year Day schedule for first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 4U; - value.userIndex = 1U; - value.localStartTime = 9000UL; - value.localEndTime = 888888888UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 97: { - LogStep(97, "Verify created year day schedule for first"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 4U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 98: { - LogStep(98, "Create Week Day schedule with valid parameters for second user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 4U; - value.userIndex = 2U; - value.daysMask = static_cast>(64U); - value.startHour = 23U; - value.startMinute = 0U; - value.endHour = 23U; - value.endMinute = 59U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 99: { - LogStep(99, "Verify created week day schedule for first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 4U; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 100: { - LogStep(100, "Create Year Day schedule for second user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - value.localStartTime = 55555UL; - value.localEndTime = 7777777UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 101: { - LogStep(101, "Verify created year day schedule for first"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 102: { - LogStep(102, "Cleanup the user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = 65534U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 103: { - LogStep(103, "Make sure clearing first user also cleared week day schedules"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 104: { - LogStep(104, "Make sure clearing first user also cleared year day schedules"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 4U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 105: { - LogStep(105, "Make sure clearing second user also cleared week day schedules"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 4U; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 106: { - LogStep(106, "Make sure clearing second user also cleared year day schedules"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 107: { - LogStep(107, "Make sure that first holiday schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 108: { - LogStep(108, "Make sure that second holiday schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 109: { - LogStep(109, "Create another Holiday schedule at the last slot"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type value; - value.holidayIndex = NumberOfHolidaySchedulesSupported; - value.localStartTime = 1UL; - value.localEndTime = 100UL; - value.operatingMode = static_cast(4); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 110: { - LogStep(110, "Verify Created Holiday Schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = NumberOfHolidaySchedulesSupported; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 111: { - LogStep(111, "Create new PIN credential and schedule user"); - 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 = chip::ByteSpan(chip::Uint8::from_const_char("123456garbage: not in length on purpose"), 6); - value.userIndex.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetCredential::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 112: { - LogStep(112, "Create Week Day schedule for first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(1U); - value.startHour = 0U; - value.startMinute = 0U; - value.endHour = 23U; - value.endMinute = 59U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 113: { - LogStep(113, "Create Year Day schedule for first user"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - value.localStartTime = 9000UL; - value.localEndTime = 888888888UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 114: { - LogStep(114, "Clear a single holiday schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Type value; - value.holidayIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 115: { - LogStep(115, "Make sure that first holiday schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 116: { - LogStep(116, "Make sure that second holiday schedule was deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 117: { - LogStep(117, "Make sure that third holiday schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = NumberOfHolidaySchedulesSupported; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 118: { - LogStep(118, "Make sure clearing holiday schedule did not clear week day schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 119: { - LogStep(119, "Make sure clearing holiday schedule did not clear year day schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 120: { - LogStep(120, "Clear all remaining holiday schedules"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Type value; - value.holidayIndex = 254U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 121: { - LogStep(121, "Make sure that first holiday is still deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 122: { - LogStep(122, "Make sure that second holiday schedule was deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 123: { - LogStep(123, "Make sure that third holiday schedule was not deleted"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = NumberOfHolidaySchedulesSupported; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 124: { - LogStep(124, "Make sure clearing holiday schedule did not clear week day schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 125: { - LogStep(125, "Make sure clearing holiday schedule did not clear year day schedule"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 126: { - LogStep(126, "Final Cleanup"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = 65534U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_1_1Suite : public TestCommand -{ -public: - Test_TC_DRLK_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_1_1", 49, 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_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, 7U)); - 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)); - { - 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, 16UL)); - } - 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, 32UL)); - } - 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, 64UL)); - } - break; - case 9: - 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, 128UL)); - } - break; - case 10: - 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, 256UL)); - } - break; - case 11: - 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, 1024UL)); - } - break; - case 12: - 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, 2048UL)); - } - break; - case 13: - 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, 4096UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 37UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 38UL)); - 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 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, 0UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 37UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 38UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 16: - 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, 3UL)); - } - break; - case 17: - 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, 17UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 27UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 28UL)); - } - break; - case 18: - 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, 18UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 23UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 24UL)); - } - break; - case 19: - 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, 19UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 25UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 26UL)); - } - break; - case 20: - 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, 20UL)); - } - break; - case 21: - 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, 21UL)); - } - break; - case 22: - 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, 22UL)); - } - break; - case 23: - 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, 48UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 49UL)); - } - break; - case 24: - 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, 51UL)); - } - break; - case 25: - 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, 33UL)); - } - break; - case 26: - 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, 34UL)); - } - break; - case 27: - 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, 35UL)); - } - break; - case 28: - 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, 36UL)); - } - break; - case 29: - 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, 39UL)); - } - break; - case 30: - 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, 40UL)); - } - break; - case 31: - 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, 41UL)); - } - break; - case 32: - 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, 42UL)); - } - break; - case 33: - 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, 43UL)); - } - break; - case 34: - 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, 44UL)); - } - break; - case 35: - 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, 3UL)); - } - break; - case 36: - 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)); - } - break; - case 37: - 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, 4UL)); - } - break; - case 38: - 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)); - } - break; - case 39: - 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)); - VerifyOrReturn(CheckConstraintContains("value", value, 12UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 13UL)); - } - break; - case 40: - 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, 14UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 15UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 16UL)); - } - break; - case 41: - 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, 17UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 18UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 19UL)); - } - break; - case 42: - 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, 39UL)); - } - break; - case 43: - 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, 26UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 27UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 29UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 34UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 36UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 38UL)); - } - break; - case 44: - 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, 3UL)); - } - break; - case 45: - 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, 12UL)); - } - break; - case 46: - 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, 15UL)); - } - break; - case 47: - 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, 18UL)); - } - break; - case 48: - 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, 28UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 35UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 37UL)); - } - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads the FeatureMap from DUT"); - VerifyOrDo(!ShouldSkip(" !DRLK.S.F00 && !DRLK.S.F01 && !DRLK.S.F02 && !DRLK.S.F04 && !DRLK.S.F05 && !DRLK.S.F06 && " - "!DRLK.S.F07 && !DRLK.S.F08 && !DRLK.S.F0a && !DRLK.S.F0b && !DRLK.S.F0c "), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given DRLK.S.F00(PIN) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given DRLK.S.F01(RID) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given DRLK.S.F02(FGP) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 3e: Given DRLK.S.F04(WDSCH) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 3f: Given DRLK.S.F05(DPS) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 3g: Given DRLK.S.F06(FACE) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F06"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3h: Given DRLK.S.F07(COTA) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 3i: Given DRLK.S.F08(USR) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 3j: Given DRLK.S.F0a(YDSCH) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 3k: Given DRLK.S.F0b(HDSCH) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Step 3l: Given DRLK.S.F0c(UBOLT) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, "Step 4a: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 4b: TH reads Feature dependent(DRLK.S.F05) attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "Step 4c: TH reads Feature dependent(DRLK.S.F08) attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 18: { - LogStep(18, "Step 4d: TH reads Feature dependent(DRLK.S.F00) attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 19: { - LogStep(19, "Step 4e: TH reads Feature dependent(DRLK.S.F01) attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 20: { - LogStep(20, "Step 4f: TH reads Feature dependent(DRLK.S.F04) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "Step 4g: TH reads Feature dependent(DRLK.S.F0a) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 22: { - LogStep(22, "Step 4h: TH reads Feature dependent(DRLK.S.F0b) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 23: { - LogStep(23, "Step 4i: TH reads Feature dependent(DRLK.S.F00 or DRLK.S.F01) attributes in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F00 || DRLK.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 24: { - LogStep(24, "Step 4j: TH reads Feature dependent(DRLK.S.F07 or DRLK.S.F00) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F07 || DRLK.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 25: { - LogStep(25, "Step 4k: TH reads optional attribute(Language) in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0021"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 26: { - LogStep(26, "Step 4l: TH reads optional attribute(LEDSettings) in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0022"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 27: { - LogStep(27, "Step 4m: TH reads optional attribute(AutoRelockTime) in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0023"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 28: { - LogStep(28, "Step 4n: TH reads optional attribute(SoundVolume) in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0024"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 29: { - LogStep(29, "Step 4o: TH reads optional attribute(DefaultConfigurationRegister) in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0027"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 30: { - LogStep(30, "Step 4p: TH reads optional attribute(EnableLocalProgramming) in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0028"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 31: { - LogStep(31, "Step 4q: TH reads optional attribute(EnableOneTouchLocking) in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0029"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Step 4r: TH reads optional attribute(EnableInsideStatusLED) in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.A002a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, "Step 4s: TH reads optional attribute(EnablePrivacyModeButton) in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.A002b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 34: { - LogStep(34, "Step 4t: TH reads optional attribute(LocalProgrammingFeatures) in AttributeList"); - VerifyOrDo(!ShouldSkip("DRLK.S.A002c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 35: { - LogStep(35, "Step 5a: TH reads EventList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 36: { - LogStep(36, "Step 5b: TH reads optional event(Door position sensor) in EventList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F05 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 37: { - LogStep(37, "Step 5c: TH reads optional event(User commands and database) in EventList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 38: { - LogStep(38, "Step 6a: TH reads AcceptedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 39: { - LogStep(39, "Step 6b: TH reads Feature dependent commands(DRLK.S.F04) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 40: { - LogStep(40, "Step 6c: TH reads Feature dependent commands(DRLK.S.F0a) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 41: { - LogStep(41, "Step 6d: TH reads Feature dependent commands(DRLK.S.F0b) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 42: { - LogStep(42, "Step 6e: TH reads Feature dependent commands(DRLK.S.F0c) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0c"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 43: { - LogStep(43, "Step 6f: TH reads Feature dependent commands(DRLK.S.F08) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 44: { - LogStep(44, "Step 6g: TH reads optional commands(DRLK.S.C03.Rsp) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("DRLK.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 45: { - LogStep(45, "Step 7a: TH reads Feature dependent command(DRLK.S.F04) in GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 46: { - LogStep(46, "Step 7b: TH reads Feature dependent command(DRLK.S.F0a) in GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 47: { - LogStep(47, "Step 7c: TH reads Feature dependent command(DRLK.S.F0b) in GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 48: { - LogStep(48, "Step 7d: TH reads Feature dependent command(DRLK.S.F08) in GeneratedCommandList"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_2_4Suite : public TestCommand -{ -public: - Test_TC_DRLK_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_4", 16, 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_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)); - 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), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - 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)); - shouldContinue = true; - 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)); - { - 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 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - 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); - 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(1000), 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, "Create new PIN credential and lock/unlock user"); - 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 = 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(1000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Verify created PIN credential"); - 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 5: { - LogStep(5, "Step 1a: TH writes AutoRelockTime attribute value as 10 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 6: { - LogStep(6, "Step 1b: 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 7: { - LogStep(7, "Step 1c: 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 8: { - LogStep(8, "Step 1d: 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 9: { - LogStep(9, "Step 2a: TH sends the Unlock with Timeout argument value as 10 seconds"); - VerifyOrDo(!ShouldSkip("DRLK.S.C03.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Type value; - value.timeout = 10U; - 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::UnlockWithTimeout::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Step 2b: TH sends the Unlock with Timeout argument value as 60 seconds"); - VerifyOrDo(!ShouldSkip("DRLK.S.C03.Rsp && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Type value; - value.timeout = 60U; - 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::UnlockWithTimeout::Id, value, - chip::Optional(1000), chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Wait for AutoRelockTime Expires"); - VerifyOrDo(!ShouldSkip("DRLK.S.C03.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 11000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 12: { - LogStep(12, "Wait for AutoRelockTime Expires"); - VerifyOrDo(!ShouldSkip("DRLK.S.C03.Rsp && PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 70000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 2c: TH reads LockState attribute"); - VerifyOrDo(!ShouldSkip("DRLK.S.A0000 && DRLK.S.C03.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Attributes::LockState::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, "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 15: { - LogStep(15, "Clean the created credential"); - VerifyOrDo(!ShouldSkip("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(1000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_2_5Suite : public TestCommand -{ -public: - Test_TC_DRLK_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_5", 12, 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_5Suite() {} - - 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 NumberOfWeekDaySchedulesSupportedPerUser; - uint16_t NumberOfTotalUsersSupported; - - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - NumberOfWeekDaySchedulesSupportedPerUser = value; - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - NumberOfTotalUsersSupported = value; - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("daysMask", value.daysMask)); - VerifyOrReturn(CheckValue("daysMask.Value()", value.daysMask.Value(), 2U)); - VerifyOrReturn(CheckValuePresent("startHour", value.startHour)); - VerifyOrReturn(CheckValue("startHour.Value()", value.startHour.Value(), 15U)); - VerifyOrReturn(CheckValuePresent("startMinute", value.startMinute)); - VerifyOrReturn(CheckValue("startMinute.Value()", value.startMinute.Value(), 45U)); - VerifyOrReturn(CheckConstraintHasValue("value.endHour", value.endHour, true)); - VerifyOrReturn(CheckConstraintMinValue("value.endHour.Value()", value.endHour.Value(), 16U)); - VerifyOrReturn(CheckConstraintHasValue("value.endMinute", value.endMinute, true)); - VerifyOrReturn(CheckConstraintMinValue("value.endMinute.Value()", value.endMinute.Value(), 55U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 0U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - VerifyOrReturn(CheckConstraintHasValue("value.daysMask", value.daysMask, false)); - VerifyOrReturn(CheckConstraintHasValue("value.startHour", value.startHour, false)); - VerifyOrReturn(CheckConstraintHasValue("value.startMinute", value.startMinute, false)); - VerifyOrReturn(CheckConstraintHasValue("value.endHour", value.endHour, false)); - VerifyOrReturn(CheckConstraintHasValue("value.endMinute", value.endMinute, false)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckConstraintHasValue("value.daysMask", value.daysMask, false)); - VerifyOrReturn(CheckConstraintHasValue("value.startHour", value.startHour, false)); - VerifyOrReturn(CheckConstraintHasValue("value.startMinute", value.startMinute, false)); - VerifyOrReturn(CheckConstraintHasValue("value.endHour", value.endHour, false)); - VerifyOrReturn(CheckConstraintHasValue("value.endMinute", value.endMinute, false)); - } - break; - case 11: - 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, "Precondition: Create new user"); - 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, "Precondition: 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, "Step 1: TH reads NumberOfWeekDay SchedulesSupportedPerUser attribute"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04 && DRLK.S.A0014"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2: TH reads NumberOfTotalUsers Supported attribute"); - 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 5: { - LogStep(5, "Step 3: TH send Set Week Day Schedule Command"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04 && DRLK.S.C0b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - value.daysMask = static_cast>(2U); - value.startHour = 15U; - value.startMinute = 45U; - value.endHour = 16U; - value.endMinute = 55U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Step 4: TH send Get Week Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Step 5: TH send Set Week Day Schedule Command"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04 && DRLK.S.C0b.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type value; - value.weekDayIndex = 0U; - value.userIndex = 1U; - value.daysMask = static_cast>(7U); - value.startHour = 15U; - value.startMinute = 45U; - value.endHour = 16U; - value.endMinute = 55U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 6: TH send Get Week Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 0U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 7: TH sends Clear Week Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04 && DRLK.S.C0d.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Step 8: TH sends Get Week Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; - value.weekDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "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(10000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_2_6Suite : public TestCommand -{ -public: - Test_TC_DRLK_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_6", 10, 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_6Suite() {} - - 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 NumberOfHolidaySchedulesSupported; - - 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(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - NumberOfHolidaySchedulesSupported = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 20UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 30UL)); - if (value.localEndTime.HasValue()) - { - VerifyOrReturn(CheckConstraintMinValue("value.localEndTime.Value()", value.localEndTime.Value(), 21UL)); - } - VerifyOrReturn(CheckValuePresent("operatingMode", value.operatingMode)); - VerifyOrReturn(CheckValue("operatingMode.Value()", value.operatingMode.Value(), 0U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 15U)); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 10U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("holidayIndex", value.holidayIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - } - break; - case 9: - 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 commissionee"); - 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 1: TH reads NumberOfHoliday SchedulesSupported and saves for future use."); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b && DRLK.S.A0016"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::NumberOfHolidaySchedulesSupported::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 2: Create Holiday schedule with 1 index"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b && DRLK.S.C11.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type value; - value.holidayIndex = 1U; - value.localStartTime = 20UL; - value.localEndTime = 30UL; - value.operatingMode = static_cast(0); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Step 3a: Get Holiday Schedule with HolidayIndex as 1"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 4: Create Holiday schedule with invalid operating mode"); - VerifyOrDo(!ShouldSkip("DRLK.S.C11.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type value; - value.holidayIndex = 1U; - value.localStartTime = 20UL; - value.localEndTime = 30UL; - value.operatingMode = static_cast(5); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 5: Get Holiday Schedule with Invalid HolidayIndex 15."); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 15U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Step 6: Get Holiday Schedule with the Non-scheduled HolidayIndex"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 10U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Step 7: Clear Holiday schedule with 1 index"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b && DRLK.S.C13.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 8: Make sure that holiday schedule was deleted"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0b && DRLK.S.C12.Rsp && DRLK.S.C12.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type value; - value.holidayIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetHolidaySchedule::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "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(10000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_2_7Suite : public TestCommand -{ -public: - Test_TC_DRLK_2_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_7", 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_DRLK_2_7Suite() {} - - 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 NumberOfYearDaySchedulesSupportedPerUser; - uint16_t NumberOfTotalUsersSupported; - - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - NumberOfYearDaySchedulesSupportedPerUser = value; - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - NumberOfTotalUsersSupported = value; - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 960UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 1980UL)); - if (value.localEndTime.HasValue()) - { - VerifyOrReturn(CheckConstraintMinValue("value.localEndTime.Value()", value.localEndTime.Value(), 961UL)); - } - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 0U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 15U)); - VerifyOrReturn(CheckValue("status", value.status, 133U)); - VerifyOrReturn(CheckConstraintHasValue("value.localStartTime", value.localStartTime, false)); - VerifyOrReturn(CheckConstraintHasValue("value.localEndTime", value.localEndTime, false)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, NumberOfYearDaySchedulesSupportedPerUser)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 5U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckConstraintHasValue("value.localStartTime", value.localStartTime, false)); - VerifyOrReturn(CheckConstraintHasValue("value.localEndTime", value.localEndTime, false)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckConstraintHasValue("value.localStartTime", value.localStartTime, false)); - VerifyOrReturn(CheckConstraintHasValue("value.localEndTime", value.localEndTime, false)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); - VerifyOrReturn(CheckValue("userIndex", value.userIndex, 1U)); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValuePresent("localStartTime", value.localStartTime)); - VerifyOrReturn(CheckValue("localStartTime.Value()", value.localStartTime.Value(), 1080UL)); - VerifyOrReturn(CheckValuePresent("localEndTime", value.localEndTime)); - VerifyOrReturn(CheckValue("localEndTime.Value()", value.localEndTime.Value(), 2100UL)); - if (value.localEndTime.HasValue()) - { - VerifyOrReturn(CheckConstraintMinValue("value.localEndTime.Value()", value.localEndTime.Value(), 1081UL)); - } - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - 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; - 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: Create new user"); - 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, "Precondition: 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, "Step 1: TH reads NumberOfYearDay SchedulesSupportedPerUser attribute"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.A0015"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, - DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2: TH reads NumberOfTotalUsers Supported attribute"); - 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 5: { - LogStep(5, "Step 3: TH sends Set Year Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C0e.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - value.localStartTime = 960UL; - value.localEndTime = 1980UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Step 4a & 4b: TH sends Get Year Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Step 5: TH send Set Year Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.C0e.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 0U; - value.userIndex = 15U; - value.localStartTime = 1020UL; - value.localEndTime = 2040UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 6: TH sends Get Year Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 0U; - value.userIndex = 15U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 7a: Create a user with userIndex as 5"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 5U; - 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 10: { - LogStep(10, "Step 7b: TH sends Get Year Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = NumberOfYearDaySchedulesSupportedPerUser; - value.userIndex = 5U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Step 8: TH sends Clear Year Day Schedule to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.C10.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Step 9: TH sends Get Year Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx && DRLK.S.C10.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Step 10: TH sends Set Year Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.C0e.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - value.localStartTime = 1080UL; - value.localEndTime = 2100UL; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Step 11: TH sends Get Year Day Schedule Command to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Step 12: TH sends Clear Year Day Schedule to DUT"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; - value.yearDayIndex = 0U; - value.userIndex = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Clear a year day schedule for the first user"); - VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; - value.yearDayIndex = 1U; - value.userIndex = 1U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearYearDaySchedule::Id, value, - chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Cleanup the created user with UserIndex 1"); - 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(10000), chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Cleanup the created user with UserIndex 5"); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = 5U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_2_8Suite : public TestCommand -{ -public: - Test_TC_DRLK_2_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_8", 14, 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_8Suite() {} - - 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; - - uint16_t Current_NumberOfTotalUsersSupported; - - 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(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65534U)); - Current_NumberOfTotalUsersSupported = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - 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 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.HasValue(), true)); - VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.Value(), 3)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - 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, 2U)); - VerifyOrReturn(CheckValueNonNull("userName", value.userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - 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, 2U)); - VerifyOrReturn(CheckValueNonNull("userName", value.userName)); - VerifyOrReturn(CheckValueAsString("userName.Value()", value.userName.Value(), chip::CharSpan("", 0))); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - 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 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - 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(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNonNull("nextUserIndex", value.nextUserIndex)); - VerifyOrReturn(CheckValue("nextUserIndex.Value()", value.nextUserIndex.Value(), 2U)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - 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, 2U)); - VerifyOrReturn(CheckValueNull("userName", value.userName)); - VerifyOrReturn(CheckValueNull("userUniqueID", value.userUniqueID)); - VerifyOrReturn(CheckValueNull("userStatus", value.userStatus)); - VerifyOrReturn(CheckValueNull("userType", value.userType)); - VerifyOrReturn(CheckValueNull("credentialRule", value.credentialRule)); - VerifyOrReturn(CheckValueNull("credentials", value.credentials)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextUserIndex", value.nextUserIndex)); - } - 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, "Step 1: TH reads NumberOfTotalUsers Supported attribute 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 2: { - LogStep(2, - "Step 2: TH sends Set User Command to DUT with the following values: OperationType as 0 UserIndex as 1 " - "UserName as xxx UserUniqueID as 6452 UserStatus as 1 UserType as 0 CredentialRule as 0"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - 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 3: { - LogStep(3, "Step 3: TH sends Get User Command to DUT with UserIndex as 1"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - 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 4: { - LogStep(4, - "Step 4: TH sends Set User Command to DUT with the following values: OperationType as 0 UserIndex as 2 " - "UserName as xxx UserUniqueID as 6452 UserStatus as 1 UserType as 10 (Invalid value) CredentialRule as 3"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 2U; - 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(10); - value.credentialRule.SetNonNull(); - value.credentialRule.Value() = static_cast(3); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 5: { - LogStep(5, - "Step 5: TH sends Set User Command to DUT with the following values: OperationType as 0 UserIndex as 1 (Same " - "as step 2) UserName as xxx UserUniqueID as 8965 UserStatus as 1 UserType as 0 CredentialRule as 0"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - 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() = 8965UL; - 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 6: { - LogStep(6, - "Step 6a: TH sends Set User Command to DUT with the following values: OperationType as 0 UserIndex as 2 " - "UserName as NULL UserUniqueID as NULL UserStatus as NULL UserType as NULL CredentialRule as NULL"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(0); - value.userIndex = 2U; - value.userName.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Step 6b: TH sends Get User Command to DUT with UserIndex as 2"); - VerifyOrDo(!ShouldSkip("DRLK.S.C1a.Rsp && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, - "Step 7: TH sends Set User Command to DUT with the following values: OperationType as 2 UserIndex as 2 " - "UserName as NULL UserUniqueID as NULL UserStatus as NULL UserType as NULL CredentialRule as NULL"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::SetUser::Type value; - value.operationType = static_cast(2); - value.userIndex = 2U; - value.userName.SetNull(); - value.userUniqueID.SetNull(); - value.userStatus.SetNull(); - value.userType.SetNull(); - value.credentialRule.SetNull(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::SetUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 8: TH sends Get User Command to DUT with the UserIndex as 2"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Step 9: TH sends Clear User Command to DUT with the UserIndex as 1"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1d.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - 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(10000), chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Step 10: TH sends Get User Command to DUT with the UserIndex as 1"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - 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 12: { - LogStep(12, "Test cleanup: TH sends Clear User Command to DUT with the UserIndex as 2"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1d.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::ClearUser::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 13: { - LogStep(13, "Test cleanup: TH sends Get User Command to DUT with the UserIndex as 2"); - VerifyOrDo(!ShouldSkip("DRLK.S.F08 && DRLK.S.C1b.Rsp && DRLK.S.C1c.Tx"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DoorLock::Commands::GetUser::Type value; - value.userIndex = 2U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetUser::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DRLK_2_11Suite : public TestCommand -{ -public: - Test_TC_DRLK_2_11Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_11", 23, credsIssuerConfig) - { - 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); - } - - ~Test_TC_DRLK_2_11Suite() {} - - 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 mPINCredentialData; - chip::Optional mRFIDCredentialData; - chip::Optional mFingerVeinCredentialData; - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 255U)); - } - break; - case 8: - 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 9: - 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 10: - 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 11: - 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(CheckConstraintType("value.credentialExists", "boolean", "boolean")); - 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 12: - 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(CheckConstraintType("value.credentialExists", "boolean", "boolean")); - 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 13: - 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(CheckConstraintType("value.credentialExists", "boolean", "boolean")); - 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 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - 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(CheckConstraintType("value.credentialExists", "boolean", "boolean")); - 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 16: - 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(CheckConstraintType("value.credentialExists", "boolean", "boolean")); - 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 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - 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(CheckConstraintType("value.credentialExists", "boolean", "boolean")); - 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 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 21: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - break; - case 22: - 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, false)); - VerifyOrReturn(CheckValueNull("userIndex", value.userIndex)); - VerifyOrReturn(CheckValueNull("creatorFabricIndex", value.creatorFabricIndex)); - VerifyOrReturn(CheckValueNull("lastModifiedFabricIndex", value.lastModifiedFabricIndex)); - VerifyOrReturn(CheckValueNull("nextCredentialIndex", value.nextCredentialIndex)); - } - 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: 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, "Precondition: 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, "Step 1a: 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, "Step 1b: 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, "Step 1c: 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, "Step 1d: 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, "Step 1e: 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, "Step 2a: 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, "Step 2b: 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("123456789A"), 10); - 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, "Step 2c: 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("123456789A"), 10); - 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, "Step 3a: 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, "Step 3b: 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, "Step 3c: 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, "Step 4a: 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, "Step 4b: 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, "Step 4c: 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, "Step 4d: 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, "Step 4e: 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, "Step 4f: 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, "Step 5a: 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, "Step 5b: 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, "Step 5c: 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 TestGroupMessagingSuite : public TestCommand -{ -public: - TestGroupMessagingSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestGroupMessaging", 41, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestGroupMessagingSuite() {} - - 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 mNodeId2; - chip::Optional mDiscriminator; - chip::Optional mPayload; - 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)); - { - chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 258U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 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)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("xyzzy", 5))); - } - 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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 0))); - } - break; - case 14: - 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; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - 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; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 258U)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 0))); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("xyzzy", 5))); - } - 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)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("", 0))); - } - break; - case 36: - 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; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 40: - 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, "KeySet Write 1"); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 417U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1110000ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 1110001ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1110002ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "KeySet Write 2"); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 418U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 2220000ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 2220001ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 2220002ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Write Group Keys"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].groupId = 257U; - listHolder_0->mList[0].groupKeySetID = 417U; - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].groupId = 258U; - listHolder_0->mList[1].groupKeySetID = 418U; - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Add Group 1 (endpoint 1)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupID = 257U; - value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Add Group 2 (endpoint 0)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupID = 258U; - value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); - return SendCommand(kIdentityAlpha, GetEndpoint(0), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Install ACLs"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(4); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 7: { - LogStep(7, "Read initial Attribute value"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Group Write Attribute"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("xyzzygarbage: not in length on purpose", 5); - return WriteGroupAttribute(kIdentityAlpha, 258, BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional); - } - case 9: { - LogStep(9, "Wait for write 1"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 10: { - LogStep(10, "Read back Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, "Restore initial Attribute value"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("garbage: not in length on purpose", 0); - return WriteGroupAttribute(kIdentityAlpha, 258, BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional); - } - case 12: { - LogStep(12, "Wait for write 2"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Read back Attribute"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Check on/off attribute value is false for endpoint 1"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Turn On the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::On::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); - } - case 16: { - LogStep(16, "Wait for command 3"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Check on/off attribute value is true after on command for endpoint 1"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Turn off the light to get ready for the next test"); - 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 19: { - LogStep(19, "Cleanup ACLs"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 20: { - LogStep(20, "Open Commissioning Window from alpha"); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Commission from gamma"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 1126240820ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityGamma, value); - } - case 22: { - LogStep(22, "Wait for the commissioned device to be retrieved for gamma"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 1126240820ULL; - return WaitForCommissionee(kIdentityGamma, value); - } - case 23: { - LogStep(23, "KeySet Write 1 for gamma"); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 417U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1110000ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 1110001ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1110002ULL; - - return SendCommand(kIdentityGamma, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 24: { - LogStep(24, "KeySet Write 2 for gamma"); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 418U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 2220000ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 2220001ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 2220002ULL; - - return SendCommand(kIdentityGamma, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Write Group Keys for gamma"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].groupId = 257U; - listHolder_0->mList[0].groupKeySetID = 417U; - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].groupId = 258U; - listHolder_0->mList[1].groupKeySetID = 418U; - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityGamma, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); - } - case 26: { - LogStep(26, "Add Group 1 (endpoint 1) for gamma"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupID = 257U; - value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); - return SendCommand(kIdentityGamma, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 27: { - LogStep(27, "Add Group 2 (endpoint 0) for gamma"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupID = 258U; - value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); - return SendCommand(kIdentityGamma, GetEndpoint(0), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 28: { - LogStep(28, "Install ACLs for gamma"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - listHolder_0->mList[1].privilege = - static_cast(4); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNull(); - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityGamma, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 29: { - LogStep(29, "Read initial Attribute value for gamma"); - return ReadAttribute(kIdentityGamma, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 30: { - LogStep(30, "Group Write Attribute for gamma"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("xyzzygarbage: not in length on purpose", 5); - return WriteGroupAttribute(kIdentityGamma, 258, BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional); - } - case 31: { - LogStep(31, "Wait for write 1 for gamma"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityGamma, value); - } - case 32: { - LogStep(32, "Read back Attribute for gamma"); - return ReadAttribute(kIdentityGamma, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 33: { - LogStep(33, "Restore initial Attribute value for gamma"); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("garbage: not in length on purpose", 0); - return WriteGroupAttribute(kIdentityGamma, 258, BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional); - } - case 34: { - LogStep(34, "Wait for write 2 for gamma"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityGamma, value); - } - case 35: { - LogStep(35, "Read back Attribute for gamma"); - return ReadAttribute(kIdentityGamma, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 36: { - LogStep(36, "Check on/off attribute value is false for endpoint 1 for gamma"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 37: { - LogStep(37, "Turn On the light to see attribute change for gamma"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::On::Type value; - return SendGroupCommand(kIdentityGamma, 257, OnOff::Id, OnOff::Commands::On::Id, value); - } - case 38: { - LogStep(38, "Wait for command 3 for gamma"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityGamma, value); - } - case 39: { - LogStep(39, "Check on/off attribute value is true after on command for endpoint 1 for gamma"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 40: { - LogStep(40, "Cleanup ACLs for gamma"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityGamma, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestGroupsClusterSuite : public TestCommand -{ -public: - TestGroupsClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("TestGroupsCluster", 27, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestGroupsClusterSuite() {} - - 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)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 135U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 0U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 126U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); - } - 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)); - { - chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); - VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #1", 8))); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 258U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("capacity", value.capacity)); - { - auto iter_0 = value.groupList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("groupList", iter_0, 0)); - VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 257U)); - VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 1)); - } - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 258U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 258U)); - VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #2", 8))); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 32767U)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); - VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #1", 8))); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 258U)); - VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #2", 8))); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("capacity", value.capacity)); - { - auto iter_0 = value.groupList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("groupList", iter_0, 0)); - VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 258U)); - VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 1)); - } - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 135U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 0U)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 260U)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 258U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); - VerifyOrReturn(CheckValueAsString("groupName", value.groupName, chip::CharSpan("Group #1", 8))); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 258U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("capacity", value.capacity)); - { - auto iter_0 = value.groupList.begin(); - VerifyOrReturn(CheckNextListItemDecodes("groupList", iter_0, 0)); - VerifyOrReturn(CheckValue("groupList[0]", iter_0.GetValue(), 257U)); - VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 1)); - } - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 258U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::ViewGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 139U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 32767U)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueNull("capacity", value.capacity)); - { - auto iter_0 = value.groupList.begin(); - VerifyOrReturn(CheckNoMoreListItems("groupList", iter_0, 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, "View Group 0 (invalid)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 2: { - LogStep(2, "View First Group (not found)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 257U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 3: { - LogStep(3, "Add First Group (no keys)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupID = 257U; - value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Add KeySet"); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 417U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1110000ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 1110001ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1110002ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Write Group Keys"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].groupId = 257U; - listHolder_0->mList[0].groupKeySetID = 417U; - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].groupId = 258U; - listHolder_0->mList[1].groupKeySetID = 417U; - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); - } - case 6: { - LogStep(6, "Add First Group (new)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupID = 257U; - value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 7: { - LogStep(7, "View First Group (new)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 257U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "View Second Group (not found)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 258U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Get Group Membership 1 (all)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; - - value.groupList = chip::app::DataModel::List(); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::GetGroupMembership::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Add Second Group (new)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupID = 258U; - value.groupName = chip::Span("Group #2garbage: not in length on purpose", 8); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 11: { - LogStep(11, "View Second Group (new)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 258U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "View Group 3 (not found)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 32767U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 13: { - LogStep(13, "View First Group (existing)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 257U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "View Second Group (existing)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 258U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Get Group Membership 2"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; - - { - auto * listHolder_0 = new ListHolder(3); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 258U; - listHolder_0->mList[1] = 259U; - listHolder_0->mList[2] = 32767U; - value.groupList = chip::app::DataModel::List(listHolder_0->mList, 3); - } - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::GetGroupMembership::Id, value, - chip::NullOptional - - ); - } - case 16: { - LogStep(16, "Remove Group 0 (invalid)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::RemoveGroup::Type value; - value.groupID = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveGroup::Id, value, - chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Remove Group 4 (not found)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::RemoveGroup::Type value; - value.groupID = 260U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveGroup::Id, value, - chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Remove Second Group (existing)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::RemoveGroup::Type value; - value.groupID = 258U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveGroup::Id, value, - chip::NullOptional - - ); - } - case 19: { - LogStep(19, "View First Group (not removed)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 257U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 20: { - LogStep(20, "View Second Group (removed)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 258U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Get Group Membership 3"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; - - { - auto * listHolder_0 = new ListHolder(4); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 257U; - listHolder_0->mList[2] = 258U; - listHolder_0->mList[3] = 3U; - value.groupList = chip::app::DataModel::List(listHolder_0->mList, 4); - } - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::GetGroupMembership::Id, value, - chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Remove All"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::RemoveAllGroups::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveAllGroups::Id, value, - chip::NullOptional - - ); - } - case 23: { - LogStep(23, "View First Group (removed)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 257U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 24: { - LogStep(24, "View Second Group (still removed)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 258U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 25: { - LogStep(25, "View Group 3 (removed)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::ViewGroup::Type value; - value.groupID = 32767U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::ViewGroup::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Get Group Membership 4"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::GetGroupMembership::Type value; - - { - auto * listHolder_0 = new ListHolder(5); - listFreer.add(listHolder_0); - listHolder_0->mList[0] = 1U; - listHolder_0->mList[1] = 257U; - listHolder_0->mList[2] = 258U; - listHolder_0->mList[3] = 3U; - listHolder_0->mList[4] = 32767U; - value.groupList = chip::app::DataModel::List(listHolder_0->mList, 5); - } - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::GetGroupMembership::Id, value, - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_G_1_1Suite : public TestCommand -{ -public: - Test_TC_G_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_G_1_1", 9, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_G_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, 4U)); - 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)); - { - 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)); - { - 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, 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 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, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 7: - 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, 5UL)); - } - break; - case 8: - 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)); - } - 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 reads the ClusterRevision from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads the FeatureMap from DUT"); - VerifyOrDo(!ShouldSkip(" !G.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given G.S.F00 ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("G.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4: TH reads AttributeList from DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5: TH reads EventList from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 6: TH reads AcceptedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 7: TH reads GeneratedCommandList from DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_G_2_1Suite : public TestCommand -{ -public: - Test_TC_G_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_G_2_1", 6, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_G_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::BitMask NameSupportFeatureSupportedValue; - chip::BitMask NameSupportValue; - - 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)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("nameSupport", value, 128U)); - NameSupportFeatureSupportedValue = value; - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("nameSupport", value, 0U)); - NameSupportValue = value; - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("nameSupport", value, NameSupportFeatureSupportedValue)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("nameSupport", value, NameSupportValue)); - } - 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, "Step 1a: TH reads NameSupport attribute from DUT"); - VerifyOrDo(!ShouldSkip("G.S.A0000 && G.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::NameSupport::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: TH reads NameSupport attribute from DUT"); - VerifyOrDo(!ShouldSkip("G.S.A0000 && !G.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::NameSupport::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 2a: TH writes NameSupport attribute as 0x80 EXOR the value as read in step 1"); - VerifyOrDo(!ShouldSkip("G.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::BitMask value; - value = static_cast>(128U); - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::NameSupport::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2b: TH reads NameSupport attribute from DUT"); - VerifyOrDo(!ShouldSkip("G.S.A0000 && G.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::NameSupport::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3: TH reads NameSupport attribute from DUT"); - VerifyOrDo(!ShouldSkip("G.S.A0000 && !G.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Attributes::NameSupport::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestActivatedCarbonFilterMonitoringSuite : public TestCommand -{ -public: - TestActivatedCarbonFilterMonitoringSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestActivatedCarbonFilterMonitoring", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestActivatedCarbonFilterMonitoringSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::ActivatedCarbonFilterMonitoring::Structs::ReplacementProductStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 0)); - VerifyOrReturn( - CheckValue("replacementProductList[0].productIdentifierType", iter_0.GetValue().productIdentifierType, 0U)); - VerifyOrReturn(CheckValueAsString("replacementProductList[0].productIdentifierValue", - iter_0.GetValue().productIdentifierValue, - chip::CharSpan("111112222233", 12))); - VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 1)); - VerifyOrReturn( - CheckValue("replacementProductList[1].productIdentifierType", iter_0.GetValue().productIdentifierType, 1U)); - VerifyOrReturn(CheckValueAsString("replacementProductList[1].productIdentifierValue", - iter_0.GetValue().productIdentifierValue, chip::CharSpan("gtin8xxx", 8))); - VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 2)); - VerifyOrReturn( - CheckValue("replacementProductList[2].productIdentifierType", iter_0.GetValue().productIdentifierType, 2U)); - VerifyOrReturn(CheckValueAsString("replacementProductList[2].productIdentifierValue", - iter_0.GetValue().productIdentifierValue, - chip::CharSpan("4444455555666", 13))); - VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 3)); - VerifyOrReturn( - CheckValue("replacementProductList[3].productIdentifierType", iter_0.GetValue().productIdentifierType, 3U)); - VerifyOrReturn(CheckValueAsString("replacementProductList[3].productIdentifierValue", - iter_0.GetValue().productIdentifierValue, - chip::CharSpan("gtin14xxxxxxxx", 14))); - VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 4)); - VerifyOrReturn( - CheckValue("replacementProductList[4].productIdentifierType", iter_0.GetValue().productIdentifierType, 4U)); - VerifyOrReturn(CheckValueAsString("replacementProductList[4].productIdentifierValue", - iter_0.GetValue().productIdentifierValue, - chip::CharSpan("oem20xxxxxxxxxxxxxxx", 20))); - VerifyOrReturn(CheckNoMoreListItems("replacementProductList", iter_0, 5)); - } - } - 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 Replacement Product List"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::ReplacementProductList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestHepaFilterMonitoringSuite : public TestCommand -{ -public: - TestHepaFilterMonitoringSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestHepaFilterMonitoring", 2, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestHepaFilterMonitoringSuite() {} - - 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)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::HepaFilterMonitoring::Structs::ReplacementProductStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 0)); - VerifyOrReturn( - CheckValue("replacementProductList[0].productIdentifierType", iter_0.GetValue().productIdentifierType, 0U)); - VerifyOrReturn(CheckValueAsString("replacementProductList[0].productIdentifierValue", - iter_0.GetValue().productIdentifierValue, - chip::CharSpan("111112222233", 12))); - VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 1)); - VerifyOrReturn( - CheckValue("replacementProductList[1].productIdentifierType", iter_0.GetValue().productIdentifierType, 1U)); - VerifyOrReturn(CheckValueAsString("replacementProductList[1].productIdentifierValue", - iter_0.GetValue().productIdentifierValue, chip::CharSpan("gtin8xxx", 8))); - VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 2)); - VerifyOrReturn( - CheckValue("replacementProductList[2].productIdentifierType", iter_0.GetValue().productIdentifierType, 2U)); - VerifyOrReturn(CheckValueAsString("replacementProductList[2].productIdentifierValue", - iter_0.GetValue().productIdentifierValue, - chip::CharSpan("4444455555666", 13))); - VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 3)); - VerifyOrReturn( - CheckValue("replacementProductList[3].productIdentifierType", iter_0.GetValue().productIdentifierType, 3U)); - VerifyOrReturn(CheckValueAsString("replacementProductList[3].productIdentifierValue", - iter_0.GetValue().productIdentifierValue, - chip::CharSpan("gtin14xxxxxxxx", 14))); - VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 4)); - VerifyOrReturn( - CheckValue("replacementProductList[4].productIdentifierType", iter_0.GetValue().productIdentifierType, 4U)); - VerifyOrReturn(CheckValueAsString("replacementProductList[4].productIdentifierValue", - iter_0.GetValue().productIdentifierValue, - chip::CharSpan("oem20xxxxxxxxxxxxxxx", 20))); - VerifyOrReturn(CheckNoMoreListItems("replacementProductList", iter_0, 5)); - } - } - 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 Replacement Product List"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::ReplacementProductList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACFREMON_1_1Suite : public TestCommand -{ -public: - Test_TC_ACFREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ACFREMON_1_1", 20, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_ACFREMON_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)); - { - 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, 3UL)); - } - 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, 2UL)); - 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 7: - 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, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 8: - 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)); - } - break; - case 9: - 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, 3UL)); - } - break; - case 10: - 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, 4UL)); - } - break; - 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, 5UL)); - } - 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)); - { - 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 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::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")); - } - break; - case 16: - 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)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip("!ACFREMON.S.F00 && !ACFREMON.S.F01 && !ACFREMON.S.F02"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given ACFREMON.S.F00(Condition) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given ACFREMON.S.F01(Warning) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given ACFREMON.S.F01(ReplacementProductList) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4a: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4b: Read the feature dependent(ACFREMON.S.F00) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4c: Read the optional attribute InPlaceIndicator (ACFREMON.S.A0003) in AttributeList"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4d: Read the optional attribute LastChangedTime (ACFREMON.S.A0004) in AttributeList"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4e: Read the optional attribute ReplacementProductList (ACFREMON.S.F02) in AttributeList"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 4f: 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)"); - 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 13: { - LogStep(13, "Step 5a: TH reads EventList attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::EventList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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, "Step 6a: Read the global attribute: AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("!ACFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 6a: Read the optional command (ResetCondition) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 17: { - LogStep( - 17, - "Step 6b: TH reads from the DUT the AcceptedCommandList attribute. 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)"); - 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 18: { - LogStep(18, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 19: { - LogStep( - 19, - "Step 7b: TH reads from the DUT the GeneratedCommandList attribute. 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ACFREMON_2_1Suite : public TestCommand -{ -public: - Test_TC_ACFREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ACFREMON_2_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_ACFREMON_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)); - { - chip::Percent value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ActivatedCarbonFilterMonitoring::DegradationDirectionEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::ActivatedCarbonFilterMonitoring::ChangeIndicationEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 4: - 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; - 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(CheckConstraintType("value", "epoch_s", "epoch_s")); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::ActivatedCarbonFilterMonitoring::Structs::ReplacementProductStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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 reads from the DUT the Condition attribute."); - VerifyOrDo(!ShouldSkip("ACFREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::Condition::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the DegradationDirection attribute.."); - VerifyOrDo(!ShouldSkip("ACFREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the ChangeIndication attribute."); - VerifyOrDo(!ShouldSkip("ACFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the InPlaceIndicator attribute"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the LastChangedTime attribute"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::LastChangedTime::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the ReplacementProductList attribute"); - VerifyOrDo(!ShouldSkip("ACFREMON.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, - ActivatedCarbonFilterMonitoring::Attributes::ReplacementProductList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_HEPAFREMON_1_1Suite : public TestCommand -{ -public: - Test_TC_HEPAFREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_HEPAFREMON_1_1", 20, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_HEPAFREMON_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)); - { - 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, 3UL)); - } - 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, 2UL)); - 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 7: - 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, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 8: - 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)); - } - break; - case 9: - 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, 3UL)); - } - break; - case 10: - 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, 4UL)); - } - break; - 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, 5UL)); - } - 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)); - { - 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 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::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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)); - { - chip::app::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); - } - break; - case 18: - 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("generatedCommandList", iter_0, 0)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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: Read the global attribute: ClusterRevision"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: Read the global attribute: FeatureMap"); - VerifyOrDo(!ShouldSkip("!HEPAFREMON.S.F00 && !HEPAFREMON.S.F01 && !HEPAFREMON.S.F02"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given HEPAFREMON.S.F00(Condition) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 3c: Given HEPAFREMON.S.F01(Warning) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 3d: Given HEPAFREMON.S.F02(ReplacementProductList) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4: Read the global attribute: AttributeList"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 4b: Read the feature dependent(HEPAFREMON.S.F00) attribute in AttributeList"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 4c: Read the optional attribute InPlaceIndicator (HEPAFREMON.S.A0003) in AttributeList"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, "Step 4d: Read the optional attribute LastChangedTime (HEPAFREMON.S.A0004) in AttributeList"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 11: { - LogStep(11, "Step 4e: Read the optional attribute ReplacementProductList (HEPAFREMON.S.F02) in AttributeList"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, - "Step 4f: TH reads from the DUT the AttributeList attribute. 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.TThe 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)"); - 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 13: { - LogStep(13, "Step 5a: TH reads EventList attribute from DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::EventList::Id, true, chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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, "Step 6a: Read the global attribute: AcceptedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, - "Step 6b: TH reads AcceptedCommandList 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)"); - 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 17: { - LogStep(17, "Step 6b: Read the optional command (ResetCondition) in AcceptedCommandList"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 7a: Read the global attribute: GeneratedCommandList"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); - } - case 19: { - LogStep(19, - "Step 7b: 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_HEPAFREMON_2_1Suite : public TestCommand -{ -public: - Test_TC_HEPAFREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_HEPAFREMON_2_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_HEPAFREMON_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)); - { - chip::Percent value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); - } - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::HepaFilterMonitoring::DegradationDirectionEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::HepaFilterMonitoring::ChangeIndicationEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 4: - 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; - 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(CheckConstraintType("value", "epoch_s", "epoch_s")); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::HepaFilterMonitoring::Structs::ReplacementProductStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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 reads from the DUT the Condition attribute."); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::Condition::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the DegradationDirection attribute.."); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the ChangeIndication attribute."); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the InPlaceIndicator attribute"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the LastChangedTime attribute"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::LastChangedTime::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 7: TH reads from the DUT the ReplacementProductList attribute"); - VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, - HepaFilterMonitoring::Attributes::ReplacementProductList::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_DD_1_5Suite : public TestCommand -{ -public: - Test_TC_DD_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_5", 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_DD_1_5Suite() {} - - 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_DD_1_6Suite : public TestCommand -{ -public: - Test_TC_DD_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_6", 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_DD_1_6Suite() {} - - 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_DD_1_7Suite : public TestCommand -{ -public: - Test_TC_DD_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_7", 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_DD_1_7Suite() {} - - 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_DD_1_8Suite : public TestCommand -{ -public: - Test_TC_DD_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_8", 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_DD_1_8Suite() {} - - 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_DD_1_9Suite : public TestCommand -{ -public: - Test_TC_DD_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_9", 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_DD_1_9Suite() {} - - 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_DD_1_10Suite : public TestCommand -{ -public: - Test_TC_DD_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_10", 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_DD_1_10Suite() {} - - 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_DD_1_11Suite : public TestCommand -{ -public: - Test_TC_DD_1_11Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_11", 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_DD_1_11Suite() {} - - 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_DD_1_12Suite : public TestCommand -{ -public: - Test_TC_DD_1_12Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_12", 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_DD_1_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) - { - 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_DD_1_13Suite : public TestCommand -{ -public: - Test_TC_DD_1_13Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_13", 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_DD_1_13Suite() {} - - 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_DD_1_14Suite : public TestCommand -{ -public: - Test_TC_DD_1_14Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_14", 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_DD_1_14Suite() {} - - 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_DD_1_15Suite : public TestCommand -{ -public: - Test_TC_DD_1_15Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_1_15", 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_DD_1_15Suite() {} - - 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_DD_2_1Suite : public TestCommand -{ -public: - Test_TC_DD_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_2_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_DD_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) - { - 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_DD_2_2Suite : public TestCommand -{ -public: - Test_TC_DD_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_2_2", 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_DD_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; - - 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_DD_3_1Suite : public TestCommand -{ -public: - Test_TC_DD_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_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_DD_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 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_DD_3_2Suite : public TestCommand -{ -public: - Test_TC_DD_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_2", 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_DD_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 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_DD_3_3Suite : public TestCommand -{ -public: - Test_TC_DD_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_3", 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_DD_3_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) - { - 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_DD_3_4Suite : public TestCommand -{ -public: - Test_TC_DD_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_4", 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_DD_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 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_DD_3_5Suite : public TestCommand -{ -public: - Test_TC_DD_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_5", 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_DD_3_5Suite() {} - - 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_DD_3_6Suite : public TestCommand -{ -public: - Test_TC_DD_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_6", 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_DD_3_6Suite() {} - - 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_DD_3_7Suite : public TestCommand -{ -public: - Test_TC_DD_3_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_7", 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_DD_3_7Suite() {} - - 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_DD_3_8Suite : public TestCommand -{ -public: - Test_TC_DD_3_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_8", 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_DD_3_8Suite() {} - - 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_DD_3_9Suite : public TestCommand -{ -public: - Test_TC_DD_3_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_9", 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_DD_3_9Suite() {} - - 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_DD_3_10Suite : public TestCommand -{ -public: - Test_TC_DD_3_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_10", 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_DD_3_10Suite() {} - - 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_DD_3_11Suite : public TestCommand -{ -public: - Test_TC_DD_3_11Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_11", 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_DD_3_11Suite() {} - - 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_DD_3_12Suite : public TestCommand -{ -public: - Test_TC_DD_3_12Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_12", 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_DD_3_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) - { - 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_DD_3_13Suite : public TestCommand -{ -public: - Test_TC_DD_3_13Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_13", 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_DD_3_13Suite() {} - - 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_DD_3_14Suite : public TestCommand -{ -public: - Test_TC_DD_3_14Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_14", 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_DD_3_14Suite() {} - - 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_DD_3_15Suite : public TestCommand -{ -public: - Test_TC_DD_3_15Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_15", 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_DD_3_15Suite() {} - - 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_DD_3_16Suite : public TestCommand -{ -public: - Test_TC_DD_3_16Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_16", 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_DD_3_16Suite() {} - - 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_DD_3_17Suite : public TestCommand -{ -public: - Test_TC_DD_3_17Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_17", 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_DD_3_17Suite() {} - - 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_DD_3_18Suite : public TestCommand -{ -public: - Test_TC_DD_3_18Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_18", 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_DD_3_18Suite() {} - - 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_DD_3_19Suite : public TestCommand -{ -public: - Test_TC_DD_3_19Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_19", 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_DD_3_19Suite() {} - - 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_DD_3_20Suite : public TestCommand -{ -public: - Test_TC_DD_3_20Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_20", 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_DD_3_20Suite() {} - - 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_DD_3_21Suite : public TestCommand -{ -public: - Test_TC_DD_3_21Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DD_3_21", 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_DD_3_21Suite() {} - - 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 TestGroupDemoCommandSuite : public TestCommand -{ -public: - TestGroupDemoCommandSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGroupDemoCommand", 21, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestGroupDemoCommandSuite() {} - - 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)); - shouldContinue = true; - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - 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)); - 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)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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, "Turn On the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::On::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); - } - case 2: { - LogStep(2, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Turn Off the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Off::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::Off::Id, value); - } - case 4: { - LogStep(4, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Turn On the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::On::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); - } - case 6: { - LogStep(6, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Turn Off the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Off::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::Off::Id, value); - } - case 8: { - LogStep(8, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Turn On the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::On::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); - } - case 10: { - LogStep(10, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Turn Off the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Off::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::Off::Id, value); - } - case 12: { - LogStep(12, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Turn On the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::On::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); - } - case 14: { - LogStep(14, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "Turn Off the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Off::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::Off::Id, value); - } - case 16: { - LogStep(16, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Turn On the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::On::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::On::Id, value); - } - case 18: { - LogStep(18, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Turn Off the light to see attribute change"); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::Off::Type value; - return SendGroupCommand(kIdentityAlpha, 257, OnOff::Id, OnOff::Commands::Off::Id, value); - } - case 20: { - LogStep(20, "Wait 100ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class TestGroupDemoConfigSuite : public TestCommand -{ -public: - TestGroupDemoConfigSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGroupDemoConfig", 5, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestGroupDemoConfigSuite() {} - - 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)); - { - chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("status", value.status, 0U)); - VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); - } - break; - case 4: - 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, "KeySet Write 1 (endpoint 0)"); - ListFreer listFreer; - chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; - - value.groupKeySet.groupKeySetID = 417U; - value.groupKeySet.groupKeySecurityPolicy = - static_cast(0); - value.groupKeySet.epochKey0.SetNonNull(); - value.groupKeySet.epochKey0.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime0.SetNonNull(); - value.groupKeySet.epochStartTime0.Value() = 1110000ULL; - value.groupKeySet.epochKey1.SetNonNull(); - value.groupKeySet.epochKey1.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime1.SetNonNull(); - value.groupKeySet.epochStartTime1.Value() = 1110001ULL; - value.groupKeySet.epochKey2.SetNonNull(); - value.groupKeySet.epochKey2.Value() = chip::ByteSpan( - chip::Uint8::from_const_char( - "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317garbage: not in length on purpose"), - 16); - value.groupKeySet.epochStartTime2.SetNonNull(); - value.groupKeySet.epochStartTime2.Value() = 1110002ULL; - - return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Write Group Keys (endpoint 0)"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = new ListHolder(1); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].groupId = 257U; - listHolder_0->mList[0].groupKeySetID = 417U; - listHolder_0->mList[0].fabricIndex = 0U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 1); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, - GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); - } - case 3: { - LogStep(3, "Add Group 1 (endpoint 1)"); - ListFreer listFreer; - chip::app::Clusters::Groups::Commands::AddGroup::Type value; - value.groupID = 257U; - value.groupName = chip::Span("Group #1garbage: not in length on purpose", 8); - return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::AddGroup::Id, value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Install ACLs"); - ListFreer listFreer; - chip::app::DataModel::List value; - - { - auto * listHolder_0 = - new ListHolder(2); - listFreer.add(listHolder_0); - - listHolder_0->mList[0].privilege = - static_cast(5); - listHolder_0->mList[0].authMode = - static_cast(2); - listHolder_0->mList[0].subjects.SetNull(); - listHolder_0->mList[0].targets.SetNull(); - listHolder_0->mList[0].fabricIndex = 1U; - - listHolder_0->mList[1].privilege = - static_cast(3); - listHolder_0->mList[1].authMode = - static_cast(3); - listHolder_0->mList[1].subjects.SetNonNull(); - - { - auto * listHolder_3 = new ListHolder(1); - listFreer.add(listHolder_3); - listHolder_3->mList[0] = 257ULL; - listHolder_0->mList[1].subjects.Value() = chip::app::DataModel::List(listHolder_3->mList, 1); - } - listHolder_0->mList[1].targets.SetNull(); - listHolder_0->mList[1].fabricIndex = 1U; - - value = chip::app::DataModel::List( - listHolder_0->mList, 2); - } - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), AccessControl::Id, AccessControl::Attributes::Acl::Id, value, - chip::NullOptional, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_G_2_2Suite : public TestCommand -{ -public: - Test_TC_G_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_G_2_2", 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_G_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; - - 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_G_2_3Suite : public TestCommand -{ -public: - Test_TC_G_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_G_2_3", 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_G_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) - { - 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_G_2_4Suite : public TestCommand -{ -public: - Test_TC_G_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_G_2_4", 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_G_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) - { - 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_G_3_2Suite : public TestCommand -{ -public: - Test_TC_G_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_G_3_2", 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_G_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 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_BDX_1_1Suite : public TestCommand -{ -public: - Test_TC_BDX_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_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_BDX_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) - { - 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_BDX_1_2Suite : public TestCommand -{ -public: - Test_TC_BDX_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_2", 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_BDX_1_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; - - 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_BDX_1_3Suite : public TestCommand -{ -public: - Test_TC_BDX_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_3", 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_BDX_1_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) - { - 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_BDX_1_4Suite : public TestCommand -{ -public: - Test_TC_BDX_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_4", 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_BDX_1_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) - { - 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_BDX_1_5Suite : public TestCommand -{ -public: - Test_TC_BDX_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_5", 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_BDX_1_5Suite() {} - - 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_BDX_1_6Suite : public TestCommand -{ -public: - Test_TC_BDX_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_1_6", 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_BDX_1_6Suite() {} - - 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_BDX_2_1Suite : public TestCommand -{ -public: - Test_TC_BDX_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_2_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_BDX_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) - { - 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_BDX_2_2Suite : public TestCommand -{ -public: - Test_TC_BDX_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_2_2", 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_BDX_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; - - 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_BDX_2_3Suite : public TestCommand -{ -public: - Test_TC_BDX_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_2_3", 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_BDX_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) - { - 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_BDX_2_4Suite : public TestCommand -{ -public: - Test_TC_BDX_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_2_4", 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_BDX_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) - { - 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_BDX_2_5Suite : public TestCommand -{ -public: - Test_TC_BDX_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BDX_2_5", 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_BDX_2_5Suite() {} - - 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_BR_1Suite : public TestCommand -{ -public: - Test_TC_BR_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BR_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_BR_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_BR_2Suite : public TestCommand -{ -public: - Test_TC_BR_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BR_2", 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_BR_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; - - 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_BR_3Suite : public TestCommand -{ -public: - Test_TC_BR_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BR_3", 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_BR_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) - { - 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_BR_4Suite : public TestCommand -{ -public: - Test_TC_BR_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BR_4", 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_BR_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) - { - 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_DA_1_1Suite : public TestCommand -{ -public: - Test_TC_DA_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DA_1_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_DA_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) - { - 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_DA_1_3Suite : public TestCommand -{ -public: - Test_TC_DA_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DA_1_3", 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_DA_1_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) - { - 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_DA_1_4Suite : public TestCommand -{ -public: - Test_TC_DA_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DA_1_4", 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_DA_1_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) - { - 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_DA_1_6Suite : public TestCommand -{ -public: - Test_TC_DA_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DA_1_6", 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_DA_1_6Suite() {} - - 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_DA_1_8Suite : public TestCommand -{ -public: - Test_TC_DA_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DA_1_8", 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_DA_1_8Suite() {} - - 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_BINFO_3_1Suite : public TestCommand -{ -public: - Test_TC_BINFO_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BINFO_3_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_BINFO_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 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_OPCREDS_3_1Suite : public TestCommand -{ -public: - Test_TC_OPCREDS_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPCREDS_3_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_OPCREDS_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 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_OPCREDS_3_2Suite : public TestCommand -{ -public: - Test_TC_OPCREDS_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPCREDS_3_2", 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_OPCREDS_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 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_OPCREDS_3_3Suite : public TestCommand -{ -public: - Test_TC_OPCREDS_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPCREDS_3_3", 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_OPCREDS_3_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) - { - 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_OPCREDS_3_4Suite : public TestCommand -{ -public: - Test_TC_OPCREDS_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPCREDS_3_4", 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_OPCREDS_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 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_OPCREDS_3_5Suite : public TestCommand -{ -public: - Test_TC_OPCREDS_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPCREDS_3_5", 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_OPCREDS_3_5Suite() {} - - 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_OPCREDS_3_6Suite : public TestCommand -{ -public: - Test_TC_OPCREDS_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPCREDS_3_6", 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_OPCREDS_3_6Suite() {} - - 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_CNET_4_1Suite : public TestCommand -{ -public: - Test_TC_CNET_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_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_CNET_4_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_CNET_4_2Suite : public TestCommand -{ -public: - Test_TC_CNET_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_2", 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_CNET_4_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; - - 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_CNET_4_3Suite : public TestCommand -{ -public: - Test_TC_CNET_4_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_3", 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_CNET_4_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) - { - 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_CNET_4_4Suite : public TestCommand -{ -public: - Test_TC_CNET_4_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_4", 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_CNET_4_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) - { - 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_CNET_4_5Suite : public TestCommand -{ -public: - Test_TC_CNET_4_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_5", 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_CNET_4_5Suite() {} - - 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_CNET_4_6Suite : public TestCommand -{ -public: - Test_TC_CNET_4_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_6", 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_CNET_4_6Suite() {} - - 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_CNET_4_9Suite : public TestCommand -{ -public: - Test_TC_CNET_4_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_9", 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_CNET_4_9Suite() {} - - 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_CNET_4_10Suite : public TestCommand -{ -public: - Test_TC_CNET_4_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_10", 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_CNET_4_10Suite() {} - - 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_CNET_4_11Suite : public TestCommand -{ -public: - Test_TC_CNET_4_11Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_11", 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_CNET_4_11Suite() {} - - 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_CNET_4_12Suite : public TestCommand -{ -public: - Test_TC_CNET_4_12Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_12", 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_CNET_4_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) - { - 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_CNET_4_13Suite : public TestCommand -{ -public: - Test_TC_CNET_4_13Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_13", 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_CNET_4_13Suite() {} - - 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_CNET_4_14Suite : public TestCommand -{ -public: - Test_TC_CNET_4_14Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_14", 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_CNET_4_14Suite() {} - - 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_CNET_4_15Suite : public TestCommand -{ -public: - Test_TC_CNET_4_15Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_15", 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_CNET_4_15Suite() {} - - 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_CNET_4_16Suite : public TestCommand -{ -public: - Test_TC_CNET_4_16Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_16", 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_CNET_4_16Suite() {} - - 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_CNET_4_20Suite : public TestCommand -{ -public: - Test_TC_CNET_4_20Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_20", 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_CNET_4_20Suite() {} - - 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_CNET_4_21Suite : public TestCommand -{ -public: - Test_TC_CNET_4_21Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_21", 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_CNET_4_21Suite() {} - - 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_CNET_4_22Suite : public TestCommand -{ -public: - Test_TC_CNET_4_22Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CNET_4_22", 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_CNET_4_22Suite() {} - - 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_DLOG_2_1Suite : public TestCommand -{ -public: - Test_TC_DLOG_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DLOG_2_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_DLOG_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) - { - 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_DLOG_2_2Suite : public TestCommand -{ -public: - Test_TC_DLOG_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DLOG_2_2", 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_DLOG_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; - - 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_DLOG_3_1Suite : public TestCommand -{ -public: - Test_TC_DLOG_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DLOG_3_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_DLOG_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 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_DISHALM_1_1Suite : public TestCommand -{ -public: - Test_TC_DISHALM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DISHALM_1_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_DISHALM_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) - { - 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_DISHALM_2_1Suite : public TestCommand -{ -public: - Test_TC_DISHALM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DISHALM_2_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_DISHALM_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) - { - 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_DISHALM_3_1Suite : public TestCommand -{ -public: - Test_TC_DISHALM_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DISHALM_3_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_DISHALM_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 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_DISHALM_3_2Suite : public TestCommand -{ -public: - Test_TC_DISHALM_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DISHALM_3_2", 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_DISHALM_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 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_DISHALM_3_3Suite : public TestCommand -{ -public: - Test_TC_DISHALM_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DISHALM_3_3", 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_DISHALM_3_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) - { - 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_DISHALM_3_4Suite : public TestCommand -{ -public: - Test_TC_DISHALM_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DISHALM_3_4", 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_DISHALM_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 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_DISHALM_3_5Suite : public TestCommand -{ -public: - Test_TC_DISHALM_3_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DISHALM_3_5", 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_DISHALM_3_5Suite() {} - - 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_DISHALM_3_6Suite : public TestCommand -{ -public: - Test_TC_DISHALM_3_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DISHALM_3_6", 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_DISHALM_3_6Suite() {} - - 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_DISHM_1_1Suite : public TestCommand -{ -public: - Test_TC_DISHM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DISHM_1_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_DISHM_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) - { - 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_DISHM_1_2Suite : public TestCommand -{ -public: - Test_TC_DISHM_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DISHM_1_2", 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_DISHM_1_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; - - 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_DISHM_2_1Suite : public TestCommand -{ -public: - Test_TC_DISHM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DISHM_2_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_DISHM_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) - { - 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_DISHM_3_1Suite : public TestCommand -{ -public: - Test_TC_DISHM_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DISHM_3_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_DISHM_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 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_DISHM_3_2Suite : public TestCommand -{ -public: - Test_TC_DISHM_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DISHM_3_2", 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_DISHM_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 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_DISHM_3_3Suite : public TestCommand -{ -public: - Test_TC_DISHM_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DISHM_3_3", 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_DISHM_3_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) - { - 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_DESC_2_1Suite : public TestCommand -{ -public: - Test_TC_DESC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DESC_2_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_DESC_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) - { - 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_CGEN_2_2Suite : public TestCommand -{ -public: - Test_TC_CGEN_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CGEN_2_2", 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_CGEN_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; - - 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_DGGEN_2_2Suite : public TestCommand -{ -public: - Test_TC_DGGEN_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGGEN_2_2", 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_DGGEN_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; - - 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_ICDM_2_2Suite : public TestCommand -{ -public: - Test_TC_ICDM_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ICDM_2_2", 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_ICDM_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; - - 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_ICDM_2_3Suite : public TestCommand -{ -public: - Test_TC_ICDM_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ICDM_2_3", 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_ICDM_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) - { - 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_I_3_2Suite : public TestCommand -{ -public: - Test_TC_I_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_I_3_2", 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_I_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 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_IDM_1_1Suite : public TestCommand -{ -public: - Test_TC_IDM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_1_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_IDM_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) - { - 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_IDM_2_1Suite : public TestCommand -{ -public: - Test_TC_IDM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_2_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_IDM_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) - { - 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_IDM_2_2Suite : public TestCommand -{ -public: - Test_TC_IDM_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_2_2", 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_IDM_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; - - 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_IDM_3_1Suite : public TestCommand -{ -public: - Test_TC_IDM_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_3_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_IDM_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 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_IDM_3_2Suite : public TestCommand -{ -public: - Test_TC_IDM_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_3_2", 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_IDM_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 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_IDM_4_1Suite : public TestCommand -{ -public: - Test_TC_IDM_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_4_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_IDM_4_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_IDM_4_2Suite : public TestCommand -{ -public: - Test_TC_IDM_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_4_2", 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_IDM_4_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; - - 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_IDM_4_3Suite : public TestCommand -{ -public: - Test_TC_IDM_4_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_4_3", 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_IDM_4_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) - { - 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_IDM_4_4Suite : public TestCommand -{ -public: - Test_TC_IDM_4_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_4_4", 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_IDM_4_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) - { - 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_IDM_5_1Suite : public TestCommand -{ -public: - Test_TC_IDM_5_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_5_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_IDM_5_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_IDM_5_2Suite : public TestCommand -{ -public: - Test_TC_IDM_5_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_5_2", 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_IDM_5_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; - - 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_IDM_6_1Suite : public TestCommand -{ -public: - Test_TC_IDM_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_6_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_IDM_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) - { - 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_IDM_6_2Suite : public TestCommand -{ -public: - Test_TC_IDM_6_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_6_2", 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_IDM_6_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; - - 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_IDM_6_3Suite : public TestCommand -{ -public: - Test_TC_IDM_6_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_6_3", 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_IDM_6_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) - { - 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_IDM_6_4Suite : public TestCommand -{ -public: - Test_TC_IDM_6_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_6_4", 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_IDM_6_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) - { - 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_IDM_7_1Suite : public TestCommand -{ -public: - Test_TC_IDM_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_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_IDM_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_IDM_8_1Suite : public TestCommand -{ -public: - Test_TC_IDM_8_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_8_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_IDM_8_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_IDM_10_1Suite : public TestCommand -{ -public: - Test_TC_IDM_10_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_10_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_IDM_10_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_IDM_11_1Suite : public TestCommand -{ -public: - Test_TC_IDM_11_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_IDM_11_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_IDM_11_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_LOWPOWER_2_2Suite : public TestCommand -{ -public: - Test_TC_LOWPOWER_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_LOWPOWER_2_2", 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_LOWPOWER_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; - - 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_APPLAUNCHER_3_7_1Suite : public TestCommand -{ -public: - Test_TC_APPLAUNCHER_3_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_APPLAUNCHER_3_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_APPLAUNCHER_3_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_APPLAUNCHER_3_8_1Suite : public TestCommand -{ -public: - Test_TC_APPLAUNCHER_3_8_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_APPLAUNCHER_3_8_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_APPLAUNCHER_3_8_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_APPLAUNCHER_3_9_1Suite : public TestCommand -{ -public: - Test_TC_APPLAUNCHER_3_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_APPLAUNCHER_3_9_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_APPLAUNCHER_3_9_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_MEDIAINPUT_3_14Suite : public TestCommand -{ -public: - Test_TC_MEDIAINPUT_3_14Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAINPUT_3_14", 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_MEDIAINPUT_3_14Suite() {} - - 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_MEDIAINPUT_3_15Suite : public TestCommand -{ -public: - Test_TC_MEDIAINPUT_3_15Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAINPUT_3_15", 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_MEDIAINPUT_3_15Suite() {} - - 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_MEDIAINPUT_3_16Suite : public TestCommand -{ -public: - Test_TC_MEDIAINPUT_3_16Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAINPUT_3_16", 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_MEDIAINPUT_3_16Suite() {} - - 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_MEDIAINPUT_3_17Suite : public TestCommand -{ -public: - Test_TC_MEDIAINPUT_3_17Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAINPUT_3_17", 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_MEDIAINPUT_3_17Suite() {} - - 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_CHANNEL_5_4Suite : public TestCommand -{ -public: - Test_TC_CHANNEL_5_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CHANNEL_5_4", 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_CHANNEL_5_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) - { - 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_CHANNEL_5_5Suite : public TestCommand -{ -public: - Test_TC_CHANNEL_5_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CHANNEL_5_5", 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_CHANNEL_5_5Suite() {} - - 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_CHANNEL_5_6Suite : public TestCommand -{ -public: - Test_TC_CHANNEL_5_6Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CHANNEL_5_6", 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_CHANNEL_5_6Suite() {} - - 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_KEYPADINPUT_3_1Suite : public TestCommand -{ -public: - Test_TC_KEYPADINPUT_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_KEYPADINPUT_3_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_KEYPADINPUT_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 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_MEDIAPLAYBACK_6_5Suite : public TestCommand -{ -public: - Test_TC_MEDIAPLAYBACK_6_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAPLAYBACK_6_5", 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_MEDIAPLAYBACK_6_5Suite() {} - - 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_MEDIAPLAYBACK_6_7Suite : public TestCommand -{ -public: - Test_TC_MEDIAPLAYBACK_6_7Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_MEDIAPLAYBACK_6_7", 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_MEDIAPLAYBACK_6_7Suite() {} - - 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_AUDIOOUTPUT_7_3Suite : public TestCommand -{ -public: - Test_TC_AUDIOOUTPUT_7_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_AUDIOOUTPUT_7_3", 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_AUDIOOUTPUT_7_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) - { - 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_AUDIOOUTPUT_7_4Suite : public TestCommand -{ -public: - Test_TC_AUDIOOUTPUT_7_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_AUDIOOUTPUT_7_4", 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_AUDIOOUTPUT_7_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) - { - 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_CONTENTLAUNCHER_10_4Suite : public TestCommand -{ -public: - Test_TC_CONTENTLAUNCHER_10_4Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CONTENTLAUNCHER_10_4", 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_CONTENTLAUNCHER_10_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) - { - 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_MC_11_1Suite : public TestCommand -{ -public: - Test_TC_MC_11_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_11_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_MC_11_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_MC_11_2Suite : public TestCommand -{ -public: - Test_TC_MC_11_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MC_11_2", 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_MC_11_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; - - 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_ALOGIN_12_2Suite : public TestCommand -{ -public: - Test_TC_ALOGIN_12_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_ALOGIN_12_2", 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_ALOGIN_12_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; - - 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_TGTNAV_8_2Suite : public TestCommand -{ -public: - Test_TC_TGTNAV_8_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TGTNAV_8_2", 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_TGTNAV_8_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; - - 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_CADMIN_1_1Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_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_CADMIN_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) - { - 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_CADMIN_1_2Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_2", 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_CADMIN_1_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; - - 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_CADMIN_1_7Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_7", 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_CADMIN_1_7Suite() {} - - 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_CADMIN_1_8Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_8", 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_CADMIN_1_8Suite() {} - - 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_CADMIN_1_11Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_11Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_11", 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_CADMIN_1_11Suite() {} - - 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_CADMIN_1_12Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_12Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_12", 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_CADMIN_1_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) - { - 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_CADMIN_1_14Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_14Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_14", 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_CADMIN_1_14Suite() {} - - 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_CADMIN_1_15Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_15Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_15", 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_CADMIN_1_15Suite() {} - - 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_CADMIN_1_16Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_16Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_16", 25, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("nodeId3", 0, UINT64_MAX, &mNodeId3); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("waitAfterCommissioning", 0, UINT16_MAX, &mWaitAfterCommissioning); - AddArgument("payload", &mPayload); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CADMIN_1_16Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - chip::Optional mNodeId; - chip::Optional mNodeId2; - chip::Optional mNodeId3; - chip::Optional mEndpoint; - chip::Optional mWaitAfterCommissioning; - chip::Optional mPayload; - chip::Optional mTimeout; - - uint8_t TH3FabricIndex; - uint8_t TH2FabricIndex; - - 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)); - shouldContinue = true; - 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)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH3FabricIndex = value; - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValue("fabrics[0].nodeID", iter_0.GetValue().nodeID, - mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 1)); - VerifyOrReturn(CheckValue("fabrics[1].nodeID", iter_0.GetValue().nodeID, - mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[1].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[1].fabricIndex", iter_0.GetValue().fabricIndex, 2U)); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 2)); - VerifyOrReturn(CheckValue("fabrics[2].nodeID", iter_0.GetValue().nodeID, - mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[2].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[2].fabricIndex", iter_0.GetValue().fabricIndex, 3U)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 3)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValue("fabrics[0].nodeID", iter_0.GetValue().nodeID, - mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 1)); - VerifyOrReturn(CheckValue("fabrics[1].nodeID", iter_0.GetValue().nodeID, - mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[1].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[1].fabricIndex", iter_0.GetValue().fabricIndex, 3U)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 2)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH2FabricIndex = value; - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValue("fabrics[0].nodeID", iter_0.GetValue().nodeID, - mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, 1U)); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 1)); - VerifyOrReturn(CheckValue("fabrics[1].nodeID", iter_0.GetValue().nodeID, - mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[1].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[1].fabricIndex", iter_0.GetValue().fabricIndex, 4U)); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 2)); - VerifyOrReturn(CheckValue("fabrics[2].nodeID", iter_0.GetValue().nodeID, - mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[2].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[2].fabricIndex", iter_0.GetValue().fabricIndex, 3U)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 3)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - return FactoryReset(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Factory Reset the DUT and enter 'y' after successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 1: TH_CR1 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2: TH_CR1 opens a commissioning window on DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 2a: Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 3: TH_CR2 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 6: { - LogStep(6, "Step 3a: DUT_CE is commissioned to TH_CR2"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 7: { - LogStep(7, "Step 4: TH_CR1 opens a commissioning window on DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 4a: Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 5: TH_CR3 Commissions with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityGamma, value); - } - case 10: { - LogStep(10, "Step 5a: DUT_CE is commissioned to TH_CR3"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL; - return WaitForCommissionee(kIdentityGamma, value); - } - case 11: { - LogStep(11, "Step 5b: TH3 reads CurrentFabricIndex attribute and save it for future use."); - return ReadAttribute(kIdentityGamma, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 6: TH_CR2 reads the list of Fabrics on DUT_CE"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::Fabrics::Id, false, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 7: TH_CR2 sends RemoveFabric with FabricIndex = 2 command to DUT_CE"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.C0a.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = 2U; - return SendCommand(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::Optional(10000), - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Step 8a: TH_CR2 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("chiptestgarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityBeta, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 8b: TH_CR2 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005 && 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 16: { - LogStep(16, "Step 9: TH_CR1 reads the list of Fabrics on DUT_CE"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::Fabrics::Id, false, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 11: TH_CR1 opens a commissioning window on DUT_CE using BCM"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 18: { - LogStep(18, "Step 11a: Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Step 12: TH_CR2 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 20: { - LogStep(20, "Step 12a: DUT_CE is commissioned to TH_CR2"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 21: { - LogStep(21, "Step 12b: TH2 reads CurrentFabricIndex attribute and save it for future use."); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 13: TH_CR1 reads the list of Fabrics on DUT_CE"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::Fabrics::Id, false, chip::NullOptional); - } - case 23: { - LogStep(23, "Step 13a: Remove TH2 FabricIndex"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.C0a.Rsp && CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = TH2FabricIndex; - return SendCommand(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::Optional(10000), - chip::NullOptional - - ); - } - case 24: { - LogStep(24, "Step 13b: Remove TH3 FabricIndex"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.C0a.Rsp && CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = TH3FabricIndex; - return SendCommand(kIdentityGamma, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::Optional(10000), - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CADMIN_1_17Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_17Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_17", 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_CADMIN_1_17Suite() {} - - 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_CADMIN_1_18Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_18Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_18", 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_CADMIN_1_18Suite() {} - - 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_CADMIN_1_19Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_19Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_19", 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_CADMIN_1_19Suite() {} - - 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_CADMIN_1_20Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_20Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_20", 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_CADMIN_1_20Suite() {} - - 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_CADMIN_1_21Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_21Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_21", 8, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - } - - ~Test_TC_CADMIN_1_21Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(950)); } - -private: - chip::Optional mNodeId; - chip::Optional mTimeout; - chip::Optional mEndpoint; - - 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)); - shouldContinue = true; - 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)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", 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, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - return FactoryReset(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Factory Reset the DUT and enter 'y' after successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 1: TH_CR1 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2: TH_CR1 opens a commissioning window on DUT_CE using BCM with a value of 900 seconds"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 900U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 3: Wait 901 seconds for commissioning Window to be closed"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 901000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 4: TH_CR1 reads the window status to verify the DUT_CE window is closed"); - VerifyOrDo(!ShouldSkip("CADMIN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5: TH_CR1 opens a commissioning window on DUT_CE using BCM with a value of 901 seconds"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 901U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Step 6: TH_CR1 reads the window status to verify the DUT_CE window is closed"); - VerifyOrDo(!ShouldSkip("CADMIN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CADMIN_1_22Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_22Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_22", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("PakeVerifier", &mPakeVerifier); - } - - ~Test_TC_CADMIN_1_22Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(950)); } - -private: - chip::Optional mNodeId; - chip::Optional mTimeout; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mPakeVerifier; - - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 0U)); - } - 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), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", 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, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - return FactoryReset(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Factory Reset the DUT and enter 'y' after successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 1: TH_CR1 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2: TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 900 seconds"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Step 2a: TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 900 seconds"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; - value.commissioningTimeout = 900U; - value.PAKEPasscodeVerifier = mPakeVerifier.HasValue() - ? mPakeVerifier.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\xb9\x61\x70\xaa\xe8\x03\x34\x68\x84\x72\x4f\xe9\xa3\xb2\x87\xc3\x03\x30\xc2\xa6\x60\x37\x5d\x17\xbb\x20" - "\x5a\x8c\xf1\xae\xcb\x35\x04\x57\xf8\xab\x79\xee\x25\x3a\xb6\xa8\xe4\x6b\xb0\x9e\x54\x3a\xe4\x22\x73\x6d" - "\xe5\x01\xe3\xdb\x37\xd4\x41\xfe\x34\x49\x20\xd0\x95\x48\xe4\xc1\x82\x40\x63\x0c\x4f\xf4\x91\x3c\x53\x51" - "\x38\x39\xb7\xc0\x7f\xcc\x06\x27\xa1\xb8\x57\x3a\x14\x9f\xcd\x1f\xa4\x66\xcf"), - 97); - value.discriminator = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - value.iterations = 1000UL; - value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 3: Wait for commissioning Window to 901 seconds"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 901000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 4: TH_CR1 reads the window status to verify the DUT_CE window is closed"); - VerifyOrDo(!ShouldSkip("CADMIN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5: TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 901 seconds"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 5a: TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 901 seconds"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; - value.commissioningTimeout = 901U; - value.PAKEPasscodeVerifier = mPakeVerifier.HasValue() - ? mPakeVerifier.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\xb9\x61\x70\xaa\xe8\x03\x34\x68\x84\x72\x4f\xe9\xa3\xb2\x87\xc3\x03\x30\xc2\xa6\x60\x37\x5d\x17\xbb\x20" - "\x5a\x8c\xf1\xae\xcb\x35\x04\x57\xf8\xab\x79\xee\x25\x3a\xb6\xa8\xe4\x6b\xb0\x9e\x54\x3a\xe4\x22\x73\x6d" - "\xe5\x01\xe3\xdb\x37\xd4\x41\xfe\x34\x49\x20\xd0\x95\x48\xe4\xc1\x82\x40\x63\x0c\x4f\xf4\x91\x3c\x53\x51" - "\x38\x39\xb7\xc0\x7f\xcc\x06\x27\xa1\xb8\x57\x3a\x14\x9f\xcd\x1f\xa4\x66\xcf"), - 97); - value.discriminator = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - value.iterations = 1000UL; - value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 6: TH_CR1 reads the window status to verify the DUT_CE window is closed"); - VerifyOrDo(!ShouldSkip("CADMIN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CADMIN_1_3Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_3", 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_CADMIN_1_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) - { - 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_CADMIN_1_4Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_4", 27, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("payload", &mPayload); - AddArgument("waitAfterCommissioning", 0, UINT16_MAX, &mWaitAfterCommissioning); - } - - ~Test_TC_CADMIN_1_4Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(300)); } - -private: - chip::Optional mNodeId; - chip::Optional mTimeout; - chip::Optional mNodeId2; - chip::Optional mEndpoint; - chip::Optional mPayload; - chip::Optional mWaitAfterCommissioning; - - uint8_t TH1FabricIndex; - uint8_t TH2FabricIndex; - - 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)); - shouldContinue = true; - 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))); - TH1FabricIndex = value; - } - 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)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - } - 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)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH2FabricIndex = value; - } - 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)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValue("fabrics[0].nodeID", iter_0.GetValue().nodeID, - mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, TH1FabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 1)); - VerifyOrReturn(CheckValue("fabrics[1].nodeID", iter_0.GetValue().nodeID, - mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[1].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[1].fabricIndex", iter_0.GetValue().fabricIndex, TH2FabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 2)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptorStruct::DecodableType> - value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); - VerifyOrReturn(CheckValue("fabrics[0].nodeID", iter_0.GetValue().nodeID, - mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[0].fabricIndex", iter_0.GetValue().fabricIndex, TH1FabricIndex)); - VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 1)); - VerifyOrReturn(CheckValue("fabrics[1].nodeID", iter_0.GetValue().nodeID, - mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL)); - VerifyOrReturn(CheckValueAsString("fabrics[1].label", iter_0.GetValue().label, chip::CharSpan("", 0))); - VerifyOrReturn(CheckValue("fabrics[1].fabricIndex", iter_0.GetValue().fabricIndex, TH2FabricIndex)); - VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 2)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("chiptest", 8))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - } - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("chiptest", 8))); - VerifyOrReturn(CheckConstraintType("value", "char_string", "char_string")); - VerifyOrReturn(CheckConstraintMaxLength("value", value, 32)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 0U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.HasValue(), true)); - VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.Value(), 9)); - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - return FactoryReset(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Factory Reset the DUT and enter 'y' after successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 1a: TH_CR1 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 1b: TH1 reads CurrentFabricIndex attribute and save it for future use."); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 2a: TH_CR1 opens a commissioning window on DUT_CE using BCM"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 2a: Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 2b: Verify that the DNS-SD advertisement shows CM=1"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("chiptestgarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 2d: TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 3a: TH_CR2 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 10: { - LogStep(10, "Step 3b: DUT_CE is commissioned by TH_CR2 on Fabric ID2 "); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 11: { - LogStep(11, "Step 3c: TH2 reads CurrentFabricIndex attribute and save it for future use."); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 4: Verify DUT_CE is now discoverable over DNS-SD with two SRV Records"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 5: TH_CR1 reads the list of Fabrics on DUT_CE"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::Fabrics::Id, false, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 6: TH_CR2 reads the list of Fabrics on DUT_CE"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::Fabrics::Id, false, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 7a: TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("chiptestgarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 16: { - LogStep(16, "Step 7b: TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 17: { - LogStep(17, "Step 8a: TH_CR2 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("chiptestgarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityBeta, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 8b: TH_CR2 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Step 9: TH_CR2 opens a commissioning window on DUT_CE using BCM"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityBeta, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 20: { - LogStep(20, "Step 10: Wait for the commissioning window in step 13 to timeout"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 180000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Step 11: TH_CR2 reads the window status to verify the DUT_CE window is closed"); - VerifyOrDo(!ShouldSkip("CADMIN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 12a: TH_CR2 opens a commissioning window on DUT_CE using BCM"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityBeta, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 23: { - LogStep(23, "Step 12b: Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 24: { - LogStep(24, "Step 13a: TH_CR1 starts a commissioning process with DUT_CE before the timeout from step 12"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityAlpha, value); - } - case 25: { - LogStep(25, "Step 13b: TH_CR2 revokes the commissioning window"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C02.Rsp && CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; - return SendCommand(kIdentityBeta, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Step 13c: Remove TH2 FabricIndex"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.C0a.Rsp && CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = TH2FabricIndex; - return SendCommand(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::Optional(10000), - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CADMIN_1_5Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_5", 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_CADMIN_1_5Suite() {} - - 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_CADMIN_1_6Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_6", 23, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("nodeIdForDuplicateCommissioning", 0, UINT64_MAX, &mNodeIdForDuplicateCommissioning); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("nodeId3", 0, UINT64_MAX, &mNodeId3); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("waitAfterCommissioning", 0, UINT16_MAX, &mWaitAfterCommissioning); - AddArgument("payload", &mPayload); - } - - ~Test_TC_CADMIN_1_6Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(300)); } - -private: - chip::Optional mNodeId; - chip::Optional mTimeout; - chip::Optional mNodeIdForDuplicateCommissioning; - chip::Optional mNodeId2; - chip::Optional mNodeId3; - chip::Optional mEndpoint; - chip::Optional mWaitAfterCommissioning; - chip::Optional mPayload; - - uint8_t TH2FabricIndex; - - 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)); - shouldContinue = true; - 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)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::CharSpan value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValueAsString("nodeLabel", value, chip::CharSpan("chiptest", 8))); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.HasValue(), true)); - VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.Value(), 2)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - TH2FabricIndex = value; - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.HasValue(), true)); - VerifyOrReturn(CheckValue("clusterStatus", status.mClusterStatus.Value(), 4)); - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - 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, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - return FactoryReset(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Factory Reset the DUT and enter 'y' after successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 1: TH_CR1 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2: TH_CR1 opens a commissioning window on DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 3: Verify that the DNS-SD advertisement shows CM=1"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Wait for PIXIT.CADMIN.CwDuration + 10"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 190000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 4: TH_CR2 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 7: { - LogStep(7, "Step 5: TH_CR1 opens a commissioning window on DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 6: TH_CR1 revokes the commissioning window on DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Step 7: TH_CR2 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 11: { - LogStep(11, "Step 8: TH_CR1 revokes the commissioning window on DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Step 9a: TH_CR1 writes the mandatory attribute NodeLabel of DUT_CE"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::CharSpan value; - value = chip::Span("chiptestgarbage: not in length on purpose", 8); - return WriteAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - value, chip::NullOptional, chip::NullOptional); - } - case 13: { - LogStep(13, "Step 9b: TH_CR1 read the mandatory attribute NodeLabel of DUT_CE"); - VerifyOrDo(!ShouldSkip("BINFO.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), BasicInformation::Id, BasicInformation::Attributes::NodeLabel::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, "Step 10: TH_CR1 opens a commissioning window on DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 16: { - LogStep(16, "Step 11: TH_CR1 opens another commissioning window on DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Step 12: TH_CR2 starts a commissioning process on DUT_CE"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 18: { - LogStep(18, "DUT_CE is commissioned by TH_CR2"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - return WaitForCommissionee(kIdentityBeta, value); - } - case 19: { - LogStep(19, "TH2 reads CurrentFabricIndex attribute and save it for future use."); - return ReadAttribute(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Attributes::CurrentFabricIndex::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "Step 13: TH_CR1 tries to revoke the commissioning window on DUT_CE using RevokeCommissioning command"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C02.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::RevokeCommissioning::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 21: { - LogStep(21, "Step 14: TH_CR3 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL; - value.payload = mPayload.HasValue() ? mPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityGamma, value); - } - case 22: { - LogStep(22, "Remove TH2 FabricIndex"); - VerifyOrDo(!ShouldSkip("OPCREDS.S.C0a.Rsp && CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type value; - value.fabricIndex = TH2FabricIndex; - return SendCommand(kIdentityBeta, GetEndpoint(0), OperationalCredentials::Id, - OperationalCredentials::Commands::RemoveFabric::Id, value, chip::Optional(10000), - chip::NullOptional - - ); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CADMIN_1_9Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CADMIN_1_9", 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_CADMIN_1_9Suite() {} - - 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_CADMIN_1_10Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_10Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_10", 28, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("nodeIdForDuplicateCommissioning", 0, UINT64_MAX, &mNodeIdForDuplicateCommissioning); - AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); - AddArgument("nodeId3", 0, UINT64_MAX, &mNodeId3); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("waitAfterCommissioning", 0, UINT16_MAX, &mWaitAfterCommissioning); - AddArgument("correctPayload", &mCorrectPayload); - AddArgument("incorrectSetupCodePayload", &mIncorrectSetupCodePayload); - } - - ~Test_TC_CADMIN_1_10Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(700)); } - -private: - chip::Optional mNodeId; - chip::Optional mTimeout; - chip::Optional mNodeIdForDuplicateCommissioning; - chip::Optional mNodeId2; - chip::Optional mNodeId3; - chip::Optional mEndpoint; - chip::Optional mWaitAfterCommissioning; - chip::Optional mCorrectPayload; - chip::Optional mIncorrectSetupCodePayload; - - 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)); - shouldContinue = true; - 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)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); - shouldContinue = true; - 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, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - return FactoryReset(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Factory Reset the DUT and enter 'y' after successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 1: TH_CR1 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2: TH_CR1 opens a commissioning window on DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 900U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 2a: Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 3: Verify that the DNS-SD advertisement shows CM=1"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 4.1: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 7: { - LogStep(7, "Step 4.2: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 8: { - LogStep(8, "Step 4.3: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 9: { - LogStep(9, "Step 4.4: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 10: { - LogStep(10, "Step 4.5: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 11: { - LogStep(11, "Step 4.6: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 12: { - LogStep(12, "Step 4.7: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 13: { - LogStep(13, "Step 4.8: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 14: { - LogStep(14, "Step 4.9: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 15: { - LogStep(15, "Step 4.10: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 16: { - LogStep(16, "Step 4.11: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 17: { - LogStep(17, "Step 4.12: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 18: { - LogStep(18, "Step 4.13: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 19: { - LogStep(19, "Step 4.14: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 20: { - LogStep(20, "Step 4.15: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 21: { - LogStep(21, "Step 4.16: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 22: { - LogStep(22, "Step 4.17: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 23: { - LogStep(23, "Step 4.18: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 24: { - LogStep(24, "Step 4.19: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 25: { - LogStep(25, "Step 4.20: TH_CR2 starts a commissioning process with DUT_CE using Invalid setup code"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = mIncorrectSetupCodePayload.HasValue() ? mIncorrectSetupCodePayload.Value() - : chip::Span("MT:-24J0AFN00I.0648G00", 22); - value.discoverOnce.Emplace(); - value.discoverOnce.Value() = true; - return PairWithCode(kIdentityBeta, value); - } - case 26: { - LogStep(26, "Step 5a: TH_CR2 attempts to do PASE to DUT_CE using the correct onboarding payload"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL; - value.payload = - mCorrectPayload.HasValue() ? mCorrectPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityBeta, value); - } - case 27: { - LogStep(27, "Step 5b: TH_CR3 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::CommissionerCommands::Commands::PairWithCode::Type value; - value.nodeId = mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL; - value.payload = - mCorrectPayload.HasValue() ? mCorrectPayload.Value() : chip::Span("MT:-24J0AFN00KA0648G00", 22); - return PairWithCode(kIdentityGamma, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CADMIN_1_13Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_13Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_13", 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_CADMIN_1_13Suite() {} - - 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_CADMIN_1_23Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_23Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_23", 8, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - } - - ~Test_TC_CADMIN_1_23Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(200)); } - -private: - chip::Optional mNodeId; - chip::Optional mTimeout; - chip::Optional mEndpoint; - - 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)); - shouldContinue = true; - 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)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 0U)); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", 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, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - return FactoryReset(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Factory Reset the DUT and enter 'y' after successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 1: TH_CR1 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2: TH_CR1 opens a commissioning window on DUT_CE using BCM with a value of 180 seconds"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Step 3: Wait for 181 seconds for commissioning Window to be closed"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 181000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, "Step 4: TH_CR1 reads the window status to verify the DUT_CE window is closed"); - VerifyOrDo(!ShouldSkip("CADMIN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 6: { - LogStep(6, "Step 5: TH_CR1 opens a commissioning window on DUT_CE using BCM with a value of 179 seconds"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 179U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 7: { - LogStep(7, "Step 6: TH_CR1 reads the window status to verify the DUT_CE window is closed"); - VerifyOrDo(!ShouldSkip("CADMIN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CADMIN_1_24Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_24Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_24", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("PakeVerifier", &mPakeVerifier); - } - - ~Test_TC_CADMIN_1_24Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(200)); } - -private: - chip::Optional mNodeId; - chip::Optional mTimeout; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mPakeVerifier; - - 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)); - shouldContinue = true; - 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)); - shouldContinue = true; - 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::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", value, 0U)); - } - 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), EMBER_ZCL_STATUS_INVALID_COMMAND)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatusEnum value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("windowStatus", 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, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::FactoryReset::Type value; - return FactoryReset(kIdentityAlpha, value); - } - case 1: { - LogStep(1, "Precondition: Reset Devices to factory defaults"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = - chip::Span("Factory Reset the DUT and enter 'y' after successgarbage: not in length on purpose", 49); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 2: { - LogStep(2, "Step 1: TH_CR1 starts a commissioning process with DUT_CE"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "Step 2: TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 180 seconds"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Step 2a: TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 180 seconds"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - value.PAKEPasscodeVerifier = mPakeVerifier.HasValue() - ? mPakeVerifier.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\xb9\x61\x70\xaa\xe8\x03\x34\x68\x84\x72\x4f\xe9\xa3\xb2\x87\xc3\x03\x30\xc2\xa6\x60\x37\x5d\x17\xbb\x20" - "\x5a\x8c\xf1\xae\xcb\x35\x04\x57\xf8\xab\x79\xee\x25\x3a\xb6\xa8\xe4\x6b\xb0\x9e\x54\x3a\xe4\x22\x73\x6d" - "\xe5\x01\xe3\xdb\x37\xd4\x41\xfe\x34\x49\x20\xd0\x95\x48\xe4\xc1\x82\x40\x63\x0c\x4f\xf4\x91\x3c\x53\x51" - "\x38\x39\xb7\xc0\x7f\xcc\x06\x27\xa1\xb8\x57\x3a\x14\x9f\xcd\x1f\xa4\x66\xcf"), - 97); - value.discriminator = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - value.iterations = 1000UL; - value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 5: { - LogStep(5, "Step 3: Wait for commissioning Window to 181 seconds"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 181000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 6: { - LogStep(6, "Step 4: TH_CR1 reads the window status to verify the DUT_CE window is closed"); - VerifyOrDo(!ShouldSkip("CADMIN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 5: TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 179 seconds"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 5a: TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 179 seconds"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; - value.commissioningTimeout = 179U; - value.PAKEPasscodeVerifier = mPakeVerifier.HasValue() - ? mPakeVerifier.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\xb9\x61\x70\xaa\xe8\x03\x34\x68\x84\x72\x4f\xe9\xa3\xb2\x87\xc3\x03\x30\xc2\xa6\x60\x37\x5d\x17\xbb\x20" - "\x5a\x8c\xf1\xae\xcb\x35\x04\x57\xf8\xab\x79\xee\x25\x3a\xb6\xa8\xe4\x6b\xb0\x9e\x54\x3a\xe4\x22\x73\x6d" - "\xe5\x01\xe3\xdb\x37\xd4\x41\xfe\x34\x49\x20\xd0\x95\x48\xe4\xc1\x82\x40\x63\x0c\x4f\xf4\x91\x3c\x53\x51" - "\x38\x39\xb7\xc0\x7f\xcc\x06\x27\xa1\xb8\x57\x3a\x14\x9f\xcd\x1f\xa4\x66\xcf"), - 97); - value.discriminator = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - value.iterations = 1000UL; - value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 9: { - LogStep(9, "Step 6: TH_CR1 reads the window status to verify the DUT_CE window is closed"); - VerifyOrDo(!ShouldSkip("CADMIN.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Attributes::WindowStatus::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CADMIN_1_25Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_25Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_25", 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_CADMIN_1_25Suite() {} - - 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_CADMIN_1_26Suite : public TestCommand -{ -public: - Test_TC_CADMIN_1_26Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_CADMIN_1_26", 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_CADMIN_1_26Suite() {} - - 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_MOD_1_2Suite : public TestCommand -{ -public: - Test_TC_MOD_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_1_2", 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_MOD_1_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; - - 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_MOD_1_3Suite : public TestCommand -{ -public: - Test_TC_MOD_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_1_3", 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_MOD_1_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) - { - 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_MOD_2_2Suite : public TestCommand -{ -public: - Test_TC_MOD_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_MOD_2_2", 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_MOD_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; - - 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_SU_1_1Suite : public TestCommand -{ -public: - Test_TC_SU_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_1_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_SU_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) - { - 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_SU_2_1Suite : public TestCommand -{ -public: - Test_TC_SU_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_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_SU_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) - { - 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_SU_2_2Suite : public TestCommand -{ -public: - Test_TC_SU_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_2", 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_SU_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; - - 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_SU_2_3Suite : public TestCommand -{ -public: - Test_TC_SU_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_3", 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_SU_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) - { - 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_SU_2_4Suite : public TestCommand -{ -public: - Test_TC_SU_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_4", 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_SU_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) - { - 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_SU_2_5Suite : public TestCommand -{ -public: - Test_TC_SU_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_5", 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_SU_2_5Suite() {} - - 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_SU_2_6Suite : public TestCommand -{ -public: - Test_TC_SU_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_6", 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_SU_2_6Suite() {} - - 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_SU_2_7Suite : public TestCommand -{ -public: - Test_TC_SU_2_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_7", 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_SU_2_7Suite() {} - - 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_SU_2_8Suite : public TestCommand -{ -public: - Test_TC_SU_2_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_2_8", 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_SU_2_8Suite() {} - - 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_SU_3_1Suite : public TestCommand -{ -public: - Test_TC_SU_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_3_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_SU_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 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_SU_3_2Suite : public TestCommand -{ -public: - Test_TC_SU_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_3_2", 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_SU_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 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_SU_3_3Suite : public TestCommand -{ -public: - Test_TC_SU_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_3_3", 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_SU_3_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) - { - 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_SU_3_4Suite : public TestCommand -{ -public: - Test_TC_SU_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_3_4", 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_SU_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 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_SU_4_1Suite : public TestCommand -{ -public: - Test_TC_SU_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_4_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_SU_4_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_SU_4_2Suite : public TestCommand -{ -public: - Test_TC_SU_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SU_4_2", 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_SU_4_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; - - 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_PSCFG_2_2Suite : public TestCommand -{ -public: - Test_TC_PSCFG_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PSCFG_2_2", 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_PSCFG_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; - - 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_SC_1_1Suite : public TestCommand -{ -public: - Test_TC_SC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_1_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_SC_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) - { - 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_SC_1_2Suite : public TestCommand -{ -public: - Test_TC_SC_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_1_2", 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_SC_1_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; - - 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_SC_1_3Suite : public TestCommand -{ -public: - Test_TC_SC_1_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_1_3", 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_SC_1_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) - { - 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_SC_1_4Suite : public TestCommand -{ -public: - Test_TC_SC_1_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_1_4", 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_SC_1_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) - { - 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_SC_2_1Suite : public TestCommand -{ -public: - Test_TC_SC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_2_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_SC_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) - { - 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_SC_2_2Suite : public TestCommand -{ -public: - Test_TC_SC_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_2_2", 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_SC_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; - - 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_SC_2_3Suite : public TestCommand -{ -public: - Test_TC_SC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_2_3", 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_SC_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) - { - 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_SC_2_4Suite : public TestCommand -{ -public: - Test_TC_SC_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_2_4", 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_SC_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) - { - 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_SC_3_1Suite : public TestCommand -{ -public: - Test_TC_SC_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_3_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_SC_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 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_SC_3_2Suite : public TestCommand -{ -public: - Test_TC_SC_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_3_2", 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_SC_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 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_SC_3_3Suite : public TestCommand -{ -public: - Test_TC_SC_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_3_3", 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_SC_3_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) - { - 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_SC_3_4Suite : public TestCommand -{ -public: - Test_TC_SC_3_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_3_4", 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_SC_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 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_SC_4_1Suite : public TestCommand -{ -public: - Test_TC_SC_4_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_1", 99, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); - AddArgument("shortDiscriminator", 0, UINT16_MAX, &mShortDiscriminator); - AddArgument("vendorId", 0, UINT16_MAX, &mVendorId); - AddArgument("productId", 0, UINT16_MAX, &mProductId); - AddArgument("deviceType", 0, UINT16_MAX, &mDeviceType); - AddArgument("PakeVerifier", &mPakeVerifier); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("waitAfterCommissioning", 0, UINT16_MAX, &mWaitAfterCommissioning); - } - - ~Test_TC_SC_4_1Suite() - { - if (deviceInstanceNameBeforeRebootBuffer != nullptr) - { - chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); - deviceInstanceNameBeforeRebootBuffer = nullptr; - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(900)); } - -private: - chip::Optional mNodeId; - chip::Optional mEndpoint; - chip::Optional mDiscriminator; - chip::Optional mShortDiscriminator; - chip::Optional mVendorId; - chip::Optional mProductId; - chip::Optional mDeviceType; - chip::Optional mPakeVerifier; - chip::Optional mTimeout; - chip::Optional mWaitAfterCommissioning; - - char * deviceInstanceNameBeforeRebootBuffer = nullptr; - chip::CharSpan deviceInstanceNameBeforeReboot; - - 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::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); - if (deviceInstanceNameBeforeRebootBuffer != nullptr) - { - chip::Platform::MemoryFree(deviceInstanceNameBeforeRebootBuffer); - } - deviceInstanceNameBeforeRebootBuffer = static_cast(chip::Platform::MemoryAlloc(value.instanceName.size())); - memcpy(deviceInstanceNameBeforeRebootBuffer, value.instanceName.data(), value.instanceName.size()); - deviceInstanceNameBeforeReboot = chip::CharSpan(deviceInstanceNameBeforeRebootBuffer, value.instanceName.size()); - } - shouldContinue = true; - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); - VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); - } - shouldContinue = true; - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); - VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); - } - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("longDiscriminator", value.longDiscriminator, - mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U)); - VerifyOrReturn(CheckConstraintMinValue("value.longDiscriminator", value.longDiscriminator, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value.longDiscriminator", value.longDiscriminator, 4096U)); - } - shouldContinue = true; - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); - } - shouldContinue = true; - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); - } - shouldContinue = true; - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (value.mrpRetryIntervalIdle.HasValue()) - { - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), - 3600000UL)); - } - } - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (value.mrpRetryIntervalActive.HasValue()) - { - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", - value.mrpRetryIntervalActive.Value(), 3600000UL)); - } - } - shouldContinue = true; - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 1U)); - } - shouldContinue = true; - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceType", value.deviceType, mDeviceType.HasValue() ? mDeviceType.Value() : 65535UL)); - } - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName, 32)); - } - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); - } - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); - } - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction, 128)); - } - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1U)); - } - shouldContinue = true; - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintNotValue("value.instanceName", value.instanceName, deviceInstanceNameBeforeReboot)); - } - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); - VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); - } - shouldContinue = true; - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); - VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); - } - shouldContinue = true; - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("longDiscriminator", value.longDiscriminator, - mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U)); - VerifyOrReturn(CheckConstraintMinValue("value.longDiscriminator", value.longDiscriminator, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value.longDiscriminator", value.longDiscriminator, 4096U)); - } - shouldContinue = true; - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); - } - shouldContinue = true; - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); - } - shouldContinue = true; - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (value.mrpRetryIntervalIdle.HasValue()) - { - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), - 3600000UL)); - } - } - shouldContinue = true; - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (value.mrpRetryIntervalActive.HasValue()) - { - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", - value.mrpRetryIntervalActive.Value(), 3600000UL)); - } - } - shouldContinue = true; - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 1U)); - } - shouldContinue = true; - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceType", value.deviceType, mDeviceType.HasValue() ? mDeviceType.Value() : 65535UL)); - } - shouldContinue = true; - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName, 32)); - } - shouldContinue = true; - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); - } - shouldContinue = true; - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); - } - shouldContinue = true; - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction, 128)); - } - shouldContinue = true; - break; - case 51: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1U)); - } - shouldContinue = true; - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); - } - shouldContinue = true; - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); - VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); - } - shouldContinue = true; - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); - VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); - } - shouldContinue = true; - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 60: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 61: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 62: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 63: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 64: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); - } - shouldContinue = true; - break; - case 65: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); - } - shouldContinue = true; - break; - case 66: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (value.mrpRetryIntervalIdle.HasValue()) - { - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), - 3600000UL)); - } - } - shouldContinue = true; - break; - case 67: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (value.mrpRetryIntervalActive.HasValue()) - { - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", - value.mrpRetryIntervalActive.Value(), 3600000UL)); - } - } - shouldContinue = true; - break; - case 68: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 69: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 2U)); - } - shouldContinue = true; - break; - case 70: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceType", value.deviceType, mDeviceType.HasValue() ? mDeviceType.Value() : 65535UL)); - } - shouldContinue = true; - break; - case 71: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName, 32)); - } - shouldContinue = true; - break; - case 72: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); - } - shouldContinue = true; - break; - case 73: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); - } - shouldContinue = true; - break; - case 74: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction, 128)); - } - shouldContinue = true; - break; - case 75: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1U)); - } - shouldContinue = true; - break; - case 76: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 77: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 78: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); - } - shouldContinue = true; - break; - case 79: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 80: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); - VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); - } - shouldContinue = true; - break; - case 81: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinLength("value.hostName", value.hostName, 12)); - VerifyOrReturn(CheckConstraintMaxLength("value.hostName", value.hostName, 16)); - VerifyOrReturn(CheckConstraintIsUpperCase("value.hostName", value.hostName, true)); - VerifyOrReturn(CheckConstraintIsHexString("value.hostName", value.hostName, true)); - } - shouldContinue = true; - break; - case 82: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 83: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 84: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 85: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 86: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 87: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("longDiscriminator", value.longDiscriminator, - mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U)); - VerifyOrReturn(CheckConstraintMinValue("value.longDiscriminator", value.longDiscriminator, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value.longDiscriminator", value.longDiscriminator, 4096U)); - } - shouldContinue = true; - break; - case 88: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); - } - shouldContinue = true; - break; - case 89: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); - } - shouldContinue = true; - break; - case 90: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (value.mrpRetryIntervalIdle.HasValue()) - { - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), - 3600000UL)); - } - } - shouldContinue = true; - break; - case 91: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - if (value.mrpRetryIntervalActive.HasValue()) - { - VerifyOrReturn(CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", - value.mrpRetryIntervalActive.Value(), 3600000UL)); - } - } - shouldContinue = true; - break; - case 92: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - } - shouldContinue = true; - break; - case 93: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 0U)); - } - shouldContinue = true; - break; - case 94: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("deviceType", value.deviceType, mDeviceType.HasValue() ? mDeviceType.Value() : 65535UL)); - } - shouldContinue = true; - break; - case 95: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName, 32)); - } - shouldContinue = true; - break; - case 96: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); - } - shouldContinue = true; - break; - case 97: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value.pairingHint", value.pairingHint, 0U)); - } - shouldContinue = true; - break; - case 98: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::app::Clusters::DiscoveryCommands::Commands::DiscoveryCommandResponse::DecodableType value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction, 128)); - } - shouldContinue = true; - 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 1a: DUT is put in Commissioning Mode using Open Basic Commissioning Window command "); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 2: { - LogStep(2, "Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, - "Step 2a: Check DNS-SD instance name must be 64-bit randomly selected ID expressed as a sixteen-char hex " - "string with capital letters"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 4: { - LogStep(4, "Step 2b: Service type must be _matterc._udp"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 2c: Check target hostname is derived from the 48bit or 64bit MAC address expressed as a twelve or " - "sixteen capital letter hex string"); - VerifyOrDo(!ShouldSkip("( MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 6: { - LogStep(6, - "Step 2c: Check target hostname is derived from the 48bit or 64bit MAC address expressed as a twelve or " - "sixteen capital letter hex string"); - VerifyOrDo(!ShouldSkip("(!MCORE.COM.WIFI && !MCORE.COM.WIFI) && MCORE.COM.THR"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2d: Check Long Discriminator _L"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByLongDiscriminator::Type value; - value.value = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840ULL; - return FindCommissionableByLongDiscriminator(kIdentityAlpha, value); - } - case 8: { - LogStep(8, "Step 2d: Check Short Discriminator (_S)"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByShortDiscriminator::Type value; - value.value = mShortDiscriminator.HasValue() ? mShortDiscriminator.Value() : 15ULL; - return FindCommissionableByShortDiscriminator(kIdentityAlpha, value); - } - case 9: { - LogStep(9, - "Step 2e: If (MCORE.SC.VENDOR_SUBTYPE) present, subtype _V is present must be 16-bit vendor id, encoded " - "as a variable-length decimal number in ASCII text, omitting any leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByVendorId::Type value; - value.value = mVendorId.HasValue() ? mVendorId.Value() : 65521ULL; - return FindCommissionableByVendorId(kIdentityAlpha, value); - } - case 10: { - LogStep(10, - "Step 2f: If (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, represents device type from " - "Data Model and must be represented as a variable length decimal number in ASCII without leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DEVTYPE_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByDeviceType::Type value; - value.value = mDeviceType.HasValue() ? mDeviceType.Value() : 65535ULL; - return FindCommissionableByDeviceType(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2g: Check Commissioning Mode (_CM) subtype _CM must be present"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByCommissioningMode::Type value; - return FindCommissionableByCommissioningMode(kIdentityAlpha, value); - } - case 12: { - LogStep(12, - "Step 2h: key D must be present and represents the discriminator which must be encoded as a variable-length " - "decimal value with up to 4 digits omitting any leading zeros"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 2i: If (MCORE.SC.VP_KEY) present, VP key must contain at least Vendor ID is present"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Step 2j: If (MCORE.SC.VP_KEY) present, VP key must contain at least Product ID is present"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 15: { - LogStep(15, - "Step 2k: If (MCORE.SC.SII_OP_DISCOVERY_KEY) present, SII key must be an unsigned integer with units of " - "milliseconds and shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall " - "not exceed 3600000"); - VerifyOrDo(!ShouldSkip("MCORE.SC.SII_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 16: { - LogStep(16, - "Step 2l: If (MCORE.SC.SAI_OP_DISCOVERY_KEY ) present, SAI key must be an unsigned integer with units of " - "milliseconds and shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall " - "not exceed 3600000."); - VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 17: { - LogStep(17, - "Step 2m: If (MCORE.SC.SAT_OP_DISCOVERY_KEY) present, SAT key must be an unsigned integer with units of " - "milliseconds and shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall " - "not exceed 65535."); - VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 2n: TXT key for commissioning mode (CM) CM=1 must be present"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 19: { - LogStep(19, - "Step 2o: If (MCORE.SC.DT_KEY) present, DT key must contain the device type identifier from Data Model Device " - "Types and must be encoded as a variable length decimal ASCII number without leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DT_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 20: { - LogStep(20, - "Step 2p: If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string with a maximum length of 32B"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DN_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 21: { - LogStep(21, - "Step 2q: If (MCORE.SC.RI_KEY ) present, key RI must include the Rotating Device Identifier encoded as a " - "uppercase string with a maximum length of 100 chars"); - VerifyOrDo(!ShouldSkip("MCORE.SC.RI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 22: { - LogStep(22, - "Step 2r: If (MCORE.SC.PH_KEY) present, key PH must be encoded as a variable-length decimal number in ASCII " - "text, omitting any leading zeros. If present value must be different of 0"); - VerifyOrDo(!ShouldSkip("MCORE.SC.PH_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 23: { - LogStep(23, - "Step 2s: If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 string with a maximum length " - "of 128 bytes"); - VerifyOrDo(!ShouldSkip("MCORE.SC.PI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 24: { - LogStep(24, - "Step 2t: DUT must publish AAAA records for each IPv6 address upon which they are willing to accept Matter " - "messages."); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 25: { - LogStep(25, "Step 3: Reboot/restart the DUT"); - VerifyOrDo(!ShouldSkip("PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::SystemCommands::Commands::Reboot::Type value; - return Reboot(kIdentityAlpha, value); - } - case 26: { - LogStep(26, "Step 3: Reboot target device(DUT)"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - 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(kIdentityAlpha, value); - } - case 27: { - LogStep(27, "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 28: { - LogStep(28, - "Step 3a: DUT put in Commissioning Mode using Open Basic Commissioning Window command, starting advertising " - "Commissionable Node Discovery service using DNS-SD"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 29: { - LogStep(29, "Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 30: { - LogStep(30, - "Step 4a: Check DNS-SD instance name must be 64-bit randomly selected ID expressed as a sixteen-char hex " - "string with capital letters and must be different from the one at step 2"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 31: { - LogStep(31, "Step 4b: service type must be _matterc._udp"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 32: { - LogStep(32, - "Step 4c: Check Hostname. If (MCORE.COM.WIFI) OR (MCORE.COM.ETH) target hostname is derived from the 48bit or " - "64bit MAC address expressed as a twelve or sixteen capital letter hex string"); - VerifyOrDo(!ShouldSkip("(MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 33: { - LogStep(33, - "Step 4c: Check Hostname. If (MCORE.COM.THR) target hostname is derived from the 48bit or 64bit MAC address " - "expressed as a twelve or sixteen capital letter hex string"); - VerifyOrDo(!ShouldSkip("(!MCORE.COM.WIFI && !MCORE.COM.ETH) && MCORE.COM.THR"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 34: { - LogStep(34, "Step 4d: Check Long Discriminator _L"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByLongDiscriminator::Type value; - value.value = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840ULL; - return FindCommissionableByLongDiscriminator(kIdentityAlpha, value); - } - case 35: { - LogStep(35, "Step 4e: Check Short Discriminator (_S)"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByShortDiscriminator::Type value; - value.value = mShortDiscriminator.HasValue() ? mShortDiscriminator.Value() : 15ULL; - return FindCommissionableByShortDiscriminator(kIdentityAlpha, value); - } - case 36: { - LogStep(36, - "Step 4f: If (MCORE.SC.VENDOR_SUBTYPE ) present, subtype _V is present must be 16-bit vendor id, " - "encoded as a variable-length decimal number in ASCII text, omitting any leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByVendorId::Type value; - value.value = mVendorId.HasValue() ? mVendorId.Value() : 65521ULL; - return FindCommissionableByVendorId(kIdentityAlpha, value); - } - case 37: { - LogStep(37, - "Step 4g: If (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, represents device type from " - "Data Model and must be represented as a variable length decimal number in ASCII without leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DEVTYPE_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByDeviceType::Type value; - value.value = mDeviceType.HasValue() ? mDeviceType.Value() : 65535ULL; - return FindCommissionableByDeviceType(kIdentityAlpha, value); - } - case 38: { - LogStep(38, "Step 4h: Check Commissioning Mode (_CM) subtype _CM is present"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByCommissioningMode::Type value; - return FindCommissionableByCommissioningMode(kIdentityAlpha, value); - } - case 39: { - LogStep(39, - "Step 4i: key D must be present and represents the discriminator which must be encoded as a variable-length " - "decimal value with up to 4 digits omitting any leading zeros"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 40: { - LogStep(40, "Step 4j: If (MCORE.SC.VP_KEY) present, VP key must contain at least Vendor ID is present."); - VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 41: { - LogStep(41, "Step 4k: If (MCORE.SC.VP_KEY) present, VP key must contain at least Product ID is present."); - VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 42: { - LogStep(42, - "Step 4l: If (MCORE.SC.SII_OP_DISCOVERY_KEY ) present, SII key must be an unsigned integer with units of " - "milliseconds and shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall " - "not exceed 3600000"); - VerifyOrDo(!ShouldSkip("MCORE.SC.SII_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 43: { - LogStep(43, - "Step 4m: If (MCORE.SC.SAI_OP_DISCOVERY_KEY) present, SAI key must be an unsigned integer with units of " - "milliseconds and shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall " - "not exceed 3600000."); - VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 44: { - LogStep(44, - "Step 4n: If (MCORE.SC.SAT_OP_DISCOVERY_KEY) present, SAT key must be an unsigned integer with units of " - "milliseconds and shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall " - "not exceed 65535."); - VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 45: { - LogStep(45, "Step 4o: TXT key for commissioning mode (CM) key CM=1 must be present"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 46: { - LogStep(46, - "Step 4p: If (MCORE.SC.DT_KEY) present, DT key must contain the device type identifier from Data Model Device " - "Types and must be encoded as a variable length decimal ASCII number without leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DT_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 47: { - LogStep(47, - "Step 4q: If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string with a maximum length of 32B"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DN_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 48: { - LogStep(48, - "Step 4r: If (MCORE.SC.RI_KEY) present, key RI must include the Rotating Device Identifier encoded as a " - "uppercase string with a maximum length of 100 chars"); - VerifyOrDo(!ShouldSkip("MCORE.SC.RI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 49: { - LogStep(49, - "Step 4s: If (MCORE.SC.PH_KEY) present, key PH must be encoded as a variable-length decimal number in ASCII " - "text, omitting any leading zeros. If present value must be different of 0"); - VerifyOrDo(!ShouldSkip("MCORE.SC.PH_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 50: { - LogStep(50, - "Step 4t: If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 string with a maximum length " - "of 128 bytes"); - VerifyOrDo(!ShouldSkip("MCORE.SC.PI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 51: { - LogStep(51, - "Step 4u: DUT must publish AAAA records for each IPv6 address upon which they are willing to accept Matter " - "messages."); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 52: { - LogStep(52, "Step 5: Wait for OpenBasicCommissioningWindow timeout to expire"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 180000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 53: { - LogStep(53, - "Step 6: DUT is Commissioned and instructed to enter in commissioning mode using Open Commissioning Window " - "command"); - VerifyOrDo(!ShouldSkip("CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type value; - value.commissioningTimeout = 180U; - value.PAKEPasscodeVerifier = mPakeVerifier.HasValue() - ? mPakeVerifier.Value() - : chip::ByteSpan( - chip::Uint8::from_const_char( - "\xb9\x61\x70\xaa\xe8\x03\x34\x68\x84\x72\x4f\xe9\xa3\xb2\x87\xc3\x03\x30\xc2\xa6\x60\x37\x5d\x17\xbb\x20" - "\x5a\x8c\xf1\xae\xcb\x35\x04\x57\xf8\xab\x79\xee\x25\x3a\xb6\xa8\xe4\x6b\xb0\x9e\x54\x3a\xe4\x22\x73\x6d" - "\xe5\x01\xe3\xdb\x37\xd4\x41\xfe\x34\x49\x20\xd0\x95\x48\xe4\xc1\x82\x40\x63\x0c\x4f\xf4\x91\x3c\x53\x51" - "\x38\x39\xb7\xc0\x7f\xcc\x06\x27\xa1\xb8\x57\x3a\x14\x9f\xcd\x1f\xa4\x66\xcf"), - 97); - value.discriminator = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U; - value.iterations = 1000UL; - value.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); - return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, - AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, value, - chip::Optional(10000), chip::NullOptional - - ); - } - case 54: { - LogStep(54, - "Step 6: DUT is Commissioned and instructed to enter in commissioning mode using Open Commissioning Window " - "command"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 55: { - LogStep(55, "Waiting after opening commissioning window"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = mWaitAfterCommissioning.HasValue() ? mWaitAfterCommissioning.Value() : 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 56: { - LogStep(56, - "Step 7a: DNS-SD instance name must be 64-bit randomly selected ID expressed as a sixteen-char hex string with " - "capital letters"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 57: { - LogStep(57, - "Step 7b: Check Hostname.If (MCORE.COM.WIFI) OR (MCORE.COM.ETH) target hostname is derived from the 48bit or " - "64bit MAC address expressed as a twelve or sixteen capital letter hex string."); - VerifyOrDo(!ShouldSkip("(MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 58: { - LogStep(58, - "Step 7b: Check Hostname. If (MCORE.COM.THR) target hostname is derived from the 48bit or 64bit MAC extended " - "address expressed as a twelve or sixteen capital letter hex string."); - VerifyOrDo(!ShouldSkip("(!MCORE.COM.WIFI && !MCORE.COM.ETH) && MCORE.COM.THR"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 59: { - LogStep(59, "Step 7c: Check Long Discriminator _L"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByLongDiscriminator::Type value; - value.value = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840ULL; - return FindCommissionableByLongDiscriminator(kIdentityAlpha, value); - } - case 60: { - LogStep(60, "Step 7d: Check Short Discriminator (_S)"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByShortDiscriminator::Type value; - value.value = mShortDiscriminator.HasValue() ? mShortDiscriminator.Value() : 15ULL; - return FindCommissionableByShortDiscriminator(kIdentityAlpha, value); - } - case 61: { - LogStep(61, - "Step 7e: If (MCORE.SC.VENDOR_SUBTYPE) present, subtype _V is present must be 16-bit vendor id, encoded " - "as a variable-length decimal number in ASCII text, omitting any leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByVendorId::Type value; - value.value = mVendorId.HasValue() ? mVendorId.Value() : 65521ULL; - return FindCommissionableByVendorId(kIdentityAlpha, value); - } - case 62: { - LogStep(62, - "Step 7f: If (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, represents device type from " - "Data Model and must be represented as a variable length decimal number in ASCII without leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByDeviceType::Type value; - value.value = mDeviceType.HasValue() ? mDeviceType.Value() : 65535ULL; - return FindCommissionableByDeviceType(kIdentityAlpha, value); - } - case 63: { - LogStep(63, "Step 7g: Check Commissioning Mode (_CM) subtype _CM is present"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByCommissioningMode::Type value; - return FindCommissionableByCommissioningMode(kIdentityAlpha, value); - } - case 64: { - LogStep(64, "Step 7h: If (MCORE.SC.VP_KEY ) present, VP key must contain at least Vendor ID is present."); - VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 65: { - LogStep(65, "Step 7i: If (MCORE.SC.VP_KEY ) present, VP key must contain at least Product ID is present"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 66: { - LogStep(66, - "Step 7j: Optional TXT key for MRP Retry Interval Idle. if (MCORE.SC.SII_OP_DISCOVERY_KEY) present, SII key " - "must be an unsigned integer with units of milliseconds and shall be encoded as a variable length decimal " - "number in ASCII, omitting leading zeros. Shall not exceed 3600000"); - VerifyOrDo(!ShouldSkip("MCORE.SC.SII_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 67: { - LogStep(67, - "Step 7k: Optional TXT key for MRP Retry Interval Active. if (MCORE.SC.SAI_OP_DISCOVERY_KEY) present, SAI key " - "must be an unsigned integer with units of milliseconds and shall be encoded as a variable length decimal " - "number in ASCII, omitting leading zeros. Shall not exceed 3600000."); - VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 68: { - LogStep(68, - "Step 7l: Optional TXT key for MRP Retry Active Mode Threshold. If (MCORE.SC.SAT_OP_DISCOVERY_KEY) present, " - "SAT key must be an unsigned integer with units of milliseconds and shall be encoded as a variable length " - "decimal number in ASCII, omitting leading zeros. Shall not exceed 65535."); - VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 69: { - LogStep(69, "Step 7m: TXT key for commissioning mode. CM=2 must be present"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 70: { - LogStep(70, - "Step 7n: If (MCORE.SC.DT_KEY) present, DT key must contain the device type identifier from Data Model Device " - "Types and must be encoded as a variable length decimal ASCII number without leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DT_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 71: { - LogStep(71, - "Step 7o: If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string with a maximum length of 32B"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DN_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 72: { - LogStep(72, - "Step 7p: If (MCORE.SC.RI_KEY) present, key RI must include the Rotating Device Identifier encoded as a " - "uppercase string with a maximum length of 100 chars"); - VerifyOrDo(!ShouldSkip("MCORE.SC.RI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 73: { - LogStep(73, - "Step 7q: If (MCORE.SC.PH_KEY) present, key PH must be encoded as a variable-length decimal number in ASCII " - "text, omitting any leading zeros. If present value must be different of 0"); - VerifyOrDo(!ShouldSkip("MCORE.SC.PH_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 74: { - LogStep(74, - "Step 7r: If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 string with a maximum length " - "of 128 bytes"); - VerifyOrDo(!ShouldSkip("MCORE.SC.PI_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 75: { - LogStep(75, - "Step 7s: DUT must publish AAAA records for each IPv6 address upon which they are willing to accept Matter " - "messages"); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 76: { - LogStep(76, "Step 8: Wait for OCW timeout to expire"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 180000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 77: { - LogStep(77, - "Step 9: If (MCORE.SC.EXTENDED_DISCOVERY ) enable Extended Discovery. DUT should start to send Commissionable " - "Node Discovery DNS-SD advertisements"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 78: { - LogStep(78, - "Step 10a: Check DNS-SD instance name must be 64-bit randomly selected ID expressed as a sixteen-char hex " - "string with capital letters"); - VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 79: { - LogStep(79, "Step 10b: service type must be _matterc._udp"); - VerifyOrDo(!ShouldSkip("PICS_SKIP_SAMPLE_APP && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 80: { - LogStep(80, - "Step 10c: Check Hostname. If (MCORE.COM.WIFI) OR (MCORE.COM.ETH) target hostname is derived from the 48bit or " - "64bit MAC address expressed as a twelve or sixteen capital letter hex string"); - VerifyOrDo(!ShouldSkip("(MCORE.COM.WIFI || MCORE.COM.ETH) && !MCORE.COM.THR && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 81: { - LogStep(81, - "Step 10c: Check Hostname. If (MCORE.COM.THR) target hostname is derived from the 48bit or 64bit MAC extended " - "address expressed as a twelve or sixteen capital letter hex string."); - VerifyOrDo(!ShouldSkip("(!MCORE.COM.WIFI && !MCORE.COM.ETH) && MCORE.COM.THR && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 82: { - LogStep(82, "Step 10d: Check Long Discriminator _L"); - VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByLongDiscriminator::Type value; - value.value = mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840ULL; - return FindCommissionableByLongDiscriminator(kIdentityAlpha, value); - } - case 83: { - LogStep(83, "Step 10e: Check Short Discriminator (_S)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByShortDiscriminator::Type value; - value.value = mShortDiscriminator.HasValue() ? mShortDiscriminator.Value() : 15ULL; - return FindCommissionableByShortDiscriminator(kIdentityAlpha, value); - } - case 84: { - LogStep(84, - "Step 10f: If (MCORE.SC.VENDOR_SUBTYPE ) present, subtype _V is present must be 16-bit vendor id, " - "encoded as a variable-length decimal number in ASCII text, omitting any leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VENDOR_SUBTYPE && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByVendorId::Type value; - value.value = mVendorId.HasValue() ? mVendorId.Value() : 65521ULL; - return FindCommissionableByVendorId(kIdentityAlpha, value); - } - case 85: { - LogStep(85, - "Step 10g: If (MCORE.SC.DEVTYPE_SUBTYPE) present, subtype _T is present, represents device type " - "from Data Model and must be represented as a variable length decimal number in ASCII without leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DEVTYPE_SUBTYPE && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByDeviceType::Type value; - value.value = mDeviceType.HasValue() ? mDeviceType.Value() : 65535ULL; - return FindCommissionableByDeviceType(kIdentityAlpha, value); - } - case 86: { - LogStep(86, "Step 10h: Check Commissioning Mode (_CM)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionableByCommissioningMode::Type value; - return FindCommissionableByCommissioningMode(kIdentityAlpha, value); - } - case 87: { - LogStep(87, "Step 10i: TXT key for discriminator (D)"); - VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 88: { - LogStep(88, "Step 10j: If (MCORE.SC.VP_KEY) present, VP key must contain at least Vendor ID is present"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 89: { - LogStep(89, "Step 10k: If (MCORE.SC.VP_KEY) present, VP key must contain at least Product ID is present"); - VerifyOrDo(!ShouldSkip("MCORE.SC.VP_KEY && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 90: { - LogStep(90, - "Step 10l: If (MCORE.SC.SII_OP_DISCOVERY_KEY) present, SII key must be an unsigned integer with units of " - "milliseconds and shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall " - "not exceed 3600000."); - VerifyOrDo(!ShouldSkip("MCORE.SC.SII_OP_DISCOVERY_KEY && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 91: { - LogStep(91, - "Step 10m: If (MCORE.SC.SAI_OP_DISCOVERY_KEY) present, SAI key must be an unsigned integer with units of " - "milliseconds and shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall " - "not exceed 3600000."); - VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 92: { - LogStep(92, - "Step 10n: If (MCORE.SC.SAT_OP_DISCOVERY_KEY) present, SAT key must be an unsigned integer with units of " - "milliseconds and shall be encoded as a variable length decimal number in ASCII, omitting leading zeros. Shall " - "not exceed 65535."); - VerifyOrDo(!ShouldSkip("MCORE.SC.SAI_OP_DISCOVERY_KEY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 93: { - LogStep(93, "Step 10o: TXT key for commissioning mode (CM), CM=0 may be present"); - VerifyOrDo(!ShouldSkip("MCORE.SC.EXTENDED_DISCOVERY"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 94: { - LogStep(94, - "Step 10p: If (MCORE.SC.DT_KEY) present, DT key must contain the device type identifier from Data Model Device " - "Types and must be encoded as a variable length decimal ASCII number without leading zeros"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DT_KEY && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 95: { - LogStep(95, - "Step 10q: If (MCORE.SC.DN_KEY) present, DN key must be a UTF-8 encoded string with a maximum length of 32B"); - VerifyOrDo(!ShouldSkip("MCORE.SC.DN_KEY && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 96: { - LogStep(96, - "Step 10r: If (MCORE.SC.RI_KEY) present, key RI must include the Rotating Device Identifier encoded as a " - "uppercase string with a maximum length of 100 chars"); - VerifyOrDo(!ShouldSkip("MCORE.SC.RI_KEY && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 97: { - LogStep(97, - "Step 10s: If (MCORE.SC.PH_KEY) present, key PH must be encoded as a variable-length decimal number in ASCII " - "text, omitting any leading zeros. If present value must be different of 0"); - VerifyOrDo(!ShouldSkip("MCORE.SC.PH_KEY && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - case 98: { - LogStep(98, - "Step 10t: If (MCORE.SC.PI_KEY) present, key PI must be encoded as a valid UTF-8 string with a maximum length " - "of 128 bytes"); - VerifyOrDo(!ShouldSkip("MCORE.SC.PI_KEY && MCORE.SC.EXTENDED_DISCOVERY"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DiscoveryCommands::Commands::FindCommissionable::Type value; - return FindCommissionable(kIdentityAlpha, value); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_SC_4_2Suite : public TestCommand -{ -public: - Test_TC_SC_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_2", 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_SC_4_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; - - 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_SC_4_3Suite : public TestCommand -{ -public: - Test_TC_SC_4_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_3", 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_SC_4_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) - { - 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_SC_4_4Suite : public TestCommand -{ -public: - Test_TC_SC_4_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_4", 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_SC_4_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) - { - 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_SC_4_5Suite : public TestCommand -{ -public: - Test_TC_SC_4_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_5", 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_SC_4_5Suite() {} - - 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_SC_4_6Suite : public TestCommand -{ -public: - Test_TC_SC_4_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_6", 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_SC_4_6Suite() {} - - 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_SC_4_7Suite : public TestCommand -{ -public: - Test_TC_SC_4_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_7", 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_SC_4_7Suite() {} - - 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_SC_4_8Suite : public TestCommand -{ -public: - Test_TC_SC_4_8Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_8", 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_SC_4_8Suite() {} - - 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_SC_4_9Suite : public TestCommand -{ -public: - Test_TC_SC_4_9Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_9", 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_SC_4_9Suite() {} - - 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_SC_4_10Suite : public TestCommand -{ -public: - Test_TC_SC_4_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_4_10", 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_SC_4_10Suite() {} - - 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_SC_5_3Suite : public TestCommand -{ -public: - Test_TC_SC_5_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_5_3", 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_SC_5_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) - { - 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_SC_6_1Suite : public TestCommand -{ -public: - Test_TC_SC_6_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SC_6_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_SC_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) - { - 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_DGSW_2_1Suite : public TestCommand -{ -public: - Test_TC_DGSW_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGSW_2_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_DGSW_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) - { - 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_DGSW_2_2Suite : public TestCommand -{ -public: - Test_TC_DGSW_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGSW_2_2", 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_DGSW_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; - - 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_DGSW_2_3Suite : public TestCommand -{ -public: - Test_TC_DGSW_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGSW_2_3", 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_DGSW_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) - { - 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_DGWIFI_2_2Suite : public TestCommand -{ -public: - Test_TC_DGWIFI_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DGWIFI_2_2", 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_DGWIFI_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; - - 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_FLW_2_2Suite : public TestCommand -{ -public: - Test_TC_FLW_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_FLW_2_2", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_FLW_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; - - chip::app::DataModel::Nullable ValueBeforeChange; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - ValueBeforeChange = value; - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - VerifyOrReturn(CheckConstraintNotValue("value", value, ValueBeforeChange)); - } - 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: Read the mandatory attribute: MeasuredValue"); - VerifyOrDo(!ShouldSkip("FLW.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, - FlowMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Operate on device to change the flow significantly"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && FLW.M.FlowChange"), 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 3: { - LogStep(3, "Step 4: Read the mandatory attribute: MeasuredValue"); - VerifyOrDo(!ShouldSkip("FLW.S.A0000 && FLW.M.FlowChange"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FlowMeasurement::Id, - FlowMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OCC_3_1Suite : public TestCommand -{ -public: - Test_TC_OCC_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_3_1", 4, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_OCC_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 mTimeout; - - chip::BitMask OccupancyValue; - - 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)); - { - chip::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - OccupancyValue = value; - } - 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::BitMask value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintNotValue("value", value, OccupancyValue)); - } - 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: Reads Occupancy attribute from DUT"); - VerifyOrDo(!ShouldSkip("OCC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, OccupancySensing::Attributes::Occupancy::Id, - true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Operate on DUT to change the occupancy status"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && OCC.M.OccupancyChange"), 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 3: { - LogStep(3, "Step 4: Reads back Occupancy attribute from DUT after few seconds"); - VerifyOrDo(!ShouldSkip("OCC.S.A0000 && OCC.M.OccupancyChange"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OccupancySensing::Id, OccupancySensing::Attributes::Occupancy::Id, - true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_PS_2_2Suite : public TestCommand -{ -public: - Test_TC_PS_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PS_2_2", 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_PS_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; - - 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_PS_3_1Suite : public TestCommand -{ -public: - Test_TC_PS_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_PS_3_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_PS_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 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_BOOL_2_2Suite : public TestCommand -{ -public: - Test_TC_BOOL_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BOOL_2_2", 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_BOOL_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; - - 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_CC_3_1Suite : public TestCommand -{ -public: - Test_TC_CC_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_3_1", 51, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_3_1Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(200)); } - -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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 68U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 92U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 85U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 115U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 102U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 138U)); - } - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 102U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 138U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 115U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 155U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - shouldContinue = true; - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 68U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 92U)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 85U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 115U)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 102U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 138U)); - } - 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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 102U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 138U)); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 85U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 115U)); - } - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 68U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 92U)); - } - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 51U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 69U)); - } - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 51U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 69U)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 50: - 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, "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 1a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 1b: H 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 3: { - LogStep(3, - "Step 2a: TH sends MoveToHue command to DUT with Hue=60, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 60U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 2b: TH sends MoveToHue command to DUT with Hue=120, Direction=0x00 (shortest distance) and " - "TransitionTime=300 (30s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 120U; - value.direction = static_cast(0); - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 2d: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2e: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 2f: H reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 3a: TH sends MoveToHue command to DUT with Hue=60, Direction=0x00 (Shortest distance) and " - "TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 60U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 16: { - LogStep(16, - "Step 3b: TH sends MoveToHue command to DUT with Hue=135, Direction=0x01 (longest distance) and " - "TransitionTime=300 (30s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 135U; - value.direction = static_cast(1); - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 3c: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000 && PICS_SKIP_SAMPLE_APP"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 3d: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000 && PICS_SKIP_SAMPLE_APP"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 22: { - LogStep(22, "Step 3e: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000 && PICS_SKIP_SAMPLE_APP"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; - value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); - value.expectedValue.Emplace(); - value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); - return UserPrompt(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 24: { - LogStep(24, "Step 3f: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 25: { - LogStep(25, - "Step 4a: TH sends MoveToHue command to DUT with Hue=60, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 60U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 27: { - LogStep(27, "Step 4b: H sends MoveToHue command to DUT with Hue=120, Direction=0x02 (up) and TransitionTime=300 (30s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 120U; - value.direction = static_cast(2); - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 28: { - LogStep(28, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 29: { - LogStep(29, "Step 4c: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 30: { - LogStep(30, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 31: { - LogStep(31, "Step 4d: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 32: { - LogStep(32, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 33: { - LogStep(33, "Step 4e: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 34: { - LogStep(34, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 35: { - LogStep(35, "Step 4f: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 36: { - LogStep(36, - "Step 5a: TH sends MoveToHue command to DUT with Hue=120, Direction=0x00 (shortest distance) and " - "TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 120U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 37: { - LogStep(37, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 38: { - LogStep(38, - "Step 5b: TH sends MoveToHue command to DUT with Hue=60, Direction=0x03 (down) and TransitionTime=300 (30s)"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type value; - value.hue = 60U; - value.direction = static_cast(3); - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::MoveToHue::Id, value, - chip::NullOptional - - ); - } - case 39: { - LogStep(39, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 40: { - LogStep(40, "Step 5c: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 41: { - LogStep(41, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 42: { - LogStep(42, "Step 5d: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 43: { - LogStep(43, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 44: { - LogStep(44, "Step 5e: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 45: { - LogStep(45, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 46: { - LogStep(46, "Step 5f: TH reads CurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::CurrentHue::Id, true, - chip::NullOptional); - } - case 47: { - LogStep(47, "Step 6a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 48: { - LogStep(48, "Step 6b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F00 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 49: { - LogStep(49, "Turn off light that we turned on"); - 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 50: { - LogStep(50, "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_CC_7_1Suite : public TestCommand -{ -public: - Test_TC_CC_7_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_7_1", 51, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_7_1Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(200)); } - -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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 6800U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9200U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 8500U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 11500U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 10200U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 13800U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 10200U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 13800U)); - } - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 17: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 18700U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 25300U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 34700U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 41300U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 50700U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 62100U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 50700U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 62100U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - shouldContinue = true; - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 6800U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9200U)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 8500U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 11500U)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 10200U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 13800U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 10200U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 13800U)); - } - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 8500U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 11500U)); - } - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 6800U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9200U)); - } - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 5100U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 6900U)); - } - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 5100U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 6900U)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorMode", value, 0U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); - } - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedColorMode", value, 3U)); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 3U)); - } - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 50: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A000f"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, - "Step 2a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=6000, Direction=0x00 (shortest distance) " - "and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 6000U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 2b: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=12000, Direction=0x00 (shortest distance) " - "and TransitionTime=300 (30s)."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 12000U; - value.direction = static_cast(0); - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "Step 2c: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 9: { - LogStep(9, "Step 2d: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 10: { - LogStep(10, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "Step 2e: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 13: { - LogStep(13, "Step 2f: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 3a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=6000, Direction=0x00 (shortest distance) " - "and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 6000U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 15: { - LogStep(15, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 16: { - LogStep(16, - "Step 3b: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=54000, Direction=0x01 (longest distance) " - "and TransitionTime=300 (30s)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 54000U; - value.direction = static_cast(1); - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 17: { - LogStep(17, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 18: { - LogStep(18, "Step 3c: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 3d: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 21: { - LogStep(21, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 22: { - LogStep(22, "Step 3e: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 23: { - LogStep(23, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 24: { - LogStep(24, "Step 3f: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, - "Step 4a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=6000, Direction=0x00 (shortest distance) " - "and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 6000U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 27: { - LogStep(27, - "Step 4b: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=12000, Direction=0x02 (up) and " - "TransitionTime=300 (30s)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 12000U; - value.direction = static_cast(2); - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 28: { - LogStep(28, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 29: { - LogStep(29, "Step 4c: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 30: { - LogStep(30, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 31: { - LogStep(31, "Step 4d: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 32: { - LogStep(32, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 33: { - LogStep(33, "Step 4e: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 34: { - LogStep(34, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 35: { - LogStep(35, "Step 4f: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 36: { - LogStep(36, - "Step 5a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=12000, Direction=0x00 (shortest distance) " - "and TransitionTime=0 (immediately)"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 12000U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 37: { - LogStep(37, "Wait 100ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 100UL; - return WaitForMs(kIdentityAlpha, value); - } - case 38: { - LogStep(38, - "Step 5b: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=6000, Direction=0x03 (down) and " - "TransitionTime=300 (30s)."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 6000U; - value.direction = static_cast(3); - value.transitionTime = 300U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 39: { - LogStep(39, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 40: { - LogStep(40, "Step 5c: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 41: { - LogStep(41, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 42: { - LogStep(42, "Step 5d: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 43: { - LogStep(43, "Wait 10s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 44: { - LogStep(44, "Step 5e: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 45: { - LogStep(45, "Wait 5s"); - VerifyOrDo(!ShouldSkip("CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 5000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 46: { - LogStep(46, "Step 5f: TH reads EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 47: { - LogStep(47, "Step 6a: TH reads ColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorMode::Id, true, - chip::NullOptional); - } - case 48: { - LogStep(48, "Step 6b: TH reads EnhancedColorMode attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedColorMode::Id, - true, chip::NullOptional); - } - case 49: { - LogStep(49, "Turn Off light that we turned on"); - 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 50: { - LogStep(50, "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_CC_9_1Suite : public TestCommand -{ -public: - Test_TC_CC_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_9_1", 72, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - } - - ~Test_TC_CC_9_1Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(400)); } - -private: - chip::Optional mNodeId; - chip::Optional mTimeout; - chip::Optional mCluster; - chip::Optional mEndpoint; - - uint16_t ColorLoopStartEnhancedHueStep5d; - uint16_t ColorLoopStoredEnhancedHueStep6c; - uint16_t ColorLoopStartEnhancedHueStep8d; - uint16_t ColorLoopStoredEnhancedHueStep9c; - uint16_t ColorLoopStartEnhancedHueStep12d; - uint16_t ColorLoopStoredEnhancedHueStep13c; - uint16_t ColorLoopStartEnhancedHueStep15d; - uint16_t ColorLoopStoredEnhancedHueStep16b; - - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopDirection", value, 0U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopTime", value, 30U)); - } - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 160U)); - } - break; - case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 14: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueStep5d = value; - } - break; - case 18: - 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, ColorLoopStartEnhancedHueStep5d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 20: - 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, ColorLoopStartEnhancedHueStep5d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueStep6c = value; - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep6c)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopDirection", value, 1U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueStep8d = value; - } - break; - case 32: - 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, ColorLoopStartEnhancedHueStep8d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 34: - 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, ColorLoopStartEnhancedHueStep8d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueStep9c = value; - } - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep9c)); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, 16384U)); - } - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopDirection", value, 0U)); - } - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueStep12d = value; - } - break; - case 49: - 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, ColorLoopStartEnhancedHueStep12d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 51: - 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, ColorLoopStartEnhancedHueStep12d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueStep13c = value; - } - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep13c)); - } - break; - case 56: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopDirection", value, 1U)); - } - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 60: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - break; - case 61: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 62: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueStep15d = value; - } - break; - case 63: - 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, ColorLoopStartEnhancedHueStep15d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 64: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 65: - 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, ColorLoopStartEnhancedHueStep15d)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 66: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 67: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 68: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueStep16b = value; - } - break; - case 69: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep16b)); - } - break; - case 70: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 71: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.A000f && CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, - "Step 0c: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest " - "distance) and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 16384U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait for 1000ms"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 1a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x0 (De-activate) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Step 1b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, - "Step 2a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction " - "attribute to 0x0 (decrement hue) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(2U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 8: { - LogStep(8, "Step 2b: Read ColorLoopDirection attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4003 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, - "Step 3a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x4 (UpdateTime) and Time attribute to " - "30 (30s for one loop) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(4U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 30U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Step 3b: Read ColorLoopTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4004 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id, - true, chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 4a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x8 (UpdateStartHue) and StartHue " - "attribute to 0x00A0 to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(8U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 160U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 12: { - LogStep(12, "Step 4b: Read ColorLoopStartEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4005 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, - "Step 5a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x1 (start from ColorLoopStartEnhancedHue) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(1); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Step 5b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 5c: Read ColorLoopStoredEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4006 && CC.S.C40.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Saving value for comparison in step 8d read ColorLoopStartEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4005 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 18: { - LogStep(18, "Step 5d: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 19: { - LogStep(19, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 20: { - LogStep(20, "Step 5e: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 21: { - LogStep(21, - "Step 6a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x0 (De-activate) to DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Step 6b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 23: { - LogStep(23, "Saving value for comparison in step 6c read ColorLoopStoredEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4006 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "Step 6c: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, - "Step 7a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction " - "attribute to 0x1 (increment hue) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(2U); - value.action = static_cast(0); - value.direction = static_cast(1); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Step 7b: Read ColorLoopDirection attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4003 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 27: { - LogStep(27, - "Step 8a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x1 (start from ColorLoopStartEnhancedHue) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(1); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 28: { - LogStep(28, "Step 8b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 29: { - LogStep(29, "Step 8c: Read ColorLoopStoredEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4006 && CC.S.C40.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 30: { - LogStep(30, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 31: { - LogStep(31, "Saving value for comparision in step 8d read ColorLoopStartEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4005 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, "Step 8d: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 33: { - LogStep(33, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 34: { - LogStep(34, "Step 8e: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 35: { - LogStep(35, - "Step 9a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x0 (De-activate) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 36: { - LogStep(36, "Step 9b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 37: { - LogStep(37, "Saving value for comparision in step 9c read ColorLoopStoredEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4006 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 38: { - LogStep(38, "Step 9c: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 39: { - LogStep(39, - "Step 10a: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest " - "distance) and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 16384U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 40: { - LogStep(40, "Wait 1000ms"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 41: { - LogStep(41, "Step 10b: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C40.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 42: { - LogStep(42, - "Step 11a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction " - "attribute to 0x0 (decrement hue) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(2U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 43: { - LogStep(43, "Step 11b: Read ColorLoopDirection attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4003 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 44: { - LogStep(44, - "Step 12a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x2 (start from EnhancedCurrentHue) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(2); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 45: { - LogStep(45, "Step 12b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 46: { - LogStep(46, "Step 12c: Read ColorLoopStoredEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4006 && CC.S.C40.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 47: { - LogStep(47, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 48: { - LogStep(48, "Saving value for comparision in step 12d read ColorLoopStartEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4005 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 49: { - LogStep(49, "Step 12d: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 50: { - LogStep(50, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 51: { - LogStep(51, "Step 12e: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 52: { - LogStep(52, - "Step 13a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x0 (De-activate) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 53: { - LogStep(53, "Step 13b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 54: { - LogStep(54, "Saving value for comparision in step 13c read ColorLoopStoredEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4006 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 55: { - LogStep(55, "Step 13c: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 56: { - LogStep(56, - "Step 14a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction " - "attribute to 0x1 (increment hue) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(2U); - value.action = static_cast(0); - value.direction = static_cast(1); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 57: { - LogStep(57, "Step 14b: Read ColorLoopDirection attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4003 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 58: { - LogStep(58, - "Step 15a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x2 (start from EnhancedCurrentHue) to DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(2); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 59: { - LogStep(59, "Step 15b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 60: { - LogStep(60, "Step 15c: Read ColorLoopStoredEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4006 && CC.S.C40.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 61: { - LogStep(61, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 62: { - LogStep(62, "Saving value for comparision in step 15d read ColorLoopStartEnhancedHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4005 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 63: { - LogStep(63, "Step 15d: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 64: { - LogStep(64, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 65: { - LogStep(65, "Step 15e: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 66: { - LogStep(66, - "Step 16a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x0 (De-activate) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 67: { - LogStep(67, "Step 16b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 68: { - LogStep(68, "Saving value for comparision in step 16b read ColorLoopStoredEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4006 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 69: { - LogStep(69, "Step 16c: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F02 && CC.S.F01 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 70: { - LogStep(70, "Turn Off light for color control tests"); - 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 71: { - LogStep(71, "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_CC_9_2Suite : public TestCommand -{ -public: - Test_TC_CC_9_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_9_2", 31, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_9_2Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(400)); } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint16_t ColorLoopStartEnhancedHueValue; - uint16_t ColorLoopStartEnhancedHue; - uint16_t ColorLoopStoredEnhancedHueValue; - - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", 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("colorLoopDirection", value, 0U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopTime", value, 30U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 160U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueValue = value; - } - break; - case 15: - 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, ColorLoopStartEnhancedHueValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopDirection", value, 1U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHue = value; - } - break; - case 22: - 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, ColorLoopStartEnhancedHue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 23: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 24: - 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, ColorLoopStartEnhancedHue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueValue = value; - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueValue)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.A000f && CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, - "Step 0c: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest " - "distance) and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 16384U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait for 1000ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 1a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0xF, Action attribute to 0x0 " - "(De-activate), Direction attribute to 0x0 (decrement hue), Time attribute to 30, and StartHue attribute to " - "0x00A0 to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(15U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 30U; - value.startHue = 160U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Step 1b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 1c: Read ColorLoopDirection attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4003 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 1d: Read ColorLoopTime attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4004 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 1e: Read ColorLoopStartEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4005 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 2a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x1 (start from ColorLoopStartEnhancedHue) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(1); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Step 2b: Read ColorLoopActive attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 2c: Read ColorLoopStoredEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4006 && CC.S.C40.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4005 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 2d: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Step 2e: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, - "Step 3a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction " - "attribute to 0x1 (increment hue) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(2U); - value.action = static_cast(0); - value.direction = static_cast(1); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 19: { - LogStep(19, "Step 3b: Read ColorLoopDirection attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4003 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4005 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 22: { - LogStep(22, "Step 3c: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 23: { - LogStep(23, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 24: { - LogStep(24, "Step 3d: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 25: { - LogStep(25, - "Step 4a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x0 (De-activate) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 26: { - LogStep(26, "Step 4b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 27: { - LogStep(27, "Saving value for comparision read ColorLoopStoredEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4006 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 28: { - LogStep(28, "Step 4c: Read EnhancedCurrentHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 29: { - LogStep(29, "Turn off light for color control tests"); - 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 30: { - LogStep(30, "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_CC_9_3Suite : public TestCommand -{ -public: - Test_TC_CC_9_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_CC_9_3", 30, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_CC_9_3Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(400)); } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - uint16_t ColorLoopStartEnhancedHueValue; - uint16_t ColorLoopStoredEnhancedHueValue; - - 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)); - shouldContinue = true; - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", 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("colorLoopDirection", value, 0U)); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopTime", value, 30U)); - } - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 160U)); - } - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStartEnhancedHueValue = value; - } - break; - case 15: - 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, ColorLoopStartEnhancedHueValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - 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)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueValue)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 18: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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("colorLoopTime", value, 60U)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 21: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - 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, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); - } - break; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); - } - break; - case 26: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - ColorLoopStoredEnhancedHueValue = value; - } - break; - case 27: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueValue)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 29: - 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, "Step 0a: TH writes 0 to the Options attribute"); - VerifyOrDo(!ShouldSkip("CC.S.A000f && CC.S.F02 && CC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - uint8_t value; - value = 0U; - return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, - chip::NullOptional, chip::NullOptional); - } - case 2: { - LogStep(2, "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; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional - - ); - } - case 3: { - LogStep(3, - "Step 0c: TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest " - "distance) and TransitionTime=0 (immediately)."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; - value.enhancedHue = 16384U; - value.direction = static_cast(0); - value.transitionTime = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, - value, chip::NullOptional - - ); - } - case 4: { - LogStep(4, "Wait for 1000ms"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 5: { - LogStep(5, - "Step 1a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0xF, Action attribute to 0x0 " - "(De-activate), Direction attribute to 0x0 (decrement hue), Time attribute to 30, and StartHue attribute to " - "0x00A0 to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(15U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 30U; - value.startHue = 160U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Step 1b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 7: { - LogStep(7, "Step 1c: Read ColorLoopDirection attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4003 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, - true, chip::NullOptional); - } - case 8: { - LogStep(8, "Step 1d: Read ColorLoopTime attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4004 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id, - true, chip::NullOptional); - } - case 9: { - LogStep(9, "Step 1e: Read ColorLoopStartEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4005 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 10: { - LogStep(10, - "Step 2a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x1 (start from ColorLoopStartEnhancedHue) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(1); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 11: { - LogStep(11, "Step 2b: Read ColorLoopActive attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 12: { - LogStep(12, "Step 2c: Read ColorLoopStoredEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4006 && CC.S.C40.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 13: { - LogStep(13, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 14: { - LogStep(14, "Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4005 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); - } - case 15: { - LogStep(15, "Step 2d: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 16: { - LogStep(16, "Wait for 30S"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 17: { - LogStep(17, "Step 2e: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 18: { - LogStep(18, - "Step 3a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x4 and Time attribute to 60 to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(4U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 60U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 19: { - LogStep(19, "Step 3b: Read ColorLoopTime attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4004 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id, - true, chip::NullOptional); - } - case 20: { - LogStep(20, "Wait for 60S"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 60000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 21: { - LogStep(21, "Step 3c: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 22: { - LogStep(22, "Wait for 60S"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 60000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "Step 3d: Read EnhancedCurrentHue attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 24: { - LogStep(24, - "Step 4a: TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " - "attribute to 0x0 (De-activate) to DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.C44.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; - value.updateFlags = static_cast>(1U); - value.action = static_cast(0); - value.direction = static_cast(0); - value.time = 0U; - value.startHue = 0U; - value.optionsMask = 0U; - value.optionsOverride = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, - chip::NullOptional - - ); - } - case 25: { - LogStep(25, "Step 4b: Read ColorLoopActive attribute from DUT"); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4002 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, - true, chip::NullOptional); - } - case 26: { - LogStep(26, "Saving value for comparision read ColorLoopStoredEnhancedHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4006 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, - ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); - } - case 27: { - LogStep(27, "Step 4c: Read EnhancedCurrentHue attribute from DUT."); - VerifyOrDo(!ShouldSkip("CC.S.F01 && CC.S.F02 && CC.S.A4000 && CC.S.C44.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, - true, chip::NullOptional); - } - case 28: { - LogStep(28, "Turn off light for color control tests"); - 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 29: { - LogStep(29, "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_DRLK_2_10Suite : public TestCommand -{ -public: - Test_TC_DRLK_2_10Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_10", 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_DRLK_2_10Suite() {} - - 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_DRLK_3_2Suite : public TestCommand -{ -public: - Test_TC_DRLK_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_3_2", 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_DRLK_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 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_LWM_1_2Suite : public TestCommand -{ -public: - Test_TC_LWM_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LWM_1_2", 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_LWM_1_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; - - 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_LWM_3_2Suite : public TestCommand -{ -public: - Test_TC_LWM_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_LWM_3_2", 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_LWM_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 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_OO_2_3Suite : public TestCommand -{ -public: - Test_TC_OO_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OO_2_3", 133, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - } - - ~Test_TC_OO_2_3Suite() {} - - chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(400)); } - -private: - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mTimeout; - chip::Optional mEndpoint; - - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("globalSceneControl", value, 1)); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 7: - 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; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("globalSceneControl", value, 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)); - shouldContinue = true; - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("globalSceneControl", value, 1)); - } - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 0)); - } - break; - case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("globalSceneControl", value, 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)); - shouldContinue = true; - break; - case 19: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 20: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("globalSceneControl", value, 1)); - } - break; - case 21: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 22: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 23: - 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; - case 24: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("globalSceneControl", value, 0)); - } - break; - case 25: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - 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)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("globalSceneControl", value, 1)); - } - break; - case 29: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 31: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 32: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("globalSceneControl", value, 1)); - } - break; - case 33: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 34: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); - } - break; - case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 36: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 37: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 255U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 345U)); - } - break; - case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 300U)); - } - break; - case 39: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 40: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 41: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 42: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 43: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 44: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 45: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 46: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 47: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 255U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 345U)); - } - break; - case 48: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 300U)); - } - break; - case 49: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 50: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 51: - 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; - case 52: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 53: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 255U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 345U)); - } - break; - case 54: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 55: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 56: - 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; - case 57: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 58: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 59: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 60: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 61: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 62: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 63: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); - } - break; - case 64: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 65: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 66: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 67: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 68: - 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; - case 69: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 70: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 255U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 345U)); - } - break; - case 71: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 72: - 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; - case 73: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 74: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); - } - break; - case 75: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 76: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 77: - 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; - case 78: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 79: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); - } - break; - case 80: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 81: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 82: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 83: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 84: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 255U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 345U)); - } - break; - case 85: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 300U)); - } - break; - case 86: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 87: - 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; - case 88: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 89: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); - } - break; - case 90: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 91: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 92: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 93: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 255U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 345U)); - } - break; - case 94: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 300U)); - } - break; - case 95: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 96: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 97: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 98: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 99: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 100: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 101: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 300U)); - } - break; - case 102: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 103: - 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; - case 104: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 105: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 255U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 345U)); - } - break; - case 106: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 107: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 108: - 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; - case 109: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 110: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 170U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 230U)); - } - break; - case 111: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 112: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 113: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 114: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); - } - break; - case 115: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 116: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 117: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 118: - 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; - case 119: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 120: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 255U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 345U)); - } - break; - case 121: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 122: - 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; - case 123: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 124: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 0U)); - } - break; - case 125: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 126: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onOff", value, 1)); - } - break; - case 127: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintMinValue("value", value, 255U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 345U)); - } - break; - case 128: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", value, 300U)); - } - break; - case 129: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - break; - case 130: - 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; - case 131: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("onTime", value, 0U)); - } - break; - case 132: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("offWaitTime", 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, "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, "2a: 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, "Wait 1000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 3: { - LogStep(3, "2b: Reads OnOff attribute from DUT"); - 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 4: { - LogStep(4, "2b:Reads GlobalSceneControl attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "3a:Sends OffWithEffect command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OffWithEffect::Type value; - value.effectIdentifier = static_cast(0); - value.effectVariant = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OffWithEffect::Id, value, - chip::NullOptional - - ); - } - case 6: { - LogStep(6, "Wait 1000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 7: { - LogStep(7, "3b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 8: { - LogStep(8, "3b:Reads GlobalSceneControl attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4000 && OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "4a:Sends OnWithRecallGlobalScene command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithRecallGlobalScene::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithRecallGlobalScene::Id, value, - chip::NullOptional - - ); - } - case 10: { - LogStep(10, "Wait 1000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 11: { - LogStep(11, "4b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 12: { - LogStep(12, "4b:Reads GlobalSceneControl attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4000 && OO.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "5a:Sends OffWithEffect command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OffWithEffect::Type value; - value.effectIdentifier = static_cast(0); - value.effectVariant = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OffWithEffect::Id, value, - chip::NullOptional - - ); - } - case 14: { - LogStep(14, "Wait 1000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 15: { - LogStep(15, "5b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 16: { - LogStep(16, "5b:Reads GlobalSceneControl attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4000 && OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id, true, - chip::NullOptional); - } - case 17: { - LogStep(17, "5c: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 18: { - LogStep(18, "Wait 1000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 19: { - LogStep(19, "5d:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 20: { - LogStep(20, "5d:Reads GlobalSceneControl attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4000 && OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id, true, - chip::NullOptional); - } - case 21: { - LogStep(21, "6a:Sends OffWithEffect command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OffWithEffect::Type value; - value.effectIdentifier = static_cast(1); - value.effectVariant = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OffWithEffect::Id, value, - chip::NullOptional - - ); - } - case 22: { - LogStep(22, "Wait 1000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 23: { - LogStep(23, "6b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 24: { - LogStep(24, "6b:Reads GlobalSceneControl attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4000 && OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id, true, - chip::NullOptional); - } - case 25: { - LogStep(25, "7a: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 26: { - LogStep(26, "Wait 1000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 27: { - LogStep(27, "7b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 28: { - LogStep(28, "7b:Reads GlobalSceneControl attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4000 && OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id, true, - chip::NullOptional); - } - case 29: { - LogStep(29, "7c:Sends OnWithRecallGlobalScene command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithRecallGlobalScene::Type value; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithRecallGlobalScene::Id, value, - chip::NullOptional - - ); - } - case 30: { - LogStep(30, "Wait 1000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 1000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 31: { - LogStep(31, "7d:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 32: { - LogStep(32, "7d:Reads GlobalSceneControl attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4000 && OO.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::GlobalSceneControl::Id, true, - chip::NullOptional); - } - case 33: { - LogStep(33, "8:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 34: { - LogStep(34, "8:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 35: { - LogStep(35, "9a:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(1U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 36: { - LogStep(36, "9b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 37: { - LogStep(37, "9b:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 38: { - LogStep(38, "9b:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 39: { - LogStep(39, "10a:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(1U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 40: { - LogStep(40, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 41: { - LogStep(41, "10b:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(1U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 42: { - LogStep(42, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 43: { - LogStep(43, "10c:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(1U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 44: { - LogStep(44, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 45: { - LogStep(45, "10d:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(1U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 46: { - LogStep(46, "10e:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 47: { - LogStep(47, "10e:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 48: { - LogStep(48, "10e:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 49: { - LogStep(49, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 50: { - LogStep(50, "11a:Sends OffWithEffect command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OffWithEffect::Type value; - value.effectIdentifier = static_cast(0); - value.effectVariant = 0U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OffWithEffect::Id, value, - chip::NullOptional - - ); - } - case 51: { - LogStep(51, "11b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 52: { - LogStep(52, "11b:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 53: { - LogStep(53, "11b:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 54: { - LogStep(54, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 55: { - LogStep(55, "12a:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(1U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 56: { - LogStep(56, "12b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 57: { - LogStep(57, "12b:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 58: { - LogStep(58, "12b:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 59: { - LogStep(59, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 60: { - LogStep(60, "13a: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 61: { - LogStep(61, "13b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 62: { - LogStep(62, "13b:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 63: { - LogStep(63, "13b:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 64: { - LogStep(64, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 65: { - LogStep(65, "14a:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(1U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 66: { - LogStep(66, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 67: { - LogStep(67, "14b: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 68: { - LogStep(68, "14c:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 69: { - LogStep(69, "14c:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 70: { - LogStep(70, "14c:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 71: { - LogStep(71, "Wait 30000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 30000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 72: { - LogStep(72, "15:Reads OnOff attribute from DUT"); - 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 73: { - LogStep(73, "15:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 74: { - LogStep(74, "15:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 75: { - LogStep(75, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 76: { - LogStep(76, "16a:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(1U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 77: { - LogStep(77, "16b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 78: { - LogStep(78, "16b:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 79: { - LogStep(79, "16b:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 80: { - LogStep(80, "17a: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 81: { - LogStep(81, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 82: { - LogStep(82, "17b:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(1U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 83: { - LogStep(83, "17c:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 84: { - LogStep(84, "17c:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 85: { - LogStep(85, "17c:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 86: { - LogStep(86, "Wait 40000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 40000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 87: { - LogStep(87, "17d:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 88: { - LogStep(88, "17d:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 89: { - LogStep(89, "17d:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 90: { - LogStep(90, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 91: { - LogStep(91, "18a:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(0U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 92: { - LogStep(92, "18b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 93: { - LogStep(93, "18b:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 94: { - LogStep(94, "18b:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 95: { - LogStep(95, "19a:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(0U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 96: { - LogStep(96, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 97: { - LogStep(97, "19b:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(0U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 98: { - LogStep(98, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 99: { - LogStep(99, "19c:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 100: { - LogStep(100, "19c:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 101: { - LogStep(101, "19c:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 102: { - LogStep(102, "20a: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 103: { - LogStep(103, "20b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 104: { - LogStep(104, "20b:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 105: { - LogStep(105, "20b:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 106: { - LogStep(106, "21a:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(0U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 107: { - LogStep(107, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 108: { - LogStep(108, "21b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 109: { - LogStep(109, "21b:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 110: { - LogStep(110, "21b:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && PICS_SKIP_SAMPLE_APP && OO.S.C42.Rsp"), - return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 111: { - LogStep(111, "22a: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 112: { - LogStep(112, "22b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 113: { - LogStep(113, "22b:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 114: { - LogStep(114, "22b:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C01.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 115: { - LogStep(115, "Wait 10000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 10000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 116: { - LogStep(116, "23a:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(0U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 117: { - LogStep(117, "23b: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 118: { - LogStep(118, "23c:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 119: { - LogStep(119, "23c:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 120: { - LogStep(120, "23c:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 121: { - LogStep(121, "Wait 40000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 40000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 122: { - LogStep(122, "23d:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 123: { - LogStep(123, "23d:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 124: { - LogStep(124, "23d:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 125: { - LogStep(125, "24a:Sends OnWithTimedOff command to DUT"); - VerifyOrDo(!ShouldSkip("OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - ListFreer listFreer; - chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type value; - value.onOffControl = static_cast>(0U); - value.onTime = 300U; - value.offWaitTime = 300U; - return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::OnWithTimedOff::Id, value, - chip::NullOptional - - ); - } - case 126: { - LogStep(126, "24b:Reads OnOff attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A0000 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); - } - case 127: { - LogStep(127, "24b:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 128: { - LogStep(128, "24b:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002 && OO.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - case 129: { - LogStep(129, "Wait 40000ms"); - ListFreer listFreer; - chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; - value.ms = 40000UL; - return WaitForMs(kIdentityAlpha, value); - } - case 130: { - LogStep(130, "24c:Reads OnOff attribute from DUT"); - 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 131: { - LogStep(131, "24c:Reads OnTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnTime::Id, true, - chip::NullOptional); - } - case 132: { - LogStep(132, "24c:Reads OffWaitTime attribute from DUT"); - VerifyOrDo(!ShouldSkip("OO.S.A4002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OffWaitTime::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OPSTATE_2_1Suite : public TestCommand -{ -public: - Test_TC_OPSTATE_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPSTATE_2_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_OPSTATE_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) - { - 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_OPSTATE_2_2Suite : public TestCommand -{ -public: - Test_TC_OPSTATE_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPSTATE_2_2", 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_OPSTATE_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; - - 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_OPSTATE_2_3Suite : public TestCommand -{ -public: - Test_TC_OPSTATE_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_OPSTATE_2_3", 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_OPSTATE_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) - { - 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_RH_2_2Suite : public TestCommand -{ -public: - Test_TC_RH_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_RH_2_2", 6, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RH_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; - - chip::app::DataModel::Nullable ValueBeforeChange; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 9999U)); - } - 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", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - } - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 10000U)); - ValueBeforeChange = value; - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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(CheckConstraintType("value", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintNotValue("value", value, ValueBeforeChange)); - } - 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: Reads constraints of attribute: MinMeasuredValue"); - VerifyOrDo(!ShouldSkip("RH.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Reads constraints of attribute: MaxMeasuredValue"); - VerifyOrDo(!ShouldSkip("RH.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Reads MeasuredValue attribute from DUT"); - VerifyOrDo(!ShouldSkip("RH.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: Operate on device to change the relative humidity significantly"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && RH.M.ManuallyControlled"), 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 5: { - LogStep(5, "Step 6: Read the mandatory attribute: MeasuredValue"); - VerifyOrDo(!ShouldSkip("RH.S.A0000 && RH.M.ManuallyControlled"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RelativeHumidityMeasurement::Id, - RelativeHumidityMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_REFALM_2_1Suite : public TestCommand -{ -public: - Test_TC_REFALM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_REFALM_2_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_REFALM_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) - { - 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_REFALM_2_2Suite : public TestCommand -{ -public: - Test_TC_REFALM_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_REFALM_2_2", 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_REFALM_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; - - 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_REFALM_2_3Suite : public TestCommand -{ -public: - Test_TC_REFALM_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_REFALM_2_3", 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_REFALM_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) - { - 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_RVCCLEANM_3_3Suite : public TestCommand -{ -public: - Test_TC_RVCCLEANM_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_RVCCLEANM_3_3", 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_RVCCLEANM_3_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) - { - 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_RVCOPSTATE_2_2Suite : public TestCommand -{ -public: - Test_TC_RVCOPSTATE_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_RVCOPSTATE_2_2", 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_RVCOPSTATE_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; - - 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_RVCRUNM_1_1Suite : public TestCommand -{ -public: - Test_TC_RVCRUNM_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_RVCRUNM_1_1", 16, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_RVCRUNM_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)); - { - 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)); - { - 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, 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 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, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 2UL)); - } - break; - case 7: - 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, 3UL)); - } - break; - case 8: - 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(CheckConstraintExcludes("value", value, 3UL)); - } - 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::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 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("acceptedCommandList", iter_0, 0)); - VerifyOrReturn(CheckValue("acceptedCommandList[0]", iter_0.GetValue(), 0UL)); - VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - 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::DataModel::DecodableList value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - { - auto iter_0 = value.begin(); - VerifyOrReturn(CheckNextListItemDecodes("generatedCommandList", iter_0, 0)); - VerifyOrReturn(CheckValue("generatedCommandList[0]", iter_0.GetValue(), 1UL)); - VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 1)); - } - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - } - break; - case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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 reads the ClusterRevision attribute from the DUT"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3a: TH reads the FeatureMap attribute from the DUT"); - VerifyOrDo(!ShouldSkip(" !RVCRUNM.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3b: Given RVCRUNM.S.F00(DEPONOFF) ensure featuremap has the correct bit set"); - VerifyOrDo(!ShouldSkip("RVCRUNM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4a: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4a: TH reads the AttributeList attribute from the DUT"); - VerifyOrDo(!ShouldSkip("!PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4b: TH reads the optional attribute(StartUpMode) in AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("RVCRUNM.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, - "Step 4c: Read the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and optional attribute(OnMode) is in " - "AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip("RVCRUNM.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, - "Step 4d: Read the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and optional attribute(OnMode) is not in " - "AttributeList from the DUT"); - VerifyOrDo(!ShouldSkip(" !RVCRUNM.S.F00 "), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, - "Step 4e: Check for mandatory attributes in AttributeList. 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)"); - 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 10: { - LogStep(10, "Step 5a: Read the global attribute: EventList from the DUT"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, - "Step 5b: TH reads from the DUT the EventList attribute. 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)"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && PICS_EVENT_LIST_ENABLED"), 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 12: { - LogStep(12, "Step 6a: Read the global attribute AcceptedCommandList. Check if it contains id 0x0 (ChangeToMode)"); - VerifyOrDo(!ShouldSkip("RVCRUNM.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::AcceptedCommandList::Id, - true, chip::NullOptional); - } - case 13: { - LogStep(13, - "Step 6b: Read the global attribute AcceptedCommandList. 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)"); - 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 14: { - LogStep(14, - "Step 7a: Read the global attribute: GeneratedCommandList. Check if it contains id 0x1 (ChangeToModeResponse)"); - VerifyOrDo(!ShouldSkip("RVCRUNM.S.C01.Tx"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcRunMode::Id, RvcRunMode::Attributes::GeneratedCommandList::Id, - true, chip::NullOptional); - } - case 15: { - LogStep(15, - "Step 7b: Read the global attribute: GeneratedCommandList. 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)"); - 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); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_RVCRUNM_3_1Suite : public TestCommand -{ -public: - Test_TC_RVCRUNM_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_RVCRUNM_3_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_RVCRUNM_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 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_RVCRUNM_3_3Suite : public TestCommand -{ -public: - Test_TC_RVCRUNM_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_RVCRUNM_3_3", 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_RVCRUNM_3_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) - { - 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_SWTCH_2_2Suite : public TestCommand -{ -public: - Test_TC_SWTCH_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SWTCH_2_2", 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_SWTCH_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; - - 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_SWTCH_3_2Suite : public TestCommand -{ -public: - Test_TC_SWTCH_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SWTCH_3_2", 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_SWTCH_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 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_TCCM_1_2Suite : public TestCommand -{ -public: - Test_TC_TCCM_1_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCCM_1_2", 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_TCCM_1_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; - - 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_TCCM_2_1Suite : public TestCommand -{ -public: - Test_TC_TCCM_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCCM_2_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_TCCM_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) - { - 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_TCCM_3_1Suite : public TestCommand -{ -public: - Test_TC_TCCM_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCCM_3_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_TCCM_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 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_TCCM_3_2Suite : public TestCommand -{ -public: - Test_TC_TCCM_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCCM_3_2", 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_TCCM_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 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_TCCM_3_3Suite : public TestCommand -{ -public: - Test_TC_TCCM_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCCM_3_3", 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_TCCM_3_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) - { - 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_TCTL_2_1Suite : public TestCommand -{ -public: - Test_TC_TCTL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCTL_2_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_TCTL_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) - { - 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_TCTL_2_2Suite : public TestCommand -{ -public: - Test_TC_TCTL_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCTL_2_2", 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_TCTL_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; - - 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_TCTL_2_3Suite : public TestCommand -{ -public: - Test_TC_TCTL_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCTL_2_3", 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_TCTL_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) - { - 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_TCTL_3_2Suite : public TestCommand -{ -public: - Test_TC_TCTL_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCTL_3_2", 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_TCTL_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 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_TCTL_3_3Suite : public TestCommand -{ -public: - Test_TC_TCTL_3_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TCTL_3_3", 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_TCTL_3_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) - { - 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_TMP_2_2Suite : public TestCommand -{ -public: - Test_TC_TMP_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TMP_2_2", 6, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_TMP_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; - - chip::app::DataModel::Nullable valueBeforeChange; - - 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)); - { - chip::app::DataModel::Nullable value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27315)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32766)); - } - 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", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27314)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - } - 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(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27314)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - valueBeforeChange = value; - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - shouldContinue = true; - 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(CheckConstraintType("value", "int16s", "int16s")); - VerifyOrReturn(CheckConstraintMinValue("value", value, -27314)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 32767)); - VerifyOrReturn(CheckConstraintNotValue("value", value, valueBeforeChange)); - } - 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: Read the mandatory attribute: MinMeasuredValue"); - VerifyOrDo(!ShouldSkip("TMP.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read the mandatory attribute: MaxMeasuredValue"); - VerifyOrDo(!ShouldSkip("TMP.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: Reads MeasuredValue attribute from DUT"); - VerifyOrDo(!ShouldSkip("TMP.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: Operate on device to change the temperature significantly"); - VerifyOrDo(!ShouldSkip("PICS_USER_PROMPT && TMP.M.ManuallyControlled"), 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 5: { - LogStep(5, "Step 6: Read the mandatory attribute: MeasuredValue"); - VerifyOrDo(!ShouldSkip("TMP.S.A0000 && TMP.M.ManuallyControlled"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TemperatureMeasurement::Id, - TemperatureMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TSTAT_3_2Suite : public TestCommand -{ -public: - Test_TC_TSTAT_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_TSTAT_3_2", 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_TSTAT_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 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_DGTHREAD_2_5Suite : public TestCommand -{ -public: - Test_TC_DGTHREAD_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_DGTHREAD_2_5", 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_DGTHREAD_2_5Suite() {} - - 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_ACT_2_1Suite : public TestCommand -{ -public: - Test_TC_ACT_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACT_2_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_ACT_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) - { - 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_ACT_2_2Suite : public TestCommand -{ -public: - Test_TC_ACT_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACT_2_2", 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_ACT_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; - - 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_ACT_3_2Suite : public TestCommand -{ -public: - Test_TC_ACT_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_ACT_3_2", 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_ACT_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 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_BIND_2_1Suite : public TestCommand -{ -public: - Test_TC_BIND_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BIND_2_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_BIND_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) - { - 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_BIND_2_2Suite : public TestCommand -{ -public: - Test_TC_BIND_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BIND_2_2", 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_BIND_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; - - 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_BIND_2_3Suite : public TestCommand -{ -public: - Test_TC_BIND_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_BIND_2_3", 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_BIND_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) - { - 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_S_1_1Suite : public TestCommand -{ -public: - Test_TC_S_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_S_1_1", 17, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_S_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, 5U)); - 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)); - { - uint32_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("featureMap", value, 1UL)); - VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); - } - 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))); - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - 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 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, 1UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - 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, 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, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - 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 7: - 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, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); - } - break; - case 8: - 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")); - } - break; - case 9: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 40UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 41UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 42UL)); - } - break; - case 10: - 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - break; - 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, 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 40UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 41UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 42UL)); - } - 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, 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - 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, 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, 5UL)); - VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); - } - 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))); - VerifyOrReturn(CheckConstraintType("value", "list", "list")); - VerifyOrReturn(CheckConstraintContains("value", value, 40UL)); - } - break; - 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, 41UL)); - } - break; - case 16: - 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, 42UL)); - } - 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: Commission DUT to TH (can be skipped if done in a preceding test)"); - 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: Read ClusterRevision (global attribute 65533)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::ClusterRevision::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: Read FeatureMap (global attribute 65532)"); - VerifyOrDo(!ShouldSkip("(!S.S.F00)"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 3: Read FeatureMap (global attribute 65532)"); - VerifyOrDo(!ShouldSkip("S.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::FeatureMap::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 4: Read AttributeList (global attribute 65531) if S.S.A0005 is true"); - VerifyOrDo(!ShouldSkip("S.S.A0005 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 4: Read AttributeList (global attribute 65531) if S.S.A0005 is true"); - VerifyOrDo(!ShouldSkip("S.S.A0005 && !PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 4: Read AttributeList (global attribute 65531) if S.S.A0005 is false"); - VerifyOrDo(!ShouldSkip(" !S.S.A0005 && PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 4: Read AttributeList (global attribute 65531) if S.S.A0005 is false"); - VerifyOrDo(!ShouldSkip(" !S.S.A0005 && !PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AttributeList::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 5: Read EventList (global attribute 65530)"); - VerifyOrDo(!ShouldSkip("PICS_EVENT_LIST_ENABLED"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::EventList::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 6a: Read AcceptedCommandList (global attribute 65529)"); - VerifyOrDo(!ShouldSkip("S.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 10: { - LogStep(10, "Step 6b: Read AcceptedCommandList (global attribute 65529)"); - VerifyOrDo(!ShouldSkip("(!S.S.C40.Rsp)"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 11: { - LogStep(11, "Step 6c: Read AcceptedCommandList (global attribute 65529)"); - VerifyOrDo(!ShouldSkip("S.C.C40.Tx"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 12: { - LogStep(12, "Step 6d: Read AcceptedCommandList (global attribute 65529)"); - VerifyOrDo(!ShouldSkip("(!S.C.C40.Tx)"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AcceptedCommandList::Id, true, - chip::NullOptional); - } - case 13: { - LogStep(13, "Step 7a: Read GeneratedCommandList (global attribute 65528)"); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 14: { - LogStep(14, - "Step 7b: Read optional command(EnhancedAddSceneResponse) in GeneratedCommandList (global attribute 65528)"); - VerifyOrDo(!ShouldSkip("S.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 15: { - LogStep(15, - "Step 7c: Read optional command(EnhancedViewSceneResponse) in GeneratedCommandList (global attribute 65528)"); - VerifyOrDo(!ShouldSkip("S.S.C41.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - case 16: { - LogStep(16, "Step 7d: Read optional command(CopySceneResponse) in GeneratedCommandList (global attribute 65528)"); - VerifyOrDo(!ShouldSkip("S.S.C42.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::GeneratedCommandList::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_S_2_1Suite : public TestCommand -{ -public: - Test_TC_S_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_S_2_1", 10, credsIssuerConfig) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~Test_TC_S_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)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int8u", "int8u")); - } - 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", "int8u", "int8u")); - } - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - chip::GroupId value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "group_id", "groupid")); - } - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - bool value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "boolean", "int8u")); - } - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("nameSupport", value, 128U)); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "int8u")); - } - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint8_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("nameSupport", value, 0U)); - VerifyOrReturn(CheckConstraintType("value", "bitmap8", "int8u")); - } - break; - case 7: - 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", "node_id", "nodeId")); - } - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - { - uint16_t value; - VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckConstraintType("value", "int16u", "uint16")); - } - break; - case 9: - 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")); - } - 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 reads from the DUT the (0x0000) SceneCount attribute"); - VerifyOrDo(!ShouldSkip("S.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::SceneCount::Id, true, - chip::NullOptional); - } - case 2: { - LogStep(2, "Step 3: TH reads from the DUT the (0x0001) CurrentScene attribute"); - VerifyOrDo(!ShouldSkip("S.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::CurrentScene::Id, true, - chip::NullOptional); - } - case 3: { - LogStep(3, "Step 4: TH reads from the DUT the (0x0002) CurrentGroup attribute"); - VerifyOrDo(!ShouldSkip("S.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::CurrentGroup::Id, true, - chip::NullOptional); - } - case 4: { - LogStep(4, "Step 5: TH reads from the DUT the (0x0003) SceneValid attribute"); - VerifyOrDo(!ShouldSkip("S.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::SceneValid::Id, true, - chip::NullOptional); - } - case 5: { - LogStep(5, "Step 6: TH reads from the DUT the (0x0004) NameSupport attribute"); - VerifyOrDo(!ShouldSkip("S.S.A0003 && S.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::NameSupport::Id, true, - chip::NullOptional); - } - case 6: { - LogStep(6, "Step 6: TH reads from the DUT the (0x0004) NameSupport attribute"); - VerifyOrDo(!ShouldSkip("S.S.A0004 && (!S.S.F00)"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::NameSupport::Id, true, - chip::NullOptional); - } - case 7: { - LogStep(7, "Step 7: TH reads from the DUT the (0x0005) LastConfiguredBy attribute"); - VerifyOrDo(!ShouldSkip("S.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::LastConfiguredBy::Id, true, - chip::NullOptional); - } - case 8: { - LogStep(8, "Step 8: TH reads from the DUT the (0x0006) SceneTableSize attribute"); - VerifyOrDo(!ShouldSkip("S.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::SceneTableSize::Id, true, - chip::NullOptional); - } - case 9: { - LogStep(9, "Step 9: TH reads from the DUT the (0x0007) RemainingCapacity attribute"); - VerifyOrDo(!ShouldSkip("S.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); - return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::RemainingCapacity::Id, true, - chip::NullOptional); - } - } - return CHIP_NO_ERROR; - } -}; - -class Test_TC_S_2_5Suite : public TestCommand -{ -public: - Test_TC_S_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_S_2_5", 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_S_2_5Suite() {} - - 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_S_2_6Suite : public TestCommand -{ -public: - Test_TC_S_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_S_2_6", 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_S_2_6Suite() {} - - 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_BRBINFO_2_2Suite : public TestCommand -{ -public: - Test_TC_BRBINFO_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BRBINFO_2_2", 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_BRBINFO_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; - - 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_BRBINFO_3_1Suite : public TestCommand -{ -public: - Test_TC_BRBINFO_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_BRBINFO_3_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_BRBINFO_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 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_WASHERCTRL_1_1Suite : public TestCommand -{ -public: - Test_TC_WASHERCTRL_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WASHERCTRL_1_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_WASHERCTRL_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) - { - 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_WASHERCTRL_2_1Suite : public TestCommand -{ -public: - Test_TC_WASHERCTRL_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WASHERCTRL_2_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_WASHERCTRL_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) - { - 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_WASHERCTRL_2_2Suite : public TestCommand -{ -public: - Test_TC_WASHERCTRL_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WASHERCTRL_2_2", 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_WASHERCTRL_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; - - 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_WASHERCTRL_3_1Suite : public TestCommand -{ -public: - Test_TC_WASHERCTRL_3_1Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WASHERCTRL_3_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_WASHERCTRL_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 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_WASHERCTRL_3_2Suite : public TestCommand -{ -public: - Test_TC_WASHERCTRL_3_2Suite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("Test_TC_WASHERCTRL_3_2", 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_WASHERCTRL_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 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; - } -}; - -#endif // CONFIG_ENABLE_YAML_TESTS - -void registerCommandsTests(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) -{ - const char * clusterName = "Tests"; - - commands_list clusterCommands = { -#if CONFIG_ENABLE_YAML_TESTS - make_unique(), - make_unique(), - make_unique(), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - 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), - make_unique(credsIssuerConfig), -#endif // CONFIG_ENABLE_YAML_TESTS - }; - - commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for running YAML tests."); -}