Skip to content

Commit

Permalink
DoorLock: Fix incorrect CredentialIndex on LockOperation events inita…
Browse files Browse the repository at this point in the history
…ted remotely (#24985) (#24986)

* DoorLock: Fix incorrect CredentialIndex on LockOperation events initiated remotely (#24985)

* Update YAML tests
  • Loading branch information
jrhees-cae authored and pull[bot] committed Sep 18, 2023
1 parent 12d7fa6 commit 645b910
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 37 deletions.
2 changes: 1 addition & 1 deletion src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ bool DoorLockServer::findUserIndexByCredential(chip::EndpointId endpointId, Cred
if (credentialInfo.credentialData.data_equal(credentialData))
{
userIndex = i;
credentialIndex = i;
credentialIndex = credential.CredentialIndex;
userInfo = user;
return true;
}
Expand Down
60 changes: 24 additions & 36 deletions src/app/tests/suites/certification/Test_TC_DRLK_2_10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ tests:
[1656497453.684077][25847:25853] CHIP:DMG: status = 0x00 (SUCCESS),
./chip-tool doorlock set-credential 0 '{ "credentialType" : 1 , "credentialIndex" : 1 }' 123456 1 null null 1 1 --timedInteractionTimeoutMs 1000
./chip-tool doorlock set-credential 0 '{ "credentialType" : 1 , "credentialIndex" : 2 }' 123456 1 null null 1 1 --timedInteractionTimeoutMs 1000
Verify "DUT sends SUCCESS response" on the TH(Chip-tool) Log:
[1656497508.814196][25858:25863] CHIP:TOO: SetCredentialResponse: {
[1656497508.814257][25858:25863] CHIP:TOO: status: 0
[1656497508.814301][25858:25863] CHIP:TOO: userIndex: null
[1656497508.814343][25858:25863] CHIP:TOO: nextCredentialIndex: 2
[1656497508.814343][25858:25863] CHIP:TOO: nextCredentialIndex: 3
Expand Down Expand Up @@ -152,7 +152,7 @@ tests:
verification: |
./chip-tool doorlock read-event lock-operation 1 1
Verify " LockOperationType is set to Lock and Event priority is set to CRITICAL" on the TH(Chip-tool) Log:
Verify " LockOperationType is set to Lock and Event priority is set to CRITICALi, UserIndex is 1, CredentialIndex is 2" on the TH(Chip-tool) Log:
[1659777214.883129][3089:3094] CHIP:DMG: SuppressResponse = true,
[1659777214.883159][3089:3094] CHIP:DMG: InteractionModelRevision = 1
Expand All @@ -170,7 +170,7 @@ tests:
[1659777214.883675][3089:3094] CHIP:TOO: Credentials: 1 entries
[1659777214.883722][3089:3094] CHIP:TOO: [1]: {
[1659777214.883744][3089:3094] CHIP:TOO: CredentialType: 1
[1659777214.883764][3089:3094] CHIP:TOO: CredentialIndex: 1
[1659777214.883764][3089:3094] CHIP:TOO: CredentialIndex: 2
[1659777214.883784][3089:3094] CHIP:TOO: }
[1659777214.883804][3089:3094] CHIP:TOO: }
disabled: true
Expand Down Expand Up @@ -205,7 +205,7 @@ tests:
verification: |
./chip-tool doorlock read-event lock-operation 1 1
Verify " LockOperationType is set to Lock and Event priority is set to CRITICAL" on the TH(Chip-tool) Log:
Verify " LockOperationType is set to Lock and Event priority is set to CRITICAL, UserIndex is 1, CredentialIndex is 2" on the TH(Chip-tool) Log:
[1659777667.226139][3222:3227] CHIP:DMG: }
[1659777667.226318][3222:3227] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0101 Event 0x0000_0002
Expand All @@ -221,7 +221,7 @@ tests:
[1659777667.226707][3222:3227] CHIP:TOO: Credentials: 1 entries
[1659777667.226758][3222:3227] CHIP:TOO: [1]: {
[1659777667.226780][3222:3227] CHIP:TOO: CredentialType: 1
[1659777667.226800][3222:3227] CHIP:TOO: CredentialIndex: 1
[1659777667.226800][3222:3227] CHIP:TOO: CredentialIndex: 2
[1659777667.226820][3222:3227] CHIP:TOO: }
[1659777667.226841][3222:3227] CHIP:TOO: }
[1659777667.226944][3222:3227] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0101 Event 0x0000_0002
Expand All @@ -237,7 +237,7 @@ tests:
[1659777667.227167][3222:3227] CHIP:TOO: Credentials: 1 entries
[1659777667.227193][3222:3227] CHIP:TOO: [1]: {
[1659777667.227213][3222:3227] CHIP:TOO: CredentialType: 1
[1659777667.227232][3222:3227] CHIP:TOO: CredentialIndex: 1
[1659777667.227232][3222:3227] CHIP:TOO: CredentialIndex: 2
[1659777667.227251][3222:3227] CHIP:TOO: }
[1659777667.227325][3222:3227] CHIP:TOO: }
disabled: true
Expand Down Expand Up @@ -273,7 +273,7 @@ tests:
verification: |
./chip-tool doorlock read-event lock-operation-error 1 1
Verify " LockOperationType is set to Unlock and Event priority is set to CRITICAL" on the TH(Chip-tool) Log:
Verify " LockOperationType is set to Unlock and Event priority is set to CRITICAL, UserIndex and Credentials are set to null" on the TH(Chip-tool) Log:
[1659777833.226970][3243:3248] CHIP:DMG: }
[1659777833.227194][3243:3248] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0101 Event 0x0000_0003
Expand All @@ -284,14 +284,10 @@ tests:
[1659777833.227407][3243:3248] CHIP:TOO: LockOperationType: 0
[1659777833.227431][3243:3248] CHIP:TOO: OperationSource: 7
[1659777833.227453][3243:3248] CHIP:TOO: OperationError: 1
[1659777833.227476][3243:3248] CHIP:TOO: UserIndex: 0
[1659777833.227476][3243:3248] CHIP:TOO: UserIndex: null
[1659777833.227498][3243:3248] CHIP:TOO: FabricIndex: 1
[1659777833.227523][3243:3248] CHIP:TOO: SourceNode: 112233
[1659777833.227553][3243:3248] CHIP:TOO: Credentials: 1 entries
[1659777833.227604][3243:3248] CHIP:TOO: [1]: {
[1659777833.227629][3243:3248] CHIP:TOO: CredentialType: 1
[1659777833.227651][3243:3248] CHIP:TOO: CredentialIndex: 0
[1659777833.227673][3243:3248] CHIP:TOO: }
[1659777833.227553][3243:3248] CHIP:TOO: Credentials: null
[1659777833.227696][3243:3248] CHIP:TOO: }
disabled: true

