@@ -234,7 +234,7 @@ def CreateNewFabricController(self):
234
234
async def TestRevokeCommissioningWindow (self , ip : str , setuppin : int , nodeid : int ):
235
235
await self .devCtrl .SendCommand (
236
236
nodeid , 0 , Clusters .AdministratorCommissioning .Commands .OpenBasicCommissioningWindow (180 ), timedRequestTimeoutMs = 10000 )
237
- if not self .TestPaseOnly (ip = ip , setuppin = setuppin , nodeid = nodeid , devCtrl = self .devCtrl2 ):
237
+ if not await self .TestPaseOnly (ip = ip , setuppin = setuppin , nodeid = nodeid , devCtrl = self .devCtrl2 ):
238
238
return False
239
239
240
240
await self .devCtrl2 .SendCommand (
@@ -248,17 +248,17 @@ async def TestRevokeCommissioningWindow(self, ip: str, setuppin: int, nodeid: in
248
248
nodeid , 0 , Clusters .AdministratorCommissioning .Commands .RevokeCommissioning (), timedRequestTimeoutMs = 10000 )
249
249
return True
250
250
251
- def TestEnhancedCommissioningWindow (self , ip : str , nodeid : int ):
252
- params = self .devCtrl .OpenCommissioningWindow (nodeid = nodeid , timeout = 600 , iteration = 10000 , discriminator = 3840 , option = 1 )
253
- return self .TestPaseOnly (ip = ip , nodeid = nodeid , setuppin = params .setupPinCode , devCtrl = self .devCtrl2 )
251
+ async def TestEnhancedCommissioningWindow (self , ip : str , nodeid : int ):
252
+ params = await self .devCtrl .OpenCommissioningWindow (nodeid = nodeid , timeout = 600 , iteration = 10000 , discriminator = 3840 , option = 1 )
253
+ return await self .TestPaseOnly (ip = ip , nodeid = nodeid , setuppin = params .setupPinCode , devCtrl = self .devCtrl2 )
254
254
255
- def TestPaseOnly (self , ip : str , setuppin : int , nodeid : int , devCtrl = None ):
255
+ async def TestPaseOnly (self , ip : str , setuppin : int , nodeid : int , devCtrl = None ):
256
256
if devCtrl is None :
257
257
devCtrl = self .devCtrl
258
258
self .logger .info (
259
259
"Attempting to establish PASE session with device id: {} addr: {}" .format (str (nodeid ), ip ))
260
260
try :
261
- devCtrl .EstablishPASESessionIP (ip , setuppin , nodeid )
261
+ await devCtrl .EstablishPASESessionIP (ip , setuppin , nodeid )
262
262
except ChipStackException :
263
263
self .logger .info (
264
264
"Failed to establish PASE session with device id: {} addr: {}" .format (str (nodeid ), ip ))
@@ -267,11 +267,11 @@ def TestPaseOnly(self, ip: str, setuppin: int, nodeid: int, devCtrl=None):
267
267
"Successfully established PASE session with device id: {} addr: {}" .format (str (nodeid ), ip ))
268
268
return True
269
269
270
- def TestCommissionOnly (self , nodeid : int ):
270
+ async def TestCommissionOnly (self , nodeid : int ):
271
271
self .logger .info (
272
272
"Commissioning device with id {}" .format (nodeid ))
273
273
try :
274
- self .devCtrl .Commission (nodeid )
274
+ await self .devCtrl .Commission (nodeid )
275
275
except ChipStackException :
276
276
self .logger .info (
277
277
"Failed to commission device with id {}" .format (str (nodeid )))
@@ -280,17 +280,17 @@ def TestCommissionOnly(self, nodeid: int):
280
280
"Successfully commissioned device with id {}" .format (str (nodeid )))
281
281
return True
282
282
283
- def TestKeyExchangeBLE (self , discriminator : int , setuppin : int , nodeid : int ):
283
+ async def TestKeyExchangeBLE (self , discriminator : int , setuppin : int , nodeid : int ):
284
284
self .logger .info (
285
285
"Conducting key exchange with device {}" .format (discriminator ))
286
- if not self .devCtrl .ConnectBLE (discriminator , setuppin , nodeid ):
286
+ if not await self .devCtrl .ConnectBLE (discriminator , setuppin , nodeid ):
287
287
self .logger .info (
288
288
"Failed to finish key exchange with device {}" .format (discriminator ))
289
289
return False
290
290
self .logger .info ("Device finished key exchange." )
291
291
return True
292
292
293
- def TestCommissionFailure (self , nodeid : int , failAfter : int ):
293
+ async def TestCommissionFailure (self , nodeid : int , failAfter : int ):
294
294
self .devCtrl .ResetTestCommissioner ()
295
295
a = self .devCtrl .SetTestCommissionerSimulateFailureOnStage (failAfter )
296
296
if not a :
@@ -299,43 +299,43 @@ def TestCommissionFailure(self, nodeid: int, failAfter: int):
299
299
300
300
self .logger .info (
301
301
"Commissioning device, expecting failure after stage {}" .format (failAfter ))
302
- self .devCtrl .Commission (nodeid )
302
+ await self .devCtrl .Commission (nodeid )
303
303
return self .devCtrl .CheckTestCommissionerCallbacks () and self .devCtrl .CheckTestCommissionerPaseConnection (nodeid )
304
304
305
- def TestCommissionFailureOnReport (self , nodeid : int , failAfter : int ):
305
+ async def TestCommissionFailureOnReport (self , nodeid : int , failAfter : int ):
306
306
self .devCtrl .ResetTestCommissioner ()
307
307
a = self .devCtrl .SetTestCommissionerSimulateFailureOnReport (failAfter )
308
308
if not a :
309
309
# We're not going to hit this stage during commissioning so no sense trying, just say it was fine.
310
310
return True
311
311
self .logger .info (
312
312
"Commissioning device, expecting failure on report for stage {}" .format (failAfter ))
313
- self .devCtrl .Commission (nodeid )
313
+ await self .devCtrl .Commission (nodeid )
314
314
return self .devCtrl .CheckTestCommissionerCallbacks () and self .devCtrl .CheckTestCommissionerPaseConnection (nodeid )
315
315
316
- def TestCommissioning (self , ip : str , setuppin : int , nodeid : int ):
316
+ async def TestCommissioning (self , ip : str , setuppin : int , nodeid : int ):
317
317
self .logger .info ("Commissioning device {}" .format (ip ))
318
318
try :
319
- self .devCtrl .CommissionIP (ip , setuppin , nodeid )
319
+ await self .devCtrl .CommissionIP (ip , setuppin , nodeid )
320
320
except ChipStackException :
321
321
self .logger .exception (
322
322
"Failed to finish commissioning device {}" .format (ip ))
323
323
return False
324
324
self .logger .info ("Commissioning finished." )
325
325
return True
326
326
327
- def TestCommissioningWithSetupPayload (self , setupPayload : str , nodeid : int , discoveryType : int = 2 ):
327
+ async def TestCommissioningWithSetupPayload (self , setupPayload : str , nodeid : int , discoveryType : int = 2 ):
328
328
self .logger .info ("Commissioning device with setup payload {}" .format (setupPayload ))
329
329
try :
330
- self .devCtrl .CommissionWithCode (setupPayload , nodeid , chip .discovery .DiscoveryType (discoveryType ))
330
+ await self .devCtrl .CommissionWithCode (setupPayload , nodeid , chip .discovery .DiscoveryType (discoveryType ))
331
331
except ChipStackException :
332
332
self .logger .exception (
333
333
"Failed to finish commissioning device {}" .format (setupPayload ))
334
334
return False
335
335
self .logger .info ("Commissioning finished." )
336
336
return True
337
337
338
- def TestOnNetworkCommissioning (self , discriminator : int , setuppin : int , nodeid : int , ip_override : str = None ):
338
+ async def TestOnNetworkCommissioning (self , discriminator : int , setuppin : int , nodeid : int , ip_override : str = None ):
339
339
self .logger .info ("Testing discovery" )
340
340
device = self .TestDiscovery (discriminator = discriminator )
341
341
if not device :
@@ -345,7 +345,7 @@ def TestOnNetworkCommissioning(self, discriminator: int, setuppin: int, nodeid:
345
345
if ip_override :
346
346
address = ip_override
347
347
self .logger .info ("Testing commissioning" )
348
- if not self .TestCommissioning (address , setuppin , nodeid ):
348
+ if not await self .TestCommissioning (address , setuppin , nodeid ):
349
349
self .logger .info ("Failed to finish commissioning" )
350
350
return False
351
351
return True
@@ -792,7 +792,7 @@ async def TestMultiFabric(self, ip: str, setuppin: int, nodeid: int):
792
792
self .controllerNodeId , self .paaTrustStorePath )
793
793
794
794
try :
795
- self .devCtrl2 .CommissionIP (ip , setuppin , nodeid )
795
+ await self .devCtrl2 .CommissionIP (ip , setuppin , nodeid )
796
796
except ChipStackException :
797
797
self .logger .exception (
798
798
"Failed to finish key exchange with device {}" .format (ip ))
@@ -1313,15 +1313,15 @@ def TestNonControllerAPIs(self):
1313
1313
return False
1314
1314
return True
1315
1315
1316
- def TestFabricScopedCommandDuringPase (self , nodeid : int ):
1316
+ async def TestFabricScopedCommandDuringPase (self , nodeid : int ):
1317
1317
'''Validates that fabric-scoped commands fail during PASE with UNSUPPORTED_ACCESS
1318
1318
1319
1319
The nodeid is the PASE pseudo-node-ID used during PASE establishment
1320
1320
'''
1321
1321
status = None
1322
1322
try :
1323
- asyncio . run ( self .devCtrl .SendCommand (
1324
- nodeid , 0 , Clusters .OperationalCredentials .Commands .UpdateFabricLabel ("roboto" )))
1323
+ await self .devCtrl .SendCommand (
1324
+ nodeid , 0 , Clusters .OperationalCredentials .Commands .UpdateFabricLabel ("roboto" ))
1325
1325
except IM .InteractionModelError as ex :
1326
1326
status = ex .status
1327
1327
0 commit comments