From 6b04a5be1ae617957505dc6b6d64a7a2886eb4c8 Mon Sep 17 00:00:00 2001 From: Fesseha Date: Wed, 3 Aug 2022 18:04:40 +0200 Subject: [PATCH] Improve occupancy testing cluster tests --- .../suites/certification/Test_TC_OCC_2_1.yaml | 2 +- .../suites/certification/Test_TC_OCC_2_2.yaml | 4 +- .../suites/certification/Test_TC_OCC_2_3.yaml | 54 +++++++++---------- .../suites/certification/Test_TC_OCC_2_4.yaml | 4 +- .../chip-tool/zap-generated/test/Commands.h | 47 +++++++++++++++- .../zap-generated/test/Commands.h | 2 +- 6 files changed, 78 insertions(+), 35 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_OCC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_OCC_2_1.yaml index 72ff07f9db86df..ed41fc63926f0d 100644 --- a/src/app/tests/suites/certification/Test_TC_OCC_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_OCC_2_1.yaml @@ -59,7 +59,7 @@ tests: constraints: type: bitmap8 minValue: 1 - maxValue: 273 + maxValue: 7 - label: "Reads optional attribute: PIROccupiedToUnoccupiedDelay" PICS: OCC.S.A0010 diff --git a/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml b/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml index c86fb0a6334948..2fab86a38b37bc 100644 --- a/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml @@ -20,8 +20,8 @@ PICS: config: nodeId: 0x12344321 - cluster: "Basic" - endpoint: 0 + cluster: "Occupancy Sensing" + endpoint: 1 tests: - label: "Commission DUT to TH" diff --git a/src/app/tests/suites/certification/Test_TC_OCC_2_3.yaml b/src/app/tests/suites/certification/Test_TC_OCC_2_3.yaml index f87b86e5ee8469..1f806e9d3757a2 100644 --- a/src/app/tests/suites/certification/Test_TC_OCC_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_OCC_2_3.yaml @@ -22,34 +22,34 @@ PICS: config: nodeId: 0x12344321 - cluster: "Basic" - endpoint: 0 + cluster: "Occupancy Sensing" + endpoint: 1 tests: - - label: "Commission DUT to TH" - verification: | - verification step to be updated. - disabled: true - - - label: "TH reads OccupancySensorType attribute from DUT" + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Reads mandatory attribute constrains: OccupancySensorType" PICS: OCC.S.A0001 - verification: | - ./chip-tool occupancysensing read occupancy-sensor-type 1 1 - - on TH , Verify that the DUT response contains a non-reserved value: - - [1648461912.765825][9300:9306] CHIP:DMG: } - [1648461912.766013][9300:9306] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0406 Attribute 0x0000_0001 DataVersion: 3082917122 - [1648461912.766089][9300:9306] CHIP:TOO: occupancy sensor type: 0 - disabled: true - - - label: "TH reads OccupancySensorTypeBitmap attribute from DUT" + command: "readAttribute" + attribute: "occupancy sensor type" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 3 + + - label: "Reads mandatory attribute constrains: OccupancySensorTypeBitmap" PICS: OCC.S.A0002 - verification: | - ./chip-tool occupancysensing read occupancy-sensor-type-bitmap 1 1 - - on TH , Verify that the DUT response contains a bitmap value: - - [1648461918.499009][9307:9312] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0406 Attribute 0x0000_0002 DataVersion: 3082917122 - [1648461918.499082][9307:9312] CHIP:TOO: occupancy sensor type bitmap: 1 - disabled: true + command: "readAttribute" + attribute: "occupancy sensor type bitmap" + response: + constraints: + type: bitmap8 + minValue: 1 + maxValue: 7 diff --git a/src/app/tests/suites/certification/Test_TC_OCC_2_4.yaml b/src/app/tests/suites/certification/Test_TC_OCC_2_4.yaml index 53f3b285bf8ec3..8bf07eeb74588e 100644 --- a/src/app/tests/suites/certification/Test_TC_OCC_2_4.yaml +++ b/src/app/tests/suites/certification/Test_TC_OCC_2_4.yaml @@ -22,8 +22,8 @@ PICS: config: nodeId: 0x12344321 - cluster: "Basic" - endpoint: 0 + cluster: "Occupancy Sensing" + endpoint: 1 tests: - label: "Commission DUT to TH" diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 56dc5e2d07ddb4..81a5232642393d 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -23517,7 +23517,7 @@ class Test_TC_OCC_2_1Suite : public TestCommand VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); VerifyOrReturn(CheckConstraintType("value", "bitmap8", "bitmap8")); VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); - VerifyOrReturn(CheckConstraintMaxValue("value", value, 273U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); } break; case 4: @@ -84912,7 +84912,7 @@ class Test_TC_OCC_2_2Suite : public TestCommand class Test_TC_OCC_2_3Suite : public TestCommand { public: - Test_TC_OCC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_2_3", 0, credsIssuerConfig) + Test_TC_OCC_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OCC_2_3", 3, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -84945,6 +84945,30 @@ class Test_TC_OCC_2_3Suite : public TestCommand switch (mTestIndex - 1) { + case 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, 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", "bitmap8", "bitmap8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 1U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -84960,6 +84984,25 @@ class Test_TC_OCC_2_3Suite : public TestCommand 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, "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, "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; } 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 e0b62d2ab70914..113cc67a2a7d8b 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -39009,7 +39009,7 @@ class Test_TC_OCC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckConstraintType("occupancySensorTypeBitmap", "bitmap8", "bitmap8")); VerifyOrReturn(CheckConstraintMinValue("occupancySensorTypeBitmap", [value unsignedCharValue], 1U)); - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", [value unsignedCharValue], 273U)); + VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", [value unsignedCharValue], 7U)); NextTest(); }];