Expand Down Expand Up @@ -324,7 +320,7 @@ tests:
verification: |
./chip-tool doorlock read-event lock-operation-error 1 1
Verify " LockOperationType is set to Lock and Event priority is set to info" on the TH(Chip-tool) Log:
Verify " LockOperationType is set to Lock and Event priority is set to info, UserIndex and Credentials are set to null" on the TH(Chip-tool) Log:
[1659777937.333613][3260:3265] CHIP:DMG: }
[1659777937.333844][3260:3265] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0101 Event 0x0000_0003
Expand All @@ -335,14 +331,10 @@ tests:
[1659777937.334086][3260:3265] CHIP:TOO: LockOperationType: 0
[1659777937.334115][3260:3265] CHIP:TOO: OperationSource: 7
[1659777937.334142][3260:3265] CHIP:TOO: OperationError: 1
[1659777937.334170][3260:3265] CHIP:TOO: UserIndex: 0
[1659777937.334170][3260:3265] CHIP:TOO: UserIndex: null
[1659777937.334197][3260:3265] CHIP:TOO: FabricIndex: 1
[1659777937.334226][3260:3265] CHIP:TOO: SourceNode: 112233
[1659777937.334261][3260:3265] CHIP:TOO: Credentials: 1 entries
[1659777937.334371][3260:3265] CHIP:TOO: [1]: {
[1659777937.334402][3260:3265] CHIP:TOO: CredentialType: 1
[1659777937.334429][3260:3265] CHIP:TOO: CredentialIndex: 0
[1659777937.334456][3260:3265] CHIP:TOO: }
[1659777937.334261][3260:3265] CHIP:TOO: Credentials: null
[1659777937.334484][3260:3265] CHIP:TOO: }
[1659777937.334614][3260:3265] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0101 Event 0x0000_0003
[1659777937.334642][3260:3265] CHIP:TOO: Event number: 9
Expand All @@ -352,14 +344,10 @@ tests:
[1659777937.334767][3260:3265] CHIP:TOO: LockOperationType: 1
[1659777937.334794][3260:3265] CHIP:TOO: OperationSource: 7
[1659777937.334821][3260:3265] CHIP:TOO: OperationError: 1
[1659777937.334846][3260:3265] CHIP:TOO: UserIndex: 0
[1659777937.334846][3260:3265] CHIP:TOO: UserIndex: null
[1659777937.334873][3260:3265] CHIP:TOO: FabricIndex: 1
[1659777937.334899][3260:3265] CHIP:TOO: SourceNode: 112233
[1659777937.334970][3260:3265] CHIP:TOO: Credentials: 1 entries
[1659777937.335008][3260:3265] CHIP:TOO: [1]: {
[1659777937.335036][3260:3265] CHIP:TOO: CredentialType: 1
[1659777937.335063][3260:3265] CHIP:TOO: CredentialIndex: 0
[1659777937.335089][3260:3265] CHIP:TOO: }
[1659777937.334970][3260:3265] CHIP:TOO: Credentials: null
[1659777937.335116][3260:3265] CHIP:TOO: }
disabled: true

