-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TC-CGEN-2.2 python test #37262
base: master
Are you sure you want to change the base?
TC-CGEN-2.2 python test #37262
Conversation
… 44 in TC_CGEN_2_2
Currently exploring two improvements for the test: - Handling the waits: The test has long waits, especially in the failsafe process. One option being explored is to minimize these waits in CI by arming the failsafe with a time=0 command, which would trigger the failsafe immediately without unnecessary delays. |
PR #37262: Size comparison from b082219 to 36442c5 Full report (3 builds for cc32xx, stm32)
|
PR #37262: Size comparison from 3044eeb to f2664b2 Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
@@ -0,0 +1,796 @@ | |||
# | |||
# Copyright (c) 2022 Project CHIP Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Copyright (c) 2022 Project CHIP Authors | |
# Copyright (c) 2025 Project CHIP Authors |
|
||
|
||
class TC_CGEN_2_2(MatterBaseTest): | ||
async def FindAndEstablishPase(self, longDiscriminator: int, setupPinCode: int, nodeid: int, dev_ctrl: ChipDeviceCtrl = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be replaced with the FindOrEstablishPASESession function from ChipDeviceCtrl.py to avoid duplication?
def steps_TC_CGEN_2_2(self) -> list[TestStep]: | ||
steps = [ | ||
TestStep(0, "Commissioning, already done", is_commissioning=True), | ||
TestStep(1, """TH1 reads the TrustedRootCertificates attribute from the Node Operational Credentials cluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of these are multiline, so I think single quotes are fine here.
async def test_TC_CGEN_2_2(self): | ||
cluster_opcreds = Clusters.OperationalCredentials | ||
cluster_cgen = Clusters.GeneralCommissioning | ||
# maxFailsafe_tmp = 60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# maxFailsafe_tmp = 60 |
|
||
self.step(0) | ||
|
||
# Read the Spteps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Read the Spteps | |
# Read the Steps |
logger.info("Step 38 skipped: Saving Tstart (current wall time clock) is bypassed due to failsafe expiration workaround.") | ||
|
||
self.step(39) | ||
trusted_root_list_original_updated = await self.read_single_attribute_check_success( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't from the test plan...
logger.info( | ||
f'Step #39 - The updated size of the num_trusted_roots_original list: {trusted_root_list_original_size_updated}') | ||
|
||
# Flow generates a new TrustedRootCertificate - Request CSR (Certificate Signing Request) and update NOC (Node Operational Certificate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can re-use the previously generated one.
"Step #31 - Unexpected number of entries in the TrustedRootCertificates table after update") | ||
|
||
self.step(41) | ||
# Step 41 - Skipped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep this in for cert testing, skip for CI.
# which immediately expires the failsafe timer (sets it to 0), bypassing the natural wait and speeding up the test execution. | ||
|
||
# This function bypasses the wait for the FailsafeTimer to expire for TH1 as originally defined in the test plan. | ||
resp = await self.expire_failsafe_timer(dev_ctrl=self.default_controller, node_id=self.dut_node_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gate on CI
cmd = Clusters.OperationalCredentials.Commands.RemoveFabric(fabricIndex=fabric_idx) | ||
await self.send_single_cmd(dev_ctrl=TH2, node_id=newNodeId+1, cmd=cmd) | ||
|
||
# The expected number of root certificates should be 1 after removing the fabric |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# The expected number of root certificates should be 1 after removing the fabric | |
# The expected number of root certificates should be numTrustedRootsOriginal after removing the fabric |
Description
This PR is focused on implementing and validating the TC-CGEN-2.2
Fixes: project-chip/matter-test-scripts#404
Test plan: https://github.com/CHIP-Specifications/chip-test-plans/blob/master/src/cluster/General_Commissioning.adoc
Purpose
This test case validates the behavior of the failsafe timer during the commissioning process, focusing on its expiration, reset behavior, and interactions with commissioning-related commands. The test ensures that the failsafe behaves as expected in various scenarios and has been adapted to bypass waiting for the failsafe to expire, optimizing test execution in CI environments. This approach simulates real-world scenarios such as network misconfigurations, incorrect credentials, expired certificates, and other issues that might occur during commissioning.
Notes
This PR includes a workaround for the waits related to the failsafe timer expiration. As specified in the test plan, the original behavior expected a wait for the failsafe expiry. However, to improve CI testing times and avoid unnecessary delays, the failsafe timer is set to
0
seconds using the functionexpire_failsafe_timer()
.Testing
To run the automated TC-CGEN-2.2 test, follow these steps:
python3 src/python_testing/TC_CGEN_2_2.py --commissioning-method on-network --qr-code MT:-24J0AFN00KA0648G00