Skip to content

Commit

Permalink
Updated DoorLock Python scripts and DRLK_2_1 yaml. (#35182)
Browse files Browse the repository at this point in the history
* Updated DoorLock Python scripts and DRLK_2_1 yaml.

* TC_DRLK_2_X.py - updated as per latest test plan

* TC_BOOLCFG_3_1.py - Test description is changed.

* TC_PWRTL_2_1.py - Added missing step for subset check as per latest test plan.

* Test_TC_DRLK_2_1.yaml - Script is updated with latest changes from test plan.

* Restyled by whitespace

* Restyled by prettier-yaml

* Restyled by autopep8

* Lint errors are fixed

* ednpoint will be taken from command line args

* Teardown function added for all scripts

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
Harshith-GRL and restyled-commits authored Sep 4, 2024
1 parent 0661d7a commit f02df89
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 193 deletions.
192 changes: 90 additions & 102 deletions src/app/tests/suites/certification/Test_TC_DRLK_2_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,35 @@ tests:
- name: "nodeId"
value: nodeId

- label: "Precondition: Create new user"
PICS: DRLK.S.F00 && DRLK.S.F07
- label: "Step 1a: TH reads LockState attribute from DUT"
PICS: DRLK.S.A0000
command: "readAttribute"
attribute: "LockState"
response:
saveAs: LockStateValue
constraints:
type: enum8
minValue: 0
maxValue: 3

- label: "Step 1b: TH writes LockState attribute as 1"
PICS: DRLK.S.A0000
command: "writeAttribute"
attribute: "LockState"
arguments:
value: 1
response:
error: UNSUPPORTED_WRITE

- label: "Step 1c: TH reads LockState attribute from DUT"
PICS: DRLK.S.A0000
command: "readAttribute"
attribute: "LockState"
response:
value: LockStateValue

- label: "Step 1d: TH sends SetUser Command to DUT"
PICS: DRLK.S.F08 && DRLK.S.C1a.Rsp
command: "SetUser"
timedInteractionTimeoutMs: 1000
arguments:
Expand All @@ -56,38 +83,34 @@ tests:
- name: "CredentialRule"
value: 0

- label: "Precondition: Read the user back and verify its fields"
PICS: DRLK.S.F00 && DRLK.S.F07
command: "GetUser"
arguments:
values:
- name: "UserIndex"
value: 1
- label:
"Step 1e: TH reads MinPINCodeLength attribute and saves the value as
min_pin_code_length"
PICS: DRLK.S.F08 && DRLK.S.F00
command: "readAttribute"
attribute: "MinPINCodeLength"
response:
values:
- name: "UserIndex"
value: 1
- name: "UserName"
value: "xxx"
- name: "UserUniqueID"
value: 6452
- name: "UserStatus"
value: 1
- name: "UserType"
value: 0
- name: "CredentialRule"
value: 0
- name: "Credentials"
value: []
- name: "CreatorFabricIndex"
value: 1
- name: "LastModifiedFabricIndex"
value: 1
- name: "NextUserIndex"
value: null
saveAs: min_pin_code_length
constraints:
type: int8u
minValue: 0
maxValue: 255

- label: "Precondition: Create new PIN credential and lock/unlock user"
PICS: DRLK.S.F00 && DRLK.S.F07
- label:
"Step 1f: TH reads MaxPINCodeLength attribute and saves the value as
max_pin_code_length"
PICS: DRLK.S.F08 && DRLK.S.F00
command: "readAttribute"
attribute: "MaxPINCodeLength"
response:
saveAs: max_pin_code_length
constraints:
type: int8u
minValue: 0
maxValue: 255

- label: "Step 1g: TH sends SetCredential Command"
PICS: DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C22.Rsp && DRLK.S.C23.Tx
command: "SetCredential"
timedInteractionTimeoutMs: 1000
arguments:
Expand All @@ -104,64 +127,9 @@ tests:
value: null
- name: "UserType"
value: null
response:
values:
- name: "Status"
value: 0
- name: "UserIndex"
value: null
- name: "NextCredentialIndex"
value: 2

- label: "Precondition: Verify created PIN credential"
PICS: DRLK.S.F00 && DRLK.S.F07
command: "GetCredentialStatus"
arguments:
values:
- name: "Credential"
value: { CredentialType: 1, CredentialIndex: 1 }
response:
values:
- name: "CredentialExists"
value: true
- name: "UserIndex"
value: 1
- name: "CreatorFabricIndex"
value: 1
- name: "LastModifiedFabricIndex"
value: 1
- name: "NextCredentialIndex"
value: null

- label: "Step 1a: TH reads LockState attribute from DUT"
PICS: DRLK.S.A0000
command: "readAttribute"
attribute: "LockState"
response:
saveAs: LockStateValue
constraints:
type: enum8
minValue: 0
maxValue: 3

- label: "Step 1b: TH writes LockState attribute as 1"
PICS: DRLK.S.A0000
command: "writeAttribute"
attribute: "LockState"
arguments:
value: 1
response:
error: UNSUPPORTED_WRITE

- label: "Step 1c: TH reads LockState attribute from DUT"
PICS: DRLK.S.A0000
command: "readAttribute"
attribute: "LockState"
response:
value: LockStateValue

- label:
"Step 1d: TH sends a Lock Door command to the DUT. If DRLK.S.F00(PIN)
"Step 1h: TH sends a Lock Door command to the DUT. If DRLK.S.F00(PIN)
& DRLK.S.F07(COTA), include a Valid PINCode in the Lock Door command."
PICS: DRLK.S.C00.Rsp && DRLK.S.F00 && DRLK.S.F07 && DRLK.S.A0000
command: "LockDoor"
Expand All @@ -171,7 +139,8 @@ tests:
- name: "PINCode"
value: "123456"

- label: "Step 1d: TH sends a Lock Door command to the DUT."
- label:
"Step 1h: TH sends a Lock Door command to the DUT without pin_code."
PICS: DRLK.S.C00.Rsp && !DRLK.S.F00 && !DRLK.S.F07 && DRLK.S.A0000
command: "LockDoor"
timedInteractionTimeoutMs: 1000
Expand All @@ -184,23 +153,16 @@ tests:
values:
- name: "ms"
value: WaitAfterLockAandUnlockDoor

- label: "Step 1d: TH reads LockState attribute from DUT"
- label: "Step 1h: TH reads LockState attribute from DUT"
PICS: DRLK.S.A0000
command: "readAttribute"
attribute: "LockState"
response:
value: 1

- label:
"Step 1e: TH sends a Unlock Door command to the DUT. If
"Step 1i: TH sends a Unlock Door command to the DUT. If
DRLK.S.F00(PIN) & DRLK.S.F07(COTA), include a Valid PINCode in the
Unlock Door command"
PICS: DRLK.S.C01.Rsp && !DRLK.S.F00 && !DRLK.S.F07 && DRLK.S.A0000
command: "UnlockDoor"
timedInteractionTimeoutMs: 1000

- label: "Step 1e: TH sends a Unlock Door command to the DUT."
PICS: DRLK.S.C01.Rsp && DRLK.S.F00 && DRLK.S.F07 && DRLK.S.A0000
command: "UnlockDoor"
timedInteractionTimeoutMs: 1000
Expand All @@ -209,6 +171,12 @@ tests:
- name: "PINCode"
value: "123456"

- label:
"Step 1i: TH sends a Unlock Door command to the DUT without pincode."
PICS: DRLK.S.C01.Rsp && !DRLK.S.F00 && !DRLK.S.F07 && DRLK.S.A0000
command: "UnlockDoor"
timedInteractionTimeoutMs: 1000

- label: "Wait after Unlock Door"
PICS: DRLK.S.C00.Rsp
cluster: "DelayCommands"
Expand All @@ -218,14 +186,14 @@ tests:
- name: "ms"
value: WaitAfterLockAandUnlockDoor

- label: "Step 1e: TH reads LockState attribute from DUT"
- label: "Step 1i: TH reads LockState attribute from DUT"
PICS: DRLK.S.A0000
command: "readAttribute"
attribute: "LockState"
response:
value: 2

- label: "Step 1f: Simulate a not fully locked scenario on the DUT."
- label: "Step 1j: Simulate a not fully locked scenario on the DUT."
PICS:
DRLK.S.A0000 && DRLK.S.M.SimulateNotFullyLocked &&
PICS_SKIP_SAMPLE_APP
Expand Down Expand Up @@ -1366,6 +1334,26 @@ tests:
response:
value: Current_WrongCode_EntryLimit

- label: "Step 31b: TH writes WrongCodeEntryLimit attribute as 8"
PICS:
" ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030 &&
DRLK.S.M.WrongCodeEntryLimitAttributeWritable "
command: "writeAttribute"
attribute: "WrongCodeEntryLimit"
arguments:
value: 8

- label: "Step 31b: TH writes WrongCodeEntryLimit attribute as 8"
PICS:
" ( DRLK.S.F00 || DRLK.S.F01 ) && DRLK.S.A0030 &&
!DRLK.S.M.WrongCodeEntryLimitAttributeWritable "
command: "writeAttribute"
attribute: "WrongCodeEntryLimit"
arguments:
value: 8
response:
error: UNSUPPORTED_WRITE

- label:
"Step 32a: TH reads UserCodeTemporary DisableTime attribute from DUT
TH saves the values as Current_UserCode TemporaryDisableTime"
Expand Down Expand Up @@ -1552,7 +1540,7 @@ tests:
value: NumberOfCredentialsSupportedPerUserValue

- label: "Step 36: TH sends ClearCredential Command to DUT"
PICS: DRLK.S.F00 && DRLK.S.F07 && DRLK.S.C26.Rsp
PICS: DRLK.S.F00 && DRLK.S.F08 && DRLK.S.C26.Rsp
command: "ClearCredential"
timedInteractionTimeoutMs: 1000
arguments:
Expand All @@ -1562,7 +1550,7 @@ tests:

- label:
"Step 37: TH sends ClearUser Command to DUT with the UserIndex as 1"
PICS: DRLK.S.F07 && DRLK.S.C1d.Rsp
PICS: DRLK.S.F08 && DRLK.S.C1d.Rsp
command: "ClearUser"
timedInteractionTimeoutMs: 1000
arguments:
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_BOOLCFG_3_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def steps_TC_BOOLCFG_3_1(self) -> list[TestStep]:
steps = [
TestStep(1, "Commissioning, already done", is_commissioning=True),
TestStep("2a", "Read FeatureMap attribute"),
TestStep("2b", "Verify SENS feature is supported"),
TestStep("2b", "Verify SENSLVL feature is supported"),
TestStep("2c", "Read AttributeList attribute"),
TestStep(3, "Read SupportedSensitivityLevels attribute"),
TestStep(4, "Read DefaultSensitivityLevel attribute, if supported"),
Expand Down
7 changes: 5 additions & 2 deletions src/python_testing/TC_DRLK_2_12.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main

# Configurable parameters:
# - userIndex: userIndex to use when creating a user on the DUT for testing purposes
# defaults to 1. Add `--int-arg user_index:<index>` to command line to override
# - CredentialIndex: CredentialIndex to use when creating a Credential on the DUT for testing purposes
# defaults to 1. Add `--int-arg credential_index:<index>` to command line to override
# - UserCodeTemporaryDisableTime: Value used to configure DUT for testing purposes.
Expand All @@ -42,14 +44,15 @@


class TC_DRLK_2_12(MatterBaseTest, DRLK_COMMON):
def setup_class(self):
return super().setup_class()

@async_test_body
async def teardown_test(self):
await self.teardown()
return super().teardown_test()

def setup_class(self):
return super().setup_class()

def pics_TC_DRLK_2_12(self) -> list[str]:
return ["DRLK.S.F0c"]

Expand Down
4 changes: 2 additions & 2 deletions src/python_testing/TC_DRLK_2_13.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# test-runner-run/run1/factoryreset: True
# test-runner-run/run1/quiet: True
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
# test-runner-run/run1/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:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# === END CI TEST ARGUMENTS ===

import logging
Expand Down Expand Up @@ -357,7 +357,7 @@ async def test_TC_DRLK_2_13(self):
self.groupIdentifier = bytes.fromhex("89d085fc302ca53e279bfcdecdf3c4ad")
self.groupResolvingKey = bytes.fromhex("89d0859bfcdecdf3c4adfc302ca53e27")
self.common_cluster_endpoint = 0
self.app_cluster_endpoint = 1
self.app_cluster_endpoint = self.matter_test_config.endpoint
self.alirouser = "AliroUser"
self.alirocredentialissuerkey = bytes.fromhex(
"047a4c882d753924cdf3779a3c84fec2debaa6f0b3084450878acc7ddcce7856ae57b1ebbe2561015103dd7474c2a183675378ec55f1e465ac3436bf3dd5ca54d4")
Expand Down
7 changes: 5 additions & 2 deletions src/python_testing/TC_DRLK_2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main

# Configurable parameters:
# - userIndex: userIndex to use when creating a user on the DUT for testing purposes
# defaults to 1. Add `--int-arg user_index:<index>` to command line to override
# - CredentialIndex: CredentialIndex to use when creating a Credential on the DUT for testing purposes
# defaults to 1. Add `--int-arg credential_index:<index>` to command line to override
# - UserCodeTemporaryDisableTime: Value used to configure DUT for testing purposes.
Expand All @@ -42,14 +44,15 @@


class TC_DRLK_2_2(MatterBaseTest, DRLK_COMMON):
def setup_class(self):
return super().setup_class()

@async_test_body
async def teardown_test(self):
await self.teardown()
return super().teardown_test()

def setup_class(self):
return super().setup_class()

def pics_TC_DRLK_2_2(self) -> list[str]:
return ["DRLK.S"]

Expand Down
7 changes: 5 additions & 2 deletions src/python_testing/TC_DRLK_2_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main

# Configurable parameters:
# - userIndex: userIndex to use when creating a user on the DUT for testing purposes
# defaults to 1. Add `--int-arg user_index:<index>` to command line to override
# - CredentialIndex: CredentialIndex to use when creating a Credential on the DUT for testing purposes
# defaults to 1. Add `--int-arg credential_index:<index>` to command line to override
# - UserCodeTemporaryDisableTime: Value used to configure DUT for testing purposes.
Expand All @@ -42,14 +44,15 @@


class TC_DRLK_2_3(MatterBaseTest, DRLK_COMMON):
def setup_class(self):
return super().setup_class()

@async_test_body
async def teardown_test(self):
await self.teardown()
return super().teardown_test()

def setup_class(self):
return super().setup_class()

def pics_TC_DRLK_2_3(self) -> list[str]:
return ["DRLK.S"]

Expand Down
Loading

0 comments on commit f02df89

Please sign in to comment.