Expand Down Expand Up @@ -396,7 +384,7 @@ tests:
verification: |
./chip-tool doorlock read-event lock-user-change 1 1
Verify " LockDataType is set to UserIndex and Event priority is set to INFO" on the TH(Chip-tool) Log:
Verify " LockDataType is set to UserIndex and Event priority is set to INFO, DataIndex is set to 4" on the TH(Chip-tool) Log:
[1659778039.468487][3278:3283] CHIP:DMG: }
[1659778039.468725][3278:3283] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0101 Event 0x0000_0004
Expand All @@ -423,7 +411,7 @@ tests:
[1659778039.469532][3278:3283] CHIP:TOO: UserIndex: 1
[1659778039.469557][3278:3283] CHIP:TOO: FabricIndex: 1
[1659778039.469582][3278:3283] CHIP:TOO: SourceNode: 112233
[1659778039.469607][3278:3283] CHIP:TOO: DataIndex: 1
[1659778039.469607][3278:3283] CHIP:TOO: DataIndex: 2
[1659778039.469632][3278:3283] CHIP:TOO: }
[1659778039.469739][3278:3283] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0101 Event 0x0000_0004
[1659778039.469765][3278:3283] CHIP:TOO: Event number: 10
Expand Down Expand Up @@ -497,7 +485,7 @@ tests:
[1659778136.033669][3293:3298] CHIP:TOO: UserIndex: 1
[1659778136.033694][3293:3298] CHIP:TOO: FabricIndex: 1
[1659778136.033719][3293:3298] CHIP:TOO: SourceNode: 112233
[1659778136.033744][3293:3298] CHIP:TOO: DataIndex: 1
[1659778136.033744][3293:3298] CHIP:TOO: DataIndex: 2
[1659778136.033768][3293:3298] CHIP:TOO: }
[1659778136.033902][3293:3298] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0101 Event 0x0000_0004
[1659778136.033931][3293:3298] CHIP:TOO: Event number: 10
Expand Down Expand Up @@ -533,7 +521,7 @@ tests:
123456 UserIndex as 1 UserStatus as 0 UserType as 0"
PICS: DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx
verification: |
./chip-tool doorlock clear-credential '{ "credentialType" : 1 , "credentialIndex" : 1 }' 1 1 --timedInteractionTimeoutMs 1000
./chip-tool doorlock clear-credential '{ "credentialType" : 1 , "credentialIndex" : 2 }' 1 1 --timedInteractionTimeoutMs 1000
Verify "DUT sends SUCCESS response" on the TH(Chip-tool) Log:
Expand All @@ -555,7 +543,7 @@ tests:
[1659778601.601785][3414:3419] CHIP:DMG: },
[1659778601.601823][3414:3419] CHIP:DMG:
./chip-tool doorlock set-credential 0 '{ "credentialType" : 1 , "credentialIndex" : 1 }' 123456 1 null null 1 1 --timedInteractionTimeoutMs 1000
./chip-tool doorlock set-credential 0 '{ "credentialType" : 1 , "credentialIndex" : 2 }' 123456 1 null null 1 1 --timedInteractionTimeoutMs 1000
Verify "DUT sends Set Credential Response command with status as SUCCESS" on the TH(Chip-tool) Log:
Expand All @@ -566,7 +554,7 @@ tests:
[1658142472.351853][2966:2971] CHIP:TOO: SetCredentialResponse: {
[1658142472.351910][2966:2971] CHIP:TOO: status: 0
[1658142472.351942][2966:2971] CHIP:TOO: userIndex: null
[1658142472.351983][2966:2971] CHIP:TOO: nextCredentialIndex: 2
[1658142472.351983][2966:2971] CHIP:TOO: nextCredentialIndex: 3
[1658142472.352012][2966:2971] CHIP:TOO: }
disabled: true

