Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 1 | #!/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 | |
| 20 | import time |
| 21 | |
| 22 | from acts.test_decorators import test_tracker_info |
Pei Huang | ab1bcf3 | 2021-01-18 13:48:45 +0800 | [diff] [blame] | 23 | from acts.utils import adb_shell_ping |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 24 | from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest |
| 25 | from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL_FOR_IMS |
| 26 | from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL |
| 27 | from acts_contrib.test_utils.tel.tel_defines import CALL_STATE_ACTIVE |
| 28 | from acts_contrib.test_utils.tel.tel_defines import CALL_STATE_HOLDING |
| 29 | from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED |
| 30 | from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_TERMINATED |
Pei Huang | 1c8f852 | 2020-12-21 19:39:20 +0800 | [diff] [blame] | 31 | from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_ANDROID_STATE_SETTLING |
Pei Huang | ab1bcf3 | 2021-01-18 13:48:45 +0800 | [diff] [blame] | 32 | from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED |
Pei Huang | a8589ff | 2021-01-21 15:31:19 +0800 | [diff] [blame] | 33 | from acts_contrib.test_utils.tel.tel_defines import GEN_5G |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 34 | from acts_contrib.test_utils.tel.tel_test_utils import ensure_phones_idle |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 35 | from acts_contrib.test_utils.tel.tel_test_utils import call_setup_teardown |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 36 | from acts_contrib.test_utils.tel.tel_test_utils import hangup_call |
| 37 | from acts_contrib.test_utils.tel.tel_test_utils import multithread_func |
| 38 | from acts_contrib.test_utils.tel.tel_test_utils import num_active_calls |
| 39 | from acts_contrib.test_utils.tel.tel_test_utils import verify_incall_state |
| 40 | from acts_contrib.test_utils.tel.tel_test_utils import verify_internet_connection |
| 41 | from acts_contrib.test_utils.tel.tel_test_utils import start_youtube_video |
| 42 | from acts_contrib.test_utils.tel.tel_test_utils import wait_for_cell_data_connection |
| 43 | from acts_contrib.test_utils.tel.tel_test_utils import active_file_download_task |
| 44 | from acts_contrib.test_utils.tel.tel_test_utils import run_multithread_func |
| 45 | from acts_contrib.test_utils.tel.tel_test_utils import wait_for_state |
Pei Huang | 1c8f852 | 2020-12-21 19:39:20 +0800 | [diff] [blame] | 46 | from acts_contrib.test_utils.tel.tel_test_utils import is_phone_in_call_active |
Pei Huang | ab1bcf3 | 2021-01-18 13:48:45 +0800 | [diff] [blame] | 47 | from acts_contrib.test_utils.tel.tel_test_utils import toggle_airplane_mode |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 48 | from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_volte |
Pei Huang | ae46649 | 2021-02-09 13:28:50 +0800 | [diff] [blame^] | 49 | from acts_contrib.test_utils.tel.tel_voice_utils import hold_unhold_test |
| 50 | from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_call_hold_unhold_test |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 51 | from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_volte |
| 52 | from acts_contrib.test_utils.tel.tel_voice_utils import two_phone_call_short_seq |
| 53 | from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_voice_3g |
| 54 | from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_3g |
Pei Huang | ab1bcf3 | 2021-01-18 13:48:45 +0800 | [diff] [blame] | 55 | from acts_contrib.test_utils.tel.tel_voice_utils import phone_idle_iwlan |
| 56 | from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan |
| 57 | from acts_contrib.test_utils.tel.tel_voice_utils import phone_setup_iwlan |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 58 | from acts_contrib.test_utils.tel.tel_5g_utils import set_preferred_mode_for_5g |
| 59 | from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_5g |
| 60 | from acts_contrib.test_utils.tel.tel_5g_utils import provision_both_devices_for_volte |
| 61 | from acts_contrib.test_utils.tel.tel_5g_utils import verify_5g_attach_for_both_devices |
Pei Huang | ab1bcf3 | 2021-01-18 13:48:45 +0800 | [diff] [blame] | 62 | from acts_contrib.test_utils.tel.tel_5g_utils import is_current_network_5g_nsa |
| 63 | from acts_contrib.test_utils.tel.tel_5g_utils import wifi_cell_switching_for_5g_nsa |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 64 | |
| 65 | |
| 66 | class Nsa5gVoiceTest(TelephonyBaseTest): |
| 67 | def setup_class(self): |
| 68 | super().setup_class() |
| 69 | self.number_of_devices = 2 |
| 70 | self.message_lengths = (50, 160, 180) |
| 71 | |
| 72 | def setup_test(self): |
| 73 | TelephonyBaseTest.setup_test(self) |
| 74 | |
| 75 | def teardown_test(self): |
| 76 | ensure_phones_idle(self.log, self.android_devices) |
| 77 | |
| 78 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 79 | def _test_call_setup_in_active_data_transfer_5g_nsa( |
| 80 | self, |
Pei Huang | a8589ff | 2021-01-21 15:31:19 +0800 | [diff] [blame] | 81 | new_gen=None, |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 82 | call_direction=DIRECTION_MOBILE_ORIGINATED, |
| 83 | allow_data_transfer_interruption=False): |
| 84 | """Test call can be established during active data connection in 5G NSA. |
| 85 | |
| 86 | Turn off airplane mode, disable WiFi, enable Cellular Data. |
| 87 | Make sure phone in 5G NSA. |
| 88 | Starting downloading file from Internet. |
| 89 | Initiate a voice call. Verify call can be established. |
| 90 | Hangup Voice Call, verify file is downloaded successfully. |
| 91 | Note: file download will be suspended when call is initiated if voice |
| 92 | is using voice channel and voice channel and data channel are |
| 93 | on different RATs. |
| 94 | |
| 95 | Returns: |
| 96 | True if success. |
| 97 | False if failed. |
| 98 | """ |
| 99 | ads = self.android_devices |
| 100 | |
| 101 | def _call_setup_teardown(log, ad_caller, ad_callee, ad_hangup, |
| 102 | caller_verifier, callee_verifier, |
| 103 | wait_time_in_call): |
| 104 | #wait time for active data transfer |
| 105 | time.sleep(5) |
| 106 | return call_setup_teardown(log, ad_caller, ad_callee, ad_hangup, |
| 107 | caller_verifier, callee_verifier, |
| 108 | wait_time_in_call) |
| 109 | |
| 110 | # Mode Pref |
| 111 | set_preferred_mode_for_5g(ads[0]) |
| 112 | |
| 113 | # Attach nsa5g |
| 114 | if not is_current_network_5g_nsa(ads[0]): |
| 115 | ads[0].log.error("Phone not attached on 5G NSA before call.") |
| 116 | return False |
| 117 | |
Pei Huang | a8589ff | 2021-01-21 15:31:19 +0800 | [diff] [blame] | 118 | if new_gen: |
| 119 | ads[0].droid.telephonyToggleDataConnection(True) |
| 120 | if not wait_for_cell_data_connection(self.log, ads[0], True): |
| 121 | ads[0].log.error("Data connection is not on cell") |
| 122 | return False |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 123 | |
| 124 | if not verify_internet_connection(self.log, ads[0]): |
| 125 | ads[0].log.error("Internet connection is not available") |
| 126 | return False |
| 127 | |
| 128 | if call_direction == DIRECTION_MOBILE_ORIGINATED: |
| 129 | ad_caller = ads[0] |
| 130 | ad_callee = ads[1] |
| 131 | else: |
| 132 | ad_caller = ads[1] |
| 133 | ad_callee = ads[0] |
| 134 | ad_download = ads[0] |
| 135 | |
| 136 | start_youtube_video(ad_download) |
| 137 | call_task = (_call_setup_teardown, (self.log, ad_caller, ad_callee, |
| 138 | ad_caller, None, None, 30)) |
| 139 | download_task = active_file_download_task(self.log, ad_download, file_name="10MB") |
| 140 | results = run_multithread_func(self.log, [download_task, call_task]) |
| 141 | if wait_for_state(ad_download.droid.audioIsMusicActive, True, 15, 1): |
| 142 | ad_download.log.info("After call hangup, audio is back to music") |
| 143 | else: |
| 144 | ad_download.log.warning( |
| 145 | "After call hang up, audio is not back to music") |
| 146 | ad_download.force_stop_apk("com.google.android.youtube") |
| 147 | if not results[1]: |
| 148 | self.log.error("Call setup failed in active data transfer.") |
| 149 | return False |
| 150 | if results[0]: |
| 151 | ad_download.log.info("Data transfer succeeded.") |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 152 | elif not allow_data_transfer_interruption: |
| 153 | ad_download.log.error( |
| 154 | "Data transfer failed with parallel phone call.") |
| 155 | return False |
| 156 | else: |
| 157 | ad_download.log.info("Retry data connection after call hung up") |
| 158 | if not verify_internet_connection(self.log, ad_download): |
| 159 | ad_download.log.error("Internet connection is not available") |
| 160 | return False |
Pei Huang | a8589ff | 2021-01-21 15:31:19 +0800 | [diff] [blame] | 161 | if not is_current_network_5g_nsa(ads[0]): |
| 162 | ads[0].log.error("Phone not attached on 5G NSA after call.") |
| 163 | return False |
| 164 | return True |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 165 | |
Pei Huang | 12f44ae | 2021-01-22 23:19:08 +0800 | [diff] [blame] | 166 | def _test_call_setup_in_active_youtube_video_5g_nsa( |
| 167 | self, |
| 168 | new_gen=None, |
| 169 | call_direction=DIRECTION_MOBILE_ORIGINATED, |
| 170 | allow_data_transfer_interruption=False): |
| 171 | """Test call can be established during active data connection on 5G NSA. |
| 172 | |
| 173 | Setup phoneA on 5G NSA. |
| 174 | Make sure phoneA on 5G NSA |
| 175 | Starting playing youtube video. |
| 176 | Initiate a voice call. Verify call can be established. |
| 177 | Make sure phoneA on 5G NSA |
| 178 | |
| 179 | Returns: |
| 180 | True if success. |
| 181 | False if failed. |
| 182 | """ |
| 183 | ads = self.android_devices |
| 184 | # Mode Pref |
| 185 | set_preferred_mode_for_5g(ads[0]) |
| 186 | |
| 187 | # Attach 5g |
| 188 | if not is_current_network_5g_nsa(ads[0]): |
| 189 | ads[0].log.error("Phone not attached on 5G NSA before call.") |
| 190 | return False |
| 191 | |
| 192 | if new_gen: |
| 193 | ads[0].droid.telephonyToggleDataConnection(True) |
| 194 | if not wait_for_cell_data_connection(self.log, ads[0], True): |
| 195 | ads[0].log.error("Data connection is not on cell") |
| 196 | return False |
| 197 | |
| 198 | if not verify_internet_connection(self.log, ads[0]): |
| 199 | ads[0].log.error("Internet connection is not available") |
| 200 | return False |
| 201 | |
| 202 | if call_direction == DIRECTION_MOBILE_ORIGINATED: |
| 203 | ad_caller = ads[0] |
| 204 | ad_callee = ads[1] |
| 205 | else: |
| 206 | ad_caller = ads[1] |
| 207 | ad_callee = ads[0] |
| 208 | ad_download = ads[0] |
| 209 | |
| 210 | if not start_youtube_video(ad_download): |
| 211 | ad_download.log.warning("Fail to bring up youtube video") |
| 212 | |
| 213 | if not call_setup_teardown(self.log, ad_caller, ad_callee, ad_caller, |
| 214 | None, None, 30): |
| 215 | ad_download.log.error("Call setup failed in active youtube video") |
| 216 | result = False |
| 217 | else: |
| 218 | ad_download.log.info("Call setup succeed in active youtube video") |
| 219 | result = True |
| 220 | |
| 221 | if wait_for_state(ad_download.droid.audioIsMusicActive, True, 15, 1): |
| 222 | ad_download.log.info("After call hangup, audio is back to music") |
| 223 | else: |
| 224 | ad_download.log.warning( |
| 225 | "After call hang up, audio is not back to music") |
| 226 | ad_download.force_stop_apk("com.google.android.youtube") |
| 227 | if not is_current_network_5g_nsa(ads[0]): |
| 228 | ads[0].log.error("Phone not attached on 5G NSA after call.") |
| 229 | result = False |
| 230 | return result |
| 231 | |
Pei Huang | f5569a0 | 2021-01-28 21:53:07 +0800 | [diff] [blame] | 232 | def _test_call_epdg_to_epdg_wfc_5g_nsa(self, |
Pei Huang | ab1bcf3 | 2021-01-18 13:48:45 +0800 | [diff] [blame] | 233 | ads, |
| 234 | apm_mode, |
| 235 | wfc_mode, |
| 236 | wifi_ssid, |
| 237 | wifi_pwd): |
| 238 | """ Test epdg<->epdg call functionality on 5G NSA. |
| 239 | |
| 240 | Set PhoneA/PhoneB on 5G NSA |
| 241 | Make sure PhoneA/PhoneB on 5G NSA before testing |
| 242 | Make Sure PhoneA is set to make epdg call. |
| 243 | Make Sure PhoneB is set to make epdg call. |
| 244 | Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. |
| 245 | Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. |
| 246 | Make sure PhoneA/PhoneB on 5G NSA after testing |
| 247 | |
| 248 | Args: |
| 249 | ads: list of android objects, this list should have two ad. |
| 250 | apm_mode: phones' airplane mode. |
| 251 | if True, phones are in airplane mode during test. |
| 252 | if False, phones are not in airplane mode during test. |
| 253 | wfc_mode: phones' wfc mode. |
| 254 | Valid mode includes: WFC_MODE_WIFI_ONLY, WFC_MODE_CELLULAR_PREFERRED, |
| 255 | WFC_MODE_WIFI_PREFERRED, WFC_MODE_DISABLED. |
| 256 | wifi_ssid: WiFi ssid to connect during test. |
| 257 | wifi_pwd: WiFi password. |
| 258 | |
| 259 | Returns: |
| 260 | True if pass; False if fail. |
| 261 | """ |
| 262 | DEFAULT_PING_DURATION = 120 # in seconds |
| 263 | |
| 264 | # if apm_mode is true, turn off apm first before setting network |
| 265 | # preferred mode to 5G NSA. |
| 266 | if apm_mode: |
| 267 | # Turn off airplane mode |
| 268 | self.log.info("Turn off APM mode before starting testing.") |
| 269 | tasks = [(toggle_airplane_mode, (self.log, ads[0], False)), |
| 270 | (toggle_airplane_mode, (self.log, ads[1], False))] |
| 271 | if not multithread_func(self.log, tasks): |
| 272 | self.log.error("Failed to turn off airplane mode") |
| 273 | return False |
| 274 | |
| 275 | if not provision_both_devices_for_5g(self.log, ads): |
| 276 | return False |
| 277 | |
| 278 | if not verify_5g_attach_for_both_devices(self.log, ads): |
| 279 | self.log.error("Phone not attached on 5G NSA before epdg call.") |
| 280 | return False |
| 281 | |
| 282 | tasks = [(phone_setup_iwlan, (self.log, ads[0], apm_mode, wfc_mode, |
| 283 | wifi_ssid, wifi_pwd)), |
| 284 | (phone_setup_iwlan, (self.log, ads[1], apm_mode, wfc_mode, |
| 285 | wifi_ssid, wifi_pwd))] |
| 286 | if not multithread_func(self.log, tasks): |
| 287 | self.log.error("Phone Failed to Set Up Properly.") |
| 288 | return False |
| 289 | |
| 290 | time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) |
| 291 | |
| 292 | ad_ping = ads[0] |
| 293 | |
| 294 | call_task = (two_phone_call_short_seq, |
| 295 | (self.log, ads[0], phone_idle_iwlan, |
| 296 | is_phone_in_call_iwlan, ads[1], phone_idle_iwlan, |
| 297 | is_phone_in_call_iwlan, None, WAIT_TIME_IN_CALL_FOR_IMS)) |
| 298 | ping_task = (adb_shell_ping, (ad_ping, DEFAULT_PING_DURATION)) |
| 299 | |
| 300 | results = run_multithread_func(self.log, [ping_task, call_task]) |
| 301 | |
| 302 | time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) |
| 303 | |
| 304 | if not verify_5g_attach_for_both_devices(self.log, ads): |
| 305 | self.log.error("Phone not attached on 5G NSA after epdg call.") |
| 306 | return False |
| 307 | |
| 308 | if not results[1]: |
| 309 | self.log.error("Call setup failed in active ICMP transfer.") |
| 310 | if results[0]: |
| 311 | self.log.info("ICMP transfer succeeded with parallel phone call.") |
| 312 | else: |
| 313 | self.log.error("ICMP transfer failed with parallel phone call.") |
| 314 | return all(results) |
| 315 | |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 316 | """ Tests Begin """ |
| 317 | |
| 318 | @test_tracker_info(uuid="1bef3da1-4608-4b0e-8b78-f3f7be0115d5") |
| 319 | @TelephonyBaseTest.tel_test_wrap |
| 320 | def test_5g_nsa_call_volte_to_volte(self): |
| 321 | """ 5g nsa volte to volte call test |
| 322 | |
| 323 | 1. Make sure PhoneA is in nsa5g mode (with volte). |
| 324 | 2. Make sure PhoneB is in nsa5g mode (with volte). |
| 325 | 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. |
| 326 | 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. |
| 327 | 5. Verify both PhoneA and PhoneB gets attached back to nsa5g |
| 328 | |
| 329 | Raises: |
| 330 | TestFailure if not success. |
| 331 | """ |
| 332 | ads = self.android_devices |
| 333 | if not provision_both_devices_for_volte(self.log, ads): |
| 334 | return False |
| 335 | |
| 336 | if not provision_both_devices_for_5g(self.log, ads): |
| 337 | return False |
| 338 | |
| 339 | # VoLTE calls |
| 340 | result = two_phone_call_short_seq( |
| 341 | self.log, ads[0], None, is_phone_in_call_volte, ads[1], |
| 342 | None, is_phone_in_call_volte, None, |
| 343 | WAIT_TIME_IN_CALL_FOR_IMS) |
| 344 | if not result: |
| 345 | self.log.error("Failure is volte call during 5g nsa") |
| 346 | return False |
| 347 | |
| 348 | if not verify_5g_attach_for_both_devices(self.log, ads): |
| 349 | return False |
| 350 | |
| 351 | self.log.info("PASS - volte test over 5g nsa validated") |
| 352 | return True |
| 353 | |
| 354 | @test_tracker_info(uuid="3df252a4-308a-49c3-8e37-08e9c4e8efef") |
| 355 | @TelephonyBaseTest.tel_test_wrap |
| 356 | def test_5g_nsa_call_volte_to_3g(self): |
| 357 | """ 5g nsa volte to 3g call test |
| 358 | |
| 359 | 1. Make sure PhoneA is in nsa5g mode (with volte). |
| 360 | 2. Make sure PhoneB is in 3g mode. |
| 361 | 3. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. |
| 362 | 4. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. |
| 363 | 5. Verify both PhoneA and PhoneB gets attached back to nsa5g |
| 364 | |
| 365 | Raises: |
| 366 | TestFailure if not success. |
| 367 | """ |
| 368 | ads = self.android_devices |
| 369 | |
| 370 | # LTE attach |
| 371 | tasks = [(phone_setup_volte, (self.log, ads[0])), |
| 372 | (phone_setup_voice_3g, (self.log, ads[1]))] |
| 373 | if not multithread_func(self.log, tasks): |
| 374 | self.log.error("Phone failed to set up in volte/3g") |
| 375 | return False |
| 376 | |
| 377 | # Mode Pref |
| 378 | set_preferred_mode_for_5g(ads[0]) |
| 379 | |
| 380 | # Attach nsa5g |
| 381 | if not is_current_network_5g_nsa(ads[0]): |
| 382 | ads[0].log.error("Phone not attached on 5g nsa before call.") |
| 383 | return False |
| 384 | |
| 385 | # VoLTE to 3G |
| 386 | result = two_phone_call_short_seq( |
| 387 | self.log, ads[0], None, is_phone_in_call_volte, ads[1], |
| 388 | None, is_phone_in_call_3g, None, |
| 389 | WAIT_TIME_IN_CALL_FOR_IMS) |
| 390 | if not result: |
| 391 | self.log.error("Failure is volte to 3g call during 5g nsa") |
| 392 | return False |
| 393 | |
| 394 | # Attach nsa5g |
| 395 | if not is_current_network_5g_nsa(ads[0]): |
| 396 | ads[0].log.error("Phone not attached on 5g nsa after call end.") |
| 397 | return False |
| 398 | |
| 399 | self.log.info("PASS - VoLTE to 3g over 5g nsa validated") |
| 400 | return True |
| 401 | |
| 402 | |
| 403 | @test_tracker_info(uuid="3a8147d6-c136-42cb-92ca-2023b8eed85e") |
| 404 | @TelephonyBaseTest.tel_test_wrap |
| 405 | def test_5g_nsa_call_volte_mo_hold_unhold(self): |
| 406 | """ 5g nsa volte mo hold unhold test |
| 407 | |
| 408 | 1. Make sure PhoneA is in nsa 5g (with volte) |
| 409 | 2. Make sure PhoneB is in nsa 5g (with volte) |
| 410 | 3. Call from PhoneA to PhoneB, accept on PhoneB |
| 411 | 4. Make sure PhoneA/B are in call |
| 412 | 5. Hold and unhold on PhoneA |
| 413 | 6. Verify both PhoneA and PhoneB gets attached back to nsa5g |
| 414 | |
| 415 | Raises: |
| 416 | TestFailure if not success. |
| 417 | """ |
| 418 | ads = self.android_devices |
| 419 | if not provision_both_devices_for_volte(self.log, ads): |
| 420 | return False |
| 421 | |
| 422 | if not provision_both_devices_for_5g(self.log, ads): |
| 423 | return False |
| 424 | |
Pei Huang | ae46649 | 2021-02-09 13:28:50 +0800 | [diff] [blame^] | 425 | if not phone_setup_call_hold_unhold_test(self.log, |
| 426 | ads, |
Pei Huang | f5569a0 | 2021-01-28 21:53:07 +0800 | [diff] [blame] | 427 | DIRECTION_MOBILE_ORIGINATED, |
| 428 | caller_func=is_phone_in_call_volte): |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 429 | return False |
| 430 | |
| 431 | if not verify_5g_attach_for_both_devices(self.log, ads): |
| 432 | return False |
| 433 | return True |
| 434 | |
| 435 | @test_tracker_info(uuid="1825f9d9-dcf1-4407-922d-3f218d5b8932") |
| 436 | @TelephonyBaseTest.tel_test_wrap |
| 437 | def test_5g_nsa_call_volte_mt_hold_unhold(self): |
| 438 | """ 5g nsa volte mt hold unhold test |
| 439 | |
| 440 | 1. Make sure PhoneA is in nsa 5g (with volte) |
| 441 | 2. Make sure PhoneB is in nsa 5g (with volte) |
| 442 | 3. Call from PhoneB to PhoneA, accept on PhoneA |
| 443 | 4. Make sure PhoneA/B are in call |
| 444 | 5. Hold and unhold on PhoneA |
| 445 | 6. Verify both PhoneA and PhoneB gets attached back to nsa5g |
| 446 | |
| 447 | Raises: |
| 448 | TestFailure if not success. |
| 449 | """ |
| 450 | ads = self.android_devices |
| 451 | if not provision_both_devices_for_volte(self.log, ads): |
| 452 | return False |
| 453 | |
| 454 | if not provision_both_devices_for_5g(self.log, ads): |
| 455 | return False |
| 456 | |
Pei Huang | ae46649 | 2021-02-09 13:28:50 +0800 | [diff] [blame^] | 457 | if not phone_setup_call_hold_unhold_test(self.log, |
| 458 | ads, |
Pei Huang | f5569a0 | 2021-01-28 21:53:07 +0800 | [diff] [blame] | 459 | DIRECTION_MOBILE_TERMINATED, |
| 460 | callee_func=is_phone_in_call_volte): |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 461 | return False |
| 462 | |
| 463 | if not verify_5g_attach_for_both_devices(self.log, ads): |
| 464 | return False |
| 465 | return True |
| 466 | |
| 467 | |
| 468 | @test_tracker_info(uuid="c082a9b0-fb66-4d3a-9fdd-1ce5710624be") |
| 469 | @TelephonyBaseTest.tel_test_wrap |
| 470 | def test_5g_nsa_call_mo_volte_in_active_data_transfer(self): |
| 471 | """Test call can be established during active data connection in 5G NSA. |
| 472 | |
| 473 | Turn off airplane mode, disable WiFi, enable Cellular Data. |
| 474 | Make sure phone in 5G NSA. |
| 475 | Starting downloading file from Internet. |
| 476 | Initiate a MO voice call. Verify call can be established. |
| 477 | Hangup Voice Call, verify file is downloaded successfully. |
| 478 | Note: file download will be suspended when call is initiated if voice |
| 479 | is using voice channel and voice channel and data channel are |
| 480 | on different RATs. |
| 481 | |
| 482 | Returns: |
| 483 | True if success. |
| 484 | False if failed. |
| 485 | """ |
| 486 | ads = self.android_devices |
| 487 | if not phone_setup_volte(self.log, ads[0]): |
| 488 | ads[0].log.error("failed to setup volte") |
| 489 | return False |
| 490 | return self._test_call_setup_in_active_data_transfer_5g_nsa( |
Pei Huang | a8589ff | 2021-01-21 15:31:19 +0800 | [diff] [blame] | 491 | GEN_5G, |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 492 | DIRECTION_MOBILE_ORIGINATED) |
| 493 | |
| 494 | |
| 495 | @test_tracker_info(uuid="aaa98e51-0bde-472a-abc3-5dc180f56a08") |
| 496 | @TelephonyBaseTest.tel_test_wrap |
| 497 | def test_5g_nsa_call_mt_volte_in_active_data_transfer(self): |
| 498 | """Test call can be established during active data connection in 5G NSA. |
| 499 | |
| 500 | Turn off airplane mode, disable WiFi, enable Cellular Data. |
| 501 | Make sure phone in 5G NSA. |
| 502 | Starting downloading file from Internet. |
| 503 | Initiate a MT voice call. Verify call can be established. |
| 504 | Hangup Voice Call, verify file is downloaded successfully. |
| 505 | Note: file download will be suspended when call is initiated if voice |
| 506 | is using voice channel and voice channel and data channel are |
| 507 | on different RATs. |
| 508 | |
| 509 | Returns: |
| 510 | True if success. |
| 511 | False if failed. |
| 512 | """ |
| 513 | ads = self.android_devices |
| 514 | if not phone_setup_volte(self.log, ads[0]): |
| 515 | ads[0].log.error("failed to setup volte") |
| 516 | return False |
| 517 | return self._test_call_setup_in_active_data_transfer_5g_nsa( |
Pei Huang | a8589ff | 2021-01-21 15:31:19 +0800 | [diff] [blame] | 518 | GEN_5G, |
Jaineel | 78a5715 | 2020-12-08 17:03:00 -0800 | [diff] [blame] | 519 | DIRECTION_MOBILE_TERMINATED) |
| 520 | |
| 521 | |
Pei Huang | 1c8f852 | 2020-12-21 19:39:20 +0800 | [diff] [blame] | 522 | @test_tracker_info(uuid="3a607dee-7e92-4567-8ca0-05099590b773") |
| 523 | @TelephonyBaseTest.tel_test_wrap |
| 524 | def test_5g_nsa_volte_in_call_wifi_toggling(self): |
| 525 | """ Test data connection network switching during VoLTE call in 5G NSA. |
| 526 | |
| 527 | 1. Make Sure PhoneA in VoLTE. |
| 528 | 2. Make Sure PhoneB in VoLTE. |
| 529 | 3. Make sure Phones are in 5G NSA |
| 530 | 4. Call from PhoneA to PhoneB. |
| 531 | 5. Toggling Wifi connection in call. |
| 532 | 6. Verify call is active. |
| 533 | 7. Hung up the call on PhoneA |
| 534 | 8. Make sure Phones are in 5G NSA |
| 535 | |
| 536 | Returns: |
| 537 | True if pass; False if fail. |
| 538 | """ |
| 539 | ads = self.android_devices |
| 540 | result = True |
| 541 | if not provision_both_devices_for_volte(self.log, ads): |
| 542 | return False |
| 543 | |
| 544 | time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) |
| 545 | |
| 546 | if not provision_both_devices_for_5g(self.log, ads): |
| 547 | return False |
| 548 | |
| 549 | if not verify_5g_attach_for_both_devices(self.log, ads): |
| 550 | self.log.error("Phone not attached on 5G NSA before call.") |
| 551 | return False |
| 552 | |
| 553 | if not call_setup_teardown(self.log, ads[0], ads[1], None, None, None, |
| 554 | 5): |
| 555 | self.log.error("Call setup failed") |
| 556 | return False |
| 557 | else: |
| 558 | self.log.info("Call setup succeed") |
| 559 | |
| 560 | if not wifi_cell_switching_for_5g_nsa(self.log, ads[0], self.wifi_network_ssid, |
| 561 | self.wifi_network_pass): |
| 562 | ads[0].log.error("Failed to do WIFI and Cell switch in call") |
| 563 | result = False |
| 564 | |
| 565 | if not is_phone_in_call_active(ads[0]): |
| 566 | return False |
| 567 | else: |
| 568 | if not ads[0].droid.telecomCallGetAudioState(): |
| 569 | ads[0].log.error("Audio is not on call") |
| 570 | result = False |
| 571 | else: |
| 572 | ads[0].log.info("Audio is on call") |
| 573 | hangup_call(self.log, ads[0]) |
| 574 | |
| 575 | time.sleep(WAIT_TIME_ANDROID_STATE_SETTLING) |
| 576 | |
| 577 | if not verify_5g_attach_for_both_devices(self.log, ads): |
| 578 | self.log.error("Phone not attached on 5G NSA after call.") |
| 579 | return False |
| 580 | return result |
| 581 | |
| 582 | |
Pei Huang | ab1bcf3 | 2021-01-18 13:48:45 +0800 | [diff] [blame] | 583 | @test_tracker_info(uuid="96b7d8c9-d32a-4abf-8326-6b060d116ac2") |
| 584 | @TelephonyBaseTest.tel_test_wrap |
| 585 | def test_5g_nsa_call_epdg_to_epdg_wfc_wifi_preferred(self): |
| 586 | """ WiFi Preferred, WiFi calling to WiFi Calling test on 5G NSA |
| 587 | |
| 588 | 1. Setup PhoneA WFC mode: WIFI_PREFERRED, APM off. |
| 589 | 2. Setup PhoneB WFC mode: WIFI_PREFERRED, APM off . |
| 590 | 3. Set PhoneA/PhoneB on 5G NSA |
| 591 | 4. Make sure PhoneA/PhoneB on 5G NSA before testing |
| 592 | 5. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneA. |
| 593 | 6. Call from PhoneA to PhoneB, accept on PhoneB, hang up on PhoneB. |
| 594 | 7. Make sure PhoneA/PhoneB on 5G NSA after testing |
| 595 | |
| 596 | Returns: |
| 597 | True if pass; False if fail. |
| 598 | """ |
Pei Huang | f5569a0 | 2021-01-28 21:53:07 +0800 | [diff] [blame] | 599 | return self._test_call_epdg_to_epdg_wfc_5g_nsa( |
Pei Huang | ab1bcf3 | 2021-01-18 13:48:45 +0800 | [diff] [blame] | 600 | self.android_devices, False, WFC_MODE_WIFI_PREFERRED, |
| 601 | self.wifi_network_ssid, self.wifi_network_pass) |
| 602 | |
Pei Huang | 12f44ae | 2021-01-22 23:19:08 +0800 | [diff] [blame] | 603 | |
| 604 | @test_tracker_info(uuid="29fa7f44-8d6a-4948-8178-33c9a9aab334") |
| 605 | @TelephonyBaseTest.tel_test_wrap |
| 606 | def test_5g_nsa_call_mo_volte_in_active_youtube(self): |
| 607 | """Test call can be established during active youtube video on 5G NSA. |
| 608 | |
| 609 | 1. Enable VoLTE on PhoneA. |
| 610 | 2. Set up PhoneA on 5G NSA. |
| 611 | 3. Make sure phoneA is on 5G NSA. |
| 612 | 4. Starting an youtube video. |
| 613 | 5. Initiate a MO voice call. Verify call can be established. |
| 614 | 6. Make sure phoneA is on 5G NSA. |
| 615 | |
| 616 | Returns: |
| 617 | True if success. |
| 618 | False if failed. |
| 619 | """ |
| 620 | if not phone_setup_volte(self.log, self.android_devices[0]): |
| 621 | self.android_devices[0].log.error("Failed to setup VoLTE") |
| 622 | return False |
| 623 | return self._test_call_setup_in_active_youtube_video_5g_nsa( |
| 624 | GEN_5G, |
| 625 | DIRECTION_MOBILE_ORIGINATED) |
| 626 | |
| 627 | @test_tracker_info(uuid="4e138477-3536-48bd-ab8a-7fb7c228b3e6") |
| 628 | @TelephonyBaseTest.tel_test_wrap |
| 629 | def test_5g_nsa_call_mt_volte_in_active_youtube(self): |
| 630 | """Test call can be established during active youtube video on 5G NSA. |
| 631 | |
| 632 | 1. Enable VoLTE on PhoneA. |
| 633 | 2. Set up PhoneA on 5G NSA. |
| 634 | 3. Make sure phoneA is on 5G NSA. |
| 635 | 4. Starting an youtube video. |
| 636 | 5. Initiate a MT voice call. Verify call can be established. |
| 637 | 6. Make sure phoneA is on 5G NSA. |
| 638 | |
| 639 | Returns: |
| 640 | True if success. |
| 641 | False if failed. |
| 642 | """ |
| 643 | if not phone_setup_volte(self.log, self.android_devices[0]): |
| 644 | self.android_devices[0].log.error("Failed to setup VoLTE") |
| 645 | return False |
| 646 | return self._test_call_setup_in_active_youtube_video_5g_nsa( |
| 647 | GEN_5G, |
| 648 | DIRECTION_MOBILE_TERMINATED) |
| 649 | |
Pei Huang | 4ac562a | 2021-01-22 17:05:29 +0800 | [diff] [blame] | 650 | |
| 651 | @test_tracker_info(uuid="0d477f6f-3464-4b32-a5e5-0fd134f2753d") |
| 652 | @TelephonyBaseTest.tel_test_wrap |
| 653 | def test_5g_nsa_call_mo_vowifi_in_active_data_transfer(self): |
| 654 | """Test MO voice wifi call can be established during active data connection on 5G NSA. |
| 655 | |
| 656 | 1. Turn off airplane mode, turn on wfc and wifi on phoneA. |
| 657 | 2. Set PhoneA on 5G NSA |
| 658 | 3. Make sure PhoneA on 5G NSA before testing |
| 659 | 4. Starting downloading file from Internet. |
| 660 | 5. Initiate a MO voice call. Verify call can be established. |
| 661 | 6. Hangup Voice Call, verify file is downloaded successfully. |
| 662 | 7. Make sure PhoneA on 5G NSA after testing |
| 663 | |
| 664 | Returns: |
| 665 | True if success. |
| 666 | False if failed. |
| 667 | """ |
| 668 | if not phone_setup_iwlan(self.log, self.android_devices[0], False, |
| 669 | WFC_MODE_WIFI_PREFERRED, |
| 670 | self.wifi_network_ssid, |
| 671 | self.wifi_network_pass): |
| 672 | self.android_devices[0].log.error( |
| 673 | "Failed to setup iwlan with APM off and WIFI and WFC on") |
| 674 | return False |
| 675 | |
| 676 | return self._test_call_setup_in_active_data_transfer_5g_nsa( |
| 677 | call_direction=DIRECTION_MOBILE_ORIGINATED) |
| 678 | |
| 679 | |
| 680 | @test_tracker_info(uuid="4d1d7dd9-b373-4361-8301-8517ef77b57b") |
| 681 | @TelephonyBaseTest.tel_test_wrap |
| 682 | def test_5g_nsa_call_mt_vowifi_in_active_data_transfer(self): |
| 683 | """Test MT voice wifi call can be established during active data connection on 5G NSA. |
| 684 | |
| 685 | 1. Turn off airplane mode, turn on wfc and wifi on phoneA. |
| 686 | 2. Set PhoneA on 5G NSA |
| 687 | 3. Make sure PhoneA on 5G NSA before testing |
| 688 | 4. Starting downloading file from Internet. |
| 689 | 5. Initiate a MT voice call. Verify call can be established. |
| 690 | 6. Hangup Voice Call, verify file is downloaded successfully. |
| 691 | 7. Make sure PhoneA on 5G NSA after testing |
| 692 | |
| 693 | Returns: |
| 694 | True if success. |
| 695 | False if failed. |
| 696 | """ |
| 697 | if not phone_setup_iwlan(self.log, self.android_devices[0], False, |
| 698 | WFC_MODE_WIFI_PREFERRED, |
| 699 | self.wifi_network_ssid, |
| 700 | self.wifi_network_pass): |
| 701 | self.android_devices[0].log.error( |
| 702 | "Failed to setup iwlan with APM off and WIFI and WFC on") |
| 703 | return False |
| 704 | |
| 705 | return self._test_call_setup_in_active_data_transfer_5g_nsa( |
| 706 | call_direction=DIRECTION_MOBILE_TERMINATED) |
| 707 | |
Pei Huang | f5569a0 | 2021-01-28 21:53:07 +0800 | [diff] [blame] | 708 | |
| 709 | @test_tracker_info(uuid="e360bc3a-96b3-4fdf-9bf3-fe3aa08b1af5") |
| 710 | @TelephonyBaseTest.tel_test_wrap |
| 711 | def test_5g_nsa_call_epdg_mo_hold_unhold_wfc_wifi_preferred(self): |
| 712 | """ WiFi Preferred, WiFi calling MO call hold/unhold test on 5G NSA |
| 713 | |
| 714 | 1. Setup PhoneA WFC mode: WIFI_PREFERRED. |
| 715 | 2. Set preferred network of phoneA on 5G NSA |
| 716 | 3. Verify phoneA is on 5G NSA. |
| 717 | 4. Call from PhoneA to PhoneB, accept on PhoneB. |
| 718 | 5. Hold and unhold on PhoneA. |
| 719 | 6. Verify phoneA is on 5G NSA. |
| 720 | |
| 721 | Returns: |
| 722 | True if pass; False if fail. |
| 723 | """ |
| 724 | ads = self.android_devices |
| 725 | if not phone_setup_iwlan(self.log, self.android_devices[0], False, |
| 726 | WFC_MODE_WIFI_PREFERRED, |
| 727 | self.wifi_network_ssid, |
| 728 | self.wifi_network_pass): |
| 729 | self.android_devices[0].log.error( |
| 730 | "Failed to setup iwlan with APM off and WIFI and WFC on") |
| 731 | return False |
| 732 | # Mode Pref |
| 733 | set_preferred_mode_for_5g(ads[0]) |
| 734 | |
| 735 | # Attach nsa5g |
| 736 | if not is_current_network_5g_nsa(ads[0]): |
| 737 | ads[0].log.error("Phone not attached on 5G NSA before call.") |
| 738 | return False |
| 739 | |
Pei Huang | ae46649 | 2021-02-09 13:28:50 +0800 | [diff] [blame^] | 740 | if not phone_setup_call_hold_unhold_test(self.log, |
| 741 | ads, |
Pei Huang | f5569a0 | 2021-01-28 21:53:07 +0800 | [diff] [blame] | 742 | DIRECTION_MOBILE_ORIGINATED, |
| 743 | caller_func=is_phone_in_call_iwlan): |
| 744 | return False |
| 745 | |
| 746 | if not is_current_network_5g_nsa(ads[0]): |
| 747 | ads[0].log.error("Phone not attached on 5G NSA after call.") |
| 748 | return False |
| 749 | return True |
| 750 | |
| 751 | |
| 752 | @test_tracker_info(uuid="d2335c83-87ec-4a0e-97a8-b53f769b0d21") |
| 753 | @TelephonyBaseTest.tel_test_wrap |
| 754 | def test_5g_nsa_call_epdg_mt_hold_unhold_wfc_wifi_preferred(self): |
| 755 | """ WiFi Preferred, WiFi calling MT call hold/unhold test on 5G NSA |
| 756 | |
| 757 | 1. Setup PhoneA WFC mode: WIFI_PREFERRED. |
| 758 | 2. Set preferred network of phoneA on 5G NSA |
| 759 | 3. Verify if phoneA is on 5G NSA. |
| 760 | 4. Call from PhoneB to PhoneA, accept on PhoneA. |
| 761 | 5. Hold and unhold on PhoneA. |
| 762 | 6. Verify if phoneA is on 5G NSA. |
| 763 | |
| 764 | Returns: |
| 765 | True if pass; False if fail. |
| 766 | """ |
| 767 | ads = self.android_devices |
| 768 | if not phone_setup_iwlan(self.log, self.android_devices[0], False, |
| 769 | WFC_MODE_WIFI_PREFERRED, |
| 770 | self.wifi_network_ssid, |
| 771 | self.wifi_network_pass): |
| 772 | self.android_devices[0].log.error( |
| 773 | "Failed to setup iwlan with APM off and WIFI and WFC on") |
| 774 | return False |
| 775 | # Mode Pref |
| 776 | set_preferred_mode_for_5g(ads[0]) |
| 777 | |
| 778 | # Attach nsa5g |
| 779 | if not is_current_network_5g_nsa(ads[0]): |
| 780 | ads[0].log.error("Phone not attached on 5G NSA before call.") |
| 781 | return False |
| 782 | |
Pei Huang | ae46649 | 2021-02-09 13:28:50 +0800 | [diff] [blame^] | 783 | if not phone_setup_call_hold_unhold_test(self.log, |
| 784 | ads, |
Pei Huang | f5569a0 | 2021-01-28 21:53:07 +0800 | [diff] [blame] | 785 | DIRECTION_MOBILE_TERMINATED, |
| 786 | callee_func=is_phone_in_call_iwlan): |
| 787 | return False |
| 788 | |
| 789 | if not is_current_network_5g_nsa(ads[0]): |
| 790 | ads[0].log.error("Phone not attached on 5G NSA after call.") |
| 791 | return False |
| 792 | return True |
| 793 | |
Pei Huang | ab1bcf3 | 2021-01-18 13:48:45 +0800 | [diff] [blame] | 794 | """ Tests End """ |