From b15ea4dee3d344b04a00d1e40e47d1c53dc15132 Mon Sep 17 00:00:00 2001 From: Jon Rhees Date: Wed, 30 Aug 2023 15:55:58 -0600 Subject: [PATCH 1/6] [DRLK] Return NOT_FOUND error for non-existent User on GetWeekdaySchedule/GetYeardaySchedule commands Fixes #21791 --- .../door-lock-server/door-lock-server.cpp | 4 +- .../certification/Test_TC_DRLK_2_5.yaml | 37 +++- .../certification/Test_TC_DRLK_2_7.yaml | 26 ++- .../chip-tool/zap-generated/test/Commands.h | 87 ++++++-- .../zap-generated/test/Commands.h | 192 +++++++++++++++--- 5 files changed, 294 insertions(+), 52 deletions(-) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index ad201e78cf7d2f..032af8e582dc76 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -1046,7 +1046,7 @@ void DoorLockServer::getWeekDayScheduleCommandHandler(chip::app::CommandHandler { ChipLogProgress(Zcl, "[GetWeekDaySchedule] User does not exist [endpointId=%d,weekDayIndex=%d,userIndex=%d]", endpointId, weekDayIndex, userIndex); - sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kFailure); + sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kNotFound); return; } @@ -1246,7 +1246,7 @@ void DoorLockServer::getYearDayScheduleCommandHandler(chip::app::CommandHandler { ChipLogProgress(Zcl, "[GetYearDaySchedule] User does not exist [endpointId=%d,yearDayIndex=%d,userIndex=%d]", endpointId, yearDayIndex, userIndex); - sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kFailure); + sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kNotFound); return; } diff --git a/src/app/tests/suites/certification/Test_TC_DRLK_2_5.yaml b/src/app/tests/suites/certification/Test_TC_DRLK_2_5.yaml index 41ec78be53f221..173658de0f5e50 100644 --- a/src/app/tests/suites/certification/Test_TC_DRLK_2_5.yaml +++ b/src/app/tests/suites/certification/Test_TC_DRLK_2_5.yaml @@ -212,7 +212,40 @@ tests: constraints: hasValue: false - - label: "Step 7: TH sends Clear Week Day Schedule Command to DUT" + - label: "Step 7: TH sends Get Week Day Schedule Command to DUT for non-existent User" + PICS: DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx + command: "GetWeekDaySchedule" + arguments: + values: + - name: "WeekDayIndex" + value: 1 + - name: "UserIndex" + value: 2 + response: + values: + - name: "WeekDayIndex" + value: 1 + - name: "UserIndex" + value: 2 + - name: "Status" + value: 0x8B + - name: "DaysMask" + constraints: + hasValue: false + - name: "StartHour" + constraints: + hasValue: false + - name: "StartMinute" + constraints: + hasValue: false + - name: "EndHour" + constraints: + hasValue: false + - name: "EndMinute" + constraints: + hasValue: false + + - label: "Step 8: TH sends Clear Week Day Schedule Command to DUT" PICS: DRLK.S.F04 && DRLK.S.C0d.Rsp command: "ClearWeekDaySchedule" arguments: @@ -222,7 +255,7 @@ tests: - name: "UserIndex" value: 1 - - label: "Step 8: TH sends Get Week Day Schedule Command to DUT" + - label: "Step 9: TH sends Get Week Day Schedule Command to DUT" PICS: DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx command: "GetWeekDaySchedule" arguments: diff --git a/src/app/tests/suites/certification/Test_TC_DRLK_2_7.yaml b/src/app/tests/suites/certification/Test_TC_DRLK_2_7.yaml index 46c91e523ed360..60573c7271e65f 100644 --- a/src/app/tests/suites/certification/Test_TC_DRLK_2_7.yaml +++ b/src/app/tests/suites/certification/Test_TC_DRLK_2_7.yaml @@ -298,7 +298,31 @@ tests: constraints: minValue: 1081 - - label: "Step 12: TH sends Clear Year Day Schedule to DUT" + - label: "Step 12: TH sends Get Year Day Schedule Command to DUT for non-existent User" + PICS: DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx + command: "GetYearDaySchedule" + arguments: + values: + - name: "YearDayIndex" + value: 1 + - name: "UserIndex" + value: 2 + response: + values: + - name: "YearDayIndex" + value: 1 + - name: "UserIndex" + value: 2 + - name: "Status" + value: 0x8B + - name: "LocalStartTime" + constraints: + hasValue: false + - name: "LocalEndTime" + constraints: + hasValue: false + + - label: "Step 13: TH sends Clear Year Day Schedule to DUT" PICS: DRLK.S.F0a && DRLK.S.C10.Rsp command: "ClearYearDaySchedule" arguments: diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 943f3119aa9240..41a39cc446d5d1 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -110812,7 +110812,7 @@ class Test_TC_DRLK_2_4Suite : public TestCommand class Test_TC_DRLK_2_5Suite : public TestCommand { public: - Test_TC_DRLK_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_5", 12, credsIssuerConfig) + Test_TC_DRLK_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_5", 13, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -110946,8 +110946,23 @@ class Test_TC_DRLK_2_5Suite : public TestCommand break; case 9: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("weekDayIndex", value.weekDayIndex, 1U)); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); + VerifyOrReturn(CheckValue("status", value.status, 139U)); + VerifyOrReturn(CheckConstraintHasValue("value.daysMask", value.daysMask, false)); + VerifyOrReturn(CheckConstraintHasValue("value.startHour", value.startHour, false)); + VerifyOrReturn(CheckConstraintHasValue("value.startMinute", value.startMinute, false)); + VerifyOrReturn(CheckConstraintHasValue("value.endHour", value.endHour, false)); + VerifyOrReturn(CheckConstraintHasValue("value.endMinute", value.endMinute, false)); + } break; case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::DecodableType value; @@ -110962,7 +110977,7 @@ class Test_TC_DRLK_2_5Suite : public TestCommand VerifyOrReturn(CheckConstraintHasValue("value.endMinute", value.endMinute, false)); } break; - case 11: + case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; default: @@ -111091,7 +111106,20 @@ class Test_TC_DRLK_2_5Suite : public TestCommand ); } case 9: { - LogStep(9, "Step 7: TH sends Clear Week Day Schedule Command to DUT"); + LogStep(9, "Step 7: TH sends Get Week Day Schedule Command to DUT for non-existent User"); + VerifyOrDo(!ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type value; + value.weekDayIndex = 1U; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetWeekDaySchedule::Id, value, + chip::NullOptional + + ); + } + case 10: { + LogStep(10, "Step 8: TH sends Clear Week Day Schedule Command to DUT"); VerifyOrDo(!ShouldSkip("DRLK.S.F04 && DRLK.S.C0d.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type value; @@ -111102,8 +111130,8 @@ class Test_TC_DRLK_2_5Suite : public TestCommand ); } - case 10: { - LogStep(10, "Step 8: TH sends Get Week Day Schedule Command to DUT"); + case 11: { + LogStep(11, "Step 9: TH sends Get Week Day Schedule Command to DUT"); VerifyOrDo(!ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; @@ -111115,8 +111143,8 @@ class Test_TC_DRLK_2_5Suite : public TestCommand ); } - case 11: { - LogStep(11, "Cleanup the created user"); + case 12: { + LogStep(12, "Cleanup the created user"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; value.userIndex = 1U; @@ -111373,7 +111401,7 @@ class Test_TC_DRLK_2_6Suite : public TestCommand class Test_TC_DRLK_2_7Suite : public TestCommand { public: - Test_TC_DRLK_2_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_7", 19, credsIssuerConfig) + Test_TC_DRLK_2_7Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_DRLK_2_7", 20, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -111552,10 +111580,19 @@ class Test_TC_DRLK_2_7Suite : public TestCommand } break; case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("yearDayIndex", value.yearDayIndex, 1U)); + VerifyOrReturn(CheckValue("userIndex", value.userIndex, 2U)); + VerifyOrReturn(CheckValue("status", value.status, 139U)); + VerifyOrReturn(CheckConstraintHasValue("value.localStartTime", value.localStartTime, false)); + VerifyOrReturn(CheckConstraintHasValue("value.localEndTime", value.localEndTime, false)); + } break; case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); break; case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -111563,6 +111600,9 @@ class Test_TC_DRLK_2_7Suite : public TestCommand case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -111769,7 +111809,20 @@ class Test_TC_DRLK_2_7Suite : public TestCommand ); } case 15: { - LogStep(15, "Step 12: TH sends Clear Year Day Schedule to DUT"); + LogStep(15, "Step 12: TH sends Get Year Day Schedule Command to DUT for non-existent User"); + VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type value; + value.yearDayIndex = 1U; + value.userIndex = 2U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), DoorLock::Id, DoorLock::Commands::GetYearDaySchedule::Id, value, + chip::NullOptional + + ); + } + case 16: { + LogStep(16, "Step 12: TH sends Clear Year Day Schedule to DUT"); VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; @@ -111780,8 +111833,8 @@ class Test_TC_DRLK_2_7Suite : public TestCommand ); } - case 16: { - LogStep(16, "Clear a year day schedule for the first user"); + case 17: { + LogStep(17, "Clear a year day schedule for the first user"); VerifyOrDo(!ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type value; @@ -111792,8 +111845,8 @@ class Test_TC_DRLK_2_7Suite : public TestCommand ); } - case 17: { - LogStep(17, "Cleanup the created user with UserIndex 1"); + case 18: { + LogStep(18, "Cleanup the created user with UserIndex 1"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; value.userIndex = 1U; @@ -111802,8 +111855,8 @@ class Test_TC_DRLK_2_7Suite : public TestCommand ); } - case 18: { - LogStep(18, "Cleanup the created user with UserIndex 5"); + case 19: { + LogStep(19, "Cleanup the created user with UserIndex 5"); ListFreer listFreer; chip::app::Clusters::DoorLock::Commands::ClearUser::Type value; value.userIndex = 5U; 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..f619647d73146a 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -170892,24 +170892,33 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { err = TestStep6ThSendGetWeekDayScheduleCommandToDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Step 7: TH sends Clear Week Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0d.Rsp")) { + ChipLogProgress( + chipTool, " ***** Test Step 9 : Step 7: TH sends Get Week Day Schedule Command to DUT for non-existent User\n"); + if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx")) { NextTest(); return; } - err = TestStep7ThSendsClearWeekDayScheduleCommandToDut_9(); + err = TestStep7ThSendsGetWeekDayScheduleCommandToDutForNonExistentUser_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Step 8: TH sends Get Week Day Schedule Command to DUT\n"); - if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 8: TH sends Clear Week Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0d.Rsp")) { NextTest(); return; } - err = TestStep8ThSendsGetWeekDayScheduleCommandToDut_10(); + err = TestStep8ThSendsClearWeekDayScheduleCommandToDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Cleanup the created user\n"); - err = TestCleanupTheCreatedUser_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 9: TH sends Get Week Day Schedule Command to DUT\n"); + if (ShouldSkip("DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx")) { + NextTest(); + return; + } + err = TestStep9ThSendsGetWeekDayScheduleCommandToDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Cleanup the created user\n"); + err = TestCleanupTheCreatedUser_12(); break; } @@ -170958,6 +170967,9 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { case 11: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -170971,7 +170983,7 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; + const uint16_t mTestCount = 13; chip::Optional mNodeId; chip::Optional mCluster; @@ -171328,7 +171340,67 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep7ThSendsClearWeekDayScheduleCommandToDut_9() + CHIP_ERROR TestStep7ThSendsGetWeekDayScheduleCommandToDutForNonExistentUser_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterGetWeekDayScheduleParams alloc] init]; + params.weekDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; + [cluster + getWeekDayScheduleWithParams:params + completion:^( + MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Step 7: TH sends Get Week Day Schedule Command to DUT for non-existent User Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.weekDayIndex; + VerifyOrReturn(CheckValue("WeekDayIndex", actualValue, 1U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 2U)); + } + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); + } + + VerifyOrReturn(CheckConstraintHasValue("daysMask", values.daysMask, false)); + if (values.daysMask != nil) { + } + + VerifyOrReturn(CheckConstraintHasValue("startHour", values.startHour, false)); + if (values.startHour != nil) { + } + + VerifyOrReturn(CheckConstraintHasValue("startMinute", values.startMinute, false)); + if (values.startMinute != nil) { + } + + VerifyOrReturn(CheckConstraintHasValue("endHour", values.endHour, false)); + if (values.endHour != nil) { + } + + VerifyOrReturn(CheckConstraintHasValue("endMinute", values.endMinute, false)); + if (values.endMinute != nil) { + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep8ThSendsClearWeekDayScheduleCommandToDut_10() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171340,7 +171412,7 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { params.userIndex = [NSNumber numberWithUnsignedShort:1U]; [cluster clearWeekDayScheduleWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Step 7: TH sends Clear Week Day Schedule Command to DUT Error: %@", err); + NSLog(@"Step 8: TH sends Clear Week Day Schedule Command to DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -171350,7 +171422,7 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep8ThSendsGetWeekDayScheduleCommandToDut_10() + CHIP_ERROR TestStep9ThSendsGetWeekDayScheduleCommandToDut_11() { MTRBaseDevice * device = GetDevice("alpha"); @@ -171363,7 +171435,7 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { [cluster getWeekDayScheduleWithParams:params completion:^(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"Step 8: TH sends Get Week Day Schedule Command to DUT Error: %@", err); + NSLog(@"Step 9: TH sends Get Week Day Schedule Command to DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -171408,7 +171480,7 @@ class Test_TC_DRLK_2_5 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanupTheCreatedUser_11() + CHIP_ERROR TestCleanupTheCreatedUser_12() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172023,28 +172095,37 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { err = TestStep11ThSendsGetYearDayScheduleCommandToDut_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Step 12: TH sends Clear Year Day Schedule to DUT\n"); - if (ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp")) { + ChipLogProgress( + chipTool, " ***** Test Step 15 : Step 12: TH sends Get Year Day Schedule Command to DUT for non-existent User\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx")) { NextTest(); return; } - err = TestStep12ThSendsClearYearDayScheduleToDut_15(); + err = TestStep12ThSendsGetYearDayScheduleCommandToDutForNonExistentUser_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Clear a year day schedule for the first user\n"); + ChipLogProgress(chipTool, " ***** Test Step 16 : Step 12: TH sends Clear Year Day Schedule to DUT\n"); if (ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp")) { NextTest(); return; } - err = TestClearAYearDayScheduleForTheFirstUser_16(); + err = TestStep12ThSendsClearYearDayScheduleToDut_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Cleanup the created user with UserIndex 1\n"); - err = TestCleanupTheCreatedUserWithUserIndex1_17(); + ChipLogProgress(chipTool, " ***** Test Step 17 : Clear a year day schedule for the first user\n"); + if (ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp")) { + NextTest(); + return; + } + err = TestClearAYearDayScheduleForTheFirstUser_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Cleanup the created user with UserIndex 5\n"); - err = TestCleanupTheCreatedUserWithUserIndex5_18(); + ChipLogProgress(chipTool, " ***** Test Step 18 : Cleanup the created user with UserIndex 1\n"); + err = TestCleanupTheCreatedUserWithUserIndex1_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Cleanup the created user with UserIndex 5\n"); + err = TestCleanupTheCreatedUserWithUserIndex5_19(); break; } @@ -172103,10 +172184,10 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 15: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 16: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_COMMAND)); break; case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -172114,6 +172195,9 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -172127,7 +172211,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 19; + const uint16_t mTestCount = 20; chip::Optional mNodeId; chip::Optional mCluster; @@ -172672,7 +172756,55 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep12ThSendsClearYearDayScheduleToDut_15() + CHIP_ERROR TestStep12ThSendsGetYearDayScheduleCommandToDutForNonExistentUser_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; + params.yearDayIndex = [NSNumber numberWithUnsignedChar:1U]; + params.userIndex = [NSNumber numberWithUnsignedShort:2U]; + [cluster + getYearDayScheduleWithParams:params + completion:^( + MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Step 12: TH sends Get Year Day Schedule Command to DUT for non-existent User Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.yearDayIndex; + VerifyOrReturn(CheckValue("YearDayIndex", actualValue, 1U)); + } + + { + id actualValue = values.userIndex; + VerifyOrReturn(CheckValue("UserIndex", actualValue, 2U)); + } + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); + } + + VerifyOrReturn(CheckConstraintHasValue("localStartTime", values.localStartTime, false)); + if (values.localStartTime != nil) { + } + + VerifyOrReturn(CheckConstraintHasValue("localEndTime", values.localEndTime, false)); + if (values.localEndTime != nil) { + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep12ThSendsClearYearDayScheduleToDut_16() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172698,7 +172830,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestClearAYearDayScheduleForTheFirstUser_16() + CHIP_ERROR TestClearAYearDayScheduleForTheFirstUser_17() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172720,7 +172852,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex1_17() + CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex1_18() { MTRBaseDevice * device = GetDevice("alpha"); @@ -172741,7 +172873,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex5_18() + CHIP_ERROR TestCleanupTheCreatedUserWithUserIndex5_19() { MTRBaseDevice * device = GetDevice("alpha"); From 7b5f34bebbd5ac2c42c26eda3d2a4d45c0e1a3e0 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 30 Aug 2023 22:09:05 +0000 Subject: [PATCH 2/6] Restyled by prettier-yaml --- src/app/tests/suites/certification/Test_TC_DRLK_2_5.yaml | 4 +++- src/app/tests/suites/certification/Test_TC_DRLK_2_7.yaml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_DRLK_2_5.yaml b/src/app/tests/suites/certification/Test_TC_DRLK_2_5.yaml index 173658de0f5e50..782824c8de5caf 100644 --- a/src/app/tests/suites/certification/Test_TC_DRLK_2_5.yaml +++ b/src/app/tests/suites/certification/Test_TC_DRLK_2_5.yaml @@ -212,7 +212,9 @@ tests: constraints: hasValue: false - - label: "Step 7: TH sends Get Week Day Schedule Command to DUT for non-existent User" + - label: + "Step 7: TH sends Get Week Day Schedule Command to DUT for + non-existent User" PICS: DRLK.S.F04 && DRLK.S.C0c.Rsp && DRLK.S.C0c.Tx command: "GetWeekDaySchedule" arguments: diff --git a/src/app/tests/suites/certification/Test_TC_DRLK_2_7.yaml b/src/app/tests/suites/certification/Test_TC_DRLK_2_7.yaml index 60573c7271e65f..0db99395e20ea8 100644 --- a/src/app/tests/suites/certification/Test_TC_DRLK_2_7.yaml +++ b/src/app/tests/suites/certification/Test_TC_DRLK_2_7.yaml @@ -298,7 +298,9 @@ tests: constraints: minValue: 1081 - - label: "Step 12: TH sends Get Year Day Schedule Command to DUT for non-existent User" + - label: + "Step 12: TH sends Get Year Day Schedule Command to DUT for + non-existent User" PICS: DRLK.S.F0a && DRLK.S.C0f.Rsp && DRLK.S.C0f.Tx command: "GetYearDaySchedule" arguments: From 6b543e025fcf57d8bc24406b28a8b32e13ae291d Mon Sep 17 00:00:00 2001 From: Jon Rhees Date: Wed, 30 Aug 2023 16:29:24 -0600 Subject: [PATCH 3/6] zap-regen --- .../darwin-framework-tool/zap-generated/test/Commands.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 4465458011c302..e8a7720347bfa0 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -176149,12 +176149,12 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { err = TestStep12ThSendsGetYearDayScheduleCommandToDutForNonExistentUser_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Step 12: TH sends Clear Year Day Schedule to DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 16 : Step 13: TH sends Clear Year Day Schedule to DUT\n"); if (ShouldSkip("DRLK.S.F0a && DRLK.S.C10.Rsp")) { NextTest(); return; } - err = TestStep12ThSendsClearYearDayScheduleToDut_16(); + err = TestStep13ThSendsClearYearDayScheduleToDut_16(); break; case 17: ChipLogProgress(chipTool, " ***** Test Step 17 : Clear a year day schedule for the first user\n"); @@ -176849,7 +176849,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestStep12ThSendsClearYearDayScheduleToDut_16() + CHIP_ERROR TestStep13ThSendsClearYearDayScheduleToDut_16() { MTRBaseDevice * device = GetDevice("alpha"); @@ -176862,7 +176862,7 @@ class Test_TC_DRLK_2_7 : public TestCommandBridge { [cluster clearYearDayScheduleWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"Step 12: TH sends Clear Year Day Schedule to DUT Error: %@", err); + NSLog(@"Step 13: TH sends Clear Year Day Schedule to DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code From 7268cdb809242c208f23a2f5bc5bf006cf13a32a Mon Sep 17 00:00:00 2001 From: Jon Rhees Date: Wed, 30 Aug 2023 17:24:47 -0600 Subject: [PATCH 4/6] Include changes to DL_Schedules.yaml test --- src/app/tests/suites/DL_Schedules.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/tests/suites/DL_Schedules.yaml b/src/app/tests/suites/DL_Schedules.yaml index e70a46863cf0eb..8b9fbfd7351aae 100644 --- a/src/app/tests/suites/DL_Schedules.yaml +++ b/src/app/tests/suites/DL_Schedules.yaml @@ -488,7 +488,7 @@ tests: - name: "UserIndex" value: 2 - name: "Status" - value: 0x01 + value: 0x8B # # Excercise SetYearDay schedules with invalid parameters @@ -686,7 +686,7 @@ tests: - name: "UserIndex" value: 2 - name: "Status" - value: 0x01 + value: 0x8B # # Excercise Set Holiday schedules with invalid parameters From 2477ba809d8f98fd5b71c084a38d3d52f7c20932 Mon Sep 17 00:00:00 2001 From: Jon Rhees Date: Wed, 30 Aug 2023 17:38:32 -0600 Subject: [PATCH 5/6] zap regen --- .../darwin-framework-tool/zap-generated/test/Commands.h | 4 ++-- 1 file changed, 2 insertions(+), 2 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 e8a7720347bfa0..09ae465e2f43dc 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -168854,7 +168854,7 @@ class DL_Schedules : public TestCommandBridge { { id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 1U)); + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); } NextTest(); @@ -169246,7 +169246,7 @@ class DL_Schedules : public TestCommandBridge { { id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 1U)); + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); } NextTest(); From 4717aeedc1fec1ee3d500499a8b86444e01073c0 Mon Sep 17 00:00:00 2001 From: Jon Rhees Date: Thu, 31 Aug 2023 08:31:35 -0600 Subject: [PATCH 6/6] Fix issue with DL_Schedules for correct Status codes --- src/app/tests/suites/DL_Schedules.yaml | 8 ++++---- .../darwin-framework-tool/zap-generated/test/Commands.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/tests/suites/DL_Schedules.yaml b/src/app/tests/suites/DL_Schedules.yaml index 8b9fbfd7351aae..208600f4f65ec8 100644 --- a/src/app/tests/suites/DL_Schedules.yaml +++ b/src/app/tests/suites/DL_Schedules.yaml @@ -1799,7 +1799,7 @@ tests: - name: "UserIndex" value: 1 - name: "Status" - value: 0x01 + value: 0x8B - label: "Make sure clearing first user also cleared year day schedules" command: "GetYearDaySchedule" @@ -1816,7 +1816,7 @@ tests: - name: "UserIndex" value: 1 - name: "Status" - value: 0x01 + value: 0x8B - label: "Make sure clearing second user also cleared week day schedules" command: "GetWeekDaySchedule" @@ -1833,7 +1833,7 @@ tests: - name: "UserIndex" value: 2 - name: "Status" - value: 0x01 + value: 0x8B - label: "Make sure clearing second user also cleared year day schedules" command: "GetYearDaySchedule" @@ -1850,7 +1850,7 @@ tests: - name: "UserIndex" value: 2 - name: "Status" - value: 0x01 + value: 0x8B # Make sure that all the manipulations did not affect the holiday schedules - label: "Make sure that first holiday schedule was not deleted" 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 09ae465e2f43dc..6ee0af30a674fe 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -171653,7 +171653,7 @@ class DL_Schedules : public TestCommandBridge { { id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 1U)); + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); } NextTest(); @@ -171691,7 +171691,7 @@ class DL_Schedules : public TestCommandBridge { { id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 1U)); + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); } NextTest(); @@ -171729,7 +171729,7 @@ class DL_Schedules : public TestCommandBridge { { id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 1U)); + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); } NextTest(); @@ -171767,7 +171767,7 @@ class DL_Schedules : public TestCommandBridge { { id actualValue = values.status; - VerifyOrReturn(CheckValue("Status", actualValue, 1U)); + VerifyOrReturn(CheckValue("Status", actualValue, 139U)); } NextTest();