blob: 2d812e3f45af31148a8cff5ba2d11ca4c83dad1b [file] [log] [blame]
Jaineel4e4a96a2020-12-03 15:11:10 -08001#!/usr/bin/env python3.4
2#
3# Copyright 2020 - Google
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16"""
17 Test Script for 5G MMS scenarios
18"""
19
20import time
21
22from acts.test_decorators import test_tracker_info
23from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
24from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING
Pei Huang47d6a0b2021-04-05 23:35:49 +080025from acts_contrib.test_utils.tel.tel_defines import SMS_OVER_WIFI_PROVIDERS
Pratik Shethaec72b72021-02-09 15:44:28 -080026from acts_contrib.test_utils.tel.tel_test_utils import call_setup_teardown
Jaineel4e4a96a2020-12-03 15:11:10 -080027from acts_contrib.test_utils.tel.tel_test_utils import ensure_phones_idle
28from acts_contrib.test_utils.tel.tel_test_utils import ensure_wifi_connected
Jaineel4e4a96a2020-12-03 15:11:10 -080029from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan
Pratik Shethaec72b72021-02-09 15:44:28 -080030from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_volte
Pei Huang47d6a0b2021-04-05 23:35:49 +080031from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_csfb
Jaineel78a57152020-12-08 17:03:00 -080032from acts_contrib.test_utils.tel.tel_5g_utils import connect_both_devices_to_wifi
Pratik Shethaec72b72021-02-09 15:44:28 -080033from acts_contrib.test_utils.tel.tel_5g_utils import disable_apm_mode_both_devices
Jaineel78a57152020-12-08 17:03:00 -080034from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_5g
35from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_volte
36from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_wfc_cell_pref
37from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_wfc_wifi_pref
38from acts_contrib.test_utils.tel.tel_5g_utils import verify_5g_attach_for_both_devices
Pei Huang47d6a0b2021-04-05 23:35:49 +080039from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_csfb
Pratik Shethaec72b72021-02-09 15:44:28 -080040from acts_contrib.test_utils.tel.tel_mms_utils import _mms_test_mo
41from acts_contrib.test_utils.tel.tel_mms_utils import _mms_test_mt
42from acts_contrib.test_utils.tel.tel_mms_utils import _long_mms_test_mo
Pei Huang47d6a0b2021-04-05 23:35:49 +080043from acts_contrib.test_utils.tel.tel_mms_utils import test_mms_mo_in_call
Jaineel4e4a96a2020-12-03 15:11:10 -080044
45class Nsa5gMmsTest(TelephonyBaseTest):
46 def setup_class(self):
47 super().setup_class()
48 self.number_of_devices = 2
49 self.message_lengths = (50, 160, 180)
50
Pei Huang47d6a0b2021-04-05 23:35:49 +080051 is_roaming = False
52 for ad in self.android_devices:
53 ad.sms_over_wifi = False
54 # verizon supports sms over wifi. will add more carriers later
55 for sub in ad.telephony["subscription"].values():
56 if sub["operator"] in SMS_OVER_WIFI_PROVIDERS:
57 ad.sms_over_wifi = True
58 if getattr(ad, 'roaming', False):
59 is_roaming = True
60 if is_roaming:
61 # roaming device does not allow message of length 180
62 self.message_lengths = (50, 160)
63
Jaineel4e4a96a2020-12-03 15:11:10 -080064 def setup_test(self):
65 TelephonyBaseTest.setup_test(self)
66
67 def teardown_test(self):
68 ensure_phones_idle(self.log, self.android_devices)
69
Jaineel4e4a96a2020-12-03 15:11:10 -080070
Jaineel4e4a96a2020-12-03 15:11:10 -080071 """ Tests Begin """
72
Pratik Shethf9d0d2b2021-03-19 15:38:44 -070073
Jaineel4e4a96a2020-12-03 15:11:10 -080074 @test_tracker_info(uuid="bc484c2c-8086-42db-94cd-a1e4a35f35cf")
75 @TelephonyBaseTest.tel_test_wrap
76 def test_5g_nsa_mms_mo_mt(self):
77 """Test MMS between two phones in 5g NSA
78
79 Provision devices in 5g NSA
80 Send and Verify MMS from PhoneA to PhoneB
81 Verify both devices are still on 5g NSA
82
83 Returns:
84 True if success.
85 False if failed.
86 """
87 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -080088 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080089 return False
90
Pratik Shethaec72b72021-02-09 15:44:28 -080091 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080092 return False
93
Jaineel78a57152020-12-08 17:03:00 -080094 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080095 return False
96
97 self.log.info("PASS - mms test over 5g nsa validated")
98 return True
99
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700100
Jaineel4e4a96a2020-12-03 15:11:10 -0800101 @test_tracker_info(uuid="51d42104-cb87-4c9b-9a16-302e246a21dc")
102 @TelephonyBaseTest.tel_test_wrap
103 def test_5g_nsa_mms_mo_mt_volte(self):
104 """Test MMS between two phones with VoLTE on 5G NSA
105
106 Provision devices on VoLTE
107 Provision devices in 5g NSA
108 Send and Verify MMS from PhoneA to PhoneB
109 Verify both devices are still on 5g NSA
110
111 Returns:
112 True if success.
113 False if failed.
114 """
115
116 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800117 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800118 return False
119
Jaineel78a57152020-12-08 17:03:00 -0800120 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800121 return False
122
Pratik Shethaec72b72021-02-09 15:44:28 -0800123 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800124 return False
125
Jaineel78a57152020-12-08 17:03:00 -0800126 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800127 return False
128
129 self.log.info("PASS - volte mms test over 5g nsa validated")
130 return True
131
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700132
Jaineel4e4a96a2020-12-03 15:11:10 -0800133 @test_tracker_info(uuid="97d6b071-aef2-40c1-8245-7be6c31870a6")
134 @TelephonyBaseTest.tel_test_wrap
135 def test_5g_nsa_mms_mo_mt_in_call_volte(self):
136 """ Test MO MMS during a VoLTE call over 5G NSA.
137
138 Provision devices on VoLTE
139 Provision devices in 5g NSA
140 Make a Voice call from PhoneA to PhoneB
141 Send and Verify MMS from PhoneA to PhoneB
142 Verify both devices are still on 5g NSA
143
144 Returns:
145 True if pass; False if fail.
146 """
147 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800148 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800149 return False
150
Jaineel78a57152020-12-08 17:03:00 -0800151 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800152 return False
153
154 self.log.info("Begin Incall mms test.")
155 if not call_setup_teardown(
156 self.log,
157 ads[0],
158 ads[1],
159 ad_hangup=None,
160 verify_caller_func=is_phone_in_call_volte,
161 verify_callee_func=None):
162 return False
163
Pratik Shethaec72b72021-02-09 15:44:28 -0800164 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800165 return False
166
Jaineel78a57152020-12-08 17:03:00 -0800167 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800168 return False
169 self.log.info("PASS - Incall volte mms test over 5g nsa validated")
170 return True
171
172
173 @test_tracker_info(uuid="bbb4b80c-fc1b-4377-b3c7-eeed642c5980")
174 @TelephonyBaseTest.tel_test_wrap
175 def test_5g_nsa_mms_mo_mt_iwlan(self):
176 """ Test MMS text function between two phones,
177 Phones in APM, WiFi connected, WFC Cell Preferred mode.
178
179 Disable APM on both devices
180 Provision devices in 5g NSA
181 Provision devices for WFC Cell Pref with APM ON
182 Send and Verify MMS from PhoneA to PhoneB
183
184 Returns:
185 True if pass; False if fail.
186 """
187
188 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800189 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800190 return False
191
Jaineel78a57152020-12-08 17:03:00 -0800192 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800193 return False
194
Jaineel78a57152020-12-08 17:03:00 -0800195 if not provision_both_devices_for_wfc_cell_pref(self.log,
196 ads,
197 self.wifi_network_ssid,
198 self.wifi_network_pass,
199 apm_mode=True):
Jaineel4e4a96a2020-12-03 15:11:10 -0800200 return False
201 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
202
Pratik Shethaec72b72021-02-09 15:44:28 -0800203 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800204 return False
205
206 self.log.info("PASS - iwlan mms test over 5g nsa validated")
207 return True
208
209
210 @test_tracker_info(uuid="d36d95dc-0973-4711-bb08-c29ce23495e4")
211 @TelephonyBaseTest.tel_test_wrap
212 def test_5g_nsa_mms_mo_mt_iwlan_apm_off(self):
213 """ Test MO MMS, Phone in APM off, WiFi connected, WFC WiFi Pref Mode
214
215 Disable APM on both devices
216 Provision devices in 5g NSA
217 Provision devices for WFC Wifi Pref with APM OFF
218 Send and Verify MMS from PhoneA to PhoneB
219 Verify 5g NSA attach for both devices
220
221 Returns:
222 True if pass; False if fail.
223 """
224
225 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800226 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800227 return False
228
Jaineel78a57152020-12-08 17:03:00 -0800229 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800230 return False
231
Jaineel78a57152020-12-08 17:03:00 -0800232 if not provision_both_devices_for_wfc_wifi_pref(self.log,
233 ads,
234 self.wifi_network_ssid,
235 self.wifi_network_pass,
236 apm_mode=False):
Jaineel4e4a96a2020-12-03 15:11:10 -0800237 return False
238 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
239
Pratik Shethaec72b72021-02-09 15:44:28 -0800240 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800241 self.log.error("Failed to send receive sms over 5g nsa")
242 return False
243 self.log.info("PASS - iwlan mms test over 5g nsa validated")
244
Jaineel78a57152020-12-08 17:03:00 -0800245 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800246 return False
247 return True
248
249
250 @test_tracker_info(uuid="74ffb79e-f1e9-4087-a9d2-e07878e47869")
251 @TelephonyBaseTest.tel_test_wrap
252 def test_5g_nsa_mms_mo_mt_in_call_iwlan(self):
253 """ Test MO MMS, Phone in APM, WiFi connected, WFC WiFi Pref mode
254
255 Disable APM on both devices
256 Provision devices in 5g NSA
257 Provision devices for WFC Wifi Pref with APM ON
258 Make a Voice call from PhoneA to PhoneB
259 Send and Verify MMS from PhoneA to PhoneB
260
261 Returns:
262 True if pass; False if fail.
263 """
264
265 ads = self.android_devices
266
Jaineel78a57152020-12-08 17:03:00 -0800267 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800268 return False
269
Jaineel78a57152020-12-08 17:03:00 -0800270 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800271 return False
272
Jaineel78a57152020-12-08 17:03:00 -0800273 if not provision_both_devices_for_wfc_wifi_pref(self.log,
274 ads,
275 self.wifi_network_ssid,
276 self.wifi_network_pass,
277 apm_mode=True):
Jaineel4e4a96a2020-12-03 15:11:10 -0800278 return False
279 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
280
281 self.log.info("Begin Incall mms test")
282 if not call_setup_teardown(
283 self.log,
284 ads[0],
285 ads[1],
286 ad_hangup=None,
287 verify_caller_func=is_phone_in_call_iwlan,
288 verify_callee_func=None):
289 return False
290
Pratik Shethaec72b72021-02-09 15:44:28 -0800291 return _mms_test_mo(self.log, ads)
Jaineel4e4a96a2020-12-03 15:11:10 -0800292
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700293
Jaineel4e4a96a2020-12-03 15:11:10 -0800294 @test_tracker_info(uuid="68c8e0ca-bea4-45e4-92cf-19424ee47ca4")
295 @TelephonyBaseTest.tel_test_wrap
296 def test_5g_nsa_mms_mo_mt_in_call_volte_wifi(self):
297 """ Test MMS during VoLTE call and WiFi connected
298
299 Make sure PhoneA/B are in 5G NSA (with VoLTE).
300 Make sure PhoneA/B are able to make/receive call.
301 Connect PhoneA/B to Wifi.
302 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA.
303 Make sure PhoneA/B are in 5G NSA.
304
305 Returns:
306 True if pass; False if fail.
307 """
308 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800309 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800310 return False
311
Jaineel78a57152020-12-08 17:03:00 -0800312 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800313 return False
314
Jaineel78a57152020-12-08 17:03:00 -0800315 if not connect_both_devices_to_wifi(self.log,
316 ads,
317 self.wifi_network_ssid,
318 self.wifi_network_pass):
Jaineel4e4a96a2020-12-03 15:11:10 -0800319 return False
320
321 self.log.info("Begin In Call MMS Test.")
322 if not call_setup_teardown(
323 self.log,
324 ads[0],
325 ads[1],
326 ad_hangup=None,
327 verify_caller_func=is_phone_in_call_volte,
328 verify_callee_func=None):
329 return False
330
Pratik Shethaec72b72021-02-09 15:44:28 -0800331 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800332 return False
333
Jaineel78a57152020-12-08 17:03:00 -0800334 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800335 return False
336 return True
337
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700338
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800339 @test_tracker_info(uuid="8c795c3a-59d4-408c-9b99-5287e79ba00b")
Pratik Shethaec72b72021-02-09 15:44:28 -0800340 @TelephonyBaseTest.tel_test_wrap
341 def test_5g_nsa_mms_long_message_mo_mt(self):
342 """Test MMS basic function between two phone. Phones in nsa 5G network.
343
344 Airplane mode is off. Phone in nsa 5G.
345 Send MMS from PhoneA to PhoneB.
346 Verify received message on PhoneB is correct.
347
348 Returns:
349 True if success.
350 False if failed.
351 """
352
353 ads = self.android_devices
354
355 if not disable_apm_mode_both_devices(self.log, ads):
356 return False
357
358 if not provision_both_devices_for_5g(self.log, ads):
359 return False
360
361 return _long_mms_test_mo(self.log, ads)
362
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700363
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800364 @test_tracker_info(uuid="e09b82ab-69a9-4eae-8cbe-b6f2cff993ad")
Pratik Shethaec72b72021-02-09 15:44:28 -0800365 @TelephonyBaseTest.tel_test_wrap
366 def test_5g_nsa_mms_mo_wifi(self):
367 """Test MMS basic function between two phone. Phones in nsa 5g network.
368
369 Airplane mode is off. Phone in nsa 5G.
370 Connect to Wifi.
371 Send MMS from PhoneA to PhoneB.
372 Verify received message on PhoneB is correct.
373
374 Returns:
375 True if success.
376 False if failed.
377 """
378
379 ads = self.android_devices
380
381 if not disable_apm_mode_both_devices(self.log, ads):
382 return False
383
384 if not provision_both_devices_for_5g(self.log, ads):
385 return False
386
387 ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
388 self.wifi_network_pass)
389
390 return _mms_test_mo(self.log, ads)
391
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700392
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800393 @test_tracker_info(uuid="fedae24f-2577-4f84-9d76-53bbbe109d48")
Pratik Shethaec72b72021-02-09 15:44:28 -0800394 @TelephonyBaseTest.tel_test_wrap
395 def test_5g_nsa_mms_mt_wifi(self):
396 """Test MMS basic function between two phone. Phones in nsa 5g network.
397
398 Airplane mode is off. Phone in nsa 5G.
399 Connect to Wifi.
400 Send MMS from PhoneB to PhoneA.
401 Verify received message on PhoneA is correct.
402
403 Returns:
404 True if success.
405 False if failed.
406 """
407
408 ads = self.android_devices
409
410 if not disable_apm_mode_both_devices(self.log, ads):
411 return False
412
413 if not provision_both_devices_for_5g(self.log, ads):
414 return False
415
416 ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
417 self.wifi_network_pass)
418
419 return _mms_test_mt(self.log, ads)
420
Pei Huang47d6a0b2021-04-05 23:35:49 +0800421
422 @TelephonyBaseTest.tel_test_wrap
423 def test_5g_nsa_mms_mo_mt_in_call_csfb_wifi(self):
424 """ Test MO/MT MMS during a MO csfb call and devices connect to Wifi.
425
426 Disable APM on both devices
427 Set up PhoneA/PhoneB are in CSFB mode.
428 Provision PhoneA/B in 5g NSA.
429 Make sure PhoneA/B is able to make/receive call.
430 Connect PhoneA/B to Wifi.
431 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA,
432 receive MMS on B.
433
434 Returns:
435 True if pass; False if fail.
436 """
437 ads = self.android_devices
438
439 if not disable_apm_mode_both_devices(self.log, ads):
440 return False
441
442 if not provision_both_devices_for_csfb(self.log, ads):
443 return False
444 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
445
446 if not provision_both_devices_for_5g(self.log, ads):
447 return False
448
449 if not connect_both_devices_to_wifi(self.log,
450 ads,
451 self.wifi_network_ssid,
452 self.wifi_network_pass):
453 return False
454 if not test_mms_mo_in_call(self.log,
455 ads,
456 wifi=True,
457 caller_func=is_phone_in_call_csfb):
458 return False
459
Pratik Shethaec72b72021-02-09 15:44:28 -0800460 """ Tests End """