Skip to content

Commit 99f4a80

Browse files
Harshith-GRLaustina-csa
authored andcommitted
Python Script DRLK 2.13 is updated as per latest test-plan (project-chip#35652)
* Python Script DRLK 2.13 is updated as per latest test-plan * scripts changes are made as per comments in PR
1 parent a20b8dd commit 99f4a80

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

src/python_testing/TC_DRLK_2_13.py

+28-24
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class TC_DRLK_2_13(MatterBaseTest):
5353

5454
def steps_TC_DRLK_2_13(self) -> list[TestStep]:
5555
steps = [
56+
TestStep("0", "Commissoning with DUT is done", is_commissioning=True),
5657
TestStep("1a", "TH reads OperationalCredentials cluster's CurrentFabricIndex and save the attribute",
5758
"TH Reads Attribute Successfully"),
5859
TestStep("1b", "TH sends ClearUser Command to DUT with the UserIndex as 0xFFFE to clear all the users",
@@ -145,11 +146,11 @@ def steps_TC_DRLK_2_13(self) -> list[TestStep]:
145146
"Verify that the DUT responds with SetCredentialResponse command and Status success. This step will fill the last slot with credentialType as AliroEvictableEndpointKey"),
146147
TestStep("31",
147148
"TH sends SetCredential Command to DUT with CredentialType as AliroNonEvictableEndpointKey and number of credentials for 'alirouser' exceeds the max_aliro_keys_supported",
148-
"Verify that the DUT responds with SetCredentialResponse command and Status success."),
149-
TestStep("32", "TH sends GetCredentialStatus Command with Credential as 7 startcredentialindex+1",
150-
"DUT responds with GetCredentialStatusResponse Command and CredentialExists is false"),
151-
TestStep("33", "TH sends GetCredentialStatus Command with Credential as 8 startcredentialindex+1",
152-
"Verify DUT responds with GetCredentialStatusResponse having CredentialExists is true and UserIndex as 1"),
149+
"Verify that the DUT responds with SetCredentialResponse command and Status ResourceExhausted"),
150+
TestStep("32", "TH sends GetCredentialStatus Command with Credential as 7 1",
151+
"DUT responds with GetCredentialStatusResponse Command and CredentialExists is True"),
152+
TestStep("33", "TH sends GetCredentialStatus Command with Credential as 8 max_aliro_keys_supported",
153+
"Verify DUT responds with GetCredentialStatusResponse having CredentialExists is false and UserIndex as 1"),
153154
TestStep("34", "TH sends ClearCredential Command to DUT to clear the ALIRO CredentialType",
154155
"Verify that the DUT sends SUCCESS response"),
155156
TestStep("35", "TH sends ClearUser Command to DUT with the UserIndex as 1",
@@ -249,7 +250,7 @@ async def get_credentials_status(self, credentialIndex: int, credentialType: clu
249250
self.step(step)
250251
try:
251252
flags = ["DRLK.S.F0d", "DRLK.S.C24.Rsp", "DRLK.S.C25.Tx"]
252-
if not self.pics_guard(all([self.check_pics(p) for p in flags])):
253+
if self.pics_guard(all([self.check_pics(p) for p in flags])):
253254
credentials_struct = cluster.Structs.CredentialStruct(credentialIndex=credentialIndex,
254255
credentialType=credentialType)
255256
response = await self.send_single_cmd(endpoint=self.app_cluster_endpoint, timedRequestTimeoutMs=1000,
@@ -268,7 +269,8 @@ async def get_credentials_status(self, credentialIndex: int, credentialType: clu
268269
asserts.assert_equal(e.status, Status.Success, f"Unexpected error returned: {e}")
269270

270271
async def set_credential_cmd(self, credential_enum: Clusters.DoorLock.Enums.CredentialTypeEnum, credentialIndex,
271-
operationType, userIndex, credentialData, userStatus, userType, step=None):
272+
operationType, userIndex, credentialData, userStatus, userType, step=None,
273+
expected_status: Status = Status.Success):
272274
if step:
273275
self.step(step)
274276
credentials = cluster.Structs.CredentialStruct(
@@ -287,7 +289,7 @@ async def set_credential_cmd(self, credential_enum: Clusters.DoorLock.Enums.Cred
287289
timedRequestTimeoutMs=1000)
288290
asserts.assert_true(type_matches(response, Clusters.Objects.DoorLock.Commands.SetCredentialResponse),
289291
"Unexpected return type for SetCredential")
290-
asserts.assert_true(response.status == Status.Success,
292+
asserts.assert_true(response.status == expected_status,
291293
"Error sending SetCredential command, status={}".format(str(response.status)))
292294
except InteractionModelError as e:
293295
logging.exception(e)
@@ -370,6 +372,7 @@ async def test_TC_DRLK_2_13(self):
370372
self.alirononevictableendpointkey1 = bytes.fromhex(
371373
"047a4c552d753924cdf3779a3c84fec2debaa6f0b3084450878acc7ddcce7856ae57b1ebbe2561015103dd7474c2a183675378ec55f1e465ac3436bf3dd5ca54d4")
372374
# step 1 TH reads DUT Endpoint 0 OperationalCredentials cluster CurrentFabricIndex attribute
375+
self.step("0")
373376
self.step("1a")
374377
self.fabric_idx1 = await self.read_attributes_from_dut(endpoint=self.common_cluster_endpoint,
375378
cluster=Clusters.Objects.OperationalCredentials,
@@ -569,6 +572,8 @@ async def test_TC_DRLK_2_13(self):
569572
endpoint=self.app_cluster_endpoint,
570573
cluster=Clusters.Objects.DoorLock,
571574
attribute=Clusters.DoorLock.Attributes.NumberOfCredentialsSupportedPerUser)
575+
logging.info(f"After reading attribute NumberOfCredentialsSupportedPerUser we get"
576+
f" value {self.numberofcredentialsupportedperuser} ")
572577
self.step("28b")
573578
await self.clear_all_aliro_credential()
574579
await self.send_clear_user_cmd(user_index=1)
@@ -600,7 +605,7 @@ async def test_TC_DRLK_2_13(self):
600605
start_credential_index = 1
601606
credentials_data = self.alirononevictableendpointkey
602607
while 1:
603-
if start_credential_index <= (self.max_aliro_keys_supported - 2):
608+
if start_credential_index <= (self.max_aliro_keys_supported - 1):
604609
if start_credential_index != 1:
605610
credentials_data = self.generate_unique_octbytes()
606611

@@ -614,37 +619,36 @@ async def test_TC_DRLK_2_13(self):
614619
logging.info(f"The updated value of start_credential_index is {start_credential_index}")
615620
else:
616621
break
617-
618-
# step 30
619-
logging.info(f"the value of start_credential_index is {start_credential_index} for step 30")
620622
self.step("30")
621623
await self.set_credential_cmd(credentialData=self.alirononevictableendpointkey,
622624
operationType=cluster.Enums.DataOperationTypeEnum.kAdd,
623625
credential_enum=cluster.Enums.CredentialTypeEnum.kAliroEvictableEndpointKey,
624-
credentialIndex=start_credential_index, userIndex=1, userStatus=NullValue,
626+
credentialIndex=1, userIndex=1, userStatus=NullValue,
625627
userType=NullValue)
628+
626629
# step 31
627630
self.step("31")
628631
await self.set_credential_cmd(credentialData=self.alirononevictableendpointkey1,
629632
operationType=cluster.Enums.DataOperationTypeEnum.kAdd,
630633
credential_enum=cluster.Enums.CredentialTypeEnum.kAliroNonEvictableEndpointKey,
631-
credentialIndex=start_credential_index, userIndex=1, userStatus=NullValue,
632-
userType=NullValue)
634+
credentialIndex=self.max_aliro_keys_supported, userIndex=1, userStatus=NullValue,
635+
userType=NullValue,
636+
expected_status=Status.ResourceExhausted)
633637
# step 32
634-
dut_get_cred_response = await self.get_credentials_status(step="32",
635-
credentialIndex=start_credential_index,
636-
credentialType=cluster.Enums.CredentialTypeEnum.kAliroEvictableEndpointKey,
637-
credential_exists=False, userIndex=NullValue)
638-
asserts.assert_equal(dut_get_cred_response.credentialExists, NullValue,
639-
f"Error when comparing for {dut_get_cred_response} of null")
638+
await self.get_credentials_status(step="32", credentialIndex=1,
639+
credentialType=cluster.Enums.CredentialTypeEnum.kAliroEvictableEndpointKey,
640+
credential_exists=True, userIndex=1)
640641

641642
# step 33
642-
await self.get_credentials_status(step="33", credentialIndex=start_credential_index,
643+
await self.get_credentials_status(step="33", credentialIndex=self.max_aliro_keys_supported,
643644
credentialType=cluster.Enums.CredentialTypeEnum.kAliroNonEvictableEndpointKey,
644-
credential_exists=True, userIndex=1)
645+
credential_exists=False, userIndex=NullValue)
645646
# step 34
646647
self.step("34")
647-
await self.clear_all_aliro_credential()
648+
if self.pics_guard(self.check_pics("DRLK.S.C26.Rsp")):
649+
await self.send_single_cmd(cmd=Clusters.DoorLock.Commands.ClearCredential(credential=NullValue),
650+
endpoint=self.app_cluster_endpoint,
651+
timedRequestTimeoutMs=1000)
648652

649653
# step 35
650654
self.step("35")

0 commit comments

Comments
 (0)