diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 9aa099bf0bbef2..ea421b96afccc3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -418,6 +418,7 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_CGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' diff --git a/examples/light-switch-app/silabs/openthread.gni b/examples/light-switch-app/silabs/openthread.gni index 09acff17959824..19b09c05a8f4b6 100644 --- a/examples/light-switch-app/silabs/openthread.gni +++ b/examples/light-switch-app/silabs/openthread.gni @@ -35,6 +35,6 @@ sl_ot_idle_interval_ms = 30000 # 30s Idle Intervals sl_ot_active_interval_ms = 500 # 500ms Active Intervals # ICD Matter Configuration flags -sl_idle_mode_interval_ms = 3600000 # 60min Idle Mode Interval +sl_idle_mode_interval_s = 3600 # 60min Idle Mode Interval sl_active_mode_interval_ms = 60000 # 60s Active Mode Interval sl_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold diff --git a/examples/lock-app/silabs/openthread.gni b/examples/lock-app/silabs/openthread.gni index 570d5e804f6c4d..cde56f8029f6da 100644 --- a/examples/lock-app/silabs/openthread.gni +++ b/examples/lock-app/silabs/openthread.gni @@ -35,6 +35,6 @@ sl_ot_idle_interval_ms = 5000 # 5s Idle Intervals sl_ot_active_interval_ms = 500 # 500ms Active Intervals # ICD Matter Configuration flags -sl_idle_mode_interval_ms = 600000 # 10min Idle Mode Interval +sl_idle_mode_interval_s = 600 # 10min Idle Mode Interval sl_active_mode_interval_ms = 10000 # 10s Active Mode Interval sl_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index 1295cc6920c462..c56180ab0db48c 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -45,7 +45,7 @@ using Status = Protocols::InteractionModel::Status; uint16_t ReadHandler::GetPublisherSelectedIntervalLimit() { #if CHIP_CONFIG_ENABLE_ICD_SERVER - return static_cast(IcdManagementServer::GetInstance().GetIdleModeInterval() / 1000); + return static_cast(IcdManagementServer::GetInstance().GetIdleModeInterval()); #else return kSubscriptionMaxIntervalPublisherLimit; #endif diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index 6601877793f8e0..91f12c23035361 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -129,7 +129,7 @@ void ICDManager::UpdateOperationState(OperationalState state) { mOperationalState = OperationalState::IdleMode; uint32_t idleModeInterval = IcdManagementServer::GetInstance().GetIdleModeInterval(); - DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(idleModeInterval), OnIdleModeDone, this); + DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(idleModeInterval), OnIdleModeDone, this); System::Clock::Milliseconds32 slowPollInterval = GetSlowPollingInterval(); diff --git a/src/app/icd/IcdManagementServer.h b/src/app/icd/IcdManagementServer.h index 8f08d62b38b5d2..185731b5257387 100644 --- a/src/app/icd/IcdManagementServer.h +++ b/src/app/icd/IcdManagementServer.h @@ -66,10 +66,26 @@ class IcdManagementServer IcdManagementServer() = default; static IcdManagementServer mInstance; - uint32_t mIdleInterval = CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL; - uint32_t mActiveInterval = CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL; - uint16_t mActiveThreshold = CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD; - uint32_t mIcdCounter = 0; + + static_assert((CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL) <= 64800, + "Spec requires the IdleModeInterval to be equal or inferior to 64800s."); + static_assert((CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL) >= 1, "Spec requires the IdleModeInterval to be equal or greater to 1s."); + uint32_t mIdleInterval = CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL; // in seconds. + + static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL) <= (CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL * 1000), + "Spec requires the IdleModeInterval be equal or greater to the ActiveModeInterval."); + static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL) >= 300, + "Spec requires the ActiveModeThreshold to be equal or greater to 300ms"); + uint32_t mActiveInterval = CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL; // in milliseconds + + static_assert((CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD) >= 300, + "Spec requires the ActiveModeThreshold to be equal or greater to 300ms."); + uint16_t mActiveThreshold = CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD; // in milliseconds + + uint32_t mIcdCounter = 0; + + static_assert((CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC) >= 1, + "Spec requires the minimum of supported clients per fabric be equal or greater to 1."); uint16_t mFabricClientsSupported = CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC; }; diff --git a/src/app/tests/TestICDManager.cpp b/src/app/tests/TestICDManager.cpp index 2f5546f067c2e4..a6523bb03008c2 100644 --- a/src/app/tests/TestICDManager.cpp +++ b/src/app/tests/TestICDManager.cpp @@ -117,7 +117,7 @@ class TestICDManager AdvanceClockAndRunEventLoop(ctx, IcdManagementServer::GetInstance().GetActiveModeInterval() + 1); // Active mode interval expired, ICDManager transitioned to the IdleMode. NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::IdleMode); - AdvanceClockAndRunEventLoop(ctx, IcdManagementServer::GetInstance().GetIdleModeInterval() + 1); + AdvanceClockAndRunEventLoop(ctx, (IcdManagementServer::GetInstance().GetIdleModeInterval() * 1000) + 1); // Idle mode interval expired, ICDManager transitioned to the ActiveMode. NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::ActiveMode); diff --git a/src/app/tests/suites/TestIcdManagementCluster.yaml b/src/app/tests/suites/TestIcdManagementCluster.yaml index fb52bd71a48a0b..d02a3a6d2a91ec 100644 --- a/src/app/tests/suites/TestIcdManagementCluster.yaml +++ b/src/app/tests/suites/TestIcdManagementCluster.yaml @@ -32,7 +32,7 @@ tests: command: "readAttribute" attribute: "IdleModeInterval" response: - value: 2000 + value: 2 - label: "Read ActiveModeInterval" command: "readAttribute" diff --git a/src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml b/src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml deleted file mode 100644 index 7a248a16045c59..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright (c) 2023 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: 312.2.1. [TC-ICDM-2.1] Attributes with DUT as Server - -PICS: - - ICDM.S - -config: - nodeId: 0x12344321 - cluster: "ICD Management" - endpoint: 0 - -tests: - - label: "Step 1: Wait for the commissioned device to be retrieved" - cluster: "DelayCommands" - command: "WaitForCommissionee" - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: "Step 2: TH reads from the DUT the IdleModeInterval attribute" - PICS: ICDM.S.A0000 - command: "readAttribute" - attribute: "IdleModeInterval" - response: - saveAs: IdleModeIntervalValue - constraints: - type: int32u - minValue: 500 - maxValue: 64800000 - - - label: "Step 3: TH reads from the DUT the ActiveModeInterval attribute" - PICS: ICDM.S.A0001 - command: "readAttribute" - attribute: "ActiveModeInterval" - response: - constraints: - type: int32u - minValue: 300 - maxValue: IdleModeIntervalValue - - - label: "Step 4: TH reads from the DUT the ActiveModeThreshold attribute" - PICS: ICDM.S.A0002 - command: "readAttribute" - attribute: "ActiveModeThreshold" - response: - constraints: - type: int16u - minValue: 300 - - - label: "Step 5: TH reads from the DUT the RegisteredClients attribute" - PICS: ICDM.S.A0003 - command: "readAttribute" - attribute: "RegisteredClients" - response: - constraints: - type: list - - - label: "Step 6: TH reads from the DUT the IcdCounter attribute" - PICS: ICDM.S.A0004 - command: "readAttribute" - attribute: "ICDCounter" - response: - constraints: - type: int32u - - - label: - "Step 7: TH reads from the DUT the ClientsSupportedPerFabric attribute" - PICS: ICDM.S.A0005 - command: "readAttribute" - attribute: "ClientsSupportedPerFabric" - response: - constraints: - type: int16u - minValue: 1 diff --git a/src/app/tests/suites/certification/Test_TC_IDM_4_2.yaml b/src/app/tests/suites/certification/Test_TC_IDM_4_2.yaml index 67ceafbb3547b2..0901e2cdf77d77 100644 --- a/src/app/tests/suites/certification/Test_TC_IDM_4_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_IDM_4_2.yaml @@ -49,7 +49,7 @@ tests: verification: | TH reads from the DUT the IdleModeInterval attribute by sending below mentioned command - icdmanagement read idle-mode-interval 1 + icdmanagement read idle-mode-interval 1 0 Please note down the value of IdleModeInterval as SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT for use in the next step validations. @@ -57,7 +57,7 @@ tests: [1690475024.398282][5675:5677] CHIP:DMG: InteractionModelRevision = 1 [1690475024.398285][5675:5677] CHIP:DMG: } [1690475024.398735][5675:5677] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0046 Attribute 0x0000_0000 DataVersion: 4216223957 - [1690475024.398921][5675:5677] CHIP:TOO: IdleModeInterval: 500 + [1690475024.398921][5675:5677] CHIP:TOO: IdleModeInterval: 1 [1690475024.399202][5675:5677] CHIP:EM: <<< [E:28320i S:44238 M:28503816 (Ack:266918637)] (S) Msg TX to 1:0000000000000001 [3C19] --- Type 0000:10 (SecureChannel:StandaloneAck) [1690475024.399208][5675:5677] CHIP:IN: (S) Sending msg 28503816 on secure session with LSID: 44238 [1690475024.399217][5675:5677] CHIP:EM: Flushed pending ack for MessageCounter:266918637 on exchange 28320i diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 6025a953f089ca..6ef9392d3af055 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2098,7 +2098,6 @@ BRBINFO.C.E02=1 BRBINFO.C.E03=1 # Interaction Data Model -ICDM.S=1 MCORE.IDM.C=1 MCORE.IDM.C.InvokeRequest=1 MCORE.IDM.C.ReadRequest=1 @@ -2592,6 +2591,9 @@ FAN.S.C00.Rsp=1 #ICD Management +#Server +ICDM.S=1 + #Server Attribute ICDM.S.A0000=1 ICDM.S.A0001=1 @@ -2715,4 +2717,4 @@ REFALM.S.A0002=1 REFALM.S.A0003=1 REFALM.S.E00=1 REFALM.S.C00.Rsp=1 -REFALM.S.C01.Rsp=1 \ No newline at end of file +REFALM.S.C01.Rsp=1 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 93746a43470d09..8fd0ac79b9c1ea 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -74,7 +74,7 @@ "GeneralCommissioning": ["Test_TC_CGEN_1_1", "Test_TC_CGEN_2_1"], "GeneralDiagnostics": ["Test_TC_DGGEN_1_1", "Test_TC_DGGEN_2_1"], "GroupKeyManagement": ["Test_TC_GRPKEY_1_1"], - "IcdManagement": ["Test_TC_ICDM_1_1", "Test_TC_ICDM_2_1"], + "IcdManagement": ["Test_TC_ICDM_1_1"], "Identify": [ "Test_TC_I_1_1", "Test_TC_I_2_1", diff --git a/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml index 5488f587487818..b16101ee25da0e 100644 --- a/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/icd-management-cluster.xml @@ -42,7 +42,7 @@ limitations under the License. - IdleModeInterval + IdleModeInterval ActiveModeInterval ActiveModeThreshold diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 2aba0915a2d52d..b59f3b0ef3bf6f 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -1476,10 +1476,10 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; /** * @def CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL * - * @brief Default value for the ICD Management cluster IdleModeInterval attribute, in milliseconds + * @brief Default value for the ICD Management cluster IdleModeInterval attribute, in seconds */ #ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL 2000 +#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL 2 #endif /** diff --git a/src/python_testing/TC_ICDM_2_1.py b/src/python_testing/TC_ICDM_2_1.py new file mode 100644 index 00000000000000..97d20fca723837 --- /dev/null +++ b/src/python_testing/TC_ICDM_2_1.py @@ -0,0 +1,97 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_ICDM_2_1(MatterBaseTest): + async def read_icdm_attribute_expect_success(self, endpoint, attribute): + cluster = Clusters.Objects.IcdManagement + return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) + + @async_test_body + async def test_TC_ICDM_2_1(self): + + endpoint = self.user_params.get("endpoint", 0) + + self.print_step(1, "Commissioning, already done") + attributes = Clusters.IcdManagement.Attributes + idleModeInterval = 0 + + # Idle Mode Interval attribute test + if (self.check_pics("ICDM.S.A0000")): + self.print_step(2, "Read IdleModeInterval Attribute") + + idleModeInterval = await self.read_icdm_attribute_expect_success(endpoint=endpoint, + attribute=attributes.IdleModeInterval) + asserts.assert_greater_equal(idleModeInterval, 1, "IdleModeInterval attribute is smaller than minimum value (1).") + asserts.assert_less_equal(idleModeInterval, 64800, "IdleModeInterval attribute is greater than maximum value (64800).") + else: + asserts.assert_true(False, "IdleModeInterval is a mandatory attribute and must be present in the PICS file") + + # Active Mode Interval attribute test + if (self.check_pics("ICDM.S.A0001")): + self.print_step(2, "Read ActiveModeInterval Attribute") + + idleModeInterval *= 1000 # Convert seconds to milliseconds + activeModeInterval = await self.read_icdm_attribute_expect_success(endpoint=endpoint, + attribute=attributes.ActiveModeInterval) + asserts.assert_greater_equal(activeModeInterval, 300, + "ActiveModeInterval attribute is smaller than minimum value (300).") + asserts.assert_less_equal(activeModeInterval, idleModeInterval, + "ActiveModeInterval attribute is greater than the IdleModeInterval attrbiute.") + else: + asserts.assert_true(False, "ActiveModeInterval is a mandatory attribute and must be present in the PICS file") + + # Active Mode Threshold attribute test + if (self.check_pics("ICDM.S.A0002")): + self.print_step(2, "Read ActiveModeThreshold Attribute") + + activeModeThreshold = await self.read_icdm_attribute_expect_success(endpoint=endpoint, + attribute=attributes.ActiveModeThreshold) + asserts.assert_greater_equal(activeModeThreshold, 300, + "ActiveModeThreshold attribute is smaller than minimum value (300).") + else: + asserts.assert_true(False, "ActiveModeThreshold is a mandatory attribute and must be present in the PICS file") + + # RegisteredClients attribute test + if (self.check_pics("ICDM.S.A0003")): + self.print_step(2, "Read RegisteredClients Attribute") + + await self.read_icdm_attribute_expect_success(endpoint=endpoint, + attribute=attributes.RegisteredClients) + + # ICDCounter attribute test + if (self.check_pics("ICDM.S.A0003")): + self.print_step(2, "Read ICDCounter Attribute") + + await self.read_icdm_attribute_expect_success(endpoint=endpoint, + attribute=attributes.ICDCounter) + + # ClientsSupportedPerFabric attribute test + if (self.check_pics("ICDM.S.A0003")): + self.print_step(2, "Read ClientsSupportedPerFabric Attribute") + + clientsSupportedPerFabric = await self.read_icdm_attribute_expect_success(endpoint=endpoint, + attribute=attributes.ClientsSupportedPerFabric) + asserts.assert_greater_equal(clientsSupportedPerFabric, 1, + "ActiveModeThreshold attribute is smaller than minimum value (300).") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 50ec1eaf051668..5b4238b47d6473 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -52,7 +52,7 @@ declare_args() { sl_ot_active_interval_ms = 200 # 200ms Active Intervals # ICD Matter Configuration flags - sl_idle_mode_interval_ms = 600000 # 10min Idle Mode Interval + sl_idle_mode_interval_s = 600 # 10min Idle Mode Interval sl_active_mode_interval_ms = 1000 # 1s Active Mode Interval sl_active_mode_threshold_ms = 500 # 500ms Active Mode Threshold sl_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric @@ -352,7 +352,7 @@ template("efr32_sdk") { "SL_ICD_ENABLED=1", "SL_ACTIVE_MODE_THRESHOLD=${sl_active_mode_threshold_ms}", "SL_ACTIVE_MODE_INTERVAL=${sl_active_mode_interval_ms}", - "SL_IDLE_MODE_INTERVAL=${sl_idle_mode_interval_ms}", + "SL_IDLE_MODE_INTERVAL=${sl_idle_mode_interval_s}", "SL_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${sl_icd_supported_clients_per_fabric}", ] diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 84fbd29b40a7bb..c5c2d9618229f1 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -113,7 +113,6 @@ class TestList : public Command { printf("Test_TC_DGGEN_2_1\n"); printf("Test_TC_GRPKEY_1_1\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"); @@ -44636,7 +44635,7 @@ class TestIcdManagementCluster : public TestCommandBridge { { id actualValue = value; - VerifyOrReturn(CheckValue("IdleModeInterval", actualValue, 2000UL)); + VerifyOrReturn(CheckValue("IdleModeInterval", actualValue, 2UL)); } NextTest(); @@ -56505,291 +56504,6 @@ class Test_TC_ICDM_1_1 : public TestCommandBridge { } }; -class Test_TC_ICDM_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ICDM_2_1() - : TestCommandBridge("Test_TC_ICDM_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_ICDM_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ICDM_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ICDM_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Step 1: Wait for the commissioned device to be retrieved\n"); - err = TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Step 2: TH reads from the DUT the IdleModeInterval attribute\n"); - if (ShouldSkip("ICDM.S.A0000")) { - NextTest(); - return; - } - err = TestStep2ThReadsFromTheDutTheIdleModeIntervalAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3: TH reads from the DUT the ActiveModeInterval attribute\n"); - if (ShouldSkip("ICDM.S.A0001")) { - NextTest(); - return; - } - err = TestStep3ThReadsFromTheDutTheActiveModeIntervalAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Step 4: TH reads from the DUT the ActiveModeThreshold attribute\n"); - if (ShouldSkip("ICDM.S.A0002")) { - NextTest(); - return; - } - err = TestStep4ThReadsFromTheDutTheActiveModeThresholdAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Step 5: TH reads from the DUT the RegisteredClients attribute\n"); - if (ShouldSkip("ICDM.S.A0003")) { - NextTest(); - return; - } - err = TestStep5ThReadsFromTheDutTheRegisteredClientsAttribute_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Step 6: TH reads from the DUT the IcdCounter attribute\n"); - if (ShouldSkip("ICDM.S.A0004")) { - NextTest(); - return; - } - err = TestStep6ThReadsFromTheDutTheIcdCounterAttribute_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Step 7: TH reads from the DUT the ClientsSupportedPerFabric attribute\n"); - if (ShouldSkip("ICDM.S.A0005")) { - NextTest(); - return; - } - err = TestStep7ThReadsFromTheDutTheClientsSupportedPerFabricAttribute_6(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - NSNumber * _Nonnull IdleModeIntervalValue; - - CHIP_ERROR TestStep2ThReadsFromTheDutTheIdleModeIntervalAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeIdleModeIntervalWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 2: TH reads from the DUT the IdleModeInterval attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("idleModeInterval", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("idleModeInterval", [value unsignedIntValue], 500UL)); - VerifyOrReturn(CheckConstraintMaxValue("idleModeInterval", [value unsignedIntValue], 64800000UL)); - { - IdleModeIntervalValue = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep3ThReadsFromTheDutTheActiveModeIntervalAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeActiveModeIntervalWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 3: TH reads from the DUT the ActiveModeInterval attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("activeModeInterval", "int32u", "int32u")); - VerifyOrReturn(CheckConstraintMinValue("activeModeInterval", [value unsignedIntValue], 300UL)); - VerifyOrReturn( - CheckConstraintMaxValue("activeModeInterval", [value unsignedIntValue], IdleModeIntervalValue)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep4ThReadsFromTheDutTheActiveModeThresholdAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeActiveModeThresholdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 4: TH reads from the DUT the ActiveModeThreshold attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("activeModeThreshold", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("activeModeThreshold", [value unsignedShortValue], 300U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep5ThReadsFromTheDutTheRegisteredClientsAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[MTRReadParams alloc] init]; - params.filterByFabric = true; - [cluster readAttributeRegisteredClientsWithParams:params - completion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 5: TH reads from the DUT the RegisteredClients attribute Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("registeredClients", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep6ThReadsFromTheDutTheIcdCounterAttribute_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeICDCounterWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 6: TH reads from the DUT the IcdCounter attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("ICDCounter", "int32u", "int32u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestStep7ThReadsFromTheDutTheClientsSupportedPerFabricAttribute_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(0) queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClientsSupportedPerFabricWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Step 7: TH reads from the DUT the ClientsSupportedPerFabric attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("clientsSupportedPerFabric", "int16u", "int16u")); - VerifyOrReturn(CheckConstraintMinValue("clientsSupportedPerFabric", [value unsignedShortValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - class Test_TC_I_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -176985,7 +176699,6 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(),