1#!/usr/bin/env python3 2# 3# Copyright 2021 - The Android Open Source Project 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 18 19import time 20import logging 21from acts import asserts 22from acts import signals 23from acts.test_decorators import test_tracker_info 24from acts.libs.utils.multithread import multithread_func 25from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest 26from acts_contrib.test_utils.tel.GFTInOutBaseTest import GFTInOutBaseTest 27from acts_contrib.test_utils.tel.tel_atten_utils import set_rssi 28from acts_contrib.test_utils.tel.gft_inout_defines import VOICE_CALL 29from acts_contrib.test_utils.tel.gft_inout_defines import VOLTE_CALL 30from acts_contrib.test_utils.tel.gft_inout_defines import CSFB_CALL 31from acts_contrib.test_utils.tel.gft_inout_defines import WFC_CALL 32from acts_contrib.test_utils.tel.gft_inout_defines import NO_VOICE_CALL 33from acts_contrib.test_utils.tel.gft_inout_defines import NO_SERVICE_POWER_LEVEL 34from acts_contrib.test_utils.tel.gft_inout_defines import IN_SERVICE_POWER_LEVEL 35from acts_contrib.test_utils.tel.gft_inout_defines import NO_SERVICE_TIME 36from acts_contrib.test_utils.tel.gft_inout_defines import WAIT_FOR_SERVICE_TIME 37from acts_contrib.test_utils.tel.gft_inout_utils import check_back_to_service_time 38from acts_contrib.test_utils.tel.gft_inout_utils import mo_voice_call 39from acts_contrib.test_utils.tel.gft_inout_utils import get_voice_call_type 40from acts_contrib.test_utils.tel.gft_inout_utils import browsing_test_ping_retry 41from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_CELLULAR_PREFERRED 42from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED 43from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_DISABLED 44from acts_contrib.test_utils.tel.tel_defines import CALL_STATE_ACTIVE 45from acts_contrib.test_utils.tel.tel_defines import CALL_STATE_HOLDING 46from acts_contrib.test_utils.tel.tel_data_utils import browsing_test 47from acts_contrib.test_utils.tel.tel_ims_utils import toggle_wfc 48from acts_contrib.test_utils.tel.tel_ims_utils import toggle_volte 49from acts_contrib.test_utils.tel.tel_ims_utils import wait_for_ims_registered 50from acts_contrib.test_utils.tel.tel_logging_utils import log_screen_shot 51from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_setup_iwlan 52from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_setup_volte 53from acts_contrib.test_utils.tel.tel_test_utils import toggle_airplane_mode 54from acts_contrib.test_utils.tel.tel_voice_utils import hangup_call 55from acts_contrib.test_utils.tel.gft_inout_utils import verify_data_connection 56from acts_contrib.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL 57 58WAIT_TIME_AT_NO_SERVICE_AREA = 300 59 60 61class TelLabGFTVoWifiTest(GFTInOutBaseTest): 62 63 def __init__(self, controllers): 64 GFTInOutBaseTest.__init__(self, controllers) 65 self.wifi_ssid = self.user_params.get('wifi_network_ssid') 66 self.wifi_pw = self.user_params.get('wifi_network_pw') 67 self.my_error_msg = "" 68 self.rssi = "" 69 logging.info("wifi_ssid = %s" %self.wifi_ssid) 70 logging.info("wifi_pw = %s" %self.wifi_pw ) 71 72 def setup_test(self): 73 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 74 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 75 GFTInOutBaseTest.setup_test(self) 76 for ad in self.android_devices: 77 ad.droid.wifiToggleState(True) 78 # Ensure IMS on 79 self.log.info("Turn on ims") 80 tasks = [(phone_setup_volte, (self.log, ad, )) for ad in self.android_devices] 81 if not multithread_func(self.log, tasks): 82 for ad in self.android_devices: 83 log_screen_shot(ad, self.test_name) 84 error_msg = "fail to setup volte" 85 self.log.error(error_msg) 86 asserts.assert_true(False, "Fail: %s." %(error_msg), 87 extras={"failure_cause": self.my_error_msg}) 88 asserts.skip(error_msg) 89 # ensure WFC is enabled 90 tasks = [(toggle_wfc, (self.log, ad,True)) for ad in self.android_devices] 91 if not multithread_func(self.log, tasks): 92 for ad in self.android_devices: 93 log_screen_shot(ad, self.test_name) 94 error_msg = "device does not support WFC! Skip test" 95 asserts.skip(error_msg) 96 97 98 def teardown_test(self): 99 super().teardown_test() 100 tasks = [(toggle_airplane_mode, (self.log, ad, False)) 101 for ad in self.android_devices] 102 multithread_func(self.log, tasks) 103 104 105 @test_tracker_info(uuid="21ec1aff-a161-4dc9-9682-91e0dd8a13a7") 106 @TelephonyBaseTest.tel_test_wrap 107 def test_wfc_in_out_wifi(self, loop=1, wfc_mode=WFC_MODE_WIFI_PREFERRED): 108 """ 109 Enable Wi-Fi calling in Wi-Fi Preferred mode and connect to a 110 valid Wi-Fi AP. Test VoWiFi call under WiFi and cellular area 111 -> move to WiFi only area -> move to Cellular only area 112 Args: 113 loop: repeat this test cases for how many times 114 wfc_mode: wfc mode 115 Returns: 116 True if pass; False if fail 117 """ 118 test_result = True 119 for x in range(self.user_params.get("wfc_cycle", 1)): 120 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 121 self.log.info("Start test at cellular and wifi area") 122 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 123 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 124 self.check_network() 125 if self._enable_wifi_calling(wfc_mode): 126 if not self._voice_call(self.android_devices, WFC_CALL, end_call=True): 127 self.log.info("VoWiFi call failure") 128 return False 129 self.log.info("Move to no service area and wifi area") 130 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 131 time.sleep(WAIT_TIME_AT_NO_SERVICE_AREA) 132 # check call status 133 for ad in self.android_devices: 134 get_voice_call_type(ad) 135 self.log.info("Move back to service area and no wifi area") 136 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 137 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 138 self.log.info("check cellular data") 139 # self._data_retry_mechanism() 140 tasks = [(verify_data_connection, (ad, 3)) 141 for ad in self.android_devices] 142 if not multithread_func(self.log, tasks): 143 self.log.info("verify_data_connection failure") 144 self.log.info("Verify device state after in-out service") 145 tasks = [(check_back_to_service_time, (ad,)) for ad in self.android_devices] 146 test_result = multithread_func(self.log, tasks) 147 if test_result: 148 test_result = self._voice_call(self.android_devices, VOICE_CALL) 149 else: 150 self.log.info("device is not back to service") 151 return test_result 152 153 def _enable_wifi_calling(self, wfc_mode, call_type=NO_VOICE_CALL, 154 end_call=True, is_airplane_mode=False, talk_time=30): 155 """ Enable Wi-Fi calling in Wi-Fi Preferred mode and connect to a 156 valid Wi-Fi AP. 157 158 Args: 159 wfc_mode: wfc mode 160 call_type: None would not make any calls 161 end_call: hang up call 162 is_airplane_mode: toggle airplane mode on or off 163 talk_time: call duration 164 165 Returns: 166 True if pass; False if fail. 167 """ 168 self.log.info("Move in WiFi area and set WFC mode to %s, airplane mode=%s" 169 %(wfc_mode, is_airplane_mode)) 170 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 171 time.sleep(10) 172 tasks = [(phone_setup_iwlan, (self.log, ad, is_airplane_mode, wfc_mode, 173 self.wifi_ssid)) 174 for ad in self.android_devices] 175 if not multithread_func(self.log, tasks): 176 self.my_error_msg += "fail to setup WFC mode to %s, " %(wfc_mode) 177 raise signals.TestFailure(self.my_error_msg) 178 if call_type != NO_VOICE_CALL: 179 if not self._voice_call(self.android_devices, call_type, end_call, talk_time): 180 self.log.error("%s failuer" %call_type) 181 return False 182 return True 183 184 def _voice_call(self, ads, call_type, end_call=True, talk_time=15): 185 """ Enable Wi-Fi calling in Wi-Fi Preferred mode and connect to a 186 valid Wi-Fi AP. 187 Args: 188 ads: android devices 189 call_type: WFC call, VOLTE call. CSFB call, voice call 190 end_call: hangup call after voice call flag 191 talk_time: in call duration in sec 192 Returns: 193 True if pass; False if fail. 194 """ 195 tasks = [(mo_voice_call, (self.log, ad, call_type, end_call, talk_time)) 196 for ad in ads] 197 if not multithread_func(self.log, tasks): 198 error_msg = "%s failure" %(call_type) 199 self.log.error(error_msg) 200 self.my_error_msg += error_msg 201 return False 202 return True 203 204 @test_tracker_info(uuid="3ca05651-a6c9-4b6b-84c0-a5d761757061") 205 @TelephonyBaseTest.tel_test_wrap 206 def test_in_out_idle_wifi_preferred(self, wfc_mode=WFC_MODE_WIFI_PREFERRED): 207 ''' In/Out Service - Idle + VoWiFi registered in Wi-Fi Preferred mode 208 Enable Wi-Fi calling in Wi-Fi Preferred mode and connect to a valid Wi-Fi AP. 209 Idle in service area. 210 Move to no service area for 1 minute when idle. 211 Move back to service area and verfiy device status. 212 213 Args: 214 loop: repeat this test cases for how many times 215 wfc_mode: wfc mode 216 217 Returns: 218 True if pass; False if fail 219 Raises: 220 TestFailure if not success. 221 ''' 222 return self._in_out_wifi_wfc_mode(1, wfc_mode) 223 224 225 @test_tracker_info(uuid="b06121de-f458-4fc0-b9ef-efac02e46181") 226 @TelephonyBaseTest.tel_test_wrap 227 def test_in_out_idle_cellular_preferred(self, loop=1,wfc_mode=WFC_MODE_CELLULAR_PREFERRED): 228 ''' In/Out Service - Idle + VoLTE registered in Cellular preferred mode 229 Enable Wi-Fi calling in Cellular preferred mode and connect to a valid Wi-Fi AP. 230 Idle in service area. 231 Move to no service area for 1 minute when idle. 232 Move back to service area and verify device status 233 234 Args: 235 loop: repeat this test cases for how many times 236 wfc_mode: wfc mode 237 238 Returns: 239 True if pass; False if fail 240 Raises: 241 TestFailure if not success. 242 ''' 243 asserts.assert_true(self._in_out_wifi_wfc_mode(1, WFC_MODE_CELLULAR_PREFERRED), 244 "Fail: %s." %(self.my_error_msg), extras={"failure_cause": self.my_error_msg}) 245 246 def _in_out_wifi_wfc_mode(self, loop=1, wfc_mode=WFC_MODE_CELLULAR_PREFERRED): 247 error_msg = "" 248 test_result = True 249 for x in range(self.user_params.get("wfc_cycle", 1)): 250 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 251 self.my_error_msg += "cylce%s: " %(x+1) 252 self.log.info("Move in Wi-Fi area and set to %s" %(wfc_mode)) 253 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 254 if not self._enable_wifi_calling(wfc_mode): 255 error_msg = "Fail to setup WFC mode" 256 self.log.info(error_msg) 257 self.my_error_msg += error_msg 258 return False 259 self.log.info("Idle in service area") 260 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 261 self.check_network() 262 263 self.log.info("Move to no service area in idle mode for 1 min") 264 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 265 time.sleep(NO_SERVICE_TIME) 266 267 self.log.info("Move back to service area and verify device status") 268 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 269 self.log.info("Verify device status after in-out service") 270 tasks = [(check_back_to_service_time, (ad,)) for ad in self.android_devices] 271 test_result = multithread_func(self.log, tasks) 272 if test_result: 273 tasks = [(self.verify_device_status, (ad, VOICE_CALL)) 274 for ad in self.android_devices] 275 if not multithread_func(self.log, tasks): 276 error_msg = "verify_device_status fail, " 277 self.log.info(error_msg) 278 else: 279 error_msg = "device is not back to service, " 280 self.log.info(error_msg) 281 self.my_error_msg += error_msg 282 return test_result 283 284 @test_tracker_info(uuid="95bf5006-4ff6-4e7e-a02d-156e6b43f129") 285 @TelephonyBaseTest.tel_test_wrap 286 def test_in_out_wifi_apm_on(self): 287 ''' 288 1.1.4 In/Out Service - Idle + VoWiFi registered in Airplane on 289 + Wi-Fi on in default mode 290 291 Returns: 292 True if pass; False if fail 293 Raises: 294 TestFailure if not success. 295 ''' 296 asserts.assert_true(self._ID_1_1_4_in_out_vowifi(1, 180), "Fail: %s." 297 %(self.my_error_msg), extras={"failure_cause": self.my_error_msg}) 298 asserts.assert_true(self._ID_1_1_4_in_out_vowifi(1, 60), "Fail: %s." 299 %(self.my_error_msg), extras={"failure_cause": self.my_error_msg}) 300 return True 301 302 def _ID_1_1_4_in_out_vowifi(self, loop=1, idle_time=60): 303 ''' 304 1.1.4 In/Out Service - Idle + VoWiFi registered in Airplane on 305 + Wi-Fi on in default mode 306 307 Args: 308 loop: repeat this test cases for how many times 309 idle_time: at no service area 310 311 Returns: 312 True if pass; False if fail 313 ''' 314 error_msg = "" 315 test_result = True 316 for x in range(self.user_params.get("wfc_cycle", 1)): 317 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 318 self.my_error_msg += "cylce%s: " %(x+1) 319 self.log.info("Enable Wi-Fi calling in Airplane on") 320 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 321 322 ad = self.android_devices[0] 323 wfc_mode = ad.droid.imsGetWfcMode() 324 tasks = [(phone_setup_iwlan, (self.log, ad, True, wfc_mode, self.wifi_ssid)) 325 for ad in self.android_devices] 326 if not multithread_func(self.log, tasks): 327 self.my_error_msg += "fail to setup WFC mode to %s, " %(wfc_mode) 328 raise signals.TestFailure(self.my_error_msg) 329 self.log.info("idle in service area") 330 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 331 time.sleep(10) 332 self.log.info("Move to no service area for %s sec" %(idle_time)) 333 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 334 time.sleep(idle_time) 335 336 self.log.info("Move back to service area and verify device status") 337 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 338 self.log.info("Verify device status after in-out service") 339 tasks = [(check_back_to_service_time, (ad,)) for ad in self.android_devices] 340 test_result = multithread_func(self.log, tasks) 341 if test_result: 342 tasks = [(self.verify_device_status, (ad, VOICE_CALL)) 343 for ad in self.android_devices] 344 test_result = multithread_func(self.log, tasks) 345 if not test_result: 346 error_msg = "verify_device_status fail, " 347 else: 348 error_msg = "device is not back to service, " 349 self.log.info(error_msg) 350 return test_result 351 352 353 def _device_status_check(self, call_type=None, end_call=True, 354 talk_time=30, verify_data=True, verify_voice=True): 355 ''' 356 Check device status 357 Args: 358 ad: android device 359 call_type: WFC call, VOLTE call. CSFB call, voice call 360 end_call: hangup call after voice call flag 361 talk_time: in call duration in sec 362 verify_data: flag to check data connection 363 verify_voice: flag to check voice 364 Returns: 365 True if pass; False if fail 366 ''' 367 tasks = [(check_back_to_service_time, (ad,)) 368 for ad in self.android_devices] 369 if multithread_func(self.log, tasks): 370 tasks = [(self.verify_device_status, (ad, call_type, end_call, 371 talk_time, verify_data, verify_voice)) for ad in self.android_devices] 372 if not multithread_func(self.log, tasks): 373 self.my_error_msg += "Verify_device_status fail, " 374 return False 375 else: 376 self.my_error_msg += "device is not back to service, " 377 return False 378 return True 379 380 def _move_in_out_wifi_cellular_area(self, cellular_power_level, 381 wifi_power_level, hangup=False): 382 ''' 383 Moves in out wifi/cellular area 384 385 Args: 386 cellular_power_level: cellular power level 387 wifi_power_level: wifi power level 388 389 Raises: 390 TestFailure if not success. 391 392 Returns: 393 True if pass; False if fail 394 ''' 395 self.adjust_cellular_signal(cellular_power_level) 396 self.adjust_wifi_signal(wifi_power_level) 397 time.sleep(WAIT_FOR_SERVICE_TIME) 398 tasks = [(wait_for_ims_registered, (self.log, ad, )) 399 for ad in self.android_devices] 400 if not multithread_func(self.log, tasks): 401 return False 402 if hangup: 403 for ad in self.android_devices: 404 hangup_call(self.log, ad) 405 time.sleep(3) 406 return True 407 408 @test_tracker_info(uuid="7d308a3e-dc01-4bc1-b986-14f6adc9d2ed") 409 @TelephonyBaseTest.tel_test_wrap 410 def test_hand_in_out_vowifi_incall (self, loop=1, wfc_mode = WFC_MODE_WIFI_PREFERRED): 411 '''1.2.17 - [Wi-Fi Preferred] Hand In/Out while VoWiFi incall 412 413 Args: 414 loop: repeat this test cases for how many times 415 wfc_mode: wfc mode 416 417 Raises: 418 TestFailure if not success. 419 Returns: 420 True if pass; False if fail 421 ''' 422 test_result = True 423 for x in range(self.user_params.get("wfc_cycle", 1)): 424 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 425 self.log.info("Start test at wifi area and no service area") 426 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 427 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 428 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 429 end_call=False): 430 self.log.info("WFC call failure") 431 test_result = False 432 self.log.info("Move out Wi-Fi area to VoLTE area") 433 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 434 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 435 time.sleep(WAIT_FOR_SERVICE_TIME) 436 self.log.info("check cellular data") 437 # self._data_retry_mechanism() 438 tasks = [(verify_data_connection, (ad, 3)) 439 for ad in self.android_devices] 440 if not multithread_func(self.log, tasks): 441 self.log.info("verify_data_connection failure") 442 for ad in self.android_devices: 443 hangup_call(self.log, ad) 444 # Make a MO VoLTE call and verify data connection 445 if not self._voice_call(self.android_devices, VOLTE_CALL, False): 446 self.log.info("VOLTE call failure") 447 test_result = False 448 #Move back to Wi-Fi area during incall. 449 self.log.info("Move back to Wi-Fi area during incall.") 450 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 451 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 452 time.sleep(WAIT_FOR_SERVICE_TIME) 453 for ad in self.android_devices: 454 hangup_call(self.log, ad) 455 # check device status 456 test_result = self._device_status_check() 457 return test_result 458 459 460 @test_tracker_info(uuid="9dda069f-068c-47c8-b9e1-2b1a0f3a6bdd") 461 @TelephonyBaseTest.tel_test_wrap 462 def test_hand_in_out_vowifi_incall_stress_ims_on(self, loop=1, 463 wfc_mode=WFC_MODE_WIFI_PREFERRED): 464 ''' 465 1.2.18 - [Wi-Fi Preferred] Hand In/Out while VoWiFi incall 466 - Stress, IMS on 467 468 Args: 469 loop: repeat this test cases for how many times 470 wfc_mode: wfc mode 471 Raises: 472 TestFailure if not success. 473 Returns: 474 True if pass; False if fail 475 ''' 476 test_result = True 477 for x in range(self.user_params.get("wfc_cycle", 1)): 478 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 479 self.log.info("Start test at wifi area and service area") 480 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 481 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 482 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 483 end_call=False): 484 raise signals.TestFailure("VoWiFi call failure: %s" 485 %(self.my_error_msg)) 486 # Move out Wi-Fi area to VoLTE area during incall. 487 self.log.info("Move out Wi-Fi area to VoLTE area") 488 if not self._move_in_out_wifi_cellular_area( 489 IN_SERVICE_POWER_LEVEL,NO_SERVICE_POWER_LEVEL): 490 raise signals.TestFailure("ims is not registered: %s" 491 %(self.my_error_msg)) 492 self.log.info("Move back to Wi-Fi area") 493 if not self._move_in_out_wifi_cellular_area( 494 IN_SERVICE_POWER_LEVEL, IN_SERVICE_POWER_LEVEL, True): 495 raise signals.TestFailure("ims is not registered: %s" 496 %(self.my_error_msg)) 497 if not self._device_status_check(): 498 raise signals.TestFailure(self.my_error_msg) 499 return test_result 500 501 502 @test_tracker_info(uuid="e3633a6b-425a-4e4f-a58c-2d6aea56ec96") 503 @TelephonyBaseTest.tel_test_wrap 504 def test_hand_in_out_vowifi_incall_stress_ims_off(self, loop=1, 505 wfc_mode = WFC_MODE_WIFI_PREFERRED): 506 ''' 507 [Wi-Fi Preferred] Hand In/Out while VoWiFi incall - 508 Hand In/Out stress, IMS on - Hand In/Out, IMS off 509 510 Args: 511 loop: repeat this test cases for how many times 512 wfc_mode: wfc mode 513 514 Raises: 515 TestFailure if not success. 516 517 Returns: 518 True if pass; False if fail 519 ''' 520 for x in range(self.user_params.get("wfc_cycle", 1)): 521 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 522 tasks = [(toggle_volte, (self.log, ad, False)) 523 for ad in self.android_devices] 524 if not multithread_func(self.log, tasks): 525 raise signals.TestFailure("fail to turn off IMS: %s" 526 %(self.my_error_msg)) 527 self.log.info("Start test at wifi area and service area") 528 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 529 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 530 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 531 end_call=False): 532 raise signals.TestFailure("VoWiFi call failure: %s" 533 %(self.my_error_msg)) 534 #Move out Wi-Fi area to VoLTE area during incall. 535 self.log.info("Move out Wi-Fi area to VoLTE area") 536 self._move_in_out_wifi_cellular_area( 537 IN_SERVICE_POWER_LEVEL, IN_SERVICE_POWER_LEVEL) 538 time.sleep(3) 539 #Make a MO CSFB call " 540 if not self._voice_call(self.android_devices, CSFB_CALL, False): 541 raise signals.TestFailure("CSFB call failure: %s" 542 %(self.my_error_msg)) 543 #Move back to Wi-Fi area during incall. 544 self.log.info("Move to WiFi only area and no VoLTE area") 545 self._move_in_out_wifi_cellular_area(NO_SERVICE_POWER_LEVEL, 546 IN_SERVICE_POWER_LEVEL, True) 547 if not self._device_status_check(): 548 raise signals.TestFailure(self.my_error_msg) 549 return True 550 551 552 553 @test_tracker_info(uuid="1f0697e5-6798-4cb1-af3f-c246cac59a40") 554 @TelephonyBaseTest.tel_test_wrap 555 def test_rove_in_out_ims_on_cellular_preferred(self, loop=1, 556 wfc_mode=WFC_MODE_CELLULAR_PREFERRED): 557 ''' 558 [Cellular Preferred] Rove In/Out when idle - IMS on 559 560 Args: 561 loop: repeat this test cases for how many times 562 wfc_mode: wfc mode 563 564 Raises: 565 TestFailure if not success. 566 567 Returns: 568 True if pass; False if fail 569 ''' 570 for x in range(self.user_params.get("roveinout_cycle", 1)): 571 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 572 self.log.info("Move in Wi-Fi area in cellular preferred mode") 573 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 574 time.sleep(10) 575 if not self._enable_wifi_calling(wfc_mode, call_type=VOLTE_CALL, 576 end_call=False): 577 raise signals.TestFailure("VoLTE call failure: %s" 578 %(self.my_error_msg)) 579 580 self.log.info("Move out Wi-Fi area to VoLTE area") 581 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 582 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 583 time.sleep(WAIT_FOR_SERVICE_TIME) 584 self.log.info("check cellular data") 585 # self._data_retry_mechanism() 586 tasks = [(verify_data_connection, (ad, 3)) 587 for ad in self.android_devices] 588 if not multithread_func(self.log, tasks): 589 self.log.info("verify_data_connection failure") 590 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 591 tasks = [(wait_for_ims_registered, (self.log, ad, )) for ad in self.android_devices] 592 if not multithread_func(self.log, tasks): 593 raise signals.TestFailure("IMS is not registered: %s" 594 %(self.my_error_msg)) 595 if not self._device_status_check(): 596 raise signals.TestFailure(self.my_error_msg) 597 return True 598 599 600 @test_tracker_info(uuid="89690d28-e21e-4baf-88cf-be04675b764b") 601 @TelephonyBaseTest.tel_test_wrap 602 def test_rove_in_out_ims_on_wifi_preferred(self, loop=1, wfc_mode=WFC_MODE_WIFI_PREFERRED): 603 ''' 1.2.154 - [Wi-Fi Preferred] Rove In/Out when idle - IMS on 604 605 Args: 606 loop: repeat this test cases for how many times 607 wfc_mode: wfc mode 608 609 Raises: 610 TestFailure if not success. 611 612 Returns: 613 True if pass; False if fail 614 ''' 615 for x in range(self.user_params.get("roveinout_cycle", 1)): 616 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 617 self.log.info("Move in Wi-Fi area in wifi preferred mode") 618 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 619 time.sleep(10) 620 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 621 end_call=False): 622 raise signals.TestFailure("VoWiFi call failure: %s" 623 %(self.my_error_msg)) 624 625 self.log.info("Move out Wi-Fi area to VoLTE area when idle.") 626 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 627 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 628 629 tasks = [(wait_for_ims_registered, (self.log, ad, )) 630 for ad in self.android_devices] 631 if not multithread_func(self.log, tasks): 632 raise signals.TestFailure("IMS is not registered: %s" 633 %(self.my_error_msg)) 634 self.log.info("check cellular data") 635 # self._data_retry_mechanism() 636 tasks = [(verify_data_connection, (ad, 3)) 637 for ad in self.android_devices] 638 if not multithread_func(self.log, tasks): 639 self.log.info("verify_data_connection failure") 640 self.log.info("Move back to Wi-Fi area when idle.") 641 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 642 643 tasks = [(wait_for_ims_registered, (self.log, ad, )) 644 for ad in self.android_devices] 645 if not multithread_func(self.log, tasks): 646 raise signals.TestFailure("IMS is not registered: %s" 647 %(self.my_error_msg)) 648 if not self._device_status_check(): 649 raise signals.TestFailure(self.my_error_msg) 650 return True 651 652 653 @test_tracker_info(uuid="cd453193-4769-4fa5-809c-a6afb1d833c3") 654 @TelephonyBaseTest.tel_test_wrap 655 def test_rove_in_out_ims_off_wifi_preferred(self, loop=1, wfc_mode=WFC_MODE_WIFI_PREFERRED): 656 ''' [Wi-Fi Preferred] Rove In/Out when idle - IMS off 657 658 Args: 659 loop: repeat this test cases for how many times 660 wfc_mode: wfc mode 661 662 Raises: 663 TestFailure if not success. 664 665 Returns: 666 True if pass; False if fail 667 ''' 668 for x in range(self.user_params.get("roveinout_cycle", 1)): 669 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 670 self.log.info("Turn off IMS") 671 tasks = [(toggle_volte, (self.log, ad, False)) 672 for ad in self.android_devices] 673 if not multithread_func(self.log, tasks): 674 raise signals.TestFailure("fail to turn off IMS: %s" 675 %(self.my_error_msg)) 676 self.log.info("Move in Wi-Fi area in wifi preferred mode") 677 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 678 time.sleep(10) 679 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 680 end_call=False): 681 raise signals.TestFailure("VoWiFi call failure: %s" 682 %(self.my_error_msg)) 683 684 self.log.info("Move out Wi-Fi area to VoLTE area when idle.") 685 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 686 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 687 688 tasks = [(wait_for_ims_registered, (self.log, ad, )) 689 for ad in self.android_devices] 690 if not multithread_func(self.log, tasks): 691 raise signals.TestFailure("IMS is not registered: %s" 692 %(self.my_error_msg)) 693 self.log.info("check cellular data") 694 # self._data_retry_mechanism() 695 tasks = [(verify_data_connection, (ad, 3)) 696 for ad in self.android_devices] 697 if not multithread_func(self.log, tasks): 698 self.log.info("verify_data_connection failure") 699 self.log.info("Move back to Wi-Fi area when idle.") 700 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 701 702 tasks = [(wait_for_ims_registered, (self.log, ad, )) 703 for ad in self.android_devices] 704 if not multithread_func(self.log, tasks): 705 raise signals.TestFailure("IMS is not registered: %s" 706 %(self.my_error_msg)) 707 if not self._device_status_check(): 708 raise signals.TestFailure(self.my_error_msg) 709 return True 710 711 712 @test_tracker_info(uuid="2632e594-3715-477b-b905-405ac8e490a9") 713 @TelephonyBaseTest.tel_test_wrap 714 def test_vowifi_airplane_mode_on(self): 715 ''' 716 Enable Wi-Fi calling in Airplane on + Wi-Fi on in default mode and 717 connect to a valid Wi-Fi AP. 718 Make a MO VoWiFi call in service area. 719 Move to no service area for 1 minute during incall. 720 Move back to service area 721 722 Returns: 723 True if pass; False if fail 724 Raises: 725 TestFailure if not success. 726 ''' 727 asserts.assert_true(self._ID_1_1_11_vowifi_airplane_mode_on(1, 60), 728 "Fail: %s." %(self.my_error_msg), extras={"failure_cause": self.my_error_msg}) 729 asserts.assert_true(self._ID_1_1_11_vowifi_airplane_mode_on(1, 180), 730 "Fail: %s." %(self.my_error_msg), extras={"failure_cause": self.my_error_msg}) 731 return True 732 733 def _ID_1_1_11_vowifi_airplane_mode_on(self, loop=1, idle_time=60): 734 ''' 735 1.1.11 - In/Out Service - VoWiFi incall in Airplane on + Wi-Fi on in default mode 736 737 Args: 738 loop: repeat this test cases for how many times 739 idle_time: at no service area 740 741 Returns: 742 True if pass; False if fail 743 ''' 744 error_msg = "" 745 for x in range(self.user_params.get("wfc_cycle", 1)): 746 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 747 self.my_error_msg += "cylce%s: " %(x+1) 748 self.log.info("idle in service area") 749 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 750 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 751 # Make a MO VoWiFi call in service area. 752 self.log.info("Enable Wi-Fi calling in Airplane on") 753 ad = self.android_devices[0] 754 wfc_mode = ad.droid.imsGetWfcMode() 755 tasks = [(phone_setup_iwlan, (self.log, ad, True, wfc_mode, self.wifi_ssid)) 756 for ad in self.android_devices] 757 if not multithread_func(self.log, tasks): 758 self.my_error_msg += "fail to setup WFC mode to %s, " %(wfc_mode) 759 raise signals.TestFailure(self.my_error_msg) 760 self.log.info("Move to no service area for %s sec" %(idle_time)) 761 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 762 time.sleep(idle_time) 763 self.log.info("Move back to service area and verify device status") 764 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 765 if not self._device_status_check(): 766 raise signals.TestFailure(self.my_error_msg) 767 return True 768 769 770 @test_tracker_info(uuid="2b1f19c5-1214-41bd-895f-86987f1cf2b5") 771 @TelephonyBaseTest.tel_test_wrap 772 def test_vowifi_call_wifi_preferred(self, loop=1 ,wfc_mode=WFC_MODE_WIFI_PREFERRED): 773 ''' 774 In/Out Service - VoWiFi incall in Wi-Fi Preferred mode 775 776 Args: 777 loop: repeat this test cases for how many times 778 wfc_mode: wifi prefer mode 779 780 Returns: 781 True if pass; False if fail 782 Raises: 783 TestFailure if not success. 784 ''' 785 for x in range(self.user_params.get("roveinout_cycle", 1)): 786 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 787 self.log.info("Start test at cellular and wifi area") 788 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 789 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 790 self.check_network() 791 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 792 end_call=False): 793 raise signals.TestFailure("VoWiFi call failure: %s" 794 %(self.my_error_msg)) 795 796 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 797 time.sleep(WAIT_FOR_SERVICE_TIME) 798 # check call status 799 for ad in self.android_devices: 800 get_voice_call_type(ad) 801 self.log.info("Move back to service area") 802 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 803 self.log.info("Verify device state after in-out service") 804 if not self._device_status_check(): 805 raise signals.TestFailure(self.my_error_msg) 806 return True 807 808 809 810 @test_tracker_info(uuid="63dfa017-8bdb-4c61-a29e-7c347982a5ac") 811 @TelephonyBaseTest.tel_test_wrap 812 def test_volte_call_cellular_preferred(self, loop=1, wfc_mode=WFC_MODE_CELLULAR_PREFERRED): 813 ''' 814 In/Out Service - VoLTE incall in Cellular preferred mode 815 Make sure that MO/MT VoWiFi call can be made after In/Out service 816 in Wi-Fi Preferred mode and Airplane on + Wi-Fi on and MO/MT 817 VoLTE call can be made in Cellular preferred mode. 818 819 Args: 820 loop: repeat this test cases for how many times 821 wfc_mode: wifi prefer mode 822 823 Returns: 824 True if pass; False if fail 825 Raises: 826 TestFailure if not success. 827 ''' 828 for x in range(self.user_params.get("roveinout_cycle", 1)): 829 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 830 self.log.info("Start test at cellular and wifi area") 831 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 832 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 833 self.check_network() 834 835 if not self._enable_wifi_calling(wfc_mode, call_type=VOLTE_CALL, 836 end_call=False): 837 raise signals.TestFailure("VoLTE call failure: %s" 838 %(self.my_error_msg)) 839 self.log.info(" Move to no service area for 1 minute during incall.") 840 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 841 time.sleep(WAIT_FOR_SERVICE_TIME) 842 # check call status 843 for ad in self.android_devices: 844 get_voice_call_type(ad) 845 self.log.info("Move back to service area") 846 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 847 self.log.info("Verify device state after in-out service") 848 if not self._device_status_check(call_type=VOLTE_CALL): 849 raise signals.TestFailure(self.my_error_msg) 850 return True 851 852 853 @test_tracker_info(uuid="4f196186-b163-4c78-bdd9-d8fd7dc79dac") 854 @TelephonyBaseTest.tel_test_wrap 855 def test_wfc_in_out_wifi_disabled(self, loop=1, wfc_mode=WFC_MODE_DISABLED): 856 """ 857 [LAB][Wi-Fi Preferred/Cellular Preferred] In/Out Wi-Fi only area with 858 Wi-Fi calling disabled - Idle -> Make sure that radio function can work 859 after in/out Wi-Fi only area when Wi-Fi calling disabled. 860 861 Args: 862 loop: repeat this test cases for how many times 863 wfc_mode: wfc mode 864 Raises: 865 TestFailure if not success. 866 Returns: 867 True if pass; False if fail 868 """ 869 for x in range(self.user_params.get("wfc_cycle", 1)): 870 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 871 self.log.info("Start test at cellular and wifi area") 872 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 873 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 874 if not self._enable_wifi_calling(wfc_mode, ): 875 raise signals.TestFailure("_enable_wifi_calling failure: %s" 876 %(self.my_error_msg)) 877 self.log.info("Move out cellular area to Wi-Fi only area") 878 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 879 time.sleep(WAIT_TIME_AT_NO_SERVICE_AREA) 880 self.log.info("Move back to service area and no wifi area") 881 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 882 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 883 884 self.log.info("Verify device state after in-out service") 885 if not self._device_status_check(call_type=VOICE_CALL): 886 raise signals.TestFailure(self.my_error_msg) 887 return True 888 889 @test_tracker_info(uuid="d597a694-fae9-426b-ba5e-97a9844cba4f") 890 @TelephonyBaseTest.tel_test_wrap 891 def test_in_out_wifi_browsing_wifi_preferred(self, loop=1, wfc_mode=WFC_MODE_WIFI_PREFERRED): 892 ''' 893 [LAB][Wi-Fi Preferred] In/Out Wi-Fi only area with Wi-Fi calling enabled 894 Browsing -> Make sure that radio function can work after in/out Wi-Fi 895 only area in Wi-Fi preferred mode. 896 897 Args: 898 loop: repeat this test cases for how many times 899 wfc_mode: wfc mode 900 901 Raises: 902 TestFailure if not success. 903 Returns: 904 True if pass; False if fail 905 ''' 906 for x in range(self.user_params.get("wfc_cycle", 1)): 907 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 908 self.log.info("Start test at cellular and wifi area") 909 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 910 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 911 self.check_network() 912 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 913 end_call=False): 914 raise signals.TestFailure("VoWiFi call failure: %s" 915 %(self.my_error_msg)) 916 #Keep browsing then move out cellular area to Wi-Fi only area 917 tasks_a = [(self._in_out_browse, ())] 918 tasks_b = [(browsing_test_ping_retry, (ad, )) for ad in self.android_devices] 919 tasks_b.extend(tasks_a) 920 if not multithread_func(self.log, tasks_b): 921 raise signals.TestFailure("in/out browsing failure: %s" 922 %(self.my_error_msg)) 923 self.log.info("Verify device state after in-out service") 924 if not self._device_status_check(call_type=VOICE_CALL): 925 raise signals.TestFailure(self.my_error_msg) 926 return True 927 928 @test_tracker_info(uuid="c7d3dc90-c0ed-48f8-b674-6d5b1efea3cc") 929 @TelephonyBaseTest.tel_test_wrap 930 def test_in_out_wifi_browsing_wfc_disabled(self, loop=1, wfc_mode=WFC_MODE_DISABLED): 931 ''' 932 [LAB][Wi-Fi Preferred/Cellular Preferred] In/Out Wi-Fi only area 933 with Wi-Fi calling disabled - Browsing 934 Args: 935 loop: repeat this test cases for how many times 936 wfc_mode: wfc mode 937 938 Raises: 939 TestFailure if not success. 940 Returns: 941 True if pass; False if fail 942 ''' 943 for x in range(self.user_params.get("wfc_cycle", 1)): 944 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 945 self.log.info("Start test at cellular and wifi area") 946 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 947 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 948 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 949 end_call=False): 950 raise signals.TestFailure("VoWiFi call failure: %s" 951 %(self.my_error_msg)) 952 # Keep browsing then move out cellular area to Wi-Fi only area 953 tasks_a = [(self._in_out_browse, ())] 954 tasks_b = [(browsing_test_ping_retry, (ad, )) for ad in self.android_devices] 955 tasks_b.extend(tasks_a) 956 if not multithread_func(self.log, tasks_b): 957 for ad in self.android_devices: 958 log_screen_shot(ad, "browsing_failure") 959 raise signals.TestFailure("in/out browsing failure: %s" 960 %(self.my_error_msg)) 961 if not self._device_status_check(call_type=VOICE_CALL): 962 raise signals.TestFailure(self.my_error_msg) 963 return True 964 965 def _in_out_browse(self): 966 ''' 967 Move out cellular area to Wi-Fi only area and 968 move back to service area and no wifi area 969 ''' 970 self.log.info("Move out cellular area to Wi-Fi only area") 971 self.adjust_cellular_signal(NO_SERVICE_POWER_LEVEL) 972 # browsing at no service area 973 time.sleep(WAIT_TIME_AT_NO_SERVICE_AREA) 974 self.log.info("Move back to service area and no wifi area") 975 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 976 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 977 return True 978 979 @test_tracker_info(uuid="9029f3bb-3aca-42be-9241-ed21aab418ff") 980 @TelephonyBaseTest.tel_test_wrap 981 def test_hand_in_out_vowifi_incall_data_transfer(self, loop=1, 982 wfc_mode=WFC_MODE_WIFI_PREFERRED): 983 ''' 984 [Wi-Fi Preferred] Hand In/Out while VoWiFi incall - 985 Data transferring -> Make sure that IMS can register between Wi-Fi 986 and LTE NW and no call dropped during data transferring after 987 hand in/out in Wi-Fi Preferred mode. 988 989 Args: 990 loop: repeat this test cases for how many times 991 wfc_mode: wfc mode 992 993 Raises: 994 TestFailure if not success. 995 Returns: 996 True if pass; False if fail 997 ''' 998 for x in range(self.user_params.get("wfc_cycle", 1)): 999 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 1000 self.log.info("Start test at cellular and wifi area") 1001 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 1002 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 1003 self.check_network() 1004 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 1005 end_call=False): 1006 raise signals.TestFailure("VoWiFi call failure: %s" 1007 %(self.my_error_msg)) 1008 #Download a large file in the background then make a MO VoWiFi call. 1009 if not self._voice_call(self.android_devices, WFC_CALL, False,): 1010 error_msg = "VoWiFi call failure, " 1011 self.log.info(error_msg) 1012 self._on_failure(error_msg) 1013 self.log.info("Move out Wi-Fi area to VoLTE area during incall + data transferring.") 1014 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 1015 time.sleep(WAIT_FOR_SERVICE_TIME) 1016 for ad in self.android_devices: 1017 hangup_call(self.log, ad) 1018 if not self._device_status_check(call_type=VOLTE_CALL): 1019 raise signals.TestFailure(self.my_error_msg) 1020 # Download a file in the background then make a MO VoLTE call. 1021 self.log.info("Move back to Wi-Fi area during incall + data transferring.") 1022 # Move back to Wi-Fi area during incall + data transferring. 1023 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 1024 time.sleep(160) 1025 for ad in self.android_devices: 1026 hangup_call(self.log, ad) 1027 if not self._device_status_check(call_type=VOICE_CALL): 1028 raise signals.TestFailure(self.my_error_msg) 1029 return True 1030 1031 1032 @test_tracker_info(uuid="45c1f623-5eeb-4ee4-8739-2b0ebcd5f19f") 1033 @TelephonyBaseTest.tel_test_wrap 1034 def test_rove_in_out_ims_on_airplane_mode(self, loop=1,): 1035 ''' 1036 [Wi-Fi Calling+Airplane On] Rove In/Out when idle - IMS on -> 1037 Make sure that IMS can register between Wi-Fi and LTE NW and 1038 VoWiFi call can be made after rove in/out. 1039 1040 Args: 1041 loop: repeat this test cases for how many times 1042 1043 Raises: 1044 TestFailure if not success. 1045 Returns: 1046 True if pass; False if fail 1047 ''' 1048 for x in range(self.user_params.get("wfc_cycle", 1)): 1049 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 1050 self.my_error_msg += "cylce%s: " %(x+1) 1051 1052 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 1053 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 1054 self.log.info("Enable Wi-Fi calling in Airplane on") 1055 ad = self.android_devices[0] 1056 wfc_mode = ad.droid.imsGetWfcMode() 1057 tasks = [(phone_setup_iwlan, (self.log, ad, True, wfc_mode, self.wifi_ssid)) 1058 for ad in self.android_devices] 1059 if not multithread_func(self.log, tasks): 1060 self.my_error_msg += "fail to setup WFC mode to %s, " %(wfc_mode) 1061 raise signals.TestFailure(self.my_error_msg) 1062 1063 self.log.info("Make a MO VoWiFi call in service area") 1064 if not self._voice_call(self.android_devices, WFC_CALL, False): 1065 raise signals.TestFailure("VoWiFi call failure: %s" 1066 %(self.my_error_msg)) 1067 1068 self.log.info("Move out Wi-Fi area to VoLTE area when idle.") 1069 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 1070 time.sleep(WAIT_FOR_SERVICE_TIME) 1071 # if not self._device_status_check(call_type=VOICE_CALL): 1072 # raise signals.TestFailure(self.my_error_msg) 1073 self.log.info("Move back to Wi-Fi area when idle.") 1074 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 1075 self.log.info("Verify device status after in-out service") 1076 self.log.info("Wait for maximum to 160 sec before IMS switched") 1077 tasks = [(wait_for_ims_registered, (self.log, ad, 160)) 1078 for ad in self.android_devices] 1079 if not multithread_func(self.log, tasks): 1080 asserts.assert_true(False, "Fail: %s." %("wait_for_ims_registered failure"), 1081 extras={"failure_cause": self.my_error_msg}) 1082 # turn off APM 1083 self.log.info("Turn off airplande mode") 1084 tasks = [(toggle_airplane_mode, (self.log, ad, False)) 1085 for ad in self.android_devices] 1086 multithread_func(self.log, tasks) 1087 return True 1088 1089 1090 @test_tracker_info(uuid="9b586a06-3b33-41be-ae0f-aacf157212b9") 1091 @TelephonyBaseTest.tel_test_wrap 1092 def test_wifi_rove_out_wfc(self,loop=1, wfc_mode=WFC_MODE_WIFI_PREFERRED, idle_time=180): 1093 ''' 1094 [Wi-Fi Preferred] Rove In/Out when idle for 1 hours - Wi-Fi calling enabled 1095 1096 Args: 1097 loop: repeat this test cases for how many times 1098 wfc_mode: 1099 idle_time: how long device will be idle 1100 1101 Raises: 1102 TestFailure if not success. 1103 Returns: 1104 True if pass; False if fail 1105 ''' 1106 for x in range(self.user_params.get("wfc_cycle", 1)): 1107 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 1108 self.log.info("Start test at cellular and wifi area") 1109 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 1110 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 1111 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 1112 end_call=False): 1113 raise signals.TestFailure("VoWiFi call failure: %s" 1114 %(self.my_error_msg)) 1115 1116 if not self._voice_call(self.android_devices, WFC_CALL, ): 1117 raise signals.TestFailure("VoWiFi call failure: %s" 1118 %(self.my_error_msg)) 1119 time.sleep(idle_time) 1120 1121 self.log.info("Move out Wi-Fi area to VoLTE area when idle.") 1122 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 1123 time.sleep(30) 1124 self.log.info("check cellular data") 1125 # self._data_retry_mechanism() 1126 tasks = [(verify_data_connection, (ad, 3)) 1127 for ad in self.android_devices] 1128 if not multithread_func(self.log, tasks): 1129 self.log.info("verify_data_connection failure") 1130 if not self._voice_call(self.android_devices, VOLTE_CALL, ): 1131 raise signals.TestFailure("VOLTE call failure: %s" 1132 %(self.my_error_msg)) 1133 self.log.info("Move back to Wi-Fi area when idle.") 1134 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 1135 if not self._device_status_check(call_type=WFC_CALL): 1136 raise signals.TestFailure(self.my_error_msg) 1137 return True 1138 1139 1140 @test_tracker_info(uuid="fb431706-737d-4020-b3d1-347dc4d7ce03") 1141 @TelephonyBaseTest.tel_test_wrap 1142 def test_wifi_rove_out_no_wfc(self,loop=1, wfc_mode=WFC_MODE_DISABLED, 1143 idle_time=180): 1144 ''' 1145 [Wi-Fi Preferred] Rove In/Out when idle for 1 hours 1146 Wi-Fi calling disabled. Make sure that IMS can register between 1147 Wi-Fi and LTE NW and VoWiFi call can be made after rove in/out. 1148 1149 Args: 1150 loop: repeat this test cases for how many times 1151 wfc_mode: 1152 idle_time: how long device will be idle 1153 1154 Raises: 1155 TestFailure if not success. 1156 Returns: 1157 True if pass; False if fail 1158 ''' 1159 for x in range(self.user_params.get("wfc_cycle", 1)): 1160 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 1161 self.log.info("Start test at cellular and wifi area") 1162 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 1163 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 1164 self.check_network() 1165 if not self._enable_wifi_calling(wfc_mode): 1166 raise signals.TestFailure("_enable_wifi_calling failure: %s" 1167 %(self.my_error_msg)) 1168 1169 if not self._voice_call(self.android_devices, VOLTE_CALL, ): 1170 raise signals.TestFailure("VOLTE call failure: %s" 1171 %(self.my_error_msg)) 1172 time.sleep(idle_time) 1173 1174 self.log.info("Move out Wi-Fi area to VoLTE area when idle.") 1175 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 1176 time.sleep(30) 1177 self.log.info("check cellular data") 1178 # self._data_retry_mechanism() 1179 tasks = [(verify_data_connection, (ad, 3)) 1180 for ad in self.android_devices] 1181 if not multithread_func(self.log, tasks): 1182 self.log.info("verify_data_connection failure") 1183 if not self._voice_call(self.android_devices, VOLTE_CALL, ): 1184 raise signals.TestFailure("VOLTE call failure: %s" 1185 %(self.my_error_msg)) 1186 self.log.info("Move back to Wi-Fi area when idle.") 1187 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 1188 # Enable Wi-Fi calling in Wi-Fi Preferred mode 1189 if not self._enable_wifi_calling(WFC_MODE_WIFI_PREFERRED): 1190 raise signals.TestFailure("_enable_wifi_calling failure: %s" 1191 %(self.my_error_msg)) 1192 # check device status 1193 if not self._device_status_check(call_type=WFC_CALL): 1194 raise signals.TestFailure(self.my_error_msg) 1195 return True 1196 1197 1198 @test_tracker_info(uuid="5ddfa906-7756-42b4-b1c4-2ac507211547") 1199 @TelephonyBaseTest.tel_test_wrap 1200 def test_hand_in_out_vowifi_incall_call_hold(self,loop=1, 1201 wfc_mode=WFC_MODE_WIFI_PREFERRED, idle_time=180): 1202 ''' 1203 [NSA/SA][Wi-Fi Preferred] Hand In/Out while VoWiFi incall - Hold 1204 Ensure IMS can register between Wi-Fi and LTE/NR NW and no call dropped 1205 during incall with hold on after hand in/out in Wi-Fi Preferred mode. 1206 1207 Args: 1208 loop: repeat this test cases for how many times 1209 wfc_mode: 1210 idle_time: how long device will be idle 1211 1212 Raises: 1213 TestFailure if not success. 1214 Returns: 1215 True if pass; False if fail 1216 ''' 1217 for x in range(self.user_params.get("wfc_cycle", 1)): 1218 self.log.info("%s loop: %s/%s" %(self.current_test_name, x+1, loop)) 1219 self.log.info("Start test at wifi area and service area") 1220 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 1221 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 1222 #Make a MO VoWiFi call and hold the call. 1223 if not self._enable_wifi_calling(wfc_mode, call_type=WFC_CALL, 1224 end_call=False): 1225 raise signals.TestFailure("VoWiFi call failure: %s" 1226 %(self.my_error_msg)) 1227 tasks = [(self._call_hold, (ad,)) for ad in self.android_devices] 1228 if not multithread_func(self.log, tasks): 1229 raise signals.TestFailure("fail to hold call: %s" 1230 %(self.my_error_msg)) 1231 1232 # Move out Wi-Fi area to 4G area during incall 1233 self.log.info("Move out Wi-Fi area to VoLTE area") 1234 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 1235 self.adjust_wifi_signal(NO_SERVICE_POWER_LEVEL) 1236 # Unhold the call 1237 tasks = [(self._call_unhold, (ad,)) for ad in self.android_devices] 1238 if not multithread_func(self.log, tasks): 1239 raise signals.TestFailure("fail to unhold call: %s" 1240 %(self.my_error_msg)) 1241 time.sleep(30) 1242 for ad in self.android_devices: 1243 hangup_call(self.log, ad) 1244 1245 # Make a MO VoLTE call and hold the call. 1246 if not self._voice_call(self.android_devices, VOLTE_CALL, False): 1247 raise signals.TestFailure("VoLTE call failure: %s" 1248 %(self.my_error_msg)) 1249 tasks = [(self._call_hold, (ad,)) for ad in self.android_devices] 1250 if not multithread_func(self.log, tasks): 1251 raise signals.TestFailure("fail to hold call: %s" 1252 %(self.my_error_msg)) 1253 1254 #Move back to Wi-Fi area during incall. 1255 self.log.info("Move back to Wi-Fi area during incall.") 1256 self.adjust_cellular_signal(IN_SERVICE_POWER_LEVEL) 1257 self.adjust_wifi_signal(IN_SERVICE_POWER_LEVEL) 1258 tasks = [(self._call_unhold, (ad,)) for ad in self.android_devices] 1259 if not multithread_func(self.log, tasks): 1260 raise signals.TestFailure("fail to unhold call: %s" 1261 %(self.my_error_msg)) 1262 time.sleep(30) 1263 for ad in self.android_devices: 1264 hangup_call(self.log, ad) 1265 # check device status 1266 if not self._device_status_check(call_type=WFC_CALL): 1267 raise signals.TestFailure(self.my_error_msg) 1268 return True 1269 1270 1271 def _call_hold(self, ad, wait_time=WAIT_TIME_IN_CALL): 1272 ''' 1273 Press call hold 1274 1275 Args: 1276 ad: android device 1277 wait_time: wait time after press hold/unhold in sec 1278 1279 Returns: 1280 True if pass; False if fail 1281 ''' 1282 if ad.droid.telecomIsInCall(): 1283 ad.droid.telecomShowInCallScreen() 1284 call_list = ad.droid.telecomCallGetCallIds() 1285 ad.log.info("Calls in PhoneA %s", call_list) 1286 call_id = call_list[0] 1287 call_state = ad.droid.telecomCallGetCallState(call_id) 1288 if call_state != CALL_STATE_ACTIVE: 1289 ad.log.error("Call_id:%s, state:%s, expected: STATE_ACTIVE", 1290 call_id, 1291 ad.droid.telecomCallGetCallState(call_id)) 1292 return False 1293 ad.log.info("Hold call_id %s on PhoneA", call_id) 1294 log_screen_shot(ad, "before_call_hold") 1295 ad.droid.telecomCallHold(call_id) 1296 time.sleep(wait_time) 1297 1298 call_state = ad.droid.telecomCallGetCallState(call_id) 1299 log_screen_shot(ad, "after_call_hold") 1300 if call_state != CALL_STATE_HOLDING: 1301 ad.log.error("Call_id:%s, state:%s, expected: STATE_HOLDING", 1302 call_id, 1303 ad.droid.telecomCallGetCallState(call_id)) 1304 log_screen_shot(ad, "hold_failure") 1305 return False 1306 else: 1307 ad.log.info("device is not in call") 1308 return False 1309 return True 1310 1311 def _call_unhold(self, ad, wait_time=WAIT_TIME_IN_CALL): 1312 ''' 1313 Press call unhold 1314 1315 Args: 1316 ad: android device 1317 wait_time: wait time after press hold/unhold in sec 1318 1319 Returns: 1320 True if pass; False if fail 1321 ''' 1322 if ad.droid.telecomIsInCall(): 1323 ad.droid.telecomShowInCallScreen() 1324 call_list = ad.droid.telecomCallGetCallIds() 1325 ad.log.info("Calls in PhoneA %s", call_list) 1326 call_id = call_list[0] 1327 call_state = ad.droid.telecomCallGetCallState(call_id) 1328 if call_state != CALL_STATE_HOLDING: 1329 ad.log.error("Call_id:%s, state:%s, expected: STATE_HOLDING", 1330 call_id, 1331 ad.droid.telecomCallGetCallState(call_id)) 1332 return False 1333 ad.log.info("Unhold call_id %s on PhoneA", call_id) 1334 log_screen_shot(ad, "before_unhold") 1335 ad.droid.telecomCallUnhold(call_id) 1336 time.sleep(wait_time) 1337 call_state = ad.droid.telecomCallGetCallState(call_id) 1338 log_screen_shot(ad, "after_unhold") 1339 if call_state != CALL_STATE_ACTIVE: 1340 ad.log.error("Call_id:%s, state:%s, expected: STATE_ACTIVE", 1341 call_id, 1342 call_state) 1343 log_screen_shot(ad, "_unhold_failure") 1344 return False 1345 else: 1346 ad.log.info("device is not in call") 1347 return False 1348 return True 1349 1350