16
16
#
17
17
18
18
import logging
19
+ import random
19
20
import time
20
21
21
22
import chip .CertificateAuthority
@@ -43,8 +44,7 @@ class TC_CGEN_2_4(MatterBaseTest):
43
44
def OpenCommissioningWindow (self ) -> CommissioningParameters :
44
45
try :
45
46
params = self .th1 .OpenCommissioningWindow (
46
- nodeid = self .dut_node_id , timeout = 600 , iteration = 10000 , discriminator = self .matter_test_config .discriminators [0 ], option = 1 )
47
- time .sleep (5 )
47
+ nodeid = self .dut_node_id , timeout = 600 , iteration = 10000 , discriminator = self .discriminator , option = 1 )
48
48
return params
49
49
50
50
except Exception as e :
@@ -62,7 +62,7 @@ async def CommissionToStageSendCompleteAndCleanup(
62
62
self .th2 .SetTestCommissionerPrematureCompleteAfter (stage )
63
63
errcode = self .th2 .CommissionOnNetwork (
64
64
nodeId = self .dut_node_id , setupPinCode = params .setupPinCode ,
65
- filterType = ChipDeviceCtrl .DiscoveryFilterType .LONG_DISCRIMINATOR , filter = self .matter_test_config . discriminators [ 0 ] )
65
+ filterType = ChipDeviceCtrl .DiscoveryFilterType .LONG_DISCRIMINATOR , filter = self .discriminator )
66
66
logging .info ('Commissioning complete done. Successful? {}, errorcode = {}' .format (errcode .is_success , errcode ))
67
67
asserts .assert_false (errcode .is_success , 'Commissioning complete did not error as expected' )
68
68
asserts .assert_true (errcode .sdk_part == expectedErrorPart , 'Unexpected error type returned from CommissioningComplete' )
@@ -75,6 +75,7 @@ async def CommissionToStageSendCompleteAndCleanup(
75
75
@async_test_body
76
76
async def test_TC_CGEN_2_4 (self ):
77
77
self .th1 = self .default_controller
78
+ self .discriminator = random .randint (0 , 4095 )
78
79
th2_certificate_authority = self .certificate_authority_manager .NewCertificateAuthority ()
79
80
th2_fabric_admin = th2_certificate_authority .NewFabricAdmin (vendorId = 0xFFF1 , fabricId = self .th1 .fabricId + 1 )
80
81
self .th2 = th2_fabric_admin .NewController (nodeId = 2 , useTestCommissioner = True )
@@ -102,7 +103,7 @@ async def test_TC_CGEN_2_4(self):
102
103
self .th2 .ResetTestCommissioner ()
103
104
errcode = self .th2 .CommissionOnNetwork (
104
105
nodeId = self .dut_node_id , setupPinCode = params .setupPinCode ,
105
- filterType = ChipDeviceCtrl .DiscoveryFilterType .LONG_DISCRIMINATOR , filter = self .matter_test_config . discriminators [ 0 ] )
106
+ filterType = ChipDeviceCtrl .DiscoveryFilterType .LONG_DISCRIMINATOR , filter = self .discriminator )
106
107
logging .info ('Commissioning complete done. Successful? {}, errorcode = {}' .format (errcode .is_success , errcode ))
107
108
108
109
logging .info ('Step 17 - TH1 sends an arm failsafe' )
0 commit comments