From dc0588f4d228fb89c14d68513e5ef07b777d7b85 Mon Sep 17 00:00:00 2001 From: James Swan Date: Mon, 10 Feb 2025 21:18:35 +0000 Subject: [PATCH] [TC_CGEN_2_8] Add TC acknowledgement attribute verification steps Add additional test steps to verify TC-related attributes before sending CommissioningComplete: - Verify TCAcceptedVersion equals 0 - Verify TCAcknowledgements equals 0 - Verify TCAcknowledgementsRequired equals True --- src/python_testing/TC_CGEN_2_8.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/python_testing/TC_CGEN_2_8.py b/src/python_testing/TC_CGEN_2_8.py index 1b885452d21d8d..abef5a3fc67dda 100644 --- a/src/python_testing/TC_CGEN_2_8.py +++ b/src/python_testing/TC_CGEN_2_8.py @@ -61,7 +61,10 @@ def steps_TC_CGEN_2_8(self) -> list[TestStep]: TestStep(5, "DUT is factory reset."), TestStep(6, "Perform the necessary actions to put the DUT into a commissionable state."), TestStep(7, "TH begins commissioning the DUT and performs the steps 'Device discovery and establish commissioning channel' through 'Security setup using CASE', skipping 'Configure information- TC Acknowledgements'"), - TestStep(8, "TH sends CommissioningComplete to DUT."), + TestStep(8, "TH reads from the DUT the attribute TCAcceptedVersion."), + TestStep(9, "TH reads from the DUT the attribute TCAcknowledgements."), + TestStep(10, "TH reads from the DUT the attribute TCAcknowledgementsRequired."), + TestStep(11, "TH sends CommissioningComplete to DUT."), ] @async_test_body @@ -147,8 +150,26 @@ async def test_TC_CGEN_2_8(self): self.matter_test_config.tc_user_response_to_simulate = None await self.commission_devices() - # Step 8: Verify CommissioningComplete fails + # Step 8: Verify that TCAcceptedVersion equals 0 self.step(8) + response = await commissioner.ReadAttribute(nodeid=self.dut_node_id, attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion)]) + accepted_version = response[ROOT_ENDPOINT_ID][Clusters.GeneralCommissioning][Clusters.GeneralCommissioning.Attributes.TCAcceptedVersion] + asserts.assert_equal(accepted_version, 0, "TCAcceptedVersion does not match expected value.") + + # Step 9: Verify that TCAcknowledgements equals 0 + self.step(9) + response = await commissioner.ReadAttribute(nodeid=self.dut_node_id, attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcknowledgements)]) + acknowledgements = response[ROOT_ENDPOINT_ID][Clusters.GeneralCommissioning][Clusters.GeneralCommissioning.Attributes.TCAcknowledgements] + asserts.assert_equal(acknowledgements, 0, "TCAcknowledgements does not match expected value.") + + # Step 10: Verify that TCAcknowledgementsRequired equals True + self.step(10) + response = await commissioner.ReadAttribute(nodeid=self.dut_node_id, attributes=[(ROOT_ENDPOINT_ID, Clusters.GeneralCommissioning.Attributes.TCAcknowledgementsRequired)]) + tc_acknowledgements_required = response[ROOT_ENDPOINT_ID][Clusters.GeneralCommissioning][Clusters.GeneralCommissioning.Attributes.TCAcknowledgementsRequired] + asserts.assert_equal(tc_acknowledgements_required, True, "TCAcknowledgementsRequired should be True.") + + # Step 11: Verify CommissioningComplete fails + self.step(11) response = await commissioner.SendCommand( nodeid=self.dut_node_id, endpoint=ROOT_ENDPOINT_ID,