blob: 44988cc88620950ff08c785a0d33bedc8f09e5de [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_voice_utils import is_phone_in_call_iwlan
Pratik Shethaec72b72021-02-09 15:44:28 -080029from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_volte
Jaineel78a57152020-12-08 17:03:00 -080030from acts_contrib.test_utils.tel.tel_5g_utils import connect_both_devices_to_wifi
Pratik Shethaec72b72021-02-09 15:44:28 -080031from acts_contrib.test_utils.tel.tel_5g_utils import disable_apm_mode_both_devices
Jaineel78a57152020-12-08 17:03:00 -080032from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_5g
33from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_volte
34from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_wfc_cell_pref
35from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_wfc_wifi_pref
36from acts_contrib.test_utils.tel.tel_5g_utils import verify_5g_attach_for_both_devices
Pratik Shethaec72b72021-02-09 15:44:28 -080037from acts_contrib.test_utils.tel.tel_mms_utils import _mms_test_mo
38from acts_contrib.test_utils.tel.tel_mms_utils import _mms_test_mt
39from acts_contrib.test_utils.tel.tel_mms_utils import _long_mms_test_mo
Jaineel4e4a96a2020-12-03 15:11:10 -080040
41class Nsa5gMmsTest(TelephonyBaseTest):
42 def setup_class(self):
43 super().setup_class()
44 self.number_of_devices = 2
45 self.message_lengths = (50, 160, 180)
46
47 def setup_test(self):
48 TelephonyBaseTest.setup_test(self)
49
50 def teardown_test(self):
51 ensure_phones_idle(self.log, self.android_devices)
52
Jaineel4e4a96a2020-12-03 15:11:10 -080053
Jaineel4e4a96a2020-12-03 15:11:10 -080054 """ Tests Begin """
55
Pratik Shethf9d0d2b2021-03-19 15:38:44 -070056
Jaineel4e4a96a2020-12-03 15:11:10 -080057 @test_tracker_info(uuid="bc484c2c-8086-42db-94cd-a1e4a35f35cf")
58 @TelephonyBaseTest.tel_test_wrap
59 def test_5g_nsa_mms_mo_mt(self):
60 """Test MMS between two phones in 5g NSA
61
62 Provision devices in 5g NSA
63 Send and Verify MMS from PhoneA to PhoneB
64 Verify both devices are still on 5g NSA
65
66 Returns:
67 True if success.
68 False if failed.
69 """
70 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -080071 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080072 return False
73
Pratik Shethaec72b72021-02-09 15:44:28 -080074 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080075 return False
76
Jaineel78a57152020-12-08 17:03:00 -080077 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -080078 return False
79
80 self.log.info("PASS - mms test over 5g nsa validated")
81 return True
82
Pratik Shethf9d0d2b2021-03-19 15:38:44 -070083
Jaineel4e4a96a2020-12-03 15:11:10 -080084 @test_tracker_info(uuid="51d42104-cb87-4c9b-9a16-302e246a21dc")
85 @TelephonyBaseTest.tel_test_wrap
86 def test_5g_nsa_mms_mo_mt_volte(self):
87 """Test MMS between two phones with VoLTE on 5G NSA
88
89 Provision devices on VoLTE
90 Provision devices in 5g NSA
91 Send and Verify MMS from PhoneA to PhoneB
92 Verify both devices are still on 5g NSA
93
94 Returns:
95 True if success.
96 False if failed.
97 """
98
99 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800100 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800101 return False
102
Jaineel78a57152020-12-08 17:03:00 -0800103 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800104 return False
105
Pratik Shethaec72b72021-02-09 15:44:28 -0800106 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800107 return False
108
Jaineel78a57152020-12-08 17:03:00 -0800109 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800110 return False
111
112 self.log.info("PASS - volte mms test over 5g nsa validated")
113 return True
114
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700115
Jaineel4e4a96a2020-12-03 15:11:10 -0800116 @test_tracker_info(uuid="97d6b071-aef2-40c1-8245-7be6c31870a6")
117 @TelephonyBaseTest.tel_test_wrap
118 def test_5g_nsa_mms_mo_mt_in_call_volte(self):
119 """ Test MO MMS during a VoLTE call over 5G NSA.
120
121 Provision devices on VoLTE
122 Provision devices in 5g NSA
123 Make a Voice call from PhoneA to PhoneB
124 Send and Verify MMS from PhoneA to PhoneB
125 Verify both devices are still on 5g NSA
126
127 Returns:
128 True if pass; False if fail.
129 """
130 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800131 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800132 return False
133
Jaineel78a57152020-12-08 17:03:00 -0800134 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800135 return False
136
137 self.log.info("Begin Incall mms test.")
138 if not call_setup_teardown(
139 self.log,
140 ads[0],
141 ads[1],
142 ad_hangup=None,
143 verify_caller_func=is_phone_in_call_volte,
144 verify_callee_func=None):
145 return False
146
Pratik Shethaec72b72021-02-09 15:44:28 -0800147 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800148 return False
149
Jaineel78a57152020-12-08 17:03:00 -0800150 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800151 return False
152 self.log.info("PASS - Incall volte mms test over 5g nsa validated")
153 return True
154
155
156 @test_tracker_info(uuid="bbb4b80c-fc1b-4377-b3c7-eeed642c5980")
157 @TelephonyBaseTest.tel_test_wrap
158 def test_5g_nsa_mms_mo_mt_iwlan(self):
159 """ Test MMS text function between two phones,
160 Phones in APM, WiFi connected, WFC Cell Preferred mode.
161
162 Disable APM on both devices
163 Provision devices in 5g NSA
164 Provision devices for WFC Cell Pref with APM ON
165 Send and Verify MMS from PhoneA to PhoneB
166
167 Returns:
168 True if pass; False if fail.
169 """
170
171 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800172 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800173 return False
174
Jaineel78a57152020-12-08 17:03:00 -0800175 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800176 return False
177
Jaineel78a57152020-12-08 17:03:00 -0800178 if not provision_both_devices_for_wfc_cell_pref(self.log,
179 ads,
180 self.wifi_network_ssid,
181 self.wifi_network_pass,
182 apm_mode=True):
Jaineel4e4a96a2020-12-03 15:11:10 -0800183 return False
184 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
185
Pratik Shethaec72b72021-02-09 15:44:28 -0800186 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800187 return False
188
189 self.log.info("PASS - iwlan mms test over 5g nsa validated")
190 return True
191
192
193 @test_tracker_info(uuid="d36d95dc-0973-4711-bb08-c29ce23495e4")
194 @TelephonyBaseTest.tel_test_wrap
195 def test_5g_nsa_mms_mo_mt_iwlan_apm_off(self):
196 """ Test MO MMS, Phone in APM off, WiFi connected, WFC WiFi Pref Mode
197
198 Disable APM on both devices
199 Provision devices in 5g NSA
200 Provision devices for WFC Wifi Pref with APM OFF
201 Send and Verify MMS from PhoneA to PhoneB
202 Verify 5g NSA attach for both devices
203
204 Returns:
205 True if pass; False if fail.
206 """
207
208 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800209 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800210 return False
211
Jaineel78a57152020-12-08 17:03:00 -0800212 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800213 return False
214
Jaineel78a57152020-12-08 17:03:00 -0800215 if not provision_both_devices_for_wfc_wifi_pref(self.log,
216 ads,
217 self.wifi_network_ssid,
218 self.wifi_network_pass,
219 apm_mode=False):
Jaineel4e4a96a2020-12-03 15:11:10 -0800220 return False
221 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
222
Pratik Shethaec72b72021-02-09 15:44:28 -0800223 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800224 self.log.error("Failed to send receive sms over 5g nsa")
225 return False
226 self.log.info("PASS - iwlan mms test over 5g nsa validated")
227
Jaineel78a57152020-12-08 17:03:00 -0800228 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800229 return False
230 return True
231
232
233 @test_tracker_info(uuid="74ffb79e-f1e9-4087-a9d2-e07878e47869")
234 @TelephonyBaseTest.tel_test_wrap
235 def test_5g_nsa_mms_mo_mt_in_call_iwlan(self):
236 """ Test MO MMS, Phone in APM, WiFi connected, WFC WiFi Pref mode
237
238 Disable APM on both devices
239 Provision devices in 5g NSA
240 Provision devices for WFC Wifi Pref with APM ON
241 Make a Voice call from PhoneA to PhoneB
242 Send and Verify MMS from PhoneA to PhoneB
243
244 Returns:
245 True if pass; False if fail.
246 """
247
248 ads = self.android_devices
249
Jaineel78a57152020-12-08 17:03:00 -0800250 if not disable_apm_mode_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800251 return False
252
Jaineel78a57152020-12-08 17:03:00 -0800253 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800254 return False
255
Jaineel78a57152020-12-08 17:03:00 -0800256 if not provision_both_devices_for_wfc_wifi_pref(self.log,
257 ads,
258 self.wifi_network_ssid,
259 self.wifi_network_pass,
260 apm_mode=True):
Jaineel4e4a96a2020-12-03 15:11:10 -0800261 return False
262 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
263
264 self.log.info("Begin Incall mms test")
265 if not call_setup_teardown(
266 self.log,
267 ads[0],
268 ads[1],
269 ad_hangup=None,
270 verify_caller_func=is_phone_in_call_iwlan,
271 verify_callee_func=None):
272 return False
273
Pratik Shethaec72b72021-02-09 15:44:28 -0800274 return _mms_test_mo(self.log, ads)
Jaineel4e4a96a2020-12-03 15:11:10 -0800275
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700276
Jaineel4e4a96a2020-12-03 15:11:10 -0800277 @test_tracker_info(uuid="68c8e0ca-bea4-45e4-92cf-19424ee47ca4")
278 @TelephonyBaseTest.tel_test_wrap
279 def test_5g_nsa_mms_mo_mt_in_call_volte_wifi(self):
280 """ Test MMS during VoLTE call and WiFi connected
281
282 Make sure PhoneA/B are in 5G NSA (with VoLTE).
283 Make sure PhoneA/B are able to make/receive call.
284 Connect PhoneA/B to Wifi.
285 Call from PhoneA to PhoneB, accept on PhoneB, send MMS on PhoneA.
286 Make sure PhoneA/B are in 5G NSA.
287
288 Returns:
289 True if pass; False if fail.
290 """
291 ads = self.android_devices
Jaineel78a57152020-12-08 17:03:00 -0800292 if not provision_both_devices_for_volte(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800293 return False
294
Jaineel78a57152020-12-08 17:03:00 -0800295 if not provision_both_devices_for_5g(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800296 return False
297
Jaineel78a57152020-12-08 17:03:00 -0800298 if not connect_both_devices_to_wifi(self.log,
299 ads,
300 self.wifi_network_ssid,
301 self.wifi_network_pass):
Jaineel4e4a96a2020-12-03 15:11:10 -0800302 return False
303
304 self.log.info("Begin In Call MMS Test.")
305 if not call_setup_teardown(
306 self.log,
307 ads[0],
308 ads[1],
309 ad_hangup=None,
310 verify_caller_func=is_phone_in_call_volte,
311 verify_callee_func=None):
312 return False
313
Pratik Shethaec72b72021-02-09 15:44:28 -0800314 if not _mms_test_mo(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800315 return False
316
Jaineel78a57152020-12-08 17:03:00 -0800317 if not verify_5g_attach_for_both_devices(self.log, ads):
Jaineel4e4a96a2020-12-03 15:11:10 -0800318 return False
319 return True
320
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700321
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 Shethf9d0d2b2021-03-19 15:38:44 -0700346
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800347 @test_tracker_info(uuid="e09b82ab-69a9-4eae-8cbe-b6f2cff993ad")
Pratik Shethaec72b72021-02-09 15:44:28 -0800348 @TelephonyBaseTest.tel_test_wrap
349 def test_5g_nsa_mms_mo_wifi(self):
350 """Test MMS basic function between two phone. Phones in nsa 5g network.
351
352 Airplane mode is off. Phone in nsa 5G.
353 Connect to Wifi.
354 Send MMS from PhoneA to PhoneB.
355 Verify received message on PhoneB is correct.
356
357 Returns:
358 True if success.
359 False if failed.
360 """
361
362 ads = self.android_devices
363
364 if not disable_apm_mode_both_devices(self.log, ads):
365 return False
366
367 if not provision_both_devices_for_5g(self.log, ads):
368 return False
369
370 ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
371 self.wifi_network_pass)
372
373 return _mms_test_mo(self.log, ads)
374
Pratik Shethf9d0d2b2021-03-19 15:38:44 -0700375
Pratik Sheth8ad702b2021-03-05 09:44:49 -0800376 @test_tracker_info(uuid="fedae24f-2577-4f84-9d76-53bbbe109d48")
Pratik Shethaec72b72021-02-09 15:44:28 -0800377 @TelephonyBaseTest.tel_test_wrap
378 def test_5g_nsa_mms_mt_wifi(self):
379 """Test MMS basic function between two phone. Phones in nsa 5g network.
380
381 Airplane mode is off. Phone in nsa 5G.
382 Connect to Wifi.
383 Send MMS from PhoneB to PhoneA.
384 Verify received message on PhoneA is correct.
385
386 Returns:
387 True if success.
388 False if failed.
389 """
390
391 ads = self.android_devices
392
393 if not disable_apm_mode_both_devices(self.log, ads):
394 return False
395
396 if not provision_both_devices_for_5g(self.log, ads):
397 return False
398
399 ensure_wifi_connected(self.log, ads[0], self.wifi_network_ssid,
400 self.wifi_network_pass)
401
402 return _mms_test_mt(self.log, ads)
403
Pratik Shethaec72b72021-02-09 15:44:28 -0800404 """ Tests End """