Skip to content

Commit

Permalink
[DRLK] Return NOT_FOUND error for non-existent User on GetWeekdaySche…
Browse files Browse the repository at this point in the history
…dule/GetYeardaySchedule commands (#28974)

* [DRLK] Return NOT_FOUND error for non-existent User on GetWeekdaySchedule/GetYeardaySchedule commands

Fixes #21791

* Restyled by prettier-yaml

* zap-regen

* Include changes to DL_Schedules.yaml test

* zap regen

* Fix issue with DL_Schedules for correct Status codes

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
jrhees-cae and restyled-commits authored Sep 1, 2023
1 parent 7239ed1 commit 8bd7e08
Show file tree
Hide file tree
Showing 5 changed files with 241 additions and 48 deletions.
4 changes: 2 additions & 2 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
12 changes: 6 additions & 6 deletions src/app/tests/suites/DL_Schedules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ tests:
- name: "UserIndex"
value: 2
- name: "Status"
value: 0x01
value: 0x8B

#
# Excercise SetYearDay schedules with invalid parameters
Expand Down Expand Up @@ -686,7 +686,7 @@ tests:
- name: "UserIndex"
value: 2
- name: "Status"
value: 0x01
value: 0x8B

#
# Excercise Set Holiday schedules with invalid parameters
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down
39 changes: 37 additions & 2 deletions src/app/tests/suites/certification/Test_TC_DRLK_2_5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,42 @@ 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:
Expand All @@ -222,7 +257,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:
Expand Down
28 changes: 27 additions & 1 deletion src/app/tests/suites/certification/Test_TC_DRLK_2_7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,33 @@ 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:
Expand Down
Loading

0 comments on commit 8bd7e08

Please sign in to comment.