Skip to content

Commit 8454f16

Browse files
m-alperen-senersjanc
authored andcommitted
sm: update wid 147 for new legacy pairing oob tests
New test cases introduced by core v6.3 reuires to use random OOB data in each iteration of the test. For other existing legacy pariring OOB method test cases, it is OK to use the OOB data retrieved from gap_oob_sc_get_local_data() btp call. Adding exception for test cases and generating random data for: SM/CEN/OOB/BV-10-C and SM/PER/OOB/BV-11-C Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
1 parent 4e8eb01 commit 8454f16

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

autopts/wid/sm.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#
1515

1616
import logging
17+
import os
1718
import re
1819

1920
from autopts.ptsprojects.stack import get_stack
@@ -199,10 +200,22 @@ def hdl_wid_146(_: WIDParams):
199200
return True
200201

201202

202-
def hdl_wid_147(_: WIDParams):
203+
def hdl_wid_147(params: WIDParams):
203204
"""
204205
Please enter 16 bytes IUT's OOB Data (confirmation).
205206
"""
207+
if params.test_case_name in ['SM/CEN/OOB/BV-10-C', 'SM/PER/OOB/BV-11-C']:
208+
# This behaviour is required by core v6.3 and later.
209+
# Ref: Core_v6.3 Vol 3, Part H section 2.3.5.4
210+
# The TK value shall be a 128-bit random number.
211+
# However this can not be forced on the Host SM layer, since OOB is not limited to be supplied
212+
# any application level method.
213+
# if test case is ble legacy pairing with OOB data, we need to generate a 16bytes random number
214+
# each time this WID is called to set the OOB data.
215+
random_number = ''.join(f'{byte:02x}' for byte in os.urandom(16))
216+
btp.gap_oob_legacy_set_data(random_number)
217+
return random_number
218+
206219
r, c = btp.gap_oob_sc_get_local_data()
207220
return c
208221

0 commit comments

Comments
 (0)