@@ -47,46 +47,46 @@ def await_nrfcloud(func, expected, field, timeout):
47
47
if expected in data :
48
48
break
49
49
50
- def get_appversion (t91x_fota ):
51
- shadow = t91x_fota .fota .get_device (t91x_fota .device_id )
50
+ def get_appversion (dut_fota ):
51
+ shadow = dut_fota .fota .get_device (dut_fota .device_id )
52
52
return shadow ["state" ]["reported" ]["device" ]["deviceInfo" ]["appVersion" ]
53
53
54
- def get_modemversion (t91x_fota ):
55
- shadow = t91x_fota .fota .get_device (t91x_fota .device_id )
54
+ def get_modemversion (dut_fota ):
55
+ shadow = dut_fota .fota .get_device (dut_fota .device_id )
56
56
return shadow ["state" ]["reported" ]["device" ]["deviceInfo" ]["modemFirmware" ]
57
57
58
- def run_fota_resumption (t91x_fota , fota_type ):
58
+ def run_fota_resumption (dut_fota , fota_type ):
59
59
timeout_50_percent = APP_FOTA_TIMEOUT / 2
60
- t91x_fota .uart .wait_for_str ("50%" , timeout = timeout_50_percent )
60
+ dut_fota .uart .wait_for_str ("50%" , timeout = timeout_50_percent )
61
61
logger .debug (f"Testing fota resumption on disconnect for { fota_type } fota" )
62
62
63
63
patterns_lte_offline = ["network: Network connectivity lost" ]
64
64
patterns_lte_normal = ["network: Network connectivity established" ]
65
65
66
66
# LTE disconnect
67
- t91x_fota .uart .flush ()
68
- t91x_fota .uart .write ("lte offline\r \n " )
69
- t91x_fota .uart .wait_for_str (patterns_lte_offline , timeout = 20 )
67
+ dut_fota .uart .flush ()
68
+ dut_fota .uart .write ("lte offline\r \n " )
69
+ dut_fota .uart .wait_for_str (patterns_lte_offline , timeout = 20 )
70
70
71
71
# LTE reconnect
72
- t91x_fota .uart .flush ()
73
- t91x_fota .uart .write ("lte normal\r \n " )
74
- t91x_fota .uart .wait_for_str (patterns_lte_normal , timeout = 120 )
72
+ dut_fota .uart .flush ()
73
+ dut_fota .uart .write ("lte normal\r \n " )
74
+ dut_fota .uart .wait_for_str (patterns_lte_normal , timeout = 120 )
75
75
76
- t91x_fota .uart .wait_for_str ("fota_download: Refuse fragment, restart with offset" )
77
- t91x_fota .uart .wait_for_str ("fota_download: Downloading from offset:" )
76
+ dut_fota .uart .wait_for_str ("fota_download: Refuse fragment, restart with offset" )
77
+ dut_fota .uart .wait_for_str ("fota_download: Downloading from offset:" )
78
78
79
79
@pytest .fixture
80
- def run_fota_fixture (t91x_fota , hex_file ):
80
+ def run_fota_fixture (dut_fota , hex_file ):
81
81
def _run_fota (bundle_id = "" , fota_type = "app" , fotatimeout = APP_FOTA_TIMEOUT , new_version = TEST_APP_VERSION ):
82
82
flash_device (os .path .abspath (hex_file ))
83
- t91x_fota .uart .xfactoryreset ()
84
- t91x_fota .uart .flush ()
83
+ dut_fota .uart .xfactoryreset ()
84
+ dut_fota .uart .flush ()
85
85
reset_device ()
86
- t91x_fota .uart .wait_for_str ("Connected to Cloud" )
86
+ dut_fota .uart .wait_for_str ("Connected to Cloud" )
87
87
88
88
if fota_type == "app" :
89
- bundle_id = t91x_fota .fota .upload_firmware (
89
+ bundle_id = dut_fota .fota .upload_firmware (
90
90
"nightly_test_app" ,
91
91
TEST_APP_BIN ,
92
92
TEST_APP_VERSION ,
@@ -96,44 +96,44 @@ def _run_fota(bundle_id="", fota_type="app", fotatimeout=APP_FOTA_TIMEOUT, new_v
96
96
logger .info (f"Uploaded file { TEST_APP_BIN } : bundleId: { bundle_id } " )
97
97
98
98
try :
99
- t91x_fota .data ['job_id' ] = t91x_fota .fota .create_fota_job (t91x_fota .device_id , bundle_id )
100
- t91x_fota .data ['bundle_id' ] = bundle_id
99
+ dut_fota .data ['job_id' ] = dut_fota .fota .create_fota_job (dut_fota .device_id , bundle_id )
100
+ dut_fota .data ['bundle_id' ] = bundle_id
101
101
except NRFCloudFOTAError as e :
102
102
pytest .skip (f"FOTA create_job REST API error: { e } " )
103
- logger .info (f"Created FOTA Job (ID: { t91x_fota .data ['job_id' ]} )" )
103
+ logger .info (f"Created FOTA Job (ID: { dut_fota .data ['job_id' ]} )" )
104
104
105
105
# Sleep a bit and trigger fota poll
106
106
for i in range (3 ):
107
107
try :
108
108
time .sleep (30 )
109
- t91x_fota .uart .write ("zbus button_press\r \n " )
110
- t91x_fota .uart .wait_for_str ("nrf_cloud_fota_poll: Starting FOTA download" )
109
+ dut_fota .uart .write ("zbus button_press\r \n " )
110
+ dut_fota .uart .wait_for_str ("nrf_cloud_fota_poll: Starting FOTA download" )
111
111
break
112
112
except AssertionError :
113
113
continue
114
114
else :
115
115
raise AssertionError (f"Fota update not available after { i } attempts" )
116
116
117
117
# if fota_type == "app":
118
- # run_fota_resumption(t91x_fota , "app")
118
+ # run_fota_resumption(dut_fota , "app")
119
119
120
120
await_nrfcloud (
121
- functools .partial (t91x_fota .fota .get_fota_status , t91x_fota .data ['job_id' ]),
121
+ functools .partial (dut_fota .fota .get_fota_status , dut_fota .data ['job_id' ]),
122
122
"COMPLETED" ,
123
123
"FOTA status" ,
124
124
fotatimeout
125
125
)
126
126
try :
127
127
if fota_type == "app" :
128
128
await_nrfcloud (
129
- functools .partial (get_appversion , t91x_fota ),
129
+ functools .partial (get_appversion , dut_fota ),
130
130
new_version ,
131
131
"appVersion" ,
132
132
DEVICE_MSG_TIMEOUT
133
133
)
134
134
else :
135
135
await_nrfcloud (
136
- functools .partial (get_modemversion , t91x_fota ),
136
+ functools .partial (get_modemversion , dut_fota ),
137
137
new_version ,
138
138
"modemFirmware" ,
139
139
DEVICE_MSG_TIMEOUT
0 commit comments