Python Script DRLK 2.13 is updated as per latest test-plan (#35652)
* Python Script DRLK 2.13 is updated as per latest test-plan
* scripts changes are made as per comments in PR
diff --git a/src/python_testing/TC_DRLK_2_13.py b/src/python_testing/TC_DRLK_2_13.py
index 78f6ef0..a26297d 100644
--- a/src/python_testing/TC_DRLK_2_13.py
+++ b/src/python_testing/TC_DRLK_2_13.py
@@ -53,6 +53,7 @@
def steps_TC_DRLK_2_13(self) -> list[TestStep]:
steps = [
+ TestStep("0", "Commissoning with DUT is done", is_commissioning=True),
TestStep("1a", "TH reads OperationalCredentials cluster's CurrentFabricIndex and save the attribute",
"TH Reads Attribute Successfully"),
TestStep("1b", "TH sends ClearUser Command to DUT with the UserIndex as 0xFFFE to clear all the users",
@@ -145,11 +146,11 @@
"Verify that the DUT responds with SetCredentialResponse command and Status success. This step will fill the last slot with credentialType as AliroEvictableEndpointKey"),
TestStep("31",
"TH sends SetCredential Command to DUT with CredentialType as AliroNonEvictableEndpointKey and number of credentials for 'alirouser' exceeds the max_aliro_keys_supported",
- "Verify that the DUT responds with SetCredentialResponse command and Status success."),
- TestStep("32", "TH sends GetCredentialStatus Command with Credential as 7 startcredentialindex+1",
- "DUT responds with GetCredentialStatusResponse Command and CredentialExists is false"),
- TestStep("33", "TH sends GetCredentialStatus Command with Credential as 8 startcredentialindex+1",
- "Verify DUT responds with GetCredentialStatusResponse having CredentialExists is true and UserIndex as 1"),
+ "Verify that the DUT responds with SetCredentialResponse command and Status ResourceExhausted"),
+ TestStep("32", "TH sends GetCredentialStatus Command with Credential as 7 1",
+ "DUT responds with GetCredentialStatusResponse Command and CredentialExists is True"),
+ TestStep("33", "TH sends GetCredentialStatus Command with Credential as 8 max_aliro_keys_supported",
+ "Verify DUT responds with GetCredentialStatusResponse having CredentialExists is false and UserIndex as 1"),
TestStep("34", "TH sends ClearCredential Command to DUT to clear the ALIRO CredentialType",
"Verify that the DUT sends SUCCESS response"),
TestStep("35", "TH sends ClearUser Command to DUT with the UserIndex as 1",
@@ -249,7 +250,7 @@
self.step(step)
try:
flags = ["DRLK.S.F0d", "DRLK.S.C24.Rsp", "DRLK.S.C25.Tx"]
- if not self.pics_guard(all([self.check_pics(p) for p in flags])):
+ if self.pics_guard(all([self.check_pics(p) for p in flags])):
credentials_struct = cluster.Structs.CredentialStruct(credentialIndex=credentialIndex,
credentialType=credentialType)
response = await self.send_single_cmd(endpoint=self.app_cluster_endpoint, timedRequestTimeoutMs=1000,
@@ -268,7 +269,8 @@
asserts.assert_equal(e.status, Status.Success, f"Unexpected error returned: {e}")
async def set_credential_cmd(self, credential_enum: Clusters.DoorLock.Enums.CredentialTypeEnum, credentialIndex,
- operationType, userIndex, credentialData, userStatus, userType, step=None):
+ operationType, userIndex, credentialData, userStatus, userType, step=None,
+ expected_status: Status = Status.Success):
if step:
self.step(step)
credentials = cluster.Structs.CredentialStruct(
@@ -287,7 +289,7 @@
timedRequestTimeoutMs=1000)
asserts.assert_true(type_matches(response, Clusters.Objects.DoorLock.Commands.SetCredentialResponse),
"Unexpected return type for SetCredential")
- asserts.assert_true(response.status == Status.Success,
+ asserts.assert_true(response.status == expected_status,
"Error sending SetCredential command, status={}".format(str(response.status)))
except InteractionModelError as e:
logging.exception(e)
@@ -370,6 +372,7 @@
self.alirononevictableendpointkey1 = bytes.fromhex(
"047a4c552d753924cdf3779a3c84fec2debaa6f0b3084450878acc7ddcce7856ae57b1ebbe2561015103dd7474c2a183675378ec55f1e465ac3436bf3dd5ca54d4")
# step 1 TH reads DUT Endpoint 0 OperationalCredentials cluster CurrentFabricIndex attribute
+ self.step("0")
self.step("1a")
self.fabric_idx1 = await self.read_attributes_from_dut(endpoint=self.common_cluster_endpoint,
cluster=Clusters.Objects.OperationalCredentials,
@@ -569,6 +572,8 @@
endpoint=self.app_cluster_endpoint,
cluster=Clusters.Objects.DoorLock,
attribute=Clusters.DoorLock.Attributes.NumberOfCredentialsSupportedPerUser)
+ logging.info(f"After reading attribute NumberOfCredentialsSupportedPerUser we get"
+ f" value {self.numberofcredentialsupportedperuser} ")
self.step("28b")
await self.clear_all_aliro_credential()
await self.send_clear_user_cmd(user_index=1)
@@ -600,7 +605,7 @@
start_credential_index = 1
credentials_data = self.alirononevictableendpointkey
while 1:
- if start_credential_index <= (self.max_aliro_keys_supported - 2):
+ if start_credential_index <= (self.max_aliro_keys_supported - 1):
if start_credential_index != 1:
credentials_data = self.generate_unique_octbytes()
@@ -614,37 +619,36 @@
logging.info(f"The updated value of start_credential_index is {start_credential_index}")
else:
break
-
- # step 30
- logging.info(f"the value of start_credential_index is {start_credential_index} for step 30")
self.step("30")
await self.set_credential_cmd(credentialData=self.alirononevictableendpointkey,
operationType=cluster.Enums.DataOperationTypeEnum.kAdd,
credential_enum=cluster.Enums.CredentialTypeEnum.kAliroEvictableEndpointKey,
- credentialIndex=start_credential_index, userIndex=1, userStatus=NullValue,
+ credentialIndex=1, userIndex=1, userStatus=NullValue,
userType=NullValue)
+
# step 31
self.step("31")
await self.set_credential_cmd(credentialData=self.alirononevictableendpointkey1,
operationType=cluster.Enums.DataOperationTypeEnum.kAdd,
credential_enum=cluster.Enums.CredentialTypeEnum.kAliroNonEvictableEndpointKey,
- credentialIndex=start_credential_index, userIndex=1, userStatus=NullValue,
- userType=NullValue)
+ credentialIndex=self.max_aliro_keys_supported, userIndex=1, userStatus=NullValue,
+ userType=NullValue,
+ expected_status=Status.ResourceExhausted)
# step 32
- dut_get_cred_response = await self.get_credentials_status(step="32",
- credentialIndex=start_credential_index,
- credentialType=cluster.Enums.CredentialTypeEnum.kAliroEvictableEndpointKey,
- credential_exists=False, userIndex=NullValue)
- asserts.assert_equal(dut_get_cred_response.credentialExists, NullValue,
- f"Error when comparing for {dut_get_cred_response} of null")
+ await self.get_credentials_status(step="32", credentialIndex=1,
+ credentialType=cluster.Enums.CredentialTypeEnum.kAliroEvictableEndpointKey,
+ credential_exists=True, userIndex=1)
# step 33
- await self.get_credentials_status(step="33", credentialIndex=start_credential_index,
+ await self.get_credentials_status(step="33", credentialIndex=self.max_aliro_keys_supported,
credentialType=cluster.Enums.CredentialTypeEnum.kAliroNonEvictableEndpointKey,
- credential_exists=True, userIndex=1)
+ credential_exists=False, userIndex=NullValue)
# step 34
self.step("34")
- await self.clear_all_aliro_credential()
+ if self.pics_guard(self.check_pics("DRLK.S.C26.Rsp")):
+ await self.send_single_cmd(cmd=Clusters.DoorLock.Commands.ClearCredential(credential=NullValue),
+ endpoint=self.app_cluster_endpoint,
+ timedRequestTimeoutMs=1000)
# step 35
self.step("35")