@@ -211,6 +211,40 @@ def parse_raw_response(self, raw_resp) -> _ActionResult:
211
211
return _ActionResult (status = _ActionStatus .SUCCESS , response = return_val )
212
212
213
213
214
+ class WaitForCommissioneeAction (BaseAction ):
215
+ ''' Wait for commissionee action to be executed.'''
216
+
217
+ def __init__ (self , test_step ):
218
+ super ().__init__ (test_step .label )
219
+ self ._node_id = test_step .node_id
220
+ self ._expire_existing_session = False
221
+ # This is the default when no timeout is provided.
222
+ _DEFAULT_TIMEOUT_MS = 10 * 1000
223
+ self ._timeout_ms = _DEFAULT_TIMEOUT_MS
224
+
225
+ if test_step .arguments is None :
226
+ # Nothing left for us to do the default values are what we want
227
+ return
228
+
229
+ args = test_step .arguments ['values' ]
230
+ request_data_as_dict = Converter .convert_list_of_name_value_pair_to_dict (args )
231
+
232
+ self ._expire_existing_session = request_data_as_dict .get ('expireExistingSession' , False )
233
+ if 'timeout' in request_data_as_dict :
234
+ # Timeout is provided in seconds we need to conver to milliseconds.
235
+ self ._timeout_ms = request_data_as_dict ['timeout' ] * 1000
236
+
237
+ def run_action (self , dev_ctrl : ChipDeviceCtrl ) -> _ActionResult :
238
+ try :
239
+ if self ._expire_existing_session :
240
+ dev_ctrl .ExpireSessions (self ._node_id )
241
+ dev_ctrl .GetConnectedDeviceSync (self ._node_id , timeoutMs = self ._timeout_ms )
242
+ except TimeoutError :
243
+ return _ActionResult (status = _ActionStatus .ERROR , response = None )
244
+
245
+ return _ActionResult (status = _ActionStatus .SUCCESS , response = None )
246
+
247
+
214
248
class AttributeChangeAccumulator :
215
249
def __init__ (self , name : str , expected_attribute : Clusters .ClusterAttributeDescriptor ,
216
250
output_queue : queue .SimpleQueue ):
@@ -461,6 +495,15 @@ def _attribute_write_action_factory(self, test_step, cluster: str):
461
495
except ParsingError :
462
496
return None
463
497
498
+ def _wait_for_commissionee_action_factory (self , test_step ):
499
+ try :
500
+ return WaitForCommissioneeAction (test_step )
501
+ except ParsingError :
502
+ # TODO For now, ParsingErrors are largely issues that will be addressed soon. Once this
503
+ # runner has matched parity of the codegen YAML test, this exception should be
504
+ # propogated.
505
+ return None
506
+
464
507
def _wait_for_report_action_factory (self , test_step ):
465
508
try :
466
509
return WaitForReportAction (test_step , self ._context )
@@ -476,7 +519,9 @@ def encode(self, request) -> BaseAction:
476
519
command = request .command
477
520
# Some of the tests contain 'cluster over-rides' that refer to a different
478
521
# cluster than that specified in 'config'.
479
- if command == 'writeAttribute' :
522
+ if cluster == 'DelayCommands' and command == 'WaitForCommissionee' :
523
+ action = self ._wait_for_commissionee_action_factory (request )
524
+ elif command == 'writeAttribute' :
480
525
action = self ._attribute_write_action_factory (request , cluster )
481
526
elif command == 'readAttribute' :
482
527
action = self ._attribute_read_action_factory (request , cluster )
0 commit comments