blob: d89ed74001f85ff4a382e5f3876cc97e45f5ef35 [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
Markus Liu660218f2021-04-29 17:14:07 +080032from acts_contrib.test_utils.tel.tel_5g_test_utils import connect_both_devices_to_wifi
33from acts_contrib.test_utils.tel.tel_5g_test_utils import disable_apm_mode_both_devices
34from acts_contrib.test_utils.tel.tel_5g_test_utils import provision_device_for_5g
35from acts_contrib.test_utils.tel.tel_5g_test_utils import provision_both_devices_for_volte
36from acts_contrib.test_utils.tel.tel_5g_test_utils import provision_both_devices_for_wfc_cell_pref
37from acts_contrib.test_utils.tel.tel_5g_test_utils import provision_both_devices_for_wfc_wifi_pref
38from acts_contrib.test_utils.tel.tel_5g_test_utils import verify_5g_attach_for_both_devices
39from acts_contrib.test_utils.tel.tel_5g_test_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
Pratik Sheth0df9f222021-04-05 17:55:51 -070045
Jaineel4e4a96a2020-12-03 15:11:10 -080046class Nsa5gMmsTest(TelephonyBaseTest):
47 def setup_class(self):
48 super().setup_class()
49 self.number_of_devices = 2
50 self.message_lengths = (50, 160, 180)
51
Pei Huang47d6a0b2021-04-05 23:35:49 +080052 is_roaming = False
53 for ad in self.android_devices:
54 ad.sms_over_wifi = False
55 # verizon supports sms over wifi. will add more carriers later
56 for sub in ad.telephony["subscription"].values():
57 if sub["operator"] in SMS_OVER_WIFI_PROVIDERS:
58 ad.sms_over_wifi = True
59 if getattr(ad, 'roaming', False):
60 is_roaming = True
61 if is_roaming:
62 # roaming device does not allow message of length 180
63 self.message_lengths = (50, 160)
64
Jaineel4e4a96a2020-12-03 15:11:10 -080065 def setup_test(self):
66 TelephonyBaseTest.setup_test(self)
67
68 def teardown_test(self):
69 ensure_phones_idle(self.log, self.android_devices)
70
Jaineel4e4a96a2020-12-03 15:11:10 -080071
Jaineel4e4a96a2020-12-03 15:11:10 -080072 """ Tests Begin """
73
Pratik Shethf9d0d2b2021-03-19 15:38:44 -070074
Jaineel4e4a96a2020-12-03 15:11:10 -080075 @test_tracker_info(uuid="bc484c2c-8086-42db-94cd-a1e4a35f35cf")
76 @TelephonyBaseTest.tel_test_wrap
77 def test_5g_nsa_mms_mo_mt(self):
78 """Test MMS between two phones in 5g NSA
79
80 Provision devices in 5g NSA
81 Send and Verify MMS from PhoneA to PhoneB
82 Verify both devices are still on 5g NSA
83
84 Returns:
85 True if success.
86 False if failed.
87 """
88 ads = self.android_devices
Pratik Sheth0df9f222021-04-05 17:55:51 -070089 if not provision_device_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080090 return False
91
Pratik Shethaec72b72021-02-09 15:44:28 -080092 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080093 return False
94
Jaineel78a57152020-12-08 17:03:00 -080095 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080096 return False
97
98 self.log.info("PASS - mms test over 5g nsa validated")
99 return True
100
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700101
Jaineel4e4a96a2020-12-03 15:11:10 -0800102 @test_tracker_info(uuid="51d42104-cb87-4c9b-9a16-302e246a21dc")
103 @TelephonyBaseTest.tel_test_wrap
104 def test_5g_nsa_mms_mo_mt_volte(self):
105 """Test MMS between two phones with VoLTE on 5G NSA
106
107 Provision devices on VoLTE
108 Provision devices in 5g NSA
109 Send and Verify MMS from PhoneA to PhoneB
110 Verify both devices are still on 5g NSA
111
112 Returns:
113 True if success.
114 False if failed.
115 """
116
117 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800118 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800119 return False
120
Pratik Sheth0df9f222021-04-05 17:55:51 -0700121 if not provision_device_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800122 return False
123
Pratik Shethaec72b72021-02-09 15:44:28 -0800124 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800125 return False
126
Jaineel78a57152020-12-08 17:03:00 -0800127 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800128 return False
129
130 self.log.info("PASS - volte mms test over 5g nsa validated")
131 return True
132
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700133
Jaineel4e4a96a2020-12-03 15:11:10 -0800134 @test_tracker_info(uuid="97d6b071-aef2-40c1-8245-7be6c31870a6")
135 @TelephonyBaseTest.tel_test_wrap
136 def test_5g_nsa_mms_mo_mt_in_call_volte(self):
137 """ Test MO MMS during a VoLTE call over 5G NSA.
138
139 Provision devices on VoLTE
140 Provision devices in 5g NSA
141 Make a Voice call from PhoneA to PhoneB
142 Send and Verify MMS from PhoneA to PhoneB
143 Verify both devices are still on 5g NSA
144
145 Returns:
146 True if pass; False if fail.
147 """
148 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800149 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800150 return False
151
Pratik Sheth0df9f222021-04-05 17:55:51 -0700152 if not provision_device_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800153 return False
154
155 self.log.info("Begin Incall mms test.")
156 if not call_setup_teardown(
157 self.log,
158 ads[0],
159 ads[1],
160 ad_hangup=None,
161 verify_caller_func=is_phone_in_call_volte,
162 verify_callee_func=None):
163 return False
164
Pratik Shethaec72b72021-02-09 15:44:28 -0800165 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800166 return False
167
Jaineel78a57152020-12-08 17:03:00 -0800168 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800169 return False
170 self.log.info("PASS - Incall volte mms test over 5g nsa validated")
171 return True
172
173
174 @test_tracker_info(uuid="bbb4b80c-fc1b-4377-b3c7-eeed642c5980")
175 @TelephonyBaseTest.tel_test_wrap
176 def test_5g_nsa_mms_mo_mt_iwlan(self):
177 """ Test MMS text function between two phones,
178 Phones in APM, WiFi connected, WFC Cell Preferred mode.
179
180 Disable APM on both devices
181 Provision devices in 5g NSA
182 Provision devices for WFC Cell Pref with APM ON
183 Send and Verify MMS from PhoneA to PhoneB
184
185 Returns:
186 True if pass; False if fail.
187 """
188
189 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800190 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800191 return False
192
Pratik Sheth0df9f222021-04-05 17:55:51 -0700193 if not provision_device_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800194 return False
195
Jaineel78a57152020-12-08 17:03:00 -0800196 if not provision_both_devices_for_wfc_cell_pref(self.log,
197 ads,
198 self.wifi_network_ssid,
199 self.wifi_network_pass,
200 apm_mode=True):
Jaineel4e4a96a2020-12-03 15:11:10 -0800201 return False
202 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
203
Pratik Shethaec72b72021-02-09 15:44:28 -0800204 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800205 return False
206
207 self.log.info("PASS - iwlan mms test over 5g nsa validated")
208 return True
209
210
211 @test_tracker_info(uuid="d36d95dc-0973-4711-bb08-c29ce23495e4")
212 @TelephonyBaseTest.tel_test_wrap
213 def test_5g_nsa_mms_mo_mt_iwlan_apm_off(self):
214 """ Test MO MMS, Phone in APM off, WiFi connected, WFC WiFi Pref Mode
215
216 Disable APM on both devices
217 Provision devices in 5g NSA
218 Provision devices for WFC Wifi Pref with APM OFF
219 Send and Verify MMS from PhoneA to PhoneB
220 Verify 5g NSA attach for both devices
221
222 Returns:
223 True if pass; False if fail.
224 """
225
226 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800227 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800228 return False
229
Pratik Sheth0df9f222021-04-05 17:55:51 -0700230 if not provision_device_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800231 return False
232
Jaineel78a57152020-12-08 17:03:00 -0800233 if not provision_both_devices_for_wfc_wifi_pref(self.log,
234 ads,
235 self.wifi_network_ssid,
236 self.wifi_network_pass,
237 apm_mode=False):
Jaineel4e4a96a2020-12-03 15:11:10 -0800238 return False
239 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
240
Pratik Shethaec72b72021-02-09 15:44:28 -0800241 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800242 self.log.error("Failed to send receive sms over 5g nsa")
243 return False
244 self.log.info("PASS - iwlan mms test over 5g nsa validated")
245
Jaineel78a57152020-12-08 17:03:00 -0800246 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800247 return False
248 return True
249
250
251 @test_tracker_info(uuid="74ffb79e-f1e9-4087-a9d2-e07878e47869")
252 @TelephonyBaseTest.tel_test_wrap
253 def test_5g_nsa_mms_mo_mt_in_call_iwlan(self):
254 """ Test MO MMS, Phone in APM, WiFi connected, WFC WiFi Pref mode
255
256 Disable APM on both devices
257 Provision devices in 5g NSA
258 Provision devices for WFC Wifi Pref with APM ON
259 Make a Voice call from PhoneA to PhoneB
260 Send and Verify MMS from PhoneA to PhoneB
261
262 Returns:
263 True if pass; False if fail.
264 """
265
266 ads = self.android_devices
267
Jaineel78a57152020-12-08 17:03:00 -0800268 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800269 return False
270
Pratik Sheth0df9f222021-04-05 17:55:51 -0700271 if not provision_device_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800272 return False
273
Jaineel78a57152020-12-08 17:03:00 -0800274 if not provision_both_devices_for_wfc_wifi_pref(self.log,
275 ads,
276 self.wifi_network_ssid,
277 self.wifi_network_pass,
278 apm_mode=True):
Jaineel4e4a96a2020-12-03 15:11:10 -0800279 return False
280 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
281
282 self.log.info("Begin Incall mms test")
283 if not call_setup_teardown(
284 self.log,
285 ads[0],
286 ads[1],
287 ad_hangup=None,
288 verify_caller_func=is_phone_in_call_iwlan,
289 verify_callee_func=None):
290 return False
291
Pratik Shethaec72b72021-02-09 15:44:28 -0800292 return _mms_test_mo(self.log, ads)
Jaineel4e4a96a2020-12-03 15:11:10 -0800293
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700294
Jaineel4e4a96a2020-12-03 15:11:10 -0800295 @test_tracker_info(uuid="68c8e0ca-bea4-45e4-92cf-19424ee47ca4")
296 @TelephonyBaseTest.tel_test_wrap
297 def test_5g_nsa_mms_mo_mt_in_call_volte_wifi(self):
298 """ Test MMS during VoLTE call and WiFi connected
299
300 Make sure PhoneA/B are in 5G NSA (with VoLTE).
301 Make sure PhoneA/B are able to make/receive call.
302 Connect PhoneA/B to Wifi.
303 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA.
304 Make sure PhoneA/B are in 5G NSA.
305
306 Returns:
307 True if pass; False if fail.
308 """
309 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800310 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800311 return False
312
Pratik Sheth0df9f222021-04-05 17:55:51 -0700313 if not provision_device_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800314 return False
315
Jaineel78a57152020-12-08 17:03:00 -0800316 if not connect_both_devices_to_wifi(self.log,
317 ads,
318 self.wifi_network_ssid,
319 self.wifi_network_pass):
Jaineel4e4a96a2020-12-03 15:11:10 -0800320 return False
321
322 self.log.info("Begin In Call MMS Test.")
323 if not call_setup_teardown(
324 self.log,
325 ads[0],
326 ads[1],
327 ad_hangup=None,
328 verify_caller_func=is_phone_in_call_volte,
329 verify_callee_func=None):
330 return False
331
Pratik Shethaec72b72021-02-09 15:44:28 -0800332 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800333 return False
334
Jaineel78a57152020-12-08 17:03:00 -0800335 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800336 return False
337 return True
338
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700339
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800340 @test_tracker_info(uuid="8c795c3a-59d4-408c-9b99-5287e79ba00b")
Pratik Shethaec72b72021-02-09 15:44:28 -0800341 @TelephonyBaseTest.tel_test_wrap
342 def test_5g_nsa_mms_long_message_mo_mt(self):
343 """Test MMS basic function between two phone. Phones in nsa 5G network.
344
345 Airplane mode is off. Phone in nsa 5G.
346 Send MMS from PhoneA to PhoneB.
347 Verify received message on PhoneB is correct.
348
349 Returns:
350 True if success.
351 False if failed.
352 """
353
354 ads = self.android_devices
355
356 if not disable_apm_mode_both_devices(self.log, ads):
357 return False
358
Pratik Sheth0df9f222021-04-05 17:55:51 -0700359 if not provision_device_for_5g(self.log, ads):
Pratik Shethaec72b72021-02-09 15:44:28 -0800360 return False
361
362 return _long_mms_test_mo(self.log, ads)
363
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700364
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800365 @test_tracker_info(uuid="e09b82ab-69a9-4eae-8cbe-b6f2cff993ad")
Pratik Shethaec72b72021-02-09 15:44:28 -0800366 @TelephonyBaseTest.tel_test_wrap
367 def test_5g_nsa_mms_mo_wifi(self):
368 """Test MMS basic function between two phone. Phones in nsa 5g network.
369
370 Airplane mode is off. Phone in nsa 5G.
371 Connect to Wifi.
372 Send MMS from PhoneA to PhoneB.
373 Verify received message on PhoneB is correct.
374
375 Returns:
376 True if success.
377 False if failed.
378 """
379
380 ads = self.android_devices
381
382 if not disable_apm_mode_both_devices(self.log, ads):
383 return False
384
Pratik Sheth0df9f222021-04-05 17:55:51 -0700385 if not provision_device_for_5g(self.log, ads):
Pratik Shethaec72b72021-02-09 15:44:28 -0800386 return False
387
388 ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
389 self.wifi_network_pass)
390
391 return _mms_test_mo(self.log, ads)
392
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700393
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800394 @test_tracker_info(uuid="fedae24f-2577-4f84-9d76-53bbbe109d48")
Pratik Shethaec72b72021-02-09 15:44:28 -0800395 @TelephonyBaseTest.tel_test_wrap
396 def test_5g_nsa_mms_mt_wifi(self):
397 """Test MMS basic function between two phone. Phones in nsa 5g network.
398
399 Airplane mode is off. Phone in nsa 5G.
400 Connect to Wifi.
401 Send MMS from PhoneB to PhoneA.
402 Verify received message on PhoneA is correct.
403
404 Returns:
405 True if success.
406 False if failed.
407 """
408
409 ads = self.android_devices
410
411 if not disable_apm_mode_both_devices(self.log, ads):
412 return False
413
Pratik Sheth0df9f222021-04-05 17:55:51 -0700414 if not provision_device_for_5g(self.log, ads):
Pratik Shethaec72b72021-02-09 15:44:28 -0800415 return False
416
417 ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
418 self.wifi_network_pass)
419
420 return _mms_test_mt(self.log, ads)
421
Pei Huang47d6a0b2021-04-05 23:35:49 +0800422
Pratik Sheth0df9f222021-04-05 17:55:51 -0700423 @test_tracker_info(uuid="156bf832-acc2-4729-a69d-b471cd5cfbde")
Pei Huang47d6a0b2021-04-05 23:35:49 +0800424 @TelephonyBaseTest.tel_test_wrap
425 def test_5g_nsa_mms_mo_mt_in_call_csfb_wifi(self):
426 """ Test MO/MT MMS during a MO csfb call and devices connect to Wifi.
427
428 Disable APM on both devices
429 Set up PhoneA/PhoneB are in CSFB mode.
430 Provision PhoneA/B in 5g NSA.
431 Make sure PhoneA/B is able to make/receive call.
432 Connect PhoneA/B to Wifi.
433 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA,
434 receive MMS on B.
435
436 Returns:
437 True if pass; False if fail.
438 """
439 ads = self.android_devices
440
441 if not disable_apm_mode_both_devices(self.log, ads):
442 return False
443
444 if not provision_both_devices_for_csfb(self.log, ads):
445 return False
446 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
447
448 if not provision_both_devices_for_5g(self.log, ads):
449 return False
450
451 if not connect_both_devices_to_wifi(self.log,
452 ads,
453 self.wifi_network_ssid,
454 self.wifi_network_pass):
455 return False
456 if not test_mms_mo_in_call(self.log,
457 ads,
458 wifi=True,
459 caller_func=is_phone_in_call_csfb):
460 return False
461
Pratik Shethaec72b72021-02-09 15:44:28 -0800462 """ Tests End """