Skip to content

Commit

Permalink
[TC_CGEN_2_8] Add TC acknowledgement attribute verification steps (#3…
Browse files Browse the repository at this point in the history
…7498)

Add additional test steps to verify TC-related attributes before sending
CommissioningComplete:
- Verify TCAcceptedVersion equals 0
- Verify TCAcknowledgements equals 0
- Verify TCAcknowledgementsRequired equals True
  • Loading branch information
swan-amazon committed Feb 11, 2025
1 parent 09d4f61 commit f66d358
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/python_testing/TC_CGEN_2_8.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,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
Expand Down Expand Up @@ -135,8 +138,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,
Expand Down

0 comments on commit f66d358

Please sign in to comment.