Expand All @@ -575,7 +563,7 @@ tests:
verification: |
./chip-tool doorlock read-event lock-user-change 1 1
Verify "LockDataType is set to PIN and LockUserChange event has priority set as INFO " on the TH(Chip-tool) Log:
Verify "LockDataType is set to PIN and LockUserChange event has priority set as INFO, DataIndex is set to 2" on the TH(Chip-tool) Log:
[1658223096.124315][4517:4522] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0101 Event 0x0000_0004
[1658223096.124350][4517:4522] CHIP:TOO: Event number: 3
Expand All @@ -601,14 +589,14 @@ tests:
[1658223096.125250][4517:4522] CHIP:TOO: UserIndex: 1
[1658223096.125281][4517:4522] CHIP:TOO: FabricIndex: 1
[1658223096.125312][4517:4522] CHIP:TOO: SourceNode: 112233
[1658223096.125342][4517:4522] CHIP:TOO: DataIndex: 1
[1658223096.125342][4517:4522] CHIP:TOO: DataIndex: 2
[1658223096.125372][4517:4522] CHIP:TOO: }
disabled: true

- label: "TH sends Clear Credential Command to DUT"
PICS: DRLK.S.C26.Rsp
verification: |
./chip-tool doorlock clear-credential '{ "credentialType" : 1 , "credentialIndex" : 1 }' 1 1 --timedInteractionTimeoutMs 1000
./chip-tool doorlock clear-credential '{ "credentialType" : 1 , "credentialIndex" : 2 }' 1 1 --timedInteractionTimeoutMs 1000
Verify "DUT sends SUCCESS response" on the TH(Chip-tool) Log:
Expand Down

0 comments on commit 645b910

Please sign in to comment.