1515
1616CURRENT_DIR_LIGHT = str (pathlib .Path (__file__ ).parent )+ '/light'
1717CHIP_TOOL_EXE = str (pathlib .Path (__file__ ).parent )+ '/../connectedhomeip/connectedhomeip/out/host/chip-tool'
18- OT_BR_EXAMPLE_PATH = str (pathlib .Path (__file__ ).parent )+ '/../esp-thread-br/examples/basic_thread_border_router'
18+ OT_BR_EXAMPLE_PATH = str (pathlib .Path (__file__ ).parent )+ '/thread_border_router'
19+ OT_DATASET_HEXSTR = '0e08000000000001000035060004001fffe00708fdb824be22185de50c0402a0f7f8051020112014020519772011201402051977030d41706f6c6c6f6e54687265616404101fefc90ee1637d47ca75f87ec24f9403000300000f0208201120140205197701022201'
1920pytest_build_dir = CURRENT_DIR_LIGHT
2021pytest_matter_thread_dir = CURRENT_DIR_LIGHT + '|' + OT_BR_EXAMPLE_PATH
2122
@@ -227,7 +228,7 @@ def fixture_Init_interface() -> bool:
227228@pytest .mark .esp_matter_dut
228229@pytest .mark .parametrize (
229230 'count, app_path, target, erase_all' , [
230- ( 2 , pytest_matter_thread_dir , 'esp32h2|esp32s3' , 'y|n ' ),
231+ ( 2 , pytest_matter_thread_dir , 'esp32h2|esp32s3' , 'y|y ' ),
231232 ],
232233 indirect = True ,
233234)
@@ -240,51 +241,56 @@ def test_matter_commissioning_h2(dut:Tuple[Dut, Dut]) -> None:
240241 fixture_Init_interface ()
241242 # BLE start advertising
242243 light .expect (r'chip\[DL\]\: Configuring CHIPoBLE advertising' , timeout = 20 )
243- # flash ot_br
244- ot_br . expect ( 'OpenThread attached to netif' , timeout = 30 )
244+ ot_br . expect ( r'chip\[DL\]\: Configuring CHIPoBLE advertising' , timeout = 20 )
245+ # Start commissioning OTBR
245246 time .sleep (2 )
246- ot_br .write ('factoryreset' )
247- ot_br .expect ('OpenThread attached to netif' , timeout = 30 )
248- time .sleep (2 )
249- ot_br .write ('log level 3' )
250- ot_br .expect ('Done' , timeout = 5 )
251- time .sleep (2 )
252- # wifi connect -s ChipTEH2 -p chiptest123
253- ot_br .write ('wifi connect -s ChipTEH2 -p chiptest123' )
254- ot_br .expect ('wifi sta is connected successfully' , timeout = 5 )
247+ command = CHIP_TOOL_EXE + ' pairing ble-wifi 1 ChipTEH2 chiptest123 20202021 3584'
248+ out_str = subprocess .getoutput (command )
249+ print (out_str )
250+ result = re .findall (r'Run command failure' , str (out_str ))
251+ if len (result ) != 0 :
252+ assert False
253+ # Set the active dataset and start Thread network
255254 time .sleep (2 )
256- # start an ot network
257- ot_br .write ('ifconfig up' )
258- ot_br .expect ('netif up' , timeout = 5 )
255+ command = CHIP_TOOL_EXE + ' generalcommissioning arm-fail-safe 180 1 1 0'
256+ out_str = subprocess .getoutput (command )
257+ print (out_str )
258+ result = re .findall (r'Run command failure' , str (out_str ))
259+ if len (result ) != 0 :
260+ assert False
259261 time .sleep (2 )
260- ot_br .write ('thread start' )
261- ot_br .expect ('Role detached -> leader' , timeout = 20 )
262+ command = CHIP_TOOL_EXE + ' threadborderroutermanagement set-active-dataset-request hex:' + OT_DATASET_HEXSTR + ' 1 1'
263+ out_str = subprocess .getoutput (command )
264+ print (out_str )
265+ result = re .findall (r'Run command failure' , str (out_str ))
266+ if len (result ) != 0 :
267+ assert False
262268 time .sleep (2 )
263- # get dataset
264- ot_br . write ( 'dataset active -x' )
265- dataset = ot_br . expect ( r'\n(\w{202}\r)' , timeout = 5 )[ 1 ]. decode ( )
266- print ( dataset )
267- ot_br . expect ( 'Got IPv6 event: Interface "example_netif_sta" address: fdde:ad00:beef:cafe' , timeout = 30 )
268- print ( "Got unique local ipv6 address" )
269- # Start commissioning
269+ command = CHIP_TOOL_EXE + ' generalcommissioning commissioning-complete 1 0'
270+ out_str = subprocess . getoutput ( command )
271+ print ( out_str )
272+ result = re . findall ( r'Run command failure' , str ( out_str ) )
273+ if len ( result ) != 0 :
274+ assert False
275+ # Start commissioning Light
270276 time .sleep (2 )
271- command = CHIP_TOOL_EXE + " pairing ble-thread 1 hex:{} " . format ( dataset . strip ()) + " 20202021 3840"
277+ command = CHIP_TOOL_EXE + ' pairing ble-thread 2 hex:' + OT_DATASET_HEXSTR + ' 20202021 3840'
272278 out_str = subprocess .getoutput (command )
273279 print (out_str )
274280 result = re .findall (r'Run command failure' , str (out_str ))
275281 if len (result ) != 0 :
276282 assert False
277283 # Use toggle command to turn-off the light
278284 time .sleep (2 )
279- command = CHIP_TOOL_EXE + ' onoff toggle 1 1'
285+ command = CHIP_TOOL_EXE + ' onoff toggle 2 1'
280286 out_str = subprocess .getoutput (command )
281287 print (out_str )
282288 result = re .findall (r'Run command failure' , str (out_str ))
283289 if len (result ) != 0 :
284290 assert False
285291 # Use toggle command to turn-on the light
286292 time .sleep (2 )
287- command = CHIP_TOOL_EXE + ' onoff toggle 1 1'
293+ command = CHIP_TOOL_EXE + ' onoff toggle 2 1'
288294 out_str = subprocess .getoutput (command )
289295 print (out_str )
290296 result = re .findall (r'Run command failure' , str (out_str ))
0 commit comments