From e2a84c22f2348538c4f175c9931c74c7b65aa708 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 22 Aug 2023 09:55:18 -0400 Subject: [PATCH 01/13] change idle mode interval type to seconds --- src/app/ReadHandler.cpp | 2 +- src/app/icd/ICDManager.cpp | 5 +++-- src/app/icd/IcdManagementServer.h | 6 +++--- src/app/tests/suites/TestIcdManagementCluster.yaml | 2 +- src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml | 4 ++-- src/app/tests/suites/certification/Test_TC_IDM_4_2.yaml | 4 ++-- .../zcl/data-model/chip/icd-management-cluster.xml | 2 +- src/lib/core/CHIPConfig.h | 4 ++-- 8 files changed, 15 insertions(+), 14 deletions(-) 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..d512faecad1dec 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -127,8 +127,9 @@ void ICDManager::UpdateOperationState(OperationalState state) if (state == OperationalState::IdleMode) { - mOperationalState = OperationalState::IdleMode; - uint32_t idleModeInterval = IcdManagementServer::GetInstance().GetIdleModeInterval(); + mOperationalState = OperationalState::IdleMode; + uint32_t idleModeInterval = + (IcdManagementServer::GetInstance().GetIdleModeInterval() * 1000); // convert IdleModeInterval from s to ms DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(idleModeInterval), OnIdleModeDone, this); System::Clock::Milliseconds32 slowPollInterval = GetSlowPollingInterval(); diff --git a/src/app/icd/IcdManagementServer.h b/src/app/icd/IcdManagementServer.h index 8f08d62b38b5d2..616659ac3e9475 100644 --- a/src/app/icd/IcdManagementServer.h +++ b/src/app/icd/IcdManagementServer.h @@ -66,9 +66,9 @@ 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 mIdleInterval = CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL; // in seconds + uint32_t mActiveInterval = CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL; // in milliseconds + uint16_t mActiveThreshold = CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD; // in milliseconds uint32_t mIcdCounter = 0; uint16_t mFabricClientsSupported = CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC; }; 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 index 7a248a16045c59..d94320f169ea6f 100644 --- a/src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml @@ -39,8 +39,8 @@ tests: saveAs: IdleModeIntervalValue constraints: type: int32u - minValue: 500 - maxValue: 64800000 + minValue: 1 + maxValue: 64800 - label: "Step 3: TH reads from the DUT the ActiveModeInterval attribute" PICS: ICDM.S.A0001 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/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 /** From 26d65d9c7a00cf9e215769556d35dd80e0c2c614 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 22 Aug 2023 10:29:59 -0400 Subject: [PATCH 02/13] Update silabs configurations --- examples/light-switch-app/silabs/openthread.gni | 2 +- examples/lock-app/silabs/openthread.gni | 2 +- third_party/silabs/efr32_sdk.gni | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) 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/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 3e56227a15b7d4..6cf98ce806aa5d 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -54,7 +54,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 @@ -354,7 +354,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}", ] From c622f638722be0b1ee1b2d6570b925ae1495c42a Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 22 Aug 2023 11:47:36 -0400 Subject: [PATCH 03/13] Fix unit tests with type change --- src/app/tests/TestICDManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 08276373c8775bc96f57f4af247304046aeb7eef Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 22 Aug 2023 12:34:13 -0400 Subject: [PATCH 04/13] Address review comments --- src/app/icd/ICDManager.cpp | 5 ++--- src/app/icd/IcdManagementServer.h | 13 ++++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index d512faecad1dec..6447b7840502fb 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -128,9 +128,8 @@ void ICDManager::UpdateOperationState(OperationalState state) if (state == OperationalState::IdleMode) { mOperationalState = OperationalState::IdleMode; - uint32_t idleModeInterval = - (IcdManagementServer::GetInstance().GetIdleModeInterval() * 1000); // convert IdleModeInterval from s to ms - DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(idleModeInterval), OnIdleModeDone, this); + uint32_t idleModeInterval = IcdManagementServer::GetInstance().GetIdleModeInterval(); + 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 616659ac3e9475..f74d40dac15eae 100644 --- a/src/app/icd/IcdManagementServer.h +++ b/src/app/icd/IcdManagementServer.h @@ -66,10 +66,21 @@ class IcdManagementServer IcdManagementServer() = default; static IcdManagementServer mInstance; - uint32_t mIdleInterval = CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL; // in seconds + + 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; }; From 0f59893562f0fbd1f4029e186205c4d432f7a83f Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 22 Aug 2023 13:11:51 -0400 Subject: [PATCH 05/13] restyle --- src/app/icd/ICDManager.cpp | 2 +- src/app/icd/IcdManagementServer.h | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index 6447b7840502fb..91f12c23035361 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -127,7 +127,7 @@ void ICDManager::UpdateOperationState(OperationalState state) if (state == OperationalState::IdleMode) { - mOperationalState = OperationalState::IdleMode; + mOperationalState = OperationalState::IdleMode; uint32_t idleModeInterval = IcdManagementServer::GetInstance().GetIdleModeInterval(); DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds32(idleModeInterval), OnIdleModeDone, this); diff --git a/src/app/icd/IcdManagementServer.h b/src/app/icd/IcdManagementServer.h index f74d40dac15eae..185731b5257387 100644 --- a/src/app/icd/IcdManagementServer.h +++ b/src/app/icd/IcdManagementServer.h @@ -67,20 +67,25 @@ class IcdManagementServer static IcdManagementServer mInstance; - 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) <= 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. + 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_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 + 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; + 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."); + 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; }; From 9b7064bdd967b6a53209c514b823c99545ab8d8a Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 22 Aug 2023 14:51:42 -0400 Subject: [PATCH 06/13] fix yaml tests --- src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml | 2 +- .../darwin-framework-tool/zap-generated/test/Commands.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 index d94320f169ea6f..62ac283afcc8e8 100644 --- a/src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml @@ -50,7 +50,7 @@ tests: constraints: type: int32u minValue: 300 - maxValue: IdleModeIntervalValue + maxValue: (IdleModeIntervalValue * 1000) - label: "Step 4: TH reads from the DUT the ActiveModeThreshold attribute" PICS: ICDM.S.A0002 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 c1db86cc0585e0..e01c152cff3dfb 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -56786,7 +56786,7 @@ class Test_TC_ICDM_2_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintType("activeModeInterval", "int32u", "int32u")); VerifyOrReturn(CheckConstraintMinValue("activeModeInterval", [value unsignedIntValue], 300UL)); VerifyOrReturn( - CheckConstraintMaxValue("activeModeInterval", [value unsignedIntValue], IdleModeIntervalValue)); + CheckConstraintMaxValue("activeModeInterval", [value unsignedIntValue], (IdleModeIntervalValue * 1000))); NextTest(); }]; From 100c17b7479393fee549b576de3e66b3f7bbae38 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 22 Aug 2023 16:30:49 -0400 Subject: [PATCH 07/13] generated files --- .../darwin-framework-tool/zap-generated/test/Commands.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 e01c152cff3dfb..8dfa39f7e4220c 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -44735,7 +44735,7 @@ class TestIcdManagementCluster : public TestCommandBridge { { id actualValue = value; - VerifyOrReturn(CheckValue("IdleModeInterval", actualValue, 2000UL)); + VerifyOrReturn(CheckValue("IdleModeInterval", actualValue, 2UL)); } NextTest(); @@ -56759,8 +56759,8 @@ class Test_TC_ICDM_2_1 : public TestCommandBridge { 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)); + VerifyOrReturn(CheckConstraintMinValue("idleModeInterval", [value unsignedIntValue], 1UL)); + VerifyOrReturn(CheckConstraintMaxValue("idleModeInterval", [value unsignedIntValue], 64800UL)); { IdleModeIntervalValue = value; } From 3773614e41eec78e95b5acadc04c9a7737783c6a Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 22 Aug 2023 19:10:40 -0400 Subject: [PATCH 08/13] replace yaml test by python test --- .github/workflows/tests.yaml | 1 + .../certification/Test_TC_ICDM_2_1.yaml | 88 --------------- src/app/tests/suites/ciTests.json | 2 +- src/python_testing/TC_ICDM_2_1.py | 102 ++++++++++++++++++ 4 files changed, 104 insertions(+), 89 deletions(-) delete mode 100644 src/app/tests/suites/certification/Test_TC_ICDM_2_1.yaml create mode 100644 src/python_testing/TC_ICDM_2_1.py diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 3acc9e4cdf4fe2..e5e8f9d2eb78d3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -417,6 +417,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 --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/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 62ac283afcc8e8..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: 1 - maxValue: 64800 - - - 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 * 1000) - - - 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/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/python_testing/TC_ICDM_2_1.py b/src/python_testing/TC_ICDM_2_1.py new file mode 100644 index 00000000000000..897c13acfba792 --- /dev/null +++ b/src/python_testing/TC_ICDM_2_1.py @@ -0,0 +1,102 @@ +# +# 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 ipaddress +from datetime import timedelta + +import chip.clusters as Clusters +from chip.clusters.Types import NullValue +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") + + registeredClients = 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") + + icdCounter = 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() From 3bee8df37265fbf927976273c533576dfcbc8d04 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 22 Aug 2023 19:17:38 -0400 Subject: [PATCH 09/13] regen yaml --- .../zap-generated/test/Commands.h | 287 ------------------ 1 file changed, 287 deletions(-) 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 8dfa39f7e4220c..224e2e58e8e558 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"); @@ -56594,291 +56593,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], 1UL)); - VerifyOrReturn(CheckConstraintMaxValue("idleModeInterval", [value unsignedIntValue], 64800UL)); - { - 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 * 1000))); - - 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 @@ -178682,7 +178396,6 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(), From e1bfb6921e853b9777157a83be8f1f9df2dcecb3 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Tue, 22 Aug 2023 19:28:15 -0400 Subject: [PATCH 10/13] remove unused code --- src/python_testing/TC_ICDM_2_1.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/python_testing/TC_ICDM_2_1.py b/src/python_testing/TC_ICDM_2_1.py index 897c13acfba792..2962caf97f1b9e 100644 --- a/src/python_testing/TC_ICDM_2_1.py +++ b/src/python_testing/TC_ICDM_2_1.py @@ -14,12 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -import ipaddress -from datetime import timedelta - import chip.clusters as Clusters -from chip.clusters.Types import NullValue from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main from mobly import asserts @@ -78,15 +73,15 @@ async def test_TC_ICDM_2_1(self): if (self.check_pics("ICDM.S.A0003")): self.print_step(2, "Read RegisteredClients Attribute") - registeredClients = await self.read_icdm_attribute_expect_success(endpoint=endpoint, - attribute=attributes.RegisteredClients) + 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") - icdCounter = await self.read_icdm_attribute_expect_success(endpoint=endpoint, - attribute=attributes.ICDCounter) + await self.read_icdm_attribute_expect_success(endpoint=endpoint, + attribute=attributes.ICDCounter) # ClientsSupportedPerFabric attribute test if (self.check_pics("ICDM.S.A0003")): From e89615667caf6c325f5879b1a77af2b496a3a576 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Thu, 24 Aug 2023 10:07:46 -0400 Subject: [PATCH 11/13] Fixed variable name in python test --- src/python_testing/TC_ICDM_2_1.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python_testing/TC_ICDM_2_1.py b/src/python_testing/TC_ICDM_2_1.py index 2962caf97f1b9e..c329feec34985b 100644 --- a/src/python_testing/TC_ICDM_2_1.py +++ b/src/python_testing/TC_ICDM_2_1.py @@ -21,7 +21,7 @@ class TC_ICDM_2_1(MatterBaseTest): async def read_icdm_attribute_expect_success(self, endpoint, attribute): - cluster = Clusters.Objects.ICDManagement + cluster = Clusters.Objects.IcdManagement return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) @async_test_body @@ -30,7 +30,7 @@ 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 + attributes = Clusters.IcdManagement.Attributes idleModeInterval = 0 # Idle Mode Interval attribute test From 5d77f956c6288c1c600682d983da38a6ab8cd46f Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 24 Aug 2023 14:09:19 +0000 Subject: [PATCH 12/13] Restyled by autopep8 --- src/python_testing/TC_ICDM_2_1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_ICDM_2_1.py b/src/python_testing/TC_ICDM_2_1.py index c329feec34985b..97d20fca723837 100644 --- a/src/python_testing/TC_ICDM_2_1.py +++ b/src/python_testing/TC_ICDM_2_1.py @@ -21,7 +21,7 @@ class TC_ICDM_2_1(MatterBaseTest): async def read_icdm_attribute_expect_success(self, endpoint, attribute): - cluster = Clusters.Objects.IcdManagement + cluster = Clusters.Objects.IcdManagement return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) @async_test_body From 43d2ac064709e90e5e8a748563b07a0a2c709be4 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Thu, 24 Aug 2023 13:20:47 -0400 Subject: [PATCH 13/13] Added PICS values file in test.yaml command --- .github/workflows/tests.yaml | 2 +- src/app/tests/suites/certification/ci-pics-values | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e5e8f9d2eb78d3..dbe1684c7f3673 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -417,7 +417,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 --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/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