blob: 124826630639d3c822aac4e3c65b0739b299da99 [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
Pratik Shethaec72b72021-02-09 15:44:28 -080025from acts_contrib.test_utils.tel.tel_test_utils import call_setup_teardown
Jaineel4e4a96a2020-12-03 15:11:10 -080026from acts_contrib.test_utils.tel.tel_test_utils import ensure_phones_idle
27from acts_contrib.test_utils.tel.tel_test_utils import ensure_wifi_connected
Jaineel4e4a96a2020-12-03 15:11:10 -080028from acts_contrib.test_utils.tel.tel_test_utils import multithread_func
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
31from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_voice_general
32from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_volte
Jaineel78a57152020-12-08 17:03:00 -080033from acts_contrib.test_utils.tel.tel_5g_utils import connect_both_devices_to_wifi
Pratik Shethaec72b72021-02-09 15:44:28 -080034from acts_contrib.test_utils.tel.tel_5g_utils import disable_apm_mode_both_devices
Jaineel78a57152020-12-08 17:03:00 -080035from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_5g
36from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_volte
37from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_wfc_cell_pref
38from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_wfc_wifi_pref
Pratik Shethaec72b72021-02-09 15:44:28 -080039from acts_contrib.test_utils.tel.tel_5g_utils import provision_device_for_5g
Jaineel78a57152020-12-08 17:03:00 -080040from acts_contrib.test_utils.tel.tel_5g_utils import verify_5g_attach_for_both_devices
Pratik Shethaec72b72021-02-09 15:44:28 -080041from acts_contrib.test_utils.tel.tel_mms_utils import _mms_test_mo
42from acts_contrib.test_utils.tel.tel_mms_utils import _mms_test_mt
43from acts_contrib.test_utils.tel.tel_mms_utils import _long_mms_test_mo
44from acts_contrib.test_utils.tel.tel_mms_utils import _long_mms_test_mt
Jaineel4e4a96a2020-12-03 15:11:10 -080045
46class 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
52 def setup_test(self):
53 TelephonyBaseTest.setup_test(self)
54
55 def teardown_test(self):
56 ensure_phones_idle(self.log, self.android_devices)
57
Jaineel4e4a96a2020-12-03 15:11:10 -080058
Jaineel4e4a96a2020-12-03 15:11:10 -080059 """ Tests Begin """
60
61 @test_tracker_info(uuid="bc484c2c-8086-42db-94cd-a1e4a35f35cf")
62 @TelephonyBaseTest.tel_test_wrap
63 def test_5g_nsa_mms_mo_mt(self):
64 """Test MMS between two phones in 5g NSA
65
66 Provision devices in 5g NSA
67 Send and Verify MMS from PhoneA to PhoneB
68 Verify both devices are still on 5g NSA
69
70 Returns:
71 True if success.
72 False if failed.
73 """
74 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -080075 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080076 return False
77
Pratik Shethaec72b72021-02-09 15:44:28 -080078 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080079 return False
80
Jaineel78a57152020-12-08 17:03:00 -080081 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080082 return False
83
84 self.log.info("PASS - mms test over 5g nsa validated")
85 return True
86
87 @test_tracker_info(uuid="51d42104-cb87-4c9b-9a16-302e246a21dc")
88 @TelephonyBaseTest.tel_test_wrap
89 def test_5g_nsa_mms_mo_mt_volte(self):
90 """Test MMS between two phones with VoLTE on 5G NSA
91
92 Provision devices on VoLTE
93 Provision devices in 5g NSA
94 Send and Verify MMS from PhoneA to PhoneB
95 Verify both devices are still on 5g NSA
96
97 Returns:
98 True if success.
99 False if failed.
100 """
101
102 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800103 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800104 return False
105
Jaineel78a57152020-12-08 17:03:00 -0800106 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800107 return False
108
Pratik Shethaec72b72021-02-09 15:44:28 -0800109 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800110 return False
111
Jaineel78a57152020-12-08 17:03:00 -0800112 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800113 return False
114
115 self.log.info("PASS - volte mms test over 5g nsa validated")
116 return True
117
118 @test_tracker_info(uuid="97d6b071-aef2-40c1-8245-7be6c31870a6")
119 @TelephonyBaseTest.tel_test_wrap
120 def test_5g_nsa_mms_mo_mt_in_call_volte(self):
121 """ Test MO MMS during a VoLTE call over 5G NSA.
122
123 Provision devices on VoLTE
124 Provision devices in 5g NSA
125 Make a Voice call from PhoneA to PhoneB
126 Send and Verify MMS from PhoneA to PhoneB
127 Verify both devices are still on 5g NSA
128
129 Returns:
130 True if pass; False if fail.
131 """
132 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800133 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800134 return False
135
Jaineel78a57152020-12-08 17:03:00 -0800136 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800137 return False
138
139 self.log.info("Begin Incall mms test.")
140 if not call_setup_teardown(
141 self.log,
142 ads[0],
143 ads[1],
144 ad_hangup=None,
145 verify_caller_func=is_phone_in_call_volte,
146 verify_callee_func=None):
147 return False
148
Pratik Shethaec72b72021-02-09 15:44:28 -0800149 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800150 return False
151
Jaineel78a57152020-12-08 17:03:00 -0800152 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800153 return False
154 self.log.info("PASS - Incall volte mms test over 5g nsa validated")
155 return True
156
157
158 @test_tracker_info(uuid="bbb4b80c-fc1b-4377-b3c7-eeed642c5980")
159 @TelephonyBaseTest.tel_test_wrap
160 def test_5g_nsa_mms_mo_mt_iwlan(self):
161 """ Test MMS text function between two phones,
162 Phones in APM, WiFi connected, WFC Cell Preferred mode.
163
164 Disable APM on both devices
165 Provision devices in 5g NSA
166 Provision devices for WFC Cell Pref with APM ON
167 Send and Verify MMS from PhoneA to PhoneB
168
169 Returns:
170 True if pass; False if fail.
171 """
172
173 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800174 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800175 return False
176
Jaineel78a57152020-12-08 17:03:00 -0800177 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800178 return False
179
Jaineel78a57152020-12-08 17:03:00 -0800180 if not provision_both_devices_for_wfc_cell_pref(self.log,
181 ads,
182 self.wifi_network_ssid,
183 self.wifi_network_pass,
184 apm_mode=True):
Jaineel4e4a96a2020-12-03 15:11:10 -0800185 return False
186 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
187
Pratik Shethaec72b72021-02-09 15:44:28 -0800188 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800189 return False
190
191 self.log.info("PASS - iwlan mms test over 5g nsa validated")
192 return True
193
194
195 @test_tracker_info(uuid="d36d95dc-0973-4711-bb08-c29ce23495e4")
196 @TelephonyBaseTest.tel_test_wrap
197 def test_5g_nsa_mms_mo_mt_iwlan_apm_off(self):
198 """ Test MO MMS, Phone in APM off, WiFi connected, WFC WiFi Pref Mode
199
200 Disable APM on both devices
201 Provision devices in 5g NSA
202 Provision devices for WFC Wifi Pref with APM OFF
203 Send and Verify MMS from PhoneA to PhoneB
204 Verify 5g NSA attach for both devices
205
206 Returns:
207 True if pass; False if fail.
208 """
209
210 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800211 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800212 return False
213
Jaineel78a57152020-12-08 17:03:00 -0800214 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800215 return False
216
Jaineel78a57152020-12-08 17:03:00 -0800217 if not provision_both_devices_for_wfc_wifi_pref(self.log,
218 ads,
219 self.wifi_network_ssid,
220 self.wifi_network_pass,
221 apm_mode=False):
Jaineel4e4a96a2020-12-03 15:11:10 -0800222 return False
223 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
224
Pratik Shethaec72b72021-02-09 15:44:28 -0800225 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800226 self.log.error("Failed to send receive sms over 5g nsa")
227 return False
228 self.log.info("PASS - iwlan mms test over 5g nsa validated")
229
Jaineel78a57152020-12-08 17:03:00 -0800230 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800231 return False
232 return True
233
234
235 @test_tracker_info(uuid="74ffb79e-f1e9-4087-a9d2-e07878e47869")
236 @TelephonyBaseTest.tel_test_wrap
237 def test_5g_nsa_mms_mo_mt_in_call_iwlan(self):
238 """ Test MO MMS, Phone in APM, WiFi connected, WFC WiFi Pref mode
239
240 Disable APM on both devices
241 Provision devices in 5g NSA
242 Provision devices for WFC Wifi Pref with APM ON
243 Make a Voice call from PhoneA to PhoneB
244 Send and Verify MMS from PhoneA to PhoneB
245
246 Returns:
247 True if pass; False if fail.
248 """
249
250 ads = self.android_devices
251
Jaineel78a57152020-12-08 17:03:00 -0800252 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800253 return False
254
Jaineel78a57152020-12-08 17:03:00 -0800255 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800256 return False
257
Jaineel78a57152020-12-08 17:03:00 -0800258 if not provision_both_devices_for_wfc_wifi_pref(self.log,
259 ads,
260 self.wifi_network_ssid,
261 self.wifi_network_pass,
262 apm_mode=True):
Jaineel4e4a96a2020-12-03 15:11:10 -0800263 return False
264 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
265
266 self.log.info("Begin Incall mms test")
267 if not call_setup_teardown(
268 self.log,
269 ads[0],
270 ads[1],
271 ad_hangup=None,
272 verify_caller_func=is_phone_in_call_iwlan,
273 verify_callee_func=None):
274 return False
275
Pratik Shethaec72b72021-02-09 15:44:28 -0800276 return _mms_test_mo(self.log, ads)
Jaineel4e4a96a2020-12-03 15:11:10 -0800277
278 @test_tracker_info(uuid="68c8e0ca-bea4-45e4-92cf-19424ee47ca4")
279 @TelephonyBaseTest.tel_test_wrap
280 def test_5g_nsa_mms_mo_mt_in_call_volte_wifi(self):
281 """ Test MMS during VoLTE call and WiFi connected
282
283 Make sure PhoneA/B are in 5G NSA (with VoLTE).
284 Make sure PhoneA/B are able to make/receive call.
285 Connect PhoneA/B to Wifi.
286 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA.
287 Make sure PhoneA/B are in 5G NSA.
288
289 Returns:
290 True if pass; False if fail.
291 """
292 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800293 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800294 return False
295
Jaineel78a57152020-12-08 17:03:00 -0800296 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800297 return False
298
Jaineel78a57152020-12-08 17:03:00 -0800299 if not connect_both_devices_to_wifi(self.log,
300 ads,
301 self.wifi_network_ssid,
302 self.wifi_network_pass):
Jaineel4e4a96a2020-12-03 15:11:10 -0800303 return False
304
305 self.log.info("Begin In Call MMS Test.")
306 if not call_setup_teardown(
307 self.log,
308 ads[0],
309 ads[1],
310 ad_hangup=None,
311 verify_caller_func=is_phone_in_call_volte,
312 verify_callee_func=None):
313 return False
314
Pratik Shethaec72b72021-02-09 15:44:28 -0800315 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800316 return False
317
Jaineel78a57152020-12-08 17:03:00 -0800318 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800319 return False
320 return True
321
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800322 @test_tracker_info(uuid="8c795c3a-59d4-408c-9b99-5287e79ba00b")
Pratik Shethaec72b72021-02-09 15:44:28 -0800323 @TelephonyBaseTest.tel_test_wrap
324 def test_5g_nsa_mms_long_message_mo_mt(self):
325 """Test MMS basic function between two phone. Phones in nsa 5G network.
326
327 Airplane mode is off. Phone in nsa 5G.
328 Send MMS from PhoneA to PhoneB.
329 Verify received message on PhoneB is correct.
330
331 Returns:
332 True if success.
333 False if failed.
334 """
335
336 ads = self.android_devices
337
338 if not disable_apm_mode_both_devices(self.log, ads):
339 return False
340
341 if not provision_both_devices_for_5g(self.log, ads):
342 return False
343
344 return _long_mms_test_mo(self.log, ads)
345
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800346 @test_tracker_info(uuid="e09b82ab-69a9-4eae-8cbe-b6f2cff993ad")
Pratik Shethaec72b72021-02-09 15:44:28 -0800347 @TelephonyBaseTest.tel_test_wrap
348 def test_5g_nsa_mms_mo_wifi(self):
349 """Test MMS basic function between two phone. Phones in nsa 5g network.
350
351 Airplane mode is off. Phone in nsa 5G.
352 Connect to Wifi.
353 Send MMS from PhoneA to PhoneB.
354 Verify received message on PhoneB is correct.
355
356 Returns:
357 True if success.
358 False if failed.
359 """
360
361 ads = self.android_devices
362
363 if not disable_apm_mode_both_devices(self.log, ads):
364 return False
365
366 if not provision_both_devices_for_5g(self.log, ads):
367 return False
368
369 ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
370 self.wifi_network_pass)
371
372 return _mms_test_mo(self.log, ads)
373
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800374 @test_tracker_info(uuid="fedae24f-2577-4f84-9d76-53bbbe109d48")
Pratik Shethaec72b72021-02-09 15:44:28 -0800375 @TelephonyBaseTest.tel_test_wrap
376 def test_5g_nsa_mms_mt_wifi(self):
377 """Test MMS basic function between two phone. Phones in nsa 5g network.
378
379 Airplane mode is off. Phone in nsa 5G.
380 Connect to Wifi.
381 Send MMS from PhoneB to PhoneA.
382 Verify received message on PhoneA is correct.
383
384 Returns:
385 True if success.
386 False if failed.
387 """
388
389 ads = self.android_devices
390
391 if not disable_apm_mode_both_devices(self.log, ads):
392 return False
393
394 if not provision_both_devices_for_5g(self.log, ads):
395 return False
396
397 ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
398 self.wifi_network_pass)
399
400 return _mms_test_mt(self.log, ads)
401
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800402 @test_tracker_info(uuid="22531406-847e-4f64-94ae-572bb60978da")
Pratik Shethaec72b72021-02-09 15:44:28 -0800403 @TelephonyBaseTest.tel_test_wrap
404 def test_5g_nsa_mms_mo_in_call_volte_wifi(self):
405 """ Test MO MMS during a MO VoLTE call.
406
407 Make sure PhoneA is in nsa 5G mode (with VoLTE).
408 Make sure PhoneB is able to make/receive call.
409 Connect PhoneA to Wifi.
410 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA.
411
412 Returns:
413 True if pass; False if fail.
414 """
415 ads = self.android_devices
416
417 tasks = [(phone_setup_volte, (self.log, ads[0])),
418 (phone_setup_voice_general, (self.log, ads[1]))]
419 if not multithread_func(self.log, tasks):
420 self.log.error("Phone Failed to Set Up Properly.")
421 return False
422
423 if not provision_device_for_5g(self.log, ads[0]):
424 return False
425
426 ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
427 self.wifi_network_pass)
428
429 self.log.info("Begin In Call SMS Test.")
430 if not call_setup_teardown(
431 self.log,
432 ads[0],
433 ads[1],
434 ad_hangup=None,
435 verify_caller_func=is_phone_in_call_volte,
436 verify_callee_func=None):
437 return False
438
439 if not _mms_test_mo(self.log, ads):
440 self.log.error("MMS test fail.")
441 return False
442
443 return True
444
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800445 @test_tracker_info(uuid="bd232ea8-17a5-422e-85cc-cd5698118b4f")
Pratik Shethaec72b72021-02-09 15:44:28 -0800446 @TelephonyBaseTest.tel_test_wrap
447 def test_5g_nsa_mms_mt_in_call_volte_wifi(self):
448 """ Test MT MMS during a MO VoLTE call.
449
450 Make sure PhoneA is in nsa 5G mode (with VoLTE).
451 Make sure PhoneB is able to make/receive call.
452 Connect PhoneA to Wifi.
453 Call from PhoneA to PhoneB, accept on PhoneB, receive MMS on PhoneA.
454
455 Returns:
456 True if pass; False if fail.
457 """
458 ads = self.android_devices
459
460 tasks = [(phone_setup_volte, (self.log, ads[0])),
461 (phone_setup_voice_general, (self.log, ads[1]))]
462 if not multithread_func(self.log, tasks):
463 self.log.error("Phone Failed to Set Up Properly.")
464 return False
465
466 if not provision_device_for_5g(self.log, ads[0]):
467 return False
468
469 ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
470 self.wifi_network_pass)
471
472 self.log.info("Begin In Call MMS Test.")
473 if not call_setup_teardown(
474 self.log,
475 ads[0],
476 ads[1],
477 ad_hangup=None,
478 verify_caller_func=is_phone_in_call_volte,
479 verify_callee_func=None):
480 return False
481
482 if not _mms_test_mt(self.log, ads):
483 self.log.error("MMS test fail.")
484 return False
485
486 return True
487
488 """ Tests End """