blob: 4b924a831a55eb1a84645dd8938756ff581cc55d [file] [log] [blame]
Jaineel78a57152020-12-08 17:03:00 -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 Voice scenarios
18"""
19
20import time
21
Pratik Sheth59efdde2021-03-10 11:50:54 -080022from acts import signals
Pei Huangab1bcf32021-01-18 13:48:45 +080023from acts.utils import adb_shell_ping
Pratik Sheth59efdde2021-03-10 11:50:54 -080024from acts.test_decorators import test_tracker_info
Jaineel78a57152020-12-08 17:03:00 -080025from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
Pratik Sheth59efdde2021-03-10 11:50:54 -080026from acts_contrib.test_utils.tel.loggers.telephony_metric_logger import TelephonyMetricLogger
Pei Huang10337282021-03-22 08:50:01 +080027from acts_contrib.test_utils.tel.loggers.protos.telephony_metric_pb2 import TelephonyVoiceTestResult
Jaineel78a57152020-12-08 17:03:00 -080028from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED
29from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_TERMINATED
Pei Huanga8589ff2021-01-21 15:31:19 +080030from acts_contrib.test_utils.tel.tel_defines import GEN_5G
Pratik Sheth59efdde2021-03-10 11:50:54 -080031from acts_contrib.test_utils.tel.tel_defines import TOTAL_LONG_CALL_DURATION
32from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING
33from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL_FOR_IMS
34from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED
35from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_WIFI_ONLY
Jaineel78a57152020-12-08 17:03:00 -080036from acts_contrib.test_utils.tel.tel_test_utils import call_setup_teardown
Pratik Sheth59efdde2021-03-10 11:50:54 -080037from acts_contrib.test_utils.tel.tel_test_utils import \
38 call_voicemail_erase_all_pending_voicemail
39from acts_contrib.test_utils.tel.tel_test_utils import ensure_phones_idle
40from acts_contrib.test_utils.tel.tel_test_utils import get_mobile_data_usage
Jaineel78a57152020-12-08 17:03:00 -080041from acts_contrib.test_utils.tel.tel_test_utils import hangup_call
Pei Huang1c8f8522020-12-21 19:39:20 +080042from acts_contrib.test_utils.tel.tel_test_utils import is_phone_in_call_active
Pratik Sheth59efdde2021-03-10 11:50:54 -080043from acts_contrib.test_utils.tel.tel_test_utils import multithread_func
44from acts_contrib.test_utils.tel.tel_test_utils import remove_mobile_data_usage_limit
45from acts_contrib.test_utils.tel.tel_test_utils import set_mobile_data_usage_limit
46from acts_contrib.test_utils.tel.tel_voice_utils import _test_call_long_duration
47from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_2g
Jaineel78a57152020-12-08 17:03:00 -080048from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_3g
Pratik Sheth59efdde2021-03-10 11:50:54 -080049from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_csfb
Pei Huangab1bcf32021-01-18 13:48:45 +080050from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan
Pratik Sheth59efdde2021-03-10 11:50:54 -080051from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_volte
52from acts_contrib.test_utils.tel.tel_voice_utils import phone_idle_2g
53from acts_contrib.test_utils.tel.tel_voice_utils import phone_idle_csfb
54from acts_contrib.test_utils.tel.tel_voice_utils import phone_idle_iwlan
55from acts_contrib.test_utils.tel.tel_voice_utils import phone_idle_volte
56from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_call_hold_unhold_test
57from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_csfb
Pei Huangab1bcf32021-01-18 13:48:45 +080058from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_iwlan
Pratik Sheth59efdde2021-03-10 11:50:54 -080059from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_voice_2g
60from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_voice_3g
61from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_voice_general
62from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_volte
63from acts_contrib.test_utils.tel.tel_voice_utils import two_phone_call_leave_voice_mail
64from acts_contrib.test_utils.tel.tel_voice_utils import two_phone_call_long_seq
65from acts_contrib.test_utils.tel.tel_voice_utils import two_phone_call_short_seq
66from acts_contrib.test_utils.tel.tel_5g_utils import is_current_network_5g_nsa
Jaineel78a57152020-12-08 17:03:00 -080067from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_5g
68from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_volte
Pratik Sheth59efdde2021-03-10 11:50:54 -080069from acts_contrib.test_utils.tel.tel_5g_utils import provision_device_for_5g
70from acts_contrib.test_utils.tel.tel_5g_utils import set_preferred_mode_for_5g
Jaineel78a57152020-12-08 17:03:00 -080071from acts_contrib.test_utils.tel.tel_5g_utils import verify_5g_attach_for_both_devices
Pei Huang10337282021-03-22 08:50:01 +080072from acts_contrib.test_utils.tel.tel_5g_utils import disable_apm_mode_both_devices
Pratik Sheth59efdde2021-03-10 11:50:54 -080073from acts_contrib.test_utils.tel.tel_data_utils import call_epdg_to_epdg_wfc
Pei Huangaa6dd142021-03-03 13:20:14 +080074from acts_contrib.test_utils.tel.tel_data_utils import test_call_setup_in_active_data_transfer
75from acts_contrib.test_utils.tel.tel_data_utils import test_call_setup_in_active_youtube_video
Pratik Sheth59efdde2021-03-10 11:50:54 -080076from acts_contrib.test_utils.tel.tel_data_utils import wifi_cell_switching
Pei Huang10337282021-03-22 08:50:01 +080077from acts_contrib.test_utils.tel.tel_data_utils import test_wifi_cell_switching_in_call
78CallResult = TelephonyVoiceTestResult.CallResult.Value
Jaineel78a57152020-12-08 17:03:00 -080079
80
81class Nsa5gVoiceTest(TelephonyBaseTest):
82 def setup_class(self):
83 super().setup_class()
84 self.number_of_devices = 2
85 self.message_lengths = (50, 160, 180)
Pratik Sheth59efdde2021-03-10 11:50:54 -080086 self.tel_logger = TelephonyMetricLogger.for_test_case()
87 self.stress_test_number = self.get_stress_test_number()
88 self.long_call_duration = self.user_params.get(
89 "long_call_duration",
90 TOTAL_LONG_CALL_DURATION)
Jaineel78a57152020-12-08 17:03:00 -080091
92 def setup_test(self):
93 TelephonyBaseTest.setup_test(self)
94
95 def teardown_test(self):
96 ensure_phones_idle(self.log, self.android_devices)
97
Jaineel78a57152020-12-08 17:03:00 -080098 """ Tests Begin """
99
100 @test_tracker_info(uuid="1bef3da1-4608-4b0e-8b78-f3f7be0115d5")
101 @TelephonyBaseTest.tel_test_wrap
102 def test_5g_nsa_call_volte_to_volte(self):
103 """ 5g nsa volte to volte call test
104
105 1. Make sure PhoneA is in nsa5g mode (with volte).
106 2. Make sure PhoneB is in nsa5g mode (with volte).
107 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
108 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
109 5. Verify both PhoneA and PhoneB gets attached back to nsa5g
110
111 Raises:
112 TestFailure if not success.
113 """
114 ads = self.android_devices
115 if not provision_both_devices_for_volte(self.log, ads):
116 return False
117
118 if not provision_both_devices_for_5g(self.log, ads):
119 return False
120
121 # VoLTE calls
122 result = two_phone_call_short_seq(
123 self.log, ads[0], None, is_phone_in_call_volte, ads[1],
124 None, is_phone_in_call_volte, None,
125 WAIT_TIME_IN_CALL_FOR_IMS)
126 if not result:
127 self.log.error("Failure is volte call during 5g nsa")
128 return False
129
130 if not verify_5g_attach_for_both_devices(self.log, ads):
131 return False
132
133 self.log.info("PASS - volte test over 5g nsa validated")
134 return True
135
136 @test_tracker_info(uuid="3df252a4-308a-49c3-8e37-08e9c4e8efef")
137 @TelephonyBaseTest.tel_test_wrap
138 def test_5g_nsa_call_volte_to_3g(self):
139 """ 5g nsa volte to 3g call test
140
141 1. Make sure PhoneA is in nsa5g mode (with volte).
142 2. Make sure PhoneB is in 3g mode.
143 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
144 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
145 5. Verify both PhoneA and PhoneB gets attached back to nsa5g
146
147 Raises:
148 TestFailure if not success.
149 """
150 ads = self.android_devices
151
152 # LTE attach
153 tasks = [(phone_setup_volte, (self.log, ads[0])),
154 (phone_setup_voice_3g, (self.log, ads[1]))]
155 if not multithread_func(self.log, tasks):
156 self.log.error("Phone failed to set up in volte/3g")
157 return False
158
Pratik Sheth59efdde2021-03-10 11:50:54 -0800159 if not provision_device_for_5g(self.log, ads[0]):
Jaineel78a57152020-12-08 17:03:00 -0800160 return False
161
162 # VoLTE to 3G
163 result = two_phone_call_short_seq(
164 self.log, ads[0], None, is_phone_in_call_volte, ads[1],
165 None, is_phone_in_call_3g, None,
166 WAIT_TIME_IN_CALL_FOR_IMS)
167 if not result:
168 self.log.error("Failure is volte to 3g call during 5g nsa")
169 return False
170
171 # Attach nsa5g
172 if not is_current_network_5g_nsa(ads[0]):
173 ads[0].log.error("Phone not attached on 5g nsa after call end.")
174 return False
175
176 self.log.info("PASS - VoLTE to 3g over 5g nsa validated")
177 return True
178
179
180 @test_tracker_info(uuid="3a8147d6-c136-42cb-92ca-2023b8eed85e")
181 @TelephonyBaseTest.tel_test_wrap
182 def test_5g_nsa_call_volte_mo_hold_unhold(self):
183 """ 5g nsa volte mo hold unhold test
184
185 1. Make sure PhoneA is in nsa 5g (with volte)
186 2. Make sure PhoneB is in nsa 5g (with volte)
187 3. Call from PhoneA to PhoneB, accept on PhoneB
188 4. Make sure PhoneA/B are in call
189 5. Hold and unhold on PhoneA
190 6. Verify both PhoneA and PhoneB gets attached back to nsa5g
191
192 Raises:
193 TestFailure if not success.
194 """
195 ads = self.android_devices
196 if not provision_both_devices_for_volte(self.log, ads):
197 return False
198
199 if not provision_both_devices_for_5g(self.log, ads):
200 return False
201
Pei Huangae466492021-02-09 13:28:50 +0800202 if not phone_setup_call_hold_unhold_test(self.log,
203 ads,
Pei Huangf5569a02021-01-28 21:53:07 +0800204 DIRECTION_MOBILE_ORIGINATED,
205 caller_func=is_phone_in_call_volte):
Jaineel78a57152020-12-08 17:03:00 -0800206 return False
207
208 if not verify_5g_attach_for_both_devices(self.log, ads):
209 return False
210 return True
211
212 @test_tracker_info(uuid="1825f9d9-dcf1-4407-922d-3f218d5b8932")
213 @TelephonyBaseTest.tel_test_wrap
214 def test_5g_nsa_call_volte_mt_hold_unhold(self):
215 """ 5g nsa volte mt hold unhold test
216
217 1. Make sure PhoneA is in nsa 5g (with volte)
218 2. Make sure PhoneB is in nsa 5g (with volte)
219 3. Call from PhoneB to PhoneA, accept on PhoneA
220 4. Make sure PhoneA/B are in call
221 5. Hold and unhold on PhoneA
222 6. Verify both PhoneA and PhoneB gets attached back to nsa5g
223
224 Raises:
225 TestFailure if not success.
226 """
227 ads = self.android_devices
228 if not provision_both_devices_for_volte(self.log, ads):
229 return False
230
231 if not provision_both_devices_for_5g(self.log, ads):
232 return False
233
Pei Huangae466492021-02-09 13:28:50 +0800234 if not phone_setup_call_hold_unhold_test(self.log,
235 ads,
Pei Huangf5569a02021-01-28 21:53:07 +0800236 DIRECTION_MOBILE_TERMINATED,
237 callee_func=is_phone_in_call_volte):
Jaineel78a57152020-12-08 17:03:00 -0800238 return False
239
240 if not verify_5g_attach_for_both_devices(self.log, ads):
241 return False
242 return True
243
244
245 @test_tracker_info(uuid="c082a9b0-fb66-4d3a-9fdd-1ce5710624be")
246 @TelephonyBaseTest.tel_test_wrap
247 def test_5g_nsa_call_mo_volte_in_active_data_transfer(self):
248 """Test call can be established during active data connection in 5G NSA.
249
250 Turn off airplane mode, disable WiFi, enable Cellular Data.
251 Make sure phone in 5G NSA.
252 Starting downloading file from Internet.
253 Initiate a MO voice call. Verify call can be established.
254 Hangup Voice Call, verify file is downloaded successfully.
255 Note: file download will be suspended when call is initiated if voice
256 is using voice channel and voice channel and data channel are
257 on different RATs.
258
259 Returns:
260 True if success.
261 False if failed.
262 """
263 ads = self.android_devices
264 if not phone_setup_volte(self.log, ads[0]):
265 ads[0].log.error("failed to setup volte")
266 return False
Pei Huangaa6dd142021-03-03 13:20:14 +0800267 return test_call_setup_in_active_data_transfer(self.log,
268 ads,
269 GEN_5G,
270 DIRECTION_MOBILE_ORIGINATED)
Jaineel78a57152020-12-08 17:03:00 -0800271
272
273 @test_tracker_info(uuid="aaa98e51-0bde-472a-abc3-5dc180f56a08")
274 @TelephonyBaseTest.tel_test_wrap
275 def test_5g_nsa_call_mt_volte_in_active_data_transfer(self):
276 """Test call can be established during active data connection in 5G NSA.
277
278 Turn off airplane mode, disable WiFi, enable Cellular Data.
279 Make sure phone in 5G NSA.
280 Starting downloading file from Internet.
281 Initiate a MT voice call. Verify call can be established.
282 Hangup Voice Call, verify file is downloaded successfully.
283 Note: file download will be suspended when call is initiated if voice
284 is using voice channel and voice channel and data channel are
285 on different RATs.
286
287 Returns:
288 True if success.
289 False if failed.
290 """
291 ads = self.android_devices
292 if not phone_setup_volte(self.log, ads[0]):
293 ads[0].log.error("failed to setup volte")
294 return False
Pei Huangaa6dd142021-03-03 13:20:14 +0800295 return test_call_setup_in_active_data_transfer(self.log,
296 ads,
297 GEN_5G,
298 DIRECTION_MOBILE_TERMINATED)
Jaineel78a57152020-12-08 17:03:00 -0800299
300
Pei Huang1c8f8522020-12-21 19:39:20 +0800301 @test_tracker_info(uuid="3a607dee-7e92-4567-8ca0-05099590b773")
302 @TelephonyBaseTest.tel_test_wrap
303 def test_5g_nsa_volte_in_call_wifi_toggling(self):
304 """ Test data connection network switching during VoLTE call in 5G NSA.
305
306 1. Make Sure PhoneA in VoLTE.
307 2. Make Sure PhoneB in VoLTE.
308 3. Make sure Phones are in 5G NSA
309 4. Call from PhoneA to PhoneB.
310 5. Toggling Wifi connection in call.
311 6. Verify call is active.
312 7. Hung up the call on PhoneA
313 8. Make sure Phones are in 5G NSA
314
315 Returns:
316 True if pass; False if fail.
317 """
318 ads = self.android_devices
319 result = True
320 if not provision_both_devices_for_volte(self.log, ads):
321 return False
322
323 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
324
325 if not provision_both_devices_for_5g(self.log, ads):
326 return False
327
328 if not verify_5g_attach_for_both_devices(self.log, ads):
329 self.log.error("Phone not attached on 5G NSA before call.")
330 return False
331
332 if not call_setup_teardown(self.log, ads[0], ads[1], None, None, None,
333 5):
334 self.log.error("Call setup failed")
335 return False
336 else:
337 self.log.info("Call setup succeed")
338
Pei Huangeb081d92021-03-01 21:18:10 +0800339 if not wifi_cell_switching(self.log, ads[0], None, self.wifi_network_ssid,
340 self.wifi_network_pass):
Pei Huang1c8f8522020-12-21 19:39:20 +0800341 ads[0].log.error("Failed to do WIFI and Cell switch in call")
342 result = False
343
344 if not is_phone_in_call_active(ads[0]):
345 return False
346 else:
347 if not ads[0].droid.telecomCallGetAudioState():
348 ads[0].log.error("Audio is not on call")
349 result = False
350 else:
351 ads[0].log.info("Audio is on call")
352 hangup_call(self.log, ads[0])
353
354 time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING)
355
356 if not verify_5g_attach_for_both_devices(self.log, ads):
357 self.log.error("Phone not attached on 5G NSA after call.")
358 return False
359 return result
360
361
Pei Huangab1bcf32021-01-18 13:48:45 +0800362 @test_tracker_info(uuid="96b7d8c9-d32a-4abf-8326-6b060d116ac2")
363 @TelephonyBaseTest.tel_test_wrap
364 def test_5g_nsa_call_epdg_to_epdg_wfc_wifi_preferred(self):
365 """ WiFi Preferred, WiFi calling to WiFi Calling test on 5G NSA
366
367 1. Setup PhoneA WFC mode: WIFI_PREFERRED, APM off.
368 2. Setup PhoneB WFC mode: WIFI_PREFERRED, APM off .
369 3. Set PhoneA/PhoneB on 5G NSA
370 4. Make sure PhoneA/PhoneB on 5G NSA before testing
371 5. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
372 6. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
373 7. Make sure PhoneA/PhoneB on 5G NSA after testing
374
375 Returns:
376 True if pass; False if fail.
377 """
Pei Huangaa6dd142021-03-03 13:20:14 +0800378 return call_epdg_to_epdg_wfc(self.log,
379 self.android_devices,
380 False,
381 WFC_MODE_WIFI_PREFERRED,
382 self.wifi_network_ssid,
383 self.wifi_network_pass,
384 GEN_5G)
Pei Huangab1bcf32021-01-18 13:48:45 +0800385
Pei Huang12f44ae2021-01-22 23:19:08 +0800386
387 @test_tracker_info(uuid="29fa7f44-8d6a-4948-8178-33c9a9aab334")
388 @TelephonyBaseTest.tel_test_wrap
389 def test_5g_nsa_call_mo_volte_in_active_youtube(self):
390 """Test call can be established during active youtube video on 5G NSA.
391
392 1. Enable VoLTE on PhoneA.
393 2. Set up PhoneA on 5G NSA.
394 3. Make sure phoneA is on 5G NSA.
395 4. Starting an youtube video.
396 5. Initiate a MO voice call. Verify call can be established.
397 6. Make sure phoneA is on 5G NSA.
398
399 Returns:
400 True if success.
401 False if failed.
402 """
Pratik Sheth59efdde2021-03-10 11:50:54 -0800403 ads = self.android_devices
404 if not phone_setup_volte(self.log, ads[0]):
405 ads[0].log.error("Failed to setup VoLTE")
Pei Huang12f44ae2021-01-22 23:19:08 +0800406 return False
Pei Huangaa6dd142021-03-03 13:20:14 +0800407 return test_call_setup_in_active_youtube_video(self.log,
Pratik Sheth59efdde2021-03-10 11:50:54 -0800408 ads,
Pei Huangaa6dd142021-03-03 13:20:14 +0800409 GEN_5G,
410 DIRECTION_MOBILE_ORIGINATED)
Pei Huang12f44ae2021-01-22 23:19:08 +0800411
412 @test_tracker_info(uuid="4e138477-3536-48bd-ab8a-7fb7c228b3e6")
413 @TelephonyBaseTest.tel_test_wrap
414 def test_5g_nsa_call_mt_volte_in_active_youtube(self):
415 """Test call can be established during active youtube video on 5G NSA.
416
417 1. Enable VoLTE on PhoneA.
418 2. Set up PhoneA on 5G NSA.
419 3. Make sure phoneA is on 5G NSA.
420 4. Starting an youtube video.
421 5. Initiate a MT voice call. Verify call can be established.
422 6. Make sure phoneA is on 5G NSA.
423
424 Returns:
425 True if success.
426 False if failed.
427 """
Pratik Sheth59efdde2021-03-10 11:50:54 -0800428 ads = self.android_devices
429 if not phone_setup_volte(self.log, ads[0]):
430 ads[0].log.error("Failed to setup VoLTE")
Pei Huang12f44ae2021-01-22 23:19:08 +0800431 return False
Pei Huangaa6dd142021-03-03 13:20:14 +0800432 return test_call_setup_in_active_youtube_video(self.log,
Pratik Sheth59efdde2021-03-10 11:50:54 -0800433 ads,
Pei Huangaa6dd142021-03-03 13:20:14 +0800434 GEN_5G,
435 DIRECTION_MOBILE_TERMINATED)
Pei Huang12f44ae2021-01-22 23:19:08 +0800436
Pei Huang4ac562a2021-01-22 17:05:29 +0800437
438 @test_tracker_info(uuid="0d477f6f-3464-4b32-a5e5-0fd134f2753d")
439 @TelephonyBaseTest.tel_test_wrap
440 def test_5g_nsa_call_mo_vowifi_in_active_data_transfer(self):
441 """Test MO voice wifi call can be established during active data connection on 5G NSA.
442
443 1. Turn off airplane mode, turn on wfc and wifi on phoneA.
444 2. Set PhoneA on 5G NSA
445 3. Make sure PhoneA on 5G NSA before testing
446 4. Starting downloading file from Internet.
447 5. Initiate a MO voice call. Verify call can be established.
448 6. Hangup Voice Call, verify file is downloaded successfully.
449 7. Make sure PhoneA on 5G NSA after testing
450
451 Returns:
452 True if success.
453 False if failed.
454 """
Pratik Sheth59efdde2021-03-10 11:50:54 -0800455 ads = self.android_devices
456 if not phone_setup_iwlan(self.log, ads[0], False,
Pei Huang4ac562a2021-01-22 17:05:29 +0800457 WFC_MODE_WIFI_PREFERRED,
458 self.wifi_network_ssid,
459 self.wifi_network_pass):
Pratik Sheth59efdde2021-03-10 11:50:54 -0800460 ads[0].log.error(
Pei Huang4ac562a2021-01-22 17:05:29 +0800461 "Failed to setup iwlan with APM off and WIFI and WFC on")
462 return False
463
Pei Huang41ee3172021-03-04 13:17:50 +0800464 return test_call_setup_in_active_data_transfer(self.log,
Pratik Sheth59efdde2021-03-10 11:50:54 -0800465 ads,
Pei Huang41ee3172021-03-04 13:17:50 +0800466 GEN_5G,
467 DIRECTION_MOBILE_ORIGINATED)
Pei Huang4ac562a2021-01-22 17:05:29 +0800468
469
470 @test_tracker_info(uuid="4d1d7dd9-b373-4361-8301-8517ef77b57b")
471 @TelephonyBaseTest.tel_test_wrap
472 def test_5g_nsa_call_mt_vowifi_in_active_data_transfer(self):
473 """Test MT voice wifi call can be established during active data connection on 5G NSA.
474
475 1. Turn off airplane mode, turn on wfc and wifi on phoneA.
476 2. Set PhoneA on 5G NSA
477 3. Make sure PhoneA on 5G NSA before testing
478 4. Starting downloading file from Internet.
479 5. Initiate a MT voice call. Verify call can be established.
480 6. Hangup Voice Call, verify file is downloaded successfully.
481 7. Make sure PhoneA on 5G NSA after testing
482
483 Returns:
484 True if success.
485 False if failed.
486 """
Pratik Sheth59efdde2021-03-10 11:50:54 -0800487 ads = self.android_devices
488 if not phone_setup_iwlan(self.log, ads[0], False,
Pei Huang4ac562a2021-01-22 17:05:29 +0800489 WFC_MODE_WIFI_PREFERRED,
490 self.wifi_network_ssid,
491 self.wifi_network_pass):
Pratik Sheth59efdde2021-03-10 11:50:54 -0800492 ads[0].log.error(
Pei Huang4ac562a2021-01-22 17:05:29 +0800493 "Failed to setup iwlan with APM off and WIFI and WFC on")
494 return False
495
Pei Huang41ee3172021-03-04 13:17:50 +0800496 return test_call_setup_in_active_data_transfer(self.log,
Pratik Sheth59efdde2021-03-10 11:50:54 -0800497 ads,
Pei Huang41ee3172021-03-04 13:17:50 +0800498 GEN_5G,
499 DIRECTION_MOBILE_TERMINATED)
Pei Huang4ac562a2021-01-22 17:05:29 +0800500
Pei Huangf5569a02021-01-28 21:53:07 +0800501
502 @test_tracker_info(uuid="e360bc3a-96b3-4fdf-9bf3-fe3aa08b1af5")
503 @TelephonyBaseTest.tel_test_wrap
504 def test_5g_nsa_call_epdg_mo_hold_unhold_wfc_wifi_preferred(self):
505 """ WiFi Preferred, WiFi calling MO call hold/unhold test on 5G NSA
506
507 1. Setup PhoneA WFC mode: WIFI_PREFERRED.
508 2. Set preferred network of phoneA on 5G NSA
509 3. Verify phoneA is on 5G NSA.
510 4. Call from PhoneA to PhoneB, accept on PhoneB.
511 5. Hold and unhold on PhoneA.
512 6. Verify phoneA is on 5G NSA.
513
514 Returns:
515 True if pass; False if fail.
516 """
517 ads = self.android_devices
Pratik Sheth59efdde2021-03-10 11:50:54 -0800518 if not phone_setup_iwlan(self.log, ads[0], False,
Pei Huangf5569a02021-01-28 21:53:07 +0800519 WFC_MODE_WIFI_PREFERRED,
520 self.wifi_network_ssid,
521 self.wifi_network_pass):
Pratik Sheth59efdde2021-03-10 11:50:54 -0800522 ads[0].log.error(
Pei Huangf5569a02021-01-28 21:53:07 +0800523 "Failed to setup iwlan with APM off and WIFI and WFC on")
524 return False
Pei Huangf5569a02021-01-28 21:53:07 +0800525
Pratik Sheth59efdde2021-03-10 11:50:54 -0800526 if not provision_device_for_5g(self.log, ads[0]):
Pei Huangf5569a02021-01-28 21:53:07 +0800527 return False
528
Pei Huangae466492021-02-09 13:28:50 +0800529 if not phone_setup_call_hold_unhold_test(self.log,
530 ads,
Pei Huangf5569a02021-01-28 21:53:07 +0800531 DIRECTION_MOBILE_ORIGINATED,
532 caller_func=is_phone_in_call_iwlan):
533 return False
534
535 if not is_current_network_5g_nsa(ads[0]):
536 ads[0].log.error("Phone not attached on 5G NSA after call.")
537 return False
538 return True
539
540
541 @test_tracker_info(uuid="d2335c83-87ec-4a0e-97a8-b53f769b0d21")
542 @TelephonyBaseTest.tel_test_wrap
543 def test_5g_nsa_call_epdg_mt_hold_unhold_wfc_wifi_preferred(self):
544 """ WiFi Preferred, WiFi calling MT call hold/unhold test on 5G NSA
545
546 1. Setup PhoneA WFC mode: WIFI_PREFERRED.
547 2. Set preferred network of phoneA on 5G NSA
548 3. Verify if phoneA is on 5G NSA.
549 4. Call from PhoneB to PhoneA, accept on PhoneA.
550 5. Hold and unhold on PhoneA.
551 6. Verify if phoneA is on 5G NSA.
552
553 Returns:
554 True if pass; False if fail.
555 """
556 ads = self.android_devices
Pratik Sheth59efdde2021-03-10 11:50:54 -0800557 if not phone_setup_iwlan(self.log, ads[0], False,
Pei Huangf5569a02021-01-28 21:53:07 +0800558 WFC_MODE_WIFI_PREFERRED,
559 self.wifi_network_ssid,
560 self.wifi_network_pass):
Pratik Sheth59efdde2021-03-10 11:50:54 -0800561 ads[0].log.error(
Pei Huangf5569a02021-01-28 21:53:07 +0800562 "Failed to setup iwlan with APM off and WIFI and WFC on")
563 return False
Pei Huangf5569a02021-01-28 21:53:07 +0800564
Pratik Sheth59efdde2021-03-10 11:50:54 -0800565 if not provision_device_for_5g(self.log, ads[0]):
Pei Huangf5569a02021-01-28 21:53:07 +0800566 return False
567
Pei Huangae466492021-02-09 13:28:50 +0800568 if not phone_setup_call_hold_unhold_test(self.log,
569 ads,
Pei Huangf5569a02021-01-28 21:53:07 +0800570 DIRECTION_MOBILE_TERMINATED,
571 callee_func=is_phone_in_call_iwlan):
572 return False
573
574 if not is_current_network_5g_nsa(ads[0]):
575 ads[0].log.error("Phone not attached on 5G NSA after call.")
576 return False
577 return True
578
Pratik Sheth59efdde2021-03-10 11:50:54 -0800579
580 @test_tracker_info(uuid="03dc3296-5f2f-4141-b2e5-bb0d8ea6ffec")
581 @TelephonyBaseTest.tel_test_wrap
582 def test_5g_nsa_call_volte_to_csfb_3g(self):
583 """ VoLTE nsa 5G to CSFB 3G call test
584
585 1. Make Sure PhoneA is in nsa 5G mode (with VoLTE).
586 2. Make Sure PhoneB is in CSFB mode (without VoLTE).
587 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
588 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
589
590 Raises:
591 TestFailure if not success.
592 """
593 ads = self.android_devices
594
595 tasks = [(phone_setup_volte, (self.log, ads[0])), (phone_setup_csfb,
596 (self.log, ads[1]))]
597 if not multithread_func(self.log, tasks):
598 self.log.error("Phone failed to set up in VoLTE/CSFB")
599 return False
600
601 if not provision_device_for_5g(self.log, ads[0]):
602 return False
603
604 result = two_phone_call_short_seq(
605 self.log, ads[0], None, is_phone_in_call_volte, ads[1],
606 phone_idle_csfb, is_phone_in_call_csfb, None)
607 self.tel_logger.set_result(result.result_value)
608 if not result:
609 raise signals.TestFailure("Failed",
610 extras={"fail_reason": str(result.result_value)})
611
612
613 @test_tracker_info(uuid="1955604b-5b81-4b06-b846-ba55b46ea997")
614 @TelephonyBaseTest.tel_test_wrap
615 def test_5g_nsa_call_volte_to_2g(self):
616 """ nsa 5G to 2G call test (with VoLTE)
617
618 1. Make Sure PhoneA is in nsa 5G mode (with VoLTE).
619 2. Make Sure PhoneB is in 2G mode.
620 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
621 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
622
623 Raises:
624 TestFailure if not success.
625 """
626 ads = self.android_devices
627
628 tasks = [(phone_setup_volte, (self.log, ads[0])),
629 (phone_setup_voice_2g, (self.log, ads[1]))]
630 if not multithread_func(self.log, tasks):
631 self.log.error("Phone failed to set up in VoLTE/2G")
632 return False
633
634 if not provision_device_for_5g(self.log, ads[0]):
635 return False
636
637 result = two_phone_call_short_seq(
638 self.log, ads[0], None, is_phone_in_call_volte, ads[1],
639 phone_idle_2g, is_phone_in_call_2g, None)
640 self.tel_logger.set_result(result.result_value)
641 if not result:
642 raise signals.TestFailure("Failed",
643 extras={"fail_reason": str(result.result_value)})
644
645
646 @test_tracker_info(uuid="547d0b7e-8130-4166-bd57-af8257d5d0c4")
647 @TelephonyBaseTest.tel_test_wrap
648 def test_5g_nsa_call_epdg_to_volte_wfc_wifi_preferred(self):
649 """ WiFi Preferred, WiFi calling to nsa5g VoLTE test
650
651 1. Setup PhoneA WFC mode: WIFI_PREFERRED.
652 2. Make Sure PhoneB is in nsa5G mode (with VoLTE enabled).
653 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
654 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
655
656 Raises:
657 TestFailure if not success.
658 """
659 ads = self.android_devices
660 tasks = [(phone_setup_iwlan,
661 (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
662 self.wifi_network_ssid, self.wifi_network_pass)),
663 (phone_setup_volte, (self.log, ads[1]))]
664
665 if not multithread_func(self.log, tasks):
666 self.log.error("Phone failed to set up in VoLTE")
667 return False
668
669 if not provision_device_for_5g(self.log, ads[1]):
670 return False
671
672 result = two_phone_call_short_seq(
673 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
674 None, is_phone_in_call_volte, None,
675 WAIT_TIME_IN_CALL_FOR_IMS)
676 self.tel_logger.set_result(result.result_value)
677 if not result:
678 raise signals.TestFailure("Failed",
679 extras={"fail_reason": str(result.result_value)})
680
681
682 @test_tracker_info(uuid="119b54f8-fe4f-4158-baa3-c869a7ce12b9")
683 @TelephonyBaseTest.tel_test_wrap
684 def test_5g_nsa_call_epdg_to_volte_apm_wfc_wifi_only(self):
685 """ Airplane + WiFi Only, WiFi calling to nsa5g VoLTE test
686
687 1. Setup PhoneA in airplane mode, WFC mode: WIFI_ONLY.
688 2. Make Sure PhoneB is in nsa 5G mode (with VoLTE enabled).
689 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
690 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
691
692 Raises:
693 TestFailure if not success.
694 """
695 ads = self.android_devices
696 tasks = [(phone_setup_iwlan,
697 (self.log, ads[0], True, WFC_MODE_WIFI_ONLY,
698 self.wifi_network_ssid, self.wifi_network_pass)),
699 (phone_setup_volte, (self.log, ads[1]))]
700
701 if not multithread_func(self.log, tasks):
702 self.log.error("Phone failed to set up in VoLTE")
703 return False
704
705 if not provision_device_for_5g(self.log, ads[1]):
706 return False
707
708 result = two_phone_call_short_seq(
709 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
710 None, is_phone_in_call_volte, None,
711 WAIT_TIME_IN_CALL_FOR_IMS)
712 self.tel_logger.set_result(result.result_value)
713 if not result:
714 raise signals.TestFailure("Failed",
715 extras={"fail_reason": str(result.result_value)})
716
717
718 @test_tracker_info(uuid="cb2eac2b-fc48-409d-bff2-a06849d6cd1a")
719 @TelephonyBaseTest.tel_test_wrap
720 def test_5g_nsa_call_epdg_to_volte_apm_wfc_wifi_preferred(self):
721 """ Airplane + WiFi Preferred, WiFi calling to nsa5g VoLTE test
722
723 1. Setup PhoneA in airplane mode, WFC mode: WIFI_PREFERRED.
724 2. Make Sure PhoneB is in nsa 5G mode (with VoLTE enabled).
725 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
726 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
727
728 Raises:
729 TestFailure if not success.
730 """
731 ads = self.android_devices
732 tasks = [(phone_setup_iwlan,
733 (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
734 self.wifi_network_ssid, self.wifi_network_pass)),
735 (phone_setup_volte, (self.log, ads[1]))]
736
737 if not multithread_func(self.log, tasks):
738 self.log.error("Phone failed to set up in VoLTE")
739 return False
740
741 if not provision_device_for_5g(self.log, ads[1]):
742 return False
743
744 result = two_phone_call_short_seq(
745 self.log, ads[0], phone_idle_iwlan, is_phone_in_call_iwlan, ads[1],
746 None, is_phone_in_call_volte, None,
747 WAIT_TIME_IN_CALL_FOR_IMS)
748 self.tel_logger.set_result(result.result_value)
749 if not result:
750 raise signals.TestFailure("Failed",
751 extras={"fail_reason": str(result.result_value)})
752
753
754 @test_tracker_info(uuid="c06d6c81-ce26-474d-b41e-fcfe1ec6e761")
755 @TelephonyBaseTest.tel_test_wrap
756 def test_5g_nsa_call_volte_to_volte_long(self):
757 """ VoLTE to nsa 5G VoLTE call test
758
759 1. Make Sure PhoneA is in LTE mode (with VoLTE).
760 2. Make Sure PhoneB is in nsa 5G mode (with VoLTE).
761 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
762 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
763 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
764 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
765
766 Raises:
767 TestFailure if not success.
768 """
769 ads = self.android_devices
770 if not provision_both_devices_for_volte(self.log, ads):
771 return False
772
773 if not provision_device_for_5g(self.log, ads[1]):
774 return False
775
776 result = two_phone_call_long_seq(
777 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte, ads[1],
778 None, is_phone_in_call_volte, None,
779 WAIT_TIME_IN_CALL_FOR_IMS)
780 self.tel_logger.set_result(result.result_value)
781 if not result:
782 raise signals.TestFailure("Failed",
783 extras={"fail_reason": str(result.result_value)})
784
785
786 @test_tracker_info(uuid="3c45ab10-9e8c-4804-9f32-c775baa3d5e7")
787 @TelephonyBaseTest.tel_test_wrap
788 def test_5g_nsa_call_volte_to_volte_loop(self):
789 """ Stress test: VoLTE to nsa 5g VoLTE call test
790
791 1. Make Sure PhoneA is in LTE mode (with VoLTE).
792 2. Make Sure PhoneB is in nsa 5G mode (with VoLTE).
793 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
794 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
795 5. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneB.
796 6. Call from PhoneB to PhoneA, accept on PhoneA, hang up on PhoneA.
797 7. Repeat step 3~6.
798
799 Returns:
800 True if pass; False if fail.
801 """
802
803 MINIMUM_SUCCESS_RATE = .95
804 ads = self.android_devices
805
806 if not provision_both_devices_for_volte(self.log, ads):
807 return False
808
809 if not provision_device_for_5g(self.log, ads[1]):
810 return False
811
812 success_count = 0
813 fail_count = 0
814
815 for i in range(1, self.stress_test_number + 1):
816
817 if two_phone_call_long_seq(
818 self.log, ads[0], phone_idle_volte, is_phone_in_call_volte,
819 ads[1], None, is_phone_in_call_volte, None,
820 WAIT_TIME_IN_CALL_FOR_IMS):
821 success_count += 1
822 result_str = "Succeeded"
823
824 else:
825 fail_count += 1
826 result_str = "Failed"
827
828 self.log.info("Iteration %s %s. Current: %s / %s passed.", i,
829 result_str, success_count, self.stress_test_number)
830
831 self.log.info("Final Count - Success: %s, Failure: %s - %s%",
832 success_count, fail_count,
833 str(100 * success_count / (success_count + fail_count)))
834 if success_count / (
835 success_count + fail_count) >= MINIMUM_SUCCESS_RATE:
836 return True
837 else:
838 return False
839
840
841 @test_tracker_info(uuid="875292c8-14f8-43aa-8770-3d0099da9c53")
842 @TelephonyBaseTest.tel_test_wrap
843 def test_5g_nsa_call_voicemail_indicator_volte(self):
844 """Test Voice Mail notification in nsa 5G (VoLTE enabled).
845 This script currently only works for TMO now.
846
847 1. Make sure DUT (ads[0]) in nsa 5g VoLTE mode. Both PhoneB and DUT idle.
848 2. Make call from PhoneB to DUT, reject on DUT.
849 3. On PhoneB, leave a voice mail to DUT.
850 4. Verify DUT receive voice mail notification.
851
852 Returns:
853 True if pass; False if fail.
854 """
855 ads = self.android_devices
856
857 tasks = [(phone_setup_voice_general, (self.log, ads[1])),
858 (phone_setup_volte, (self.log, ads[0]))]
859 if not multithread_func(self.log, tasks):
860 self.log.error("Phone Failed to Set Up Properly.")
861 return False
862
863 if not provision_device_for_5g(self.log, ads[0]):
864 return False
865
866 if not call_voicemail_erase_all_pending_voicemail(self.log, ads[0]):
867 self.log.error("Failed to clear voice mail.")
868 return False
869
870 return two_phone_call_leave_voice_mail(self.log, ads[1], None, None,
871 ads[0], phone_idle_volte)
872
873
874 @test_tracker_info(uuid="b866dcfa-f133-424d-bb5d-f381a1f63602")
875 @TelephonyBaseTest.tel_test_wrap
876 def test_5g_nsa_call_long_duration_volte(self):
877 """ Test call drop rate for nsa 5g VoLTE long duration call.
878
879 Steps:
880 1. Setup nsa 5g VoLTE for DUT.
881 2. Make nsa 5g VoLTE call from DUT to PhoneB.
882 3. For <total_duration> time, check if DUT drop call or not.
883
884 Expected Results:
885 DUT should not drop call.
886
887 Returns:
888 False if DUT call dropped during test.
889 Otherwise True.
890 """
891 ads = self.android_devices
892
893 tasks = [(phone_setup_volte, (self.log, ads[0])),
894 (phone_setup_voice_general, (self.log, ads[1]))]
895 if not multithread_func(self.log, tasks):
896 self.log.error("Phone Failed to Set Up Properly.")
897 return False
898
899 if not provision_device_for_5g(self.log, ads[0]):
900 return False
901
902 return _test_call_long_duration(self.log, ads,
903 is_phone_in_call_volte, self.long_call_duration)
904
905
906 @test_tracker_info(uuid="527e6676-25c7-4adc-94e7-bb6d3b8f6c24")
907 @TelephonyBaseTest.tel_test_wrap
908 def test_5g_nsa_call_volte_after_mobile_data_usage_limit_reached(self):
909 """ VoLTE to VoLTE call test after mobile data usage limit reached
910
911 1. Set the data limit to the current usage
912 2. Make Sure PhoneA is in nsa 5G mode (with VoLTE).
913 3. Make Sure PhoneB is in nsa 5G mode (with VoLTE).
914 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA.
915 5. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB.
916
917 Raises:
918 TestFailure if not success.
919 """
920 ads = self.android_devices
921 try:
922 subscriber_id = ads[0].droid.telephonyGetSubscriberId()
923 data_usage = get_mobile_data_usage(ads[0], subscriber_id)
924 set_mobile_data_usage_limit(ads[0], data_usage, subscriber_id)
925
926 if not provision_both_devices_for_5g(self.log, ads):
927 self.log.error("Phone Failed to Set Up Properly.")
928 self.tel_logger.set_result(CallResult("CALL_SETUP_FAILURE"))
929 raise signals.TestFailure("Failed",
930 extras={"fail_reason": "Phone Failed to Set Up Properly."})
931
932 result = two_phone_call_short_seq(
933 self.log, ads[0], None, is_phone_in_call_volte,
934 ads[1], None, is_phone_in_call_volte, None,
935 WAIT_TIME_IN_CALL_FOR_IMS)
936 self.tel_logger.set_result(result.result_value)
937
938 if not result:
939 raise signals.TestFailure("Failed",
940 extras={"fail_reason": str(result.result_value)})
941 finally:
942 remove_mobile_data_usage_limit(ads[0], subscriber_id)
943
944
945 @test_tracker_info(uuid="2c28a974-dc31-4f01-b555-d3e0a8374f37")
946 @TelephonyBaseTest.tel_test_wrap
947 def test_5g_nsa_call_volte_in_call_wifi_toggling(self):
948 """ General voice to voice call.
949
950 1. Make Sure PhoneA in nsa5G.
951 2. Make Sure PhoneB in nsa5G.
952 3. Call from PhoneA to PhoneB.
953 4. Toggling Wifi connnection in call.
954 5. Verify call is active.
955 6. Hung up the call on PhoneA
956
957 Returns:
958 True if pass; False if fail.
959 """
960 ads = self.android_devices
961 result = True
962
963 if not provision_both_devices_for_5g(self.log, ads):
964 self.log.error("Phone Failed to Set Up Properly.")
965 self.tel_logger.set_result(CallResult("CALL_SETUP_FAILURE"))
966 raise signals.TestFailure("Failed",
967 extras={"fail_reason": "Phone Failed to Set Up Properly."})
968
969 if not call_setup_teardown(self.log, ads[0], ads[1], None, None, None,
970 5):
971 self.log.error("Call setup failed")
972 return False
973 else:
974 self.log.info("Call setup succeed")
975
976 if not wifi_cell_switching(self.log, ads[0], GEN_5G, self.wifi_network_ssid,
977 self.wifi_network_pass):
978 ads[0].log.error("Failed to do WIFI and Cell switch in call")
979 result = False
980
981 if not is_phone_in_call_active(ads[0]):
982 return False
983 else:
984 if not ads[0].droid.telecomCallGetAudioState():
985 ads[0].log.error("Audio is not on call")
986 result = False
987 else:
988 ads[0].log.info("Audio is on call")
989 hangup_call(self.log, ads[0])
990 return result
991
Pei Huang10337282021-03-22 08:50:01 +0800992 @test_tracker_info(uuid="95802175-06d5-4774-8ce8-fdf7922eca20")
993 @TelephonyBaseTest.tel_test_wrap
994 def test_5g_nsa_call_mo_vowifi_in_active_youtube(self):
995 """Test call can be established during active youtube video on 5G NSA.
996
997 Turn off airplane mode, turn on wfc and wifi.
998 Starting youtube video.
999 Initiate a MO voice call. Verify call can be established.
1000
1001 Returns:
1002 True if success.
1003 False if failed.
1004 """
1005 if not phone_setup_iwlan(self.log, self.android_devices[0], False,
1006 WFC_MODE_WIFI_PREFERRED,
1007 self.wifi_network_ssid,
1008 self.wifi_network_pass):
1009 self.android_devices[0].log.error(
1010 "Failed to setup IWLAN with NON-APM WIFI WFC on")
1011 return False
1012 return test_call_setup_in_active_youtube_video(self.log,
1013 self.android_devices,
1014 GEN_5G,
1015 DIRECTION_MOBILE_ORIGINATED)
1016
1017 @test_tracker_info(uuid="f827a8b5-039c-4cc1-b030-78a09119acfc")
1018 @TelephonyBaseTest.tel_test_wrap
1019 def test_5g_nsa_call_mt_vowifi_in_active_youtube(self):
1020 """Test call can be established during active youtube_video on 5G NSA.
1021
1022 Turn off airplane mode, turn on wfc and wifi.
1023 Starting an youtube video.
1024 Initiate a MT voice call. Verify call can be established.
1025
1026 Returns:
1027 True if success.
1028 False if failed.
1029 """
1030 if not phone_setup_iwlan(self.log, self.android_devices[0], False,
1031 WFC_MODE_WIFI_PREFERRED,
1032 self.wifi_network_ssid,
1033 self.wifi_network_pass):
1034 self.android_devices[0].log.error(
1035 "Failed to setup iwlan with APM off and WIFI and WFC on")
1036 return False
1037 return test_call_setup_in_active_youtube_video(self.log,
1038 self.android_devices,
1039 GEN_5G,
1040 DIRECTION_MOBILE_TERMINATED)
1041
1042 @test_tracker_info(uuid="af3254d0-a84a-47c8-8ebc-11517b7b4944")
1043 @TelephonyBaseTest.tel_test_wrap
1044 def test_5g_nsa_call_mo_vowifi_apm_in_active_data_transfer(self):
1045 """Test call can be established during active data connection on 5G NSA.
1046
1047 Turn on wifi-calling, airplane mode and wifi.
1048 Starting downloading file from Internet.
1049 Initiate a MO voice call. Verify call can be established.
1050 Hangup Voice Call, verify file is downloaded successfully.
1051
1052 Returns:
1053 True if success.
1054 False if failed.
1055 """
1056 if not provision_device_for_5g(self.log, self.android_devices[0]):
1057 self.android_devices[0].log.error("Phone not attached on 5G NSA before call.")
1058 return False
1059
1060 if not phone_setup_iwlan(self.log, self.android_devices[0], True,
1061 WFC_MODE_WIFI_PREFERRED,
1062 self.wifi_network_ssid,
1063 self.wifi_network_pass):
1064 self.android_devices[0].log.error(
1065 "Failed to setup iwlan with APM, WIFI and WFC on")
1066 return False
1067 return test_call_setup_in_active_data_transfer(self.log,
1068 self.android_devices,
1069 None,
1070 DIRECTION_MOBILE_ORIGINATED)
1071
1072 @test_tracker_info(uuid="5c58af94-8c24-481b-a555-bdbf36db5f6e")
1073 @TelephonyBaseTest.tel_test_wrap
1074 def test_5g_nsa_call_mt_vowifi_apm_in_active_data_transfer(self):
1075 """Test call can be established during active data connection on 5G NSA.
1076
1077 Turn on wifi-calling, airplane mode and wifi.
1078 Starting downloading file from Internet.
1079 Initiate a MT voice call. Verify call can be established.
1080 Hangup Voice Call, verify file is downloaded successfully.
1081
1082 Returns:
1083 True if success.
1084 False if failed.
1085 """
1086 if not provision_device_for_5g(self.log, self.android_devices[0]):
1087 self.android_devices[0].log.error("Phone not attached on 5G NSA before call.")
1088 return False
1089
1090 if not phone_setup_iwlan(self.log, self.android_devices[0], True,
1091 WFC_MODE_WIFI_PREFERRED,
1092 self.wifi_network_ssid,
1093 self.wifi_network_pass):
1094 self.android_devices[0].log.error(
1095 "Failed to setup iwlan with APM, WIFI and WFC on")
1096 return False
1097 return test_call_setup_in_active_data_transfer(self.log,
1098 self.android_devices,
1099 None,
1100 DIRECTION_MOBILE_TERMINATED)
1101
1102 @test_tracker_info(uuid="bcd874ae-58e1-4954-88af-bb3dd54d4abf")
1103 @TelephonyBaseTest.tel_test_wrap
1104 def test_5g_nsa_call_mo_vowifi_apm_in_active_youtube(self):
1105 """Test call can be established during active youtube video on 5G NSA.
1106
1107 Turn on wifi-calling, airplane mode and wifi.
1108 Starting an youtube video.
1109 Initiate a MO voice call. Verify call can be established.
1110
1111 Returns:
1112 True if success.
1113 False if failed.
1114 """
1115 if not provision_device_for_5g(self.log, self.android_devices[0]):
1116 self.android_devices[0].log.error("Phone not attached on 5G NSA before call.")
1117 return False
1118
1119 if not phone_setup_iwlan(self.log, self.android_devices[0], True,
1120 WFC_MODE_WIFI_PREFERRED,
1121 self.wifi_network_ssid,
1122 self.wifi_network_pass):
1123 self.android_devices[0].log.error(
1124 "Failed to setup iwlan with APM, WIFI and WFC on")
1125 return False
1126 return test_call_setup_in_active_youtube_video(self.log,
1127 self.android_devices,
1128 None,
1129 DIRECTION_MOBILE_ORIGINATED)
1130
1131 @test_tracker_info(uuid="ad96f1cf-0d17-4a39-86cf-cacb5f4cc81c")
1132 @TelephonyBaseTest.tel_test_wrap
1133 def test_5g_nsa_call_mt_vowifi_apm_in_active_youtube(self):
1134 """Test call can be established during active youtube video on 5G NSA.
1135
1136 Turn on wifi-calling, airplane mode and wifi.
1137 Starting youtube video.
1138 Initiate a MT voice call. Verify call can be established.
1139
1140 Returns:
1141 True if success.
1142 False if failed.
1143 """
1144 if not provision_device_for_5g(self.log, self.android_devices[0]):
1145 self.android_devices[0].log.error("Phone not attached on 5G NSA before call.")
1146 return False
1147
1148 if not phone_setup_iwlan(self.log, self.android_devices[0], True,
1149 WFC_MODE_WIFI_PREFERRED,
1150 self.wifi_network_ssid,
1151 self.wifi_network_pass):
1152 self.android_devices[0].log.error(
1153 "Failed to setup iwlan with APM, WIFI and WFC on")
1154 return False
1155 return test_call_setup_in_active_youtube_video(self.log,
1156 self.android_devices,
1157 None,
1158 DIRECTION_MOBILE_TERMINATED)
1159
1160 @test_tracker_info(uuid="9d1121c1-aae4-428b-9167-09d4efdb7e37")
1161 @TelephonyBaseTest.tel_test_wrap
1162 def test_5g_nsa_call_wfc_in_call_wifi_toggling(self):
1163 """ General voice to voice call on 5G NSA. TMO Only Test
1164
1165 1. Make Sure PhoneA in wfc with APM off.
1166 2. Make Sure PhoneB in Voice Capable.
1167 3. Call from PhoneA to PhoneB.
1168 4. Toggling Wifi connection in call.
1169 5. Verify call is active.
1170 6. Hung up the call on PhoneA
1171
1172 Returns:
1173 True if pass; False if fail.
1174 """
1175
1176 ads = self.android_devices
1177
1178 if not provision_both_devices_for_5g(self.log, ads):
1179 return False
1180 tasks = [(phone_setup_iwlan,
1181 (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
1182 self.wifi_network_ssid, self.wifi_network_pass)),
1183 (phone_setup_voice_general, (self.log, ads[1]))]
1184
1185 if not multithread_func(self.log, tasks):
1186 self.log.error("Phone Failed to Set Up Properly.")
1187 return False
1188 return test_wifi_cell_switching_in_call(self.log,
1189 ads,
1190 self.wifi_network_ssid,
1191 self.wifi_network_pass)
Pratik Sheth59efdde2021-03-10 11:50:54 -08001192
Pei Huangab1bcf32021-01-18 13:48:45 +08001193 """ Tests End """