1 #!/usr/bin/env python3.4 2 # 3 # Copyright 2016 - 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 epdg RF shield box related tests. 18 """ 19 20 import time 21 from queue import Empty 22 from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest 23 from acts.test_utils.tel.tel_atten_utils import set_rssi 24 from acts.test_utils.tel.tel_defines import CELL_STRONG_RSSI_VALUE 25 from acts.test_utils.tel.tel_defines import CELL_WEAK_RSSI_VALUE 26 from acts.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED 27 from acts.test_utils.tel.tel_defines import DIRECTION_MOBILE_TERMINATED 28 from acts.test_utils.tel.tel_defines import GEN_3G 29 from acts.test_utils.tel.tel_defines import GEN_4G 30 from acts.test_utils.tel.tel_defines import INVALID_WIFI_RSSI 31 from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_CALL_DROP 32 from acts.test_utils.tel.tel_defines import MAX_WAIT_TIME_NW_SELECTION 33 from acts.test_utils.tel.tel_defines import MAX_RSSI_RESERVED_VALUE 34 from acts.test_utils.tel.tel_defines import MIN_RSSI_RESERVED_VALUE 35 from acts.test_utils.tel.tel_defines import NETWORK_SERVICE_DATA 36 from acts.test_utils.tel.tel_defines import NETWORK_SERVICE_VOICE 37 from acts.test_utils.tel.tel_defines import PRECISE_CALL_STATE_LISTEN_LEVEL_BACKGROUND 38 from acts.test_utils.tel.tel_defines import PRECISE_CALL_STATE_LISTEN_LEVEL_FOREGROUND 39 from acts.test_utils.tel.tel_defines import PRECISE_CALL_STATE_LISTEN_LEVEL_RINGING 40 from acts.test_utils.tel.tel_defines import RAT_LTE 41 from acts.test_utils.tel.tel_defines import RAT_IWLAN 42 from acts.test_utils.tel.tel_defines import RAT_WCDMA 43 from acts.test_utils.tel.tel_defines import WAIT_TIME_BETWEEN_REG_AND_CALL 44 from acts.test_utils.tel.tel_defines import WAIT_TIME_IN_CALL 45 from acts.test_utils.tel.tel_defines import WAIT_TIME_WIFI_RSSI_CALIBRATION_SCREEN_ON 46 from acts.test_utils.tel.tel_defines import WAIT_TIME_WIFI_RSSI_CALIBRATION_WIFI_CONNECTED 47 from acts.test_utils.tel.tel_defines import WFC_MODE_CELLULAR_PREFERRED 48 from acts.test_utils.tel.tel_defines import WFC_MODE_DISABLED 49 from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_ONLY 50 from acts.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED 51 from acts.test_utils.tel.tel_defines import WIFI_WEAK_RSSI_VALUE 52 from acts.test_utils.tel.tel_defines import EventNetworkCallback 53 from acts.test_utils.tel.tel_defines import NetworkCallbackAvailable 54 from acts.test_utils.tel.tel_defines import NetworkCallbackLost 55 from acts.test_utils.tel.tel_defines import SignalStrengthContainer 56 from acts.test_utils.tel.tel_test_utils import WifiUtils 57 from acts.test_utils.tel.tel_test_utils import ensure_network_generation 58 from acts.test_utils.tel.tel_test_utils import ensure_phones_default_state 59 from acts.test_utils.tel.tel_test_utils import ensure_wifi_connected 60 from acts.test_utils.tel.tel_test_utils import get_network_rat 61 from acts.test_utils.tel.tel_test_utils import get_phone_number 62 from acts.test_utils.tel.tel_test_utils import hangup_call 63 from acts.test_utils.tel.tel_test_utils import initiate_call 64 from acts.test_utils.tel.tel_test_utils import is_network_call_back_event_match 65 from acts.test_utils.tel.tel_test_utils import is_phone_in_call 66 from acts.test_utils.tel.tel_test_utils import is_phone_not_in_call 67 from acts.test_utils.tel.tel_test_utils import set_wfc_mode 68 from acts.test_utils.tel.tel_test_utils import toggle_airplane_mode 69 from acts.test_utils.tel.tel_test_utils import toggle_volte 70 from acts.test_utils.tel.tel_test_utils import wait_and_answer_call 71 from acts.test_utils.tel.tel_test_utils import wait_for_cell_data_connection 72 from acts.test_utils.tel.tel_test_utils import wait_for_droid_not_in_call 73 from acts.test_utils.tel.tel_test_utils import wait_for_wfc_disabled 74 from acts.test_utils.tel.tel_test_utils import wait_for_wfc_enabled 75 from acts.test_utils.tel.tel_test_utils import wait_for_wifi_data_connection 76 from acts.test_utils.tel.tel_test_utils import verify_http_connection 77 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_3g 78 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_csfb 79 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan 80 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_not_iwlan 81 from acts.test_utils.tel.tel_voice_utils import is_phone_in_call_volte 82 from acts.test_utils.tel.tel_voice_utils import phone_setup_voice_general 83 from acts.test_utils.tel.tel_voice_utils import phone_idle_3g 84 from acts.test_utils.tel.tel_voice_utils import phone_idle_csfb 85 from acts.test_utils.tel.tel_voice_utils import phone_idle_iwlan 86 from acts.test_utils.tel.tel_voice_utils import phone_idle_volte 87 from acts.utils import load_config 88 89 # Attenuator name 90 ATTEN_NAME_FOR_WIFI = 'wifi0' 91 ATTEN_NAME_FOR_CELL = 'cell0' 92 93 # WiFi RSSI settings for ROVE_IN test 94 WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN = -60 95 WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_NOT_ROVE_IN = -70 96 97 # WiFi RSSI settings for ROVE_OUT test 98 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE = -60 99 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_NOT_ROVE_OUT = -70 100 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT = -90 101 102 # WiFi RSSI settings for HAND_IN test 103 WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_NOT_HAND_IN = -80 104 WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN = -50 105 106 # WiFi RSSI settings for HAND_OUT test 107 WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_NOT_HAND_OUT = -70 108 WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT = -85 109 110 111 class TelWifiVoiceTest(TelephonyBaseTest): 112 def __init__(self, controllers): 113 TelephonyBaseTest.__init__(self, controllers) 114 self.tests = ( 115 # WFC Call Routing tests. 116 # epdg, WFC, APM, WiFi strong 117 "test_call_epdg_wfc_wifi_only_wifi_strong_apm", 118 "test_call_epdg_wfc_wifi_preferred_wifi_strong_apm", 119 "test_call_epdg_wfc_cellular_preferred_wifi_strong_apm", 120 121 # epdg, WFC, APM, WiFi Absent 122 "test_call_epdg_wfc_wifi_only_wifi_absent_apm", 123 "test_call_epdg_wfc_wifi_preferred_wifi_absent_apm", 124 "test_call_epdg_wfc_cellular_preferred_wifi_absent_apm", 125 126 # epdg, WFC, APM, WiFi Disabled 127 "test_call_epdg_wfc_wifi_only_wifi_disabled_apm", 128 "test_call_epdg_wfc_wifi_preferred_wifi_disabled_apm", 129 "test_call_epdg_wfc_cellular_preferred_wifi_disabled_apm", 130 131 # epdg, WFC, cellular strong, WiFi strong 132 "test_call_epdg_wfc_wifi_preferred_wifi_strong_cellular_strong", 133 "test_call_epdg_wfc_cellular_preferred_wifi_strong_cellular_strong", 134 135 # epdg, WFC, cellular strong, WiFi weak 136 "test_call_epdg_wfc_wifi_preferred_wifi_weak_cellular_strong", 137 "test_call_epdg_wfc_cellular_preferred_wifi_weak_cellular_strong", 138 139 # epdg, WFC, cellular strong, WiFi Absent 140 "test_call_epdg_wfc_wifi_preferred_wifi_absent_cellular_strong", 141 "test_call_epdg_wfc_cellular_preferred_wifi_absent_cellular_strong", 142 143 # epdg, WFC, cellular strong, WiFi Disabled 144 "test_call_epdg_wfc_wifi_preferred_wifi_disabled_cellular_strong", 145 "test_call_epdg_wfc_cellular_preferred_wifi_disabled_cellular_strong", 146 147 # epdg, WFC, cellular weak, WiFi strong 148 "test_call_epdg_wfc_wifi_preferred_wifi_strong_cellular_weak", 149 150 # epdg, WFC, cellular weak, WiFi Absent= 151 "test_call_epdg_wfc_wifi_preferred_wifi_absent_cellular_weak", 152 "test_call_epdg_wfc_cellular_preferred_wifi_absent_cellular_weak", 153 154 # epdg, WFC, cellular weak, WiFi Disabled 155 "test_call_epdg_wfc_wifi_preferred_wifi_disabled_cellular_weak", 156 "test_call_epdg_wfc_cellular_preferred_wifi_disabled_cellular_weak", 157 158 # epdg, WiFI strong, WFC disabled 159 "test_call_epdg_wfc_disabled_wifi_strong_apm", 160 "test_call_epdg_wfc_disabled_wifi_strong_cellular_strong", 161 "test_call_epdg_wfc_disabled_wifi_strong_cellular_weak", 162 163 # WFC Idle-Mode Mobility 164 # Rove-in, Rove-out test 165 "test_rove_in_lte_wifi_preferred", 166 "test_rove_in_lte_wifi_only", 167 "test_rove_in_wcdma_wifi_preferred", 168 "test_rove_in_wcdma_wifi_only", 169 "test_rove_out_lte_wifi_preferred", 170 "test_rove_out_lte_wifi_only", 171 "test_rove_out_wcdma_wifi_preferred", 172 "test_rove_out_wcdma_wifi_only", 173 "test_rove_out_in_stress", 174 175 # WFC Active-Mode Mobility 176 # Hand-in, Hand-out test 177 "test_hand_out_wifi_only", 178 "test_hand_out_wifi_preferred", 179 "test_hand_out_in_wifi_preferred", 180 "test_hand_in_wifi_preferred", 181 "test_hand_in_out_wifi_preferred", 182 "test_hand_out_in_stress", 183 184 # WFC test with E4G disabled 185 "test_call_epdg_wfc_wifi_preferred_e4g_disabled", 186 "test_call_epdg_wfc_wifi_preferred_e4g_disabled_wifi_not_connected", 187 "test_call_epdg_wfc_wifi_preferred_e4g_disabled_leave_wifi_coverage", 188 189 # ePDG Active-Mode Mobility: Hand-in, Hand-out test 190 "test_hand_out_cellular_preferred", 191 "test_hand_in_cellular_preferred", 192 193 # epdg, WFC, cellular weak, WiFi strong 194 "test_call_epdg_wfc_wifi_only_wifi_strong_cellular_weak", 195 "test_call_epdg_wfc_cellular_preferred_wifi_strong_cellular_weak", 196 197 # epdg, WFC, cellular weak, WiFi weak 198 "test_call_epdg_wfc_wifi_only_wifi_weak_cellular_weak", 199 "test_call_epdg_wfc_wifi_preferred_wifi_weak_cellular_weak", 200 "test_call_epdg_wfc_cellular_preferred_wifi_weak_cellular_weak", 201 202 # epdg, WFC, cellular weak, WiFi Absent 203 "test_call_epdg_wfc_wifi_only_wifi_absent_cellular_weak", 204 205 # epdg, WFC, cellular weak, WiFi Disabled 206 "test_call_epdg_wfc_wifi_only_wifi_disabled_cellular_weak", 207 208 # epdg, WFC, cellular absent, WiFi strong 209 "test_call_epdg_wfc_wifi_only_wifi_strong_cellular_absent", 210 "test_call_epdg_wfc_wifi_preferred_wifi_strong_cellular_absent", 211 "test_call_epdg_wfc_cellular_preferred_wifi_strong_cellular_absent", 212 213 # epdg, WFC, cellular absent, WiFi weak 214 "test_call_epdg_wfc_wifi_only_wifi_weak_cellular_absent", 215 "test_call_epdg_wfc_wifi_preferred_wifi_weak_cellular_absent", 216 "test_call_epdg_wfc_cellular_preferred_wifi_weak_cellular_absent", 217 218 # epdg, WFC, cellular absent, WiFi Absent 219 "test_call_epdg_wfc_wifi_only_wifi_absent_cellular_absent", 220 "test_call_epdg_wfc_wifi_preferred_wifi_absent_cellular_absent", 221 "test_call_epdg_wfc_cellular_preferred_wifi_absent_cellular_absent", 222 223 # epdg, WFC, cellular absent, WiFi Disabled 224 "test_call_epdg_wfc_wifi_only_wifi_disabled_cellular_absent", 225 "test_call_epdg_wfc_wifi_preferred_wifi_disabled_cellular_absent", 226 "test_call_epdg_wfc_cellular_preferred_wifi_disabled_cellular_absent", 227 228 # epdg, WiFI strong, WFC disabled 229 "test_call_epdg_wfc_disabled_wifi_strong_cellular_absent", 230 231 # Below test fail now, because: 232 # 1. wifi weak not working now. (phone don't rove-in) 233 # 2. wifi-only mode not working now. 234 # epdg, WFC, APM, WiFi weak 235 "test_call_epdg_wfc_wifi_only_wifi_weak_apm", 236 "test_call_epdg_wfc_wifi_preferred_wifi_weak_apm", 237 "test_call_epdg_wfc_cellular_preferred_wifi_weak_apm", 238 239 # epdg, WFC, cellular strong, WiFi strong 240 "test_call_epdg_wfc_wifi_only_wifi_strong_cellular_strong", 241 242 # epdg, WFC, cellular strong, WiFi weak 243 "test_call_epdg_wfc_wifi_only_wifi_weak_cellular_strong", 244 245 # epdg, WFC, cellular strong, WiFi Absent 246 "test_call_epdg_wfc_wifi_only_wifi_absent_cellular_strong", 247 248 # epdg, WFC, cellular strong, WiFi Disabled 249 "test_call_epdg_wfc_wifi_only_wifi_disabled_cellular_strong", 250 251 # RSSI monitoring 252 "test_rssi_monitoring", ) 253 254 self.simconf = load_config(self.user_params["sim_conf_file"]) 255 self.stress_test_number = int(self.user_params["stress_test_number"]) 256 self.live_network_ssid = self.user_params["wifi_network_ssid"] 257 258 try: 259 self.live_network_pwd = self.user_params["wifi_network_pass"] 260 except KeyError: 261 self.live_network_pwd = None 262 263 self.attens = {} 264 for atten in self.attenuators: 265 self.attens[atten.path] = atten 266 267 def setup_class(self): 268 269 super().setup_class() 270 271 self.log.info("WFC phone: <{}> <{}>".format(self.android_devices[ 272 0].serial, get_phone_number(self.log, self.android_devices[0]))) 273 self.android_devices[ 274 0].droid.telephonyStartTrackingSignalStrengthChange() 275 276 # Do WiFi RSSI calibration. 277 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 0, 278 MAX_RSSI_RESERVED_VALUE) 279 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 0, 280 MAX_RSSI_RESERVED_VALUE) 281 if not ensure_network_generation(self.log, self.android_devices[0], 282 GEN_4G, voice_or_data=NETWORK_SERVICE_DATA, 283 toggle_apm_after_setting=True): 284 self.log.error("Setup_class: phone failed to select to LTE.") 285 return False 286 if not ensure_wifi_connected(self.log, self.android_devices[0], 287 self.live_network_ssid, 288 self.live_network_pwd): 289 self.log.error("{} connect WiFI failed".format( 290 self.android_devices[0].serial)) 291 return False 292 if (not wait_for_wifi_data_connection(self.log, 293 self.android_devices[0], True) or 294 not verify_http_connection(self.log, self.android_devices[0])): 295 self.log.error("No Data on Wifi") 296 return False 297 298 # Delay WAIT_TIME_WIFI_RSSI_CALIBRATION_WIFI_CONNECTED after WiFi 299 # Connected to make sure WiFi RSSI reported value is correct. 300 time.sleep(WAIT_TIME_WIFI_RSSI_CALIBRATION_WIFI_CONNECTED) 301 # Turn On Screen and delay WAIT_TIME_WIFI_RSSI_CALIBRATION_SCREEN_ON 302 # then get WiFi RSSI to avoid WiFi RSSI report -127(invalid value). 303 self.android_devices[0].droid.wakeUpNow() 304 time.sleep(WAIT_TIME_WIFI_RSSI_CALIBRATION_SCREEN_ON) 305 306 setattr(self, "wifi_rssi_with_no_atten", 307 self.android_devices[0].droid.wifiGetConnectionInfo()['rssi']) 308 if self.wifi_rssi_with_no_atten == INVALID_WIFI_RSSI: 309 self.log.error( 310 "Initial WiFi RSSI calibration value is wrong: -127.") 311 return False 312 self.log.info("WiFi RSSI calibration info: atten=0, RSSI={}".format( 313 self.wifi_rssi_with_no_atten)) 314 ensure_phones_default_state(self.log, [self.android_devices[0]]) 315 316 # Do Cellular RSSI calibration. 317 setattr(self, "cell_rssi_with_no_atten", self.android_devices[ 318 0].droid.telephonyGetSignalStrength()[ 319 SignalStrengthContainer.SIGNAL_STRENGTH_LTE_DBM]) 320 self.log.info( 321 "Cellular RSSI calibration info: atten=0, RSSI={}".format( 322 self.cell_rssi_with_no_atten)) 323 return True 324 325 def teardown_class(self): 326 327 super().teardown_class() 328 329 self.android_devices[ 330 0].droid.telephonyStopTrackingSignalStrengthChange() 331 return True 332 333 def teardown_test(self): 334 335 super().teardown_test() 336 337 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 0, 338 MAX_RSSI_RESERVED_VALUE) 339 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 0, 340 MAX_RSSI_RESERVED_VALUE) 341 return True 342 343 def _wfc_call_sequence(self, ads, mo_mt, initial_wifi_cellular_setup_func, 344 wfc_phone_setup_func, verify_wfc_initial_idle_func, 345 verify_wfc_in_call_state_func, 346 incall_wifi_cellular_setting_check_func, 347 expected_result): 348 """_wfc_call_sequence 349 350 Args: 351 ads: list of android devices. This list should have 2 ad. 352 mo_mt: indicating this call sequence is MO or MT. 353 Valid input: DIRECTION_MOBILE_ORIGINATED and 354 DIRECTION_MOBILE_TERMINATED. 355 initial_wifi_cellular_setup_func: Initial WiFI router and Attenuator 356 setup function before phone setup. 357 wfc_phone_setup_func: WFC phone setup function. 358 verify_wfc_initial_idle_func: Initial WFC phone idle check function. 359 verify_wfc_in_call_state_func: WFC phone in call state check function. 360 incall_wifi_cellular_setting_check_func: During call, WiFI router and Attenuator 361 change setting and phone status check function. 362 (for test hand-in and hand-out) 363 364 expected_result: expected test result. 365 If expect call sequence finish, this value should be set to 'True'. 366 If expect call sequence not finish (eg. setup fail, call initial fail), 367 this value should be set to "exception string" 368 Current supported string include: 369 "initial_wifi_cellular_setup_func fail." 370 "wfc_phone_setup_func fail." 371 "phone_setup_voice_general fail." 372 "verify_wfc_initial_idle_func fail." 373 "initiate_call fail." 374 "wait_and_answer_call fail." 375 "verify_wfc_in_call_state_func fail." 376 "PhoneB not in call." 377 "verify_wfc_in_call_state_func fail after 30 seconds." 378 "PhoneB not in call after 30 seconds." 379 "incall_wifi_cellular_setting_func fail." 380 "incall_setting_check_func fail." 381 "hangup_call fail." 382 383 Returns: 384 if expected_result is True, 385 Return True if call sequence finish without exception. Otherwise False. 386 if expected_result is string, 387 Return True if expected exception happened. Otherwise False. 388 389 """ 390 391 class _WfcCallSequenceException(Exception): 392 pass 393 394 if (len(ads) != 2) or (mo_mt not in [ 395 DIRECTION_MOBILE_ORIGINATED, DIRECTION_MOBILE_TERMINATED 396 ]): 397 self.log.error("Invalid parameters.") 398 return False 399 400 if mo_mt == DIRECTION_MOBILE_ORIGINATED: 401 ad_caller = ads[0] 402 ad_callee = ads[1] 403 else: 404 ad_caller = ads[1] 405 ad_callee = ads[0] 406 caller_number = get_phone_number(self.log, ad_caller) 407 callee_number = get_phone_number(self.log, ad_callee) 408 409 self.log.info("-->Begin wfc_call_sequence: {} to {}<--".format( 410 caller_number, callee_number)) 411 412 try: 413 # initial setup wifi router and RF 414 if initial_wifi_cellular_setup_func and not initial_wifi_cellular_setup_func( 415 ): 416 raise _WfcCallSequenceException( 417 "initial_wifi_cellular_setup_func fail.") 418 419 if wfc_phone_setup_func and not wfc_phone_setup_func(): 420 raise _WfcCallSequenceException("wfc_phone_setup_func fail.") 421 if not phone_setup_voice_general(self.log, ads[1]): 422 raise _WfcCallSequenceException( 423 "phone_setup_voice_general fail.") 424 time.sleep(WAIT_TIME_BETWEEN_REG_AND_CALL) 425 426 # Ensure idle status correct 427 if verify_wfc_initial_idle_func and not verify_wfc_initial_idle_func( 428 ): 429 raise _WfcCallSequenceException( 430 "verify_wfc_initial_idle_func fail.") 431 432 # Make MO/MT call. 433 if not initiate_call(self.log, ad_caller, callee_number): 434 raise _WfcCallSequenceException("initiate_call fail.") 435 if not wait_and_answer_call(self.log, ad_callee, caller_number): 436 raise _WfcCallSequenceException("wait_and_answer_call fail.") 437 time.sleep(1) 438 439 # Check state, wait 30 seconds, check again. 440 if verify_wfc_in_call_state_func and not verify_wfc_in_call_state_func( 441 ): 442 raise _WfcCallSequenceException( 443 "verify_wfc_in_call_state_func fail.") 444 if is_phone_not_in_call(self.log, ads[1]): 445 raise _WfcCallSequenceException("PhoneB not in call.") 446 time.sleep(WAIT_TIME_IN_CALL) 447 if verify_wfc_in_call_state_func and not verify_wfc_in_call_state_func( 448 ): 449 raise _WfcCallSequenceException( 450 "verify_wfc_in_call_state_func fail after 30 seconds.") 451 if is_phone_not_in_call(self.log, ads[1]): 452 raise _WfcCallSequenceException( 453 "PhoneB not in call after 30 seconds.") 454 455 # in call change setting and check 456 if incall_wifi_cellular_setting_check_func and not incall_wifi_cellular_setting_check_func( 457 ): 458 raise _WfcCallSequenceException( 459 "incall_wifi_cellular_setting_check_func fail.") 460 461 if is_phone_in_call(self.log, ads[0]): 462 # hangup call 463 if not hangup_call(self.log, ads[0]): 464 raise _WfcCallSequenceException("hangup_call fail.") 465 else: 466 # Call drop is unexpected if 467 # incall_wifi_cellular_setting_check_func is None 468 if incall_wifi_cellular_setting_check_func is None: 469 raise _WfcCallSequenceException("Unexpected call drop.") 470 471 except _WfcCallSequenceException as e: 472 if str(e) == expected_result: 473 self.log.info( 474 "Expected exception happened: <{}>, return True.".format( 475 e)) 476 return True 477 else: 478 self.log.info( 479 "Unexpected exception happened: <{}>, return False.".format( 480 e)) 481 return False 482 finally: 483 ensure_phones_default_state(self.log, [ads[0], ads[1]]) 484 485 self.log.info("wfc_call_sequence finished, return {}".format( 486 expected_result is True)) 487 return (expected_result is True) 488 489 def _phone_idle_iwlan(self): 490 return phone_idle_iwlan(self.log, self.android_devices[0]) 491 492 def _phone_idle_not_iwlan(self): 493 return not self._phone_idle_iwlan() 494 495 def _phone_idle_volte(self): 496 return phone_idle_volte(self.log, self.android_devices[0]) 497 498 def _phone_idle_csfb(self): 499 return phone_idle_csfb(self.log, self.android_devices[0]) 500 501 def _phone_idle_3g(self): 502 return phone_idle_3g(self.log, self.android_devices[0]) 503 504 def _phone_wait_for_not_wfc(self): 505 result = wait_for_wfc_disabled(self.log, self.android_devices[0], 506 MAX_WAIT_TIME_NW_SELECTION) 507 self.log.info("_phone_wait_for_not_wfc: WFC_disabled is {}".format( 508 result)) 509 if not result: 510 return False 511 # TODO: b/26338343 Need to check Data RAT. Data RAT should not be iwlan. 512 return True 513 514 def _phone_wait_for_wfc(self): 515 result = wait_for_wfc_enabled(self.log, self.android_devices[0], 516 MAX_WAIT_TIME_NW_SELECTION) 517 self.log.info("_phone_wait_for_wfc: WFC_enabled is {}".format(result)) 518 if not result: 519 return False 520 nw_type = get_network_rat(self.log, self.android_devices[0], 521 NETWORK_SERVICE_DATA) 522 if nw_type != RAT_IWLAN: 523 self.log.error( 524 "_phone_wait_for_wfc Data Rat is {}, expecting {}".format( 525 nw_type, RAT_IWLAN)) 526 return False 527 return True 528 529 def _phone_wait_for_call_drop(self): 530 if not wait_for_droid_not_in_call(self.log, self.android_devices[0], 531 MAX_WAIT_TIME_CALL_DROP): 532 self.log.info("_phone_wait_for_call_drop: Call not drop.") 533 return False 534 return True 535 536 def _is_phone_in_call_iwlan(self): 537 return is_phone_in_call_iwlan(self.log, self.android_devices[0]) 538 539 def _is_phone_in_call_not_iwlan(self): 540 return is_phone_in_call_not_iwlan(self.log, self.android_devices[0]) 541 542 def _is_phone_not_in_call(self): 543 if is_phone_in_call(self.log, self.android_devices[0]): 544 self.log.info("{} in call.".format(self.android_devices[0].serial)) 545 return False 546 self.log.info("{} not in call.".format(self.android_devices[0].serial)) 547 return True 548 549 def _is_phone_in_call_volte(self): 550 return is_phone_in_call_volte(self.log, self.android_devices[0]) 551 552 def _is_phone_in_call_3g(self): 553 return is_phone_in_call_3g(self.log, self.android_devices[0]) 554 555 def _is_phone_in_call_csfb(self): 556 return is_phone_in_call_csfb(self.log, self.android_devices[0]) 557 558 def _wfc_phone_setup(self, is_airplane_mode, wfc_mode, volte_mode=True): 559 toggle_airplane_mode(self.log, self.android_devices[0], False) 560 toggle_volte(self.log, self.android_devices[0], volte_mode) 561 if not ensure_network_generation(self.log, self.android_devices[0], 562 GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): 563 return False 564 565 if not set_wfc_mode(self.log, self.android_devices[0], wfc_mode): 566 self.log.error("{} set WFC mode failed.".format( 567 self.android_devices[0].serial)) 568 return False 569 570 toggle_airplane_mode(self.log, self.android_devices[0], 571 is_airplane_mode) 572 573 if not ensure_wifi_connected(self.log, self.android_devices[0], 574 self.live_network_ssid, 575 self.live_network_pwd): 576 self.log.error("{} connect WiFI failed".format( 577 self.android_devices[0].serial)) 578 return False 579 return True 580 581 def _wfc_phone_setup_cellular_absent(self, wfc_mode): 582 is_exception_happened = False 583 try: 584 if not toggle_airplane_mode(self.log, self.android_devices[0], 585 False): 586 raise Exception("Toggle APM failed.") 587 if not ensure_network_generation(self.log, self.android_devices[0], 588 GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): 589 raise Exception("Ensure LTE failed.") 590 except Exception: 591 is_exception_happened = True 592 593 if not is_exception_happened: 594 self.log.error( 595 "_wfc_phone_setup_cellular_absent error:" 596 "Phone on LTE, expected Phone have no cellular signal") 597 return False 598 if not toggle_volte(self.log, self.android_devices[0], True): 599 self.log.error( 600 "_wfc_phone_setup_cellular_absent: toggle VoLTE fail.") 601 raise False 602 603 if not set_wfc_mode(self.log, self.android_devices[0], wfc_mode): 604 self.log.error("{} set WFC mode failed.".format( 605 self.android_devices[0].serial)) 606 return False 607 608 if not ensure_wifi_connected(self.log, self.android_devices[0], 609 self.live_network_ssid, 610 self.live_network_pwd): 611 self.log.error("{} connect WiFI failed".format( 612 self.android_devices[0].serial)) 613 return False 614 return True 615 616 def _wfc_phone_setup_apm_wifi_only(self): 617 return self._wfc_phone_setup(True, WFC_MODE_WIFI_ONLY) 618 619 def _wfc_phone_setup_apm_wifi_preferred(self): 620 return self._wfc_phone_setup(True, WFC_MODE_WIFI_PREFERRED) 621 622 def _wfc_phone_setup_apm_cellular_preferred(self): 623 return self._wfc_phone_setup(True, WFC_MODE_CELLULAR_PREFERRED) 624 625 def _wfc_phone_setup_apm_wfc_disabled(self): 626 return self._wfc_phone_setup(True, WFC_MODE_DISABLED) 627 628 def _wfc_phone_setup_wifi_only(self): 629 return self._wfc_phone_setup(False, WFC_MODE_WIFI_ONLY) 630 631 def _wfc_phone_setup_wifi_preferred(self): 632 return self._wfc_phone_setup(False, WFC_MODE_WIFI_PREFERRED) 633 634 def _wfc_phone_setup_cellular_preferred(self): 635 return self._wfc_phone_setup(False, WFC_MODE_CELLULAR_PREFERRED) 636 637 def _wfc_phone_setup_wfc_disabled(self): 638 return self._wfc_phone_setup(False, WFC_MODE_DISABLED) 639 640 def _wfc_phone_setup_cellular_absent_wifi_only(self): 641 return self._wfc_phone_setup_cellular_absent(WFC_MODE_WIFI_ONLY) 642 643 def _wfc_phone_setup_cellular_absent_wifi_preferred(self): 644 return self._wfc_phone_setup_cellular_absent(WFC_MODE_WIFI_PREFERRED) 645 646 def _wfc_phone_setup_cellular_absent_cellular_preferred(self): 647 return self._wfc_phone_setup_cellular_absent( 648 WFC_MODE_CELLULAR_PREFERRED) 649 650 def _wfc_phone_setup_cellular_absent_wfc_disabled(self): 651 return self._wfc_phone_setup_cellular_absent(WFC_MODE_DISABLED) 652 653 def _wfc_phone_setup_wifi_preferred_e4g_disabled(self): 654 return self._wfc_phone_setup(False, WFC_MODE_WIFI_PREFERRED, False) 655 656 def _wfc_phone_setup_wifi_absent(self, 657 is_airplane_mode, 658 wfc_mode, 659 volte_mode=True): 660 toggle_airplane_mode(self.log, self.android_devices[0], False) 661 toggle_volte(self.log, self.android_devices[0], volte_mode) 662 if not ensure_network_generation(self.log, self.android_devices[0], 663 GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): 664 return False 665 666 if not set_wfc_mode(self.log, self.android_devices[0], wfc_mode): 667 self.log.error("{} set WFC mode failed.".format( 668 self.android_devices[0].serial)) 669 return False 670 671 toggle_airplane_mode(self.log, self.android_devices[0], 672 is_airplane_mode) 673 674 if ensure_wifi_connected(self.log, self.android_devices[0], 675 self.live_network_ssid, 676 self.live_network_pwd): 677 self.log.error( 678 "{} connect WiFI succeed, expected not succeed".format( 679 self.android_devices[0].serial)) 680 return False 681 return True 682 683 def _wfc_phone_setup_cellular_absent_wifi_absent(self, wfc_mode): 684 is_exception_happened = False 685 try: 686 if not toggle_airplane_mode(self.log, self.android_devices[0], 687 False): 688 raise Exception("Toggle APM failed.") 689 if not ensure_network_generation(self.log, self.android_devices[0], 690 GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): 691 raise Exception("Ensure LTE failed.") 692 except Exception: 693 is_exception_happened = True 694 695 if not is_exception_happened: 696 self.log.error( 697 "_wfc_phone_setup_cellular_absent_wifi_absent error:" 698 "Phone on LTE, expected Phone have no cellular signal") 699 return False 700 if not toggle_volte(self.log, self.android_devices[0], True): 701 self.log.error( 702 "_wfc_phone_setup_cellular_absent: toggle VoLTE fail.") 703 raise False 704 705 if not set_wfc_mode(self.log, self.android_devices[0], wfc_mode): 706 self.log.error("{} set WFC mode failed.".format( 707 self.android_devices[0].serial)) 708 return False 709 710 if ensure_wifi_connected(self.log, self.android_devices[0], 711 self.live_network_ssid, 712 self.live_network_pwd): 713 self.log.error( 714 "{} connect WiFI succeed, expected not succeed".format( 715 self.android_devices[0].serial)) 716 return False 717 return True 718 719 def _wfc_phone_setup_apm_wifi_absent_wifi_only(self): 720 return self._wfc_phone_setup_wifi_absent(True, WFC_MODE_WIFI_ONLY) 721 722 def _wfc_phone_setup_apm_wifi_absent_wifi_preferred(self): 723 return self._wfc_phone_setup_wifi_absent(True, WFC_MODE_WIFI_PREFERRED) 724 725 def _wfc_phone_setup_apm_wifi_absent_cellular_preferred(self): 726 return self._wfc_phone_setup_wifi_absent(True, 727 WFC_MODE_CELLULAR_PREFERRED) 728 729 def _wfc_phone_setup_wifi_absent_wifi_only(self): 730 return self._wfc_phone_setup_wifi_absent(False, WFC_MODE_WIFI_ONLY) 731 732 def _wfc_phone_setup_wifi_absent_wifi_preferred(self): 733 return self._wfc_phone_setup_wifi_absent(False, 734 WFC_MODE_WIFI_PREFERRED) 735 736 def _wfc_phone_setup_wifi_absent_cellular_preferred(self): 737 return self._wfc_phone_setup_wifi_absent(False, 738 WFC_MODE_CELLULAR_PREFERRED) 739 740 def _wfc_phone_setup_cellular_absent_wifi_absent_wifi_only(self): 741 return self._wfc_phone_setup_cellular_absent_wifi_absent( 742 WFC_MODE_WIFI_ONLY) 743 744 def _wfc_phone_setup_cellular_absent_wifi_absent_wifi_preferred(self): 745 return self._wfc_phone_setup_cellular_absent_wifi_absent( 746 WFC_MODE_WIFI_PREFERRED) 747 748 def _wfc_phone_setup_cellular_absent_wifi_absent_cellular_preferred(self): 749 return self._wfc_phone_setup_cellular_absent_wifi_absent( 750 WFC_MODE_CELLULAR_PREFERRED) 751 752 def _wfc_phone_setup_wifi_absent_wifi_preferred_e4g_disabled(self): 753 return self._wfc_phone_setup_wifi_absent( 754 False, WFC_MODE_WIFI_PREFERRED, False) 755 756 def _wfc_phone_setup_wifi_disabled(self, is_airplane_mode, wfc_mode): 757 toggle_airplane_mode(self.log, self.android_devices[0], False) 758 toggle_volte(self.log, self.android_devices[0], True) 759 if not ensure_network_generation(self.log, self.android_devices[0], 760 GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): 761 return False 762 763 if not set_wfc_mode(self.log, self.android_devices[0], wfc_mode): 764 self.log.error("{} set WFC mode failed.".format( 765 self.android_devices[0].serial)) 766 return False 767 768 toggle_airplane_mode(self.log, self.android_devices[0], 769 is_airplane_mode) 770 771 WifiUtils.wifi_toggle_state(self.log, self.android_devices[0], False) 772 return True 773 774 def _wfc_phone_setup_cellular_absent_wifi_disabled(self, wfc_mode): 775 is_exception_happened = False 776 try: 777 if not toggle_airplane_mode(self.log, self.android_devices[0], 778 False): 779 raise Exception("Toggle APM failed.") 780 if not ensure_network_generation(self.log, self.android_devices[0], 781 GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): 782 raise Exception("Ensure LTE failed.") 783 except Exception: 784 is_exception_happened = True 785 786 if not is_exception_happened: 787 self.log.error( 788 "_wfc_phone_setup_cellular_absent_wifi_disabled error:" 789 "Phone on LTE, expected Phone have no cellular signal") 790 return False 791 if not toggle_volte(self.log, self.android_devices[0], True): 792 self.log.error( 793 "_wfc_phone_setup_cellular_absent: toggle VoLTE fail.") 794 raise False 795 796 if not set_wfc_mode(self.log, self.android_devices[0], wfc_mode): 797 self.log.error("{} set WFC mode failed.".format( 798 self.android_devices[0].serial)) 799 return False 800 801 WifiUtils.wifi_toggle_state(self.log, self.android_devices[0], False) 802 return True 803 804 def _wfc_phone_setup_apm_wifi_disabled_wifi_only(self): 805 return self._wfc_phone_setup_wifi_disabled(True, WFC_MODE_WIFI_ONLY) 806 807 def _wfc_phone_setup_apm_wifi_disabled_wifi_preferred(self): 808 return self._wfc_phone_setup_wifi_disabled(True, 809 WFC_MODE_WIFI_PREFERRED) 810 811 def _wfc_phone_setup_apm_wifi_disabled_cellular_preferred(self): 812 return self._wfc_phone_setup_wifi_disabled(True, 813 WFC_MODE_CELLULAR_PREFERRED) 814 815 def _wfc_phone_setup_wifi_disabled_wifi_only(self): 816 return self._wfc_phone_setup_wifi_disabled(False, WFC_MODE_WIFI_ONLY) 817 818 def _wfc_phone_setup_wifi_disabled_wifi_preferred(self): 819 return self._wfc_phone_setup_wifi_disabled(False, 820 WFC_MODE_WIFI_PREFERRED) 821 822 def _wfc_phone_setup_wifi_disabled_cellular_preferred(self): 823 return self._wfc_phone_setup_wifi_disabled(False, 824 WFC_MODE_CELLULAR_PREFERRED) 825 826 def _wfc_phone_setup_cellular_absent_wifi_disabled_wifi_only(self): 827 return self._wfc_phone_setup_cellular_absent_wifi_disabled( 828 WFC_MODE_WIFI_ONLY) 829 830 def _wfc_phone_setup_cellular_absent_wifi_disabled_wifi_preferred(self): 831 return self._wfc_phone_setup_cellular_absent_wifi_disabled( 832 WFC_MODE_WIFI_PREFERRED) 833 834 def _wfc_phone_setup_cellular_absent_wifi_disabled_cellular_preferred( 835 self): 836 return self._wfc_phone_setup_cellular_absent_wifi_disabled( 837 WFC_MODE_CELLULAR_PREFERRED) 838 839 def _wfc_set_wifi_strong_cell_strong(self): 840 self.log.info("--->Setting WiFi strong cell strong<---") 841 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 842 self.wifi_rssi_with_no_atten, MAX_RSSI_RESERVED_VALUE) 843 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 844 self.cell_rssi_with_no_atten, MAX_RSSI_RESERVED_VALUE) 845 return True 846 847 def _wfc_set_wifi_strong_cell_weak(self): 848 self.log.info("--->Setting WiFi strong cell weak<---") 849 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 850 self.wifi_rssi_with_no_atten, MAX_RSSI_RESERVED_VALUE) 851 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 852 self.cell_rssi_with_no_atten, CELL_WEAK_RSSI_VALUE) 853 return True 854 855 def _wfc_set_wifi_strong_cell_absent(self): 856 self.log.info("--->Setting WiFi strong cell absent<---") 857 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 858 self.wifi_rssi_with_no_atten, MAX_RSSI_RESERVED_VALUE) 859 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 860 self.cell_rssi_with_no_atten, MIN_RSSI_RESERVED_VALUE) 861 return True 862 863 def _wfc_set_wifi_weak_cell_strong(self): 864 self.log.info("--->Setting WiFi weak cell strong<---") 865 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 866 self.wifi_rssi_with_no_atten, WIFI_WEAK_RSSI_VALUE) 867 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 868 self.cell_rssi_with_no_atten, MAX_RSSI_RESERVED_VALUE) 869 return True 870 871 def _wfc_set_wifi_weak_cell_weak(self): 872 self.log.info("--->Setting WiFi weak cell weak<---") 873 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 874 self.cell_rssi_with_no_atten, CELL_WEAK_RSSI_VALUE) 875 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 876 self.wifi_rssi_with_no_atten, WIFI_WEAK_RSSI_VALUE) 877 return True 878 879 def _wfc_set_wifi_weak_cell_absent(self): 880 self.log.info("--->Setting WiFi weak cell absent<---") 881 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 882 self.wifi_rssi_with_no_atten, WIFI_WEAK_RSSI_VALUE) 883 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 884 self.cell_rssi_with_no_atten, MIN_RSSI_RESERVED_VALUE) 885 return True 886 887 def _wfc_set_wifi_absent_cell_strong(self): 888 self.log.info("--->Setting WiFi absent cell strong<---") 889 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 890 self.wifi_rssi_with_no_atten, MIN_RSSI_RESERVED_VALUE) 891 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 892 self.cell_rssi_with_no_atten, MAX_RSSI_RESERVED_VALUE) 893 return True 894 895 def _wfc_set_wifi_absent_cell_weak(self): 896 self.log.info("--->Setting WiFi absent cell weak<---") 897 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 898 self.wifi_rssi_with_no_atten, MIN_RSSI_RESERVED_VALUE) 899 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 900 self.cell_rssi_with_no_atten, CELL_WEAK_RSSI_VALUE) 901 return True 902 903 def _wfc_set_wifi_absent_cell_absent(self): 904 self.log.info("--->Setting WiFi absent cell absent<---") 905 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 906 self.wifi_rssi_with_no_atten, MIN_RSSI_RESERVED_VALUE) 907 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 908 self.cell_rssi_with_no_atten, MIN_RSSI_RESERVED_VALUE) 909 return True 910 911 """ Tests Begin """ 912 913 @TelephonyBaseTest.tel_test_wrap 914 def test_call_epdg_wfc_wifi_only_wifi_strong_apm(self): 915 """ Test WFC MO MT, WiFI only mode, WIFI Strong, Phone in APM 916 917 Set WiFi/Cellular network environment. 918 Make Sure PhoneA is set correct WFC parameters. 919 Make SUre PhoneB is able to make MO/MT call. 920 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 921 Call from PhoneB to PHoneA, call should succeed, call should on WiFi. 922 923 Returns: 924 True if pass; False if fail. 925 """ 926 927 ads = [self.android_devices[0], self.android_devices[1]] 928 mo_result = self._wfc_call_sequence( 929 ads, DIRECTION_MOBILE_ORIGINATED, 930 self._wfc_set_wifi_strong_cell_strong, 931 self._wfc_phone_setup_apm_wifi_only, self._phone_idle_iwlan, 932 self._is_phone_in_call_iwlan, None, True) 933 934 mt_result = self._wfc_call_sequence( 935 ads, DIRECTION_MOBILE_TERMINATED, 936 self._wfc_set_wifi_strong_cell_strong, 937 self._wfc_phone_setup_apm_wifi_only, self._phone_idle_iwlan, 938 self._is_phone_in_call_iwlan, None, True) 939 940 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 941 return ((mo_result is True) and (mt_result is True)) 942 943 @TelephonyBaseTest.tel_test_wrap 944 def test_call_epdg_wfc_wifi_preferred_wifi_strong_apm(self): 945 """ Test WFC MO MT, WiFI preferred mode, WIFI Strong, Phone in APM 946 947 Set WiFi/Cellular network environment. 948 Make Sure PhoneA is set correct WFC parameters. 949 Make SUre PhoneB is able to make MO/MT call. 950 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 951 Call from PhoneB to PHoneA, call should succeed, call should on WiFi. 952 953 Returns: 954 True if pass; False if fail. 955 """ 956 957 ads = [self.android_devices[0], self.android_devices[1]] 958 mo_result = self._wfc_call_sequence( 959 ads, DIRECTION_MOBILE_ORIGINATED, 960 self._wfc_set_wifi_strong_cell_strong, 961 self._wfc_phone_setup_apm_wifi_preferred, self._phone_idle_iwlan, 962 self._is_phone_in_call_iwlan, None, True) 963 964 mt_result = self._wfc_call_sequence( 965 ads, DIRECTION_MOBILE_TERMINATED, 966 self._wfc_set_wifi_strong_cell_strong, 967 self._wfc_phone_setup_apm_wifi_preferred, self._phone_idle_iwlan, 968 self._is_phone_in_call_iwlan, None, True) 969 970 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 971 return ((mo_result is True) and (mt_result is True)) 972 973 @TelephonyBaseTest.tel_test_wrap 974 def test_call_epdg_wfc_cellular_preferred_wifi_strong_apm(self): 975 """ Test WFC MO MT, cellular preferred mode, WIFI Strong, Phone in APM 976 977 Set WiFi/Cellular network environment. 978 Make Sure PhoneA is set correct WFC parameters. 979 Make SUre PhoneB is able to make MO/MT call. 980 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 981 Call from PhoneB to PHoneA, call should succeed, call should on WiFi. 982 983 Returns: 984 True if pass; False if fail. 985 """ 986 987 ads = [self.android_devices[0], self.android_devices[1]] 988 mo_result = self._wfc_call_sequence( 989 ads, DIRECTION_MOBILE_ORIGINATED, 990 self._wfc_set_wifi_strong_cell_strong, 991 self._wfc_phone_setup_apm_cellular_preferred, 992 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 993 994 mt_result = self._wfc_call_sequence( 995 ads, DIRECTION_MOBILE_TERMINATED, 996 self._wfc_set_wifi_strong_cell_strong, 997 self._wfc_phone_setup_apm_cellular_preferred, 998 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 999 1000 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1001 return ((mo_result is True) and (mt_result is True)) 1002 1003 @TelephonyBaseTest.tel_test_wrap 1004 def test_call_epdg_wfc_wifi_only_wifi_weak_apm(self): 1005 """ Test WFC MO MT, WiFI only mode, WIFI weak, Phone in APM 1006 1007 Set WiFi/Cellular network environment. 1008 Make Sure PhoneA is set correct WFC parameters. 1009 Make SUre PhoneB is able to make MO/MT call. 1010 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1011 Call from PhoneB to PHoneA, call should succeed, call should on WiFi. 1012 1013 Returns: 1014 True if pass; False if fail. 1015 """ 1016 1017 ads = [self.android_devices[0], self.android_devices[1]] 1018 mo_result = self._wfc_call_sequence( 1019 ads, DIRECTION_MOBILE_ORIGINATED, 1020 self._wfc_set_wifi_weak_cell_strong, 1021 self._wfc_phone_setup_apm_wifi_only, self._phone_idle_iwlan, 1022 self._is_phone_in_call_iwlan, None, True) 1023 1024 mt_result = self._wfc_call_sequence( 1025 ads, DIRECTION_MOBILE_TERMINATED, 1026 self._wfc_set_wifi_weak_cell_strong, 1027 self._wfc_phone_setup_apm_wifi_only, self._phone_idle_iwlan, 1028 self._is_phone_in_call_iwlan, None, True) 1029 1030 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1031 return ((mo_result is True) and (mt_result is True)) 1032 1033 @TelephonyBaseTest.tel_test_wrap 1034 def test_call_epdg_wfc_wifi_preferred_wifi_weak_apm(self): 1035 """ Test WFC MO MT, WiFI preferred mode, WIFI weak, Phone in APM 1036 1037 Set WiFi/Cellular network environment. 1038 Make Sure PhoneA is set correct WFC parameters. 1039 Make SUre PhoneB is able to make MO/MT call. 1040 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1041 Call from PhoneB to PHoneA, call should succeed, call should on WiFi. 1042 1043 Returns: 1044 True if pass; False if fail. 1045 """ 1046 1047 ads = [self.android_devices[0], self.android_devices[1]] 1048 mo_result = self._wfc_call_sequence( 1049 ads, DIRECTION_MOBILE_ORIGINATED, 1050 self._wfc_set_wifi_weak_cell_strong, 1051 self._wfc_phone_setup_apm_wifi_preferred, self._phone_idle_iwlan, 1052 self._is_phone_in_call_iwlan, None, True) 1053 1054 mt_result = self._wfc_call_sequence( 1055 ads, DIRECTION_MOBILE_TERMINATED, 1056 self._wfc_set_wifi_weak_cell_strong, 1057 self._wfc_phone_setup_apm_wifi_preferred, self._phone_idle_iwlan, 1058 self._is_phone_in_call_iwlan, None, True) 1059 1060 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1061 return ((mo_result is True) and (mt_result is True)) 1062 1063 @TelephonyBaseTest.tel_test_wrap 1064 def test_call_epdg_wfc_cellular_preferred_wifi_weak_apm(self): 1065 """ Test WFC MO MT, cellular preferred mode, WIFI weak, Phone in APM 1066 1067 Set WiFi/Cellular network environment. 1068 Make Sure PhoneA is set correct WFC parameters. 1069 Make SUre PhoneB is able to make MO/MT call. 1070 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1071 Call from PhoneB to PHoneA, call should succeed, call should on WiFi. 1072 1073 Returns: 1074 True if pass; False if fail. 1075 """ 1076 1077 ads = [self.android_devices[0], self.android_devices[1]] 1078 mo_result = self._wfc_call_sequence( 1079 ads, DIRECTION_MOBILE_ORIGINATED, 1080 self._wfc_set_wifi_weak_cell_strong, 1081 self._wfc_phone_setup_apm_cellular_preferred, 1082 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 1083 1084 mt_result = self._wfc_call_sequence( 1085 ads, DIRECTION_MOBILE_TERMINATED, 1086 self._wfc_set_wifi_weak_cell_strong, 1087 self._wfc_phone_setup_apm_cellular_preferred, 1088 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 1089 1090 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1091 return ((mo_result is True) and (mt_result is True)) 1092 1093 @TelephonyBaseTest.tel_test_wrap 1094 def test_call_epdg_wfc_wifi_only_wifi_absent_apm(self): 1095 """ Test WFC MO MT, WiFI only mode, WIFI absent, Phone in APM 1096 1097 Set WiFi/Cellular network environment. 1098 Make Sure PhoneA is set correct WFC parameters. 1099 Make SUre PhoneB is able to make MO/MT call. 1100 Call from PhoneA to PhoneB, call should fail. 1101 Call from PhoneB to PHoneA, call should fail. 1102 1103 Returns: 1104 True if pass; False if fail. 1105 """ 1106 ads = [self.android_devices[0], self.android_devices[1]] 1107 mo_result = self._wfc_call_sequence( 1108 ads, DIRECTION_MOBILE_ORIGINATED, 1109 self._wfc_set_wifi_absent_cell_strong, 1110 self._wfc_phone_setup_apm_wifi_absent_wifi_only, 1111 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1112 "initiate_call fail.") 1113 1114 mt_result = self._wfc_call_sequence( 1115 ads, DIRECTION_MOBILE_TERMINATED, 1116 self._wfc_set_wifi_absent_cell_strong, 1117 self._wfc_phone_setup_apm_wifi_absent_wifi_only, 1118 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1119 "wait_and_answer_call fail.") 1120 1121 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1122 return ((mo_result is True) and (mt_result is True)) 1123 1124 @TelephonyBaseTest.tel_test_wrap 1125 def test_call_epdg_wfc_wifi_preferred_wifi_absent_apm(self): 1126 """ Test WFC MO MT, WiFI preferred mode, WIFI absent, Phone in APM 1127 1128 Set WiFi/Cellular network environment. 1129 Make Sure PhoneA is set correct WFC parameters. 1130 Make SUre PhoneB is able to make MO/MT call. 1131 Call from PhoneA to PhoneB, call should fail. 1132 Call from PhoneB to PHoneA, call should fail. 1133 1134 Returns: 1135 True if pass; False if fail. 1136 """ 1137 ads = [self.android_devices[0], self.android_devices[1]] 1138 mo_result = self._wfc_call_sequence( 1139 ads, DIRECTION_MOBILE_ORIGINATED, 1140 self._wfc_set_wifi_absent_cell_strong, 1141 self._wfc_phone_setup_apm_wifi_absent_wifi_preferred, 1142 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1143 "initiate_call fail.") 1144 1145 mt_result = self._wfc_call_sequence( 1146 ads, DIRECTION_MOBILE_TERMINATED, 1147 self._wfc_set_wifi_absent_cell_strong, 1148 self._wfc_phone_setup_apm_wifi_absent_wifi_preferred, 1149 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1150 "wait_and_answer_call fail.") 1151 1152 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1153 return ((mo_result is True) and (mt_result is True)) 1154 1155 @TelephonyBaseTest.tel_test_wrap 1156 def test_call_epdg_wfc_cellular_preferred_wifi_absent_apm(self): 1157 """ Test WFC MO MT, cellular preferred mode, WIFI absent, Phone in APM 1158 1159 Set WiFi/Cellular network environment. 1160 Make Sure PhoneA is set correct WFC parameters. 1161 Make SUre PhoneB is able to make MO/MT call. 1162 Call from PhoneA to PhoneB, call should fail. 1163 Call from PhoneB to PHoneA, call should fail. 1164 1165 Returns: 1166 True if pass; False if fail. 1167 """ 1168 ads = [self.android_devices[0], self.android_devices[1]] 1169 mo_result = self._wfc_call_sequence( 1170 ads, DIRECTION_MOBILE_ORIGINATED, 1171 self._wfc_set_wifi_absent_cell_strong, 1172 self._wfc_phone_setup_apm_wifi_absent_cellular_preferred, 1173 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1174 "initiate_call fail.") 1175 1176 mt_result = self._wfc_call_sequence( 1177 ads, DIRECTION_MOBILE_TERMINATED, 1178 self._wfc_set_wifi_absent_cell_strong, 1179 self._wfc_phone_setup_apm_wifi_absent_cellular_preferred, 1180 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1181 "wait_and_answer_call fail.") 1182 1183 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1184 return ((mo_result is True) and (mt_result is True)) 1185 1186 @TelephonyBaseTest.tel_test_wrap 1187 def test_call_epdg_wfc_wifi_only_wifi_disabled_apm(self): 1188 """ Test WFC MO MT, WiFI only mode, WIFI disabled, Phone in APM 1189 1190 Set WiFi/Cellular network environment. 1191 Make Sure PhoneA is set correct WFC parameters. 1192 Make SUre PhoneB is able to make MO/MT call. 1193 Call from PhoneA to PhoneB, call should fail. 1194 Call from PhoneB to PHoneA, call should fail. 1195 1196 Returns: 1197 True if pass; False if fail. 1198 """ 1199 ads = [self.android_devices[0], self.android_devices[1]] 1200 mo_result = self._wfc_call_sequence( 1201 ads, DIRECTION_MOBILE_ORIGINATED, 1202 self._wfc_set_wifi_strong_cell_strong, 1203 self._wfc_phone_setup_apm_wifi_disabled_wifi_only, 1204 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1205 "initiate_call fail.") 1206 1207 mt_result = self._wfc_call_sequence( 1208 ads, DIRECTION_MOBILE_TERMINATED, 1209 self._wfc_set_wifi_strong_cell_strong, 1210 self._wfc_phone_setup_apm_wifi_disabled_wifi_only, 1211 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1212 "wait_and_answer_call fail.") 1213 1214 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1215 return ((mo_result is True) and (mt_result is True)) 1216 1217 @TelephonyBaseTest.tel_test_wrap 1218 def test_call_epdg_wfc_wifi_preferred_wifi_disabled_apm(self): 1219 """ Test WFC MO MT, WiFI preferred mode, WIFI disabled, Phone in APM 1220 1221 Set WiFi/Cellular network environment. 1222 Make Sure PhoneA is set correct WFC parameters. 1223 Make SUre PhoneB is able to make MO/MT call. 1224 Call from PhoneA to PhoneB, call should fail. 1225 Call from PhoneB to PHoneA, call should fail. 1226 1227 Returns: 1228 True if pass; False if fail. 1229 """ 1230 ads = [self.android_devices[0], self.android_devices[1]] 1231 mo_result = self._wfc_call_sequence( 1232 ads, DIRECTION_MOBILE_ORIGINATED, 1233 self._wfc_set_wifi_strong_cell_strong, 1234 self._wfc_phone_setup_apm_wifi_disabled_wifi_preferred, 1235 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1236 "initiate_call fail.") 1237 1238 mt_result = self._wfc_call_sequence( 1239 ads, DIRECTION_MOBILE_TERMINATED, 1240 self._wfc_set_wifi_strong_cell_strong, 1241 self._wfc_phone_setup_apm_wifi_disabled_wifi_preferred, 1242 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1243 "wait_and_answer_call fail.") 1244 1245 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1246 return ((mo_result is True) and (mt_result is True)) 1247 1248 @TelephonyBaseTest.tel_test_wrap 1249 def test_call_epdg_wfc_cellular_preferred_wifi_disabled_apm(self): 1250 """ Test WFC MO MT, cellular preferred mode, WIFI disabled, Phone in APM 1251 1252 Set WiFi/Cellular network environment. 1253 Make Sure PhoneA is set correct WFC parameters. 1254 Make SUre PhoneB is able to make MO/MT call. 1255 Call from PhoneA to PhoneB, call should fail. 1256 Call from PhoneB to PHoneA, call should fail. 1257 1258 Returns: 1259 True if pass; False if fail. 1260 """ 1261 ads = [self.android_devices[0], self.android_devices[1]] 1262 mo_result = self._wfc_call_sequence( 1263 ads, DIRECTION_MOBILE_ORIGINATED, 1264 self._wfc_set_wifi_strong_cell_strong, 1265 self._wfc_phone_setup_apm_wifi_disabled_cellular_preferred, 1266 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1267 "initiate_call fail.") 1268 1269 mt_result = self._wfc_call_sequence( 1270 ads, DIRECTION_MOBILE_TERMINATED, 1271 self._wfc_set_wifi_strong_cell_strong, 1272 self._wfc_phone_setup_apm_wifi_disabled_cellular_preferred, 1273 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1274 "wait_and_answer_call fail.") 1275 1276 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1277 return ((mo_result is True) and (mt_result is True)) 1278 1279 @TelephonyBaseTest.tel_test_wrap 1280 def test_call_epdg_wfc_wifi_only_wifi_strong_cellular_strong(self): 1281 """ Test WFC MO MT, WiFI only mode, WIFI strong, Cellular strong 1282 1283 Set WiFi/Cellular network environment. 1284 Make Sure PhoneA is set correct WFC parameters. 1285 Make SUre PhoneB is able to make MO/MT call. 1286 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1287 Call from PhoneB to PHoneA, call should succeed, call should on WiFi. 1288 1289 Returns: 1290 True if pass; False if fail. 1291 """ 1292 ########### 1293 ads = [self.android_devices[0], self.android_devices[1]] 1294 mo_result = self._wfc_call_sequence( 1295 ads, DIRECTION_MOBILE_ORIGINATED, 1296 self._wfc_set_wifi_strong_cell_strong, 1297 self._wfc_phone_setup_wifi_only, self._phone_idle_iwlan, 1298 self._is_phone_in_call_iwlan, None, True) 1299 1300 mt_result = self._wfc_call_sequence( 1301 ads, DIRECTION_MOBILE_TERMINATED, 1302 self._wfc_set_wifi_strong_cell_strong, 1303 self._wfc_phone_setup_wifi_only, self._phone_idle_iwlan, 1304 self._is_phone_in_call_iwlan, None, True) 1305 1306 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1307 return ((mo_result is True) and (mt_result is True)) 1308 1309 @TelephonyBaseTest.tel_test_wrap 1310 def test_call_epdg_wfc_wifi_preferred_wifi_strong_cellular_strong(self): 1311 """ Test WFC MO MT, WiFI preferred mode, WIFI strong, Cellular strong 1312 1313 Set WiFi/Cellular network environment. 1314 Make Sure PhoneA is set correct WFC parameters. 1315 Make SUre PhoneB is able to make MO/MT call. 1316 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1317 Call from PhoneB to PHoneA, call should succeed, call should on WiFi. 1318 1319 Returns: 1320 True if pass; False if fail. 1321 """ 1322 ads = [self.android_devices[0], self.android_devices[1]] 1323 mo_result = self._wfc_call_sequence( 1324 ads, DIRECTION_MOBILE_ORIGINATED, 1325 self._wfc_set_wifi_strong_cell_strong, 1326 self._wfc_phone_setup_wifi_preferred, self._phone_idle_iwlan, 1327 self._is_phone_in_call_iwlan, None, True) 1328 1329 mt_result = self._wfc_call_sequence( 1330 ads, DIRECTION_MOBILE_TERMINATED, 1331 self._wfc_set_wifi_strong_cell_strong, 1332 self._wfc_phone_setup_wifi_preferred, self._phone_idle_iwlan, 1333 self._is_phone_in_call_iwlan, None, True) 1334 1335 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1336 return ((mo_result is True) and (mt_result is True)) 1337 1338 @TelephonyBaseTest.tel_test_wrap 1339 def test_call_epdg_wfc_cellular_preferred_wifi_strong_cellular_strong( 1340 self): 1341 """ Test WFC MO MT, cellular preferred mode, WIFI strong, Cellular strong 1342 1343 Set WiFi/Cellular network environment. 1344 Make Sure PhoneA is set correct WFC parameters. 1345 Make SUre PhoneB is able to make MO/MT call. 1346 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1347 Call from PhoneB to PHoneA, call should succeed, call should on Cellular. 1348 1349 Returns: 1350 True if pass; False if fail. 1351 """ 1352 ads = [self.android_devices[0], self.android_devices[1]] 1353 mo_result = self._wfc_call_sequence( 1354 ads, DIRECTION_MOBILE_ORIGINATED, 1355 self._wfc_set_wifi_strong_cell_strong, 1356 self._wfc_phone_setup_cellular_preferred, 1357 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1358 True) 1359 1360 mt_result = self._wfc_call_sequence( 1361 ads, DIRECTION_MOBILE_TERMINATED, 1362 self._wfc_set_wifi_strong_cell_strong, 1363 self._wfc_phone_setup_cellular_preferred, 1364 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1365 True) 1366 1367 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1368 return ((mo_result is True) and (mt_result is True)) 1369 1370 @TelephonyBaseTest.tel_test_wrap 1371 def test_call_epdg_wfc_wifi_only_wifi_weak_cellular_strong(self): 1372 """ Test WFC MO MT, WiFI only mode, WIFI weak, Cellular strong 1373 1374 Set WiFi/Cellular network environment. 1375 Make Sure PhoneA is set correct WFC parameters. 1376 Make SUre PhoneB is able to make MO/MT call. 1377 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1378 Call from PhoneB to PHoneA, call should succeed, call should on WiFi. 1379 1380 Returns: 1381 True if pass; False if fail. 1382 """ 1383 ########### 1384 ads = [self.android_devices[0], self.android_devices[1]] 1385 mo_result = self._wfc_call_sequence( 1386 ads, DIRECTION_MOBILE_ORIGINATED, 1387 self._wfc_set_wifi_weak_cell_strong, 1388 self._wfc_phone_setup_wifi_only, self._phone_idle_iwlan, 1389 self._is_phone_in_call_iwlan, None, True) 1390 1391 mt_result = self._wfc_call_sequence( 1392 ads, DIRECTION_MOBILE_TERMINATED, 1393 self._wfc_set_wifi_weak_cell_strong, 1394 self._wfc_phone_setup_wifi_only, self._phone_idle_iwlan, 1395 self._is_phone_in_call_iwlan, None, True) 1396 1397 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1398 return ((mo_result is True) and (mt_result is True)) 1399 1400 @TelephonyBaseTest.tel_test_wrap 1401 def test_call_epdg_wfc_wifi_preferred_wifi_weak_cellular_strong(self): 1402 """ Test WFC MO MT, WiFI preferred mode, WIFI weak, Cellular strong 1403 1404 Set WiFi/Cellular network environment. 1405 Make Sure PhoneA is set correct WFC parameters. 1406 Make SUre PhoneB is able to make MO/MT call. 1407 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1408 Call from PhoneB to PHoneA, call should succeed, call should on Cellular. 1409 1410 Returns: 1411 True if pass; False if fail. 1412 """ 1413 ads = [self.android_devices[0], self.android_devices[1]] 1414 mo_result = self._wfc_call_sequence( 1415 ads, DIRECTION_MOBILE_ORIGINATED, 1416 self._wfc_set_wifi_weak_cell_strong, 1417 self._wfc_phone_setup_wifi_preferred, self._phone_idle_not_iwlan, 1418 self._is_phone_in_call_not_iwlan, None, True) 1419 1420 mt_result = self._wfc_call_sequence( 1421 ads, DIRECTION_MOBILE_TERMINATED, 1422 self._wfc_set_wifi_weak_cell_strong, 1423 self._wfc_phone_setup_wifi_preferred, self._phone_idle_not_iwlan, 1424 self._is_phone_in_call_not_iwlan, None, True) 1425 1426 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1427 return ((mo_result is True) and (mt_result is True)) 1428 1429 @TelephonyBaseTest.tel_test_wrap 1430 def test_call_epdg_wfc_cellular_preferred_wifi_weak_cellular_strong(self): 1431 """ Test WFC MO MT, cellular preferred mode, WIFI strong, Cellular strong 1432 1433 Set WiFi/Cellular network environment. 1434 Make Sure PhoneA is set correct WFC parameters. 1435 Make SUre PhoneB is able to make MO/MT call. 1436 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1437 Call from PhoneB to PHoneA, call should succeed, call should on Cellular. 1438 1439 Returns: 1440 True if pass; False if fail. 1441 """ 1442 ads = [self.android_devices[0], self.android_devices[1]] 1443 mo_result = self._wfc_call_sequence( 1444 ads, DIRECTION_MOBILE_ORIGINATED, 1445 self._wfc_set_wifi_weak_cell_strong, 1446 self._wfc_phone_setup_cellular_preferred, 1447 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1448 True) 1449 1450 mt_result = self._wfc_call_sequence( 1451 ads, DIRECTION_MOBILE_TERMINATED, 1452 self._wfc_set_wifi_weak_cell_strong, 1453 self._wfc_phone_setup_cellular_preferred, 1454 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1455 True) 1456 1457 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1458 return ((mo_result is True) and (mt_result is True)) 1459 1460 @TelephonyBaseTest.tel_test_wrap 1461 def test_call_epdg_wfc_wifi_only_wifi_absent_cellular_strong(self): 1462 """ Test WFC MO MT, WiFI only mode, WIFI absent, Cellular strong 1463 1464 Set WiFi/Cellular network environment. 1465 Make Sure PhoneA is set correct WFC parameters. 1466 Make SUre PhoneB is able to make MO/MT call. 1467 Call from PhoneA to PhoneB, call should fail. 1468 Call from PhoneB to PHoneA, call should fail. 1469 1470 Returns: 1471 True if pass; False if fail. 1472 """ 1473 ads = [self.android_devices[0], self.android_devices[1]] 1474 mo_result = self._wfc_call_sequence( 1475 ads, DIRECTION_MOBILE_ORIGINATED, 1476 self._wfc_set_wifi_absent_cell_strong, 1477 self._wfc_phone_setup_wifi_absent_wifi_only, 1478 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1479 "initiate_call fail.") 1480 1481 mt_result = self._wfc_call_sequence( 1482 ads, DIRECTION_MOBILE_TERMINATED, 1483 self._wfc_set_wifi_absent_cell_strong, 1484 self._wfc_phone_setup_wifi_absent_wifi_only, 1485 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1486 "wait_and_answer_call fail.") 1487 1488 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1489 return ((mo_result is True) and (mt_result is True)) 1490 1491 @TelephonyBaseTest.tel_test_wrap 1492 def test_call_epdg_wfc_wifi_preferred_wifi_absent_cellular_strong(self): 1493 """ Test WFC MO MT, WiFI preferred mode, WIFI absent, Cellular strong 1494 1495 Set WiFi/Cellular network environment. 1496 Make Sure PhoneA is set correct WFC parameters. 1497 Make SUre PhoneB is able to make MO/MT call. 1498 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1499 Call from PhoneB to PHoneA, call should succeed, call should on Cellular. 1500 1501 Returns: 1502 True if pass; False if fail. 1503 """ 1504 ads = [self.android_devices[0], self.android_devices[1]] 1505 mo_result = self._wfc_call_sequence( 1506 ads, DIRECTION_MOBILE_ORIGINATED, 1507 self._wfc_set_wifi_absent_cell_strong, 1508 self._wfc_phone_setup_wifi_absent_wifi_preferred, 1509 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1510 True) 1511 1512 mt_result = self._wfc_call_sequence( 1513 ads, DIRECTION_MOBILE_TERMINATED, 1514 self._wfc_set_wifi_absent_cell_strong, 1515 self._wfc_phone_setup_wifi_absent_wifi_preferred, 1516 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1517 True) 1518 1519 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1520 return ((mo_result is True) and (mt_result is True)) 1521 1522 @TelephonyBaseTest.tel_test_wrap 1523 def test_call_epdg_wfc_cellular_preferred_wifi_absent_cellular_strong( 1524 self): 1525 """ Test WFC MO MT, cellular preferred mode, WIFI absent, Cellular strong 1526 1527 Set WiFi/Cellular network environment. 1528 Make Sure PhoneA is set correct WFC parameters. 1529 Make SUre PhoneB is able to make MO/MT call. 1530 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1531 Call from PhoneB to PHoneA, call should succeed, call should on Cellular. 1532 1533 Returns: 1534 True if pass; False if fail. 1535 """ 1536 ads = [self.android_devices[0], self.android_devices[1]] 1537 mo_result = self._wfc_call_sequence( 1538 ads, DIRECTION_MOBILE_ORIGINATED, 1539 self._wfc_set_wifi_absent_cell_strong, 1540 self._wfc_phone_setup_wifi_absent_cellular_preferred, 1541 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1542 True) 1543 1544 mt_result = self._wfc_call_sequence( 1545 ads, DIRECTION_MOBILE_TERMINATED, 1546 self._wfc_set_wifi_absent_cell_strong, 1547 self._wfc_phone_setup_wifi_absent_cellular_preferred, 1548 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1549 True) 1550 1551 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1552 return ((mo_result is True) and (mt_result is True)) 1553 1554 @TelephonyBaseTest.tel_test_wrap 1555 def test_call_epdg_wfc_wifi_only_wifi_disabled_cellular_strong(self): 1556 """ Test WFC MO MT, WiFI only mode, WIFI disabled, Cellular strong 1557 1558 Set WiFi/Cellular network environment. 1559 Make Sure PhoneA is set correct WFC parameters. 1560 Make SUre PhoneB is able to make MO/MT call. 1561 Call from PhoneA to PhoneB, call should fail. 1562 Call from PhoneB to PHoneA, call should fail. 1563 1564 Returns: 1565 True if pass; False if fail. 1566 """ 1567 ads = [self.android_devices[0], self.android_devices[1]] 1568 mo_result = self._wfc_call_sequence( 1569 ads, DIRECTION_MOBILE_ORIGINATED, 1570 self._wfc_set_wifi_strong_cell_strong, 1571 self._wfc_phone_setup_wifi_disabled_wifi_only, 1572 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1573 "initiate_call fail.") 1574 1575 mt_result = self._wfc_call_sequence( 1576 ads, DIRECTION_MOBILE_TERMINATED, 1577 self._wfc_set_wifi_strong_cell_strong, 1578 self._wfc_phone_setup_wifi_disabled_wifi_only, 1579 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1580 "wait_and_answer_call fail.") 1581 1582 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1583 return ((mo_result is True) and (mt_result is True)) 1584 1585 @TelephonyBaseTest.tel_test_wrap 1586 def test_call_epdg_wfc_wifi_preferred_wifi_disabled_cellular_strong(self): 1587 """ Test WFC MO MT, WiFI preferred mode, WIFI disabled, Cellular strong 1588 1589 Set WiFi/Cellular network environment. 1590 Make Sure PhoneA is set correct WFC parameters. 1591 Make SUre PhoneB is able to make MO/MT call. 1592 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1593 Call from PhoneB to PHoneA, call should succeed, call should on Cellular. 1594 1595 Returns: 1596 True if pass; False if fail. 1597 """ 1598 ads = [self.android_devices[0], self.android_devices[1]] 1599 mo_result = self._wfc_call_sequence( 1600 ads, DIRECTION_MOBILE_ORIGINATED, 1601 self._wfc_set_wifi_strong_cell_strong, 1602 self._wfc_phone_setup_wifi_disabled_wifi_preferred, 1603 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1604 True) 1605 1606 mt_result = self._wfc_call_sequence( 1607 ads, DIRECTION_MOBILE_TERMINATED, 1608 self._wfc_set_wifi_strong_cell_strong, 1609 self._wfc_phone_setup_wifi_disabled_wifi_preferred, 1610 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1611 True) 1612 1613 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1614 return ((mo_result is True) and (mt_result is True)) 1615 1616 @TelephonyBaseTest.tel_test_wrap 1617 def test_call_epdg_wfc_cellular_preferred_wifi_disabled_cellular_strong( 1618 self): 1619 """ Test WFC MO MT, cellular preferred mode, WIFI disabled, Cellular strong 1620 1621 Set WiFi/Cellular network environment. 1622 Make Sure PhoneA is set correct WFC parameters. 1623 Make SUre PhoneB is able to make MO/MT call. 1624 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1625 Call from PhoneB to PHoneA, call should succeed, call should on Cellular. 1626 1627 Returns: 1628 True if pass; False if fail. 1629 """ 1630 ads = [self.android_devices[0], self.android_devices[1]] 1631 mo_result = self._wfc_call_sequence( 1632 ads, DIRECTION_MOBILE_ORIGINATED, 1633 self._wfc_set_wifi_strong_cell_strong, 1634 self._wfc_phone_setup_wifi_disabled_cellular_preferred, 1635 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1636 True) 1637 1638 mt_result = self._wfc_call_sequence( 1639 ads, DIRECTION_MOBILE_TERMINATED, 1640 self._wfc_set_wifi_strong_cell_strong, 1641 self._wfc_phone_setup_wifi_disabled_cellular_preferred, 1642 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1643 True) 1644 1645 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1646 return ((mo_result is True) and (mt_result is True)) 1647 1648 @TelephonyBaseTest.tel_test_wrap 1649 def test_call_epdg_wfc_wifi_only_wifi_strong_cellular_weak(self): 1650 """ Test WFC MO MT, WiFI only mode, WIFI strong, Cellular weak 1651 1652 Set WiFi/Cellular network environment. 1653 Make Sure PhoneA is set correct WFC parameters. 1654 Make SUre PhoneB is able to make MO/MT call. 1655 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1656 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 1657 1658 Returns: 1659 True if pass; False if fail. 1660 """ 1661 ########### 1662 ads = [self.android_devices[0], self.android_devices[1]] 1663 mo_result = self._wfc_call_sequence( 1664 ads, DIRECTION_MOBILE_ORIGINATED, 1665 self._wfc_set_wifi_strong_cell_weak, 1666 self._wfc_phone_setup_wifi_only, self._phone_idle_iwlan, 1667 self._is_phone_in_call_iwlan, None, True) 1668 1669 mt_result = self._wfc_call_sequence( 1670 ads, DIRECTION_MOBILE_TERMINATED, 1671 self._wfc_set_wifi_strong_cell_weak, 1672 self._wfc_phone_setup_wifi_only, self._phone_idle_iwlan, 1673 self._is_phone_in_call_iwlan, None, True) 1674 1675 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1676 return ((mo_result is True) and (mt_result is True)) 1677 1678 @TelephonyBaseTest.tel_test_wrap 1679 def test_call_epdg_wfc_wifi_preferred_wifi_strong_cellular_weak(self): 1680 """ Test WFC MO MT, WiFI preferred mode, WIFI strong, Cellular weak 1681 1682 Set WiFi/Cellular network environment. 1683 Make Sure PhoneA is set correct WFC parameters. 1684 Make SUre PhoneB is able to make MO/MT call. 1685 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1686 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 1687 1688 Returns: 1689 True if pass; False if fail. 1690 """ 1691 ads = [self.android_devices[0], self.android_devices[1]] 1692 mo_result = self._wfc_call_sequence( 1693 ads, DIRECTION_MOBILE_ORIGINATED, 1694 self._wfc_set_wifi_strong_cell_weak, 1695 self._wfc_phone_setup_wifi_preferred, self._phone_idle_iwlan, 1696 self._is_phone_in_call_iwlan, None, True) 1697 1698 mt_result = self._wfc_call_sequence( 1699 ads, DIRECTION_MOBILE_TERMINATED, 1700 self._wfc_set_wifi_strong_cell_weak, 1701 self._wfc_phone_setup_wifi_preferred, self._phone_idle_iwlan, 1702 self._is_phone_in_call_iwlan, None, True) 1703 1704 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1705 return ((mo_result is True) and (mt_result is True)) 1706 1707 @TelephonyBaseTest.tel_test_wrap 1708 def test_call_epdg_wfc_cellular_preferred_wifi_strong_cellular_weak(self): 1709 """ Test WFC MO MT, cellular preferred mode, WIFI strong, Cellular weak 1710 1711 Set WiFi/Cellular network environment. 1712 Make Sure PhoneA is set correct WFC parameters. 1713 Make SUre PhoneB is able to make MO/MT call. 1714 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1715 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 1716 1717 Returns: 1718 True if pass; False if fail. 1719 """ 1720 ########### 1721 ads = [self.android_devices[0], self.android_devices[1]] 1722 mo_result = self._wfc_call_sequence( 1723 ads, DIRECTION_MOBILE_ORIGINATED, 1724 self._wfc_set_wifi_strong_cell_weak, 1725 self._wfc_phone_setup_cellular_preferred, self._phone_idle_iwlan, 1726 self._is_phone_in_call_iwlan, None, True) 1727 1728 mt_result = self._wfc_call_sequence( 1729 ads, DIRECTION_MOBILE_TERMINATED, 1730 self._wfc_set_wifi_strong_cell_weak, 1731 self._wfc_phone_setup_cellular_preferred, self._phone_idle_iwlan, 1732 self._is_phone_in_call_iwlan, None, True) 1733 1734 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1735 return ((mo_result is True) and (mt_result is True)) 1736 1737 @TelephonyBaseTest.tel_test_wrap 1738 def test_call_epdg_wfc_wifi_only_wifi_weak_cellular_weak(self): 1739 """ Test WFC MO MT, WiFI only mode, WIFI weak, Cellular weak 1740 1741 Set WiFi/Cellular network environment. 1742 Make Sure PhoneA is set correct WFC parameters. 1743 Make SUre PhoneB is able to make MO/MT call. 1744 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1745 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 1746 1747 Returns: 1748 True if pass; False if fail. 1749 """ 1750 ########### 1751 ads = [self.android_devices[0], self.android_devices[1]] 1752 mo_result = self._wfc_call_sequence( 1753 ads, DIRECTION_MOBILE_ORIGINATED, 1754 self._wfc_set_wifi_weak_cell_weak, self._wfc_phone_setup_wifi_only, 1755 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 1756 1757 mt_result = self._wfc_call_sequence( 1758 ads, DIRECTION_MOBILE_TERMINATED, 1759 self._wfc_set_wifi_weak_cell_weak, self._wfc_phone_setup_wifi_only, 1760 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 1761 1762 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1763 return ((mo_result is True) and (mt_result is True)) 1764 1765 @TelephonyBaseTest.tel_test_wrap 1766 def test_call_epdg_wfc_wifi_preferred_wifi_weak_cellular_weak(self): 1767 """ Test WFC MO MT, WiFI preferred mode, WIFI weak, Cellular weak 1768 1769 Set WiFi/Cellular network environment. 1770 Make Sure PhoneA is set correct WFC parameters. 1771 Make SUre PhoneB is able to make MO/MT call. 1772 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 1773 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 1774 1775 Returns: 1776 True if pass; False if fail. 1777 """ 1778 ########### 1779 ads = [self.android_devices[0], self.android_devices[1]] 1780 mo_result = self._wfc_call_sequence( 1781 ads, DIRECTION_MOBILE_ORIGINATED, 1782 self._wfc_set_wifi_weak_cell_weak, 1783 self._wfc_phone_setup_wifi_preferred, self._phone_idle_iwlan, 1784 self._is_phone_in_call_iwlan, None, True) 1785 1786 mt_result = self._wfc_call_sequence( 1787 ads, DIRECTION_MOBILE_TERMINATED, 1788 self._wfc_set_wifi_weak_cell_weak, 1789 self._wfc_phone_setup_wifi_preferred, self._phone_idle_iwlan, 1790 self._is_phone_in_call_iwlan, None, True) 1791 1792 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1793 return ((mo_result is True) and (mt_result is True)) 1794 1795 @TelephonyBaseTest.tel_test_wrap 1796 def test_call_epdg_wfc_cellular_preferred_wifi_weak_cellular_weak(self): 1797 """ Test WFC MO MT, cellular preferred mode, WIFI weak, Cellular weak 1798 1799 Set WiFi/Cellular network environment. 1800 Make Sure PhoneA is set correct WFC parameters. 1801 Make SUre PhoneB is able to make MO/MT call. 1802 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1803 Call from PhoneB to PhoneA, call should succeed, call should on Cellular. 1804 1805 Returns: 1806 True if pass; False if fail. 1807 """ 1808 ########### 1809 ads = [self.android_devices[0], self.android_devices[1]] 1810 mo_result = self._wfc_call_sequence( 1811 ads, DIRECTION_MOBILE_ORIGINATED, 1812 self._wfc_set_wifi_weak_cell_weak, 1813 self._wfc_phone_setup_cellular_preferred, 1814 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1815 True) 1816 1817 mt_result = self._wfc_call_sequence( 1818 ads, DIRECTION_MOBILE_TERMINATED, 1819 self._wfc_set_wifi_weak_cell_weak, 1820 self._wfc_phone_setup_cellular_preferred, 1821 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1822 True) 1823 1824 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1825 return ((mo_result is True) and (mt_result is True)) 1826 1827 @TelephonyBaseTest.tel_test_wrap 1828 def test_call_epdg_wfc_wifi_only_wifi_absent_cellular_weak(self): 1829 """ Test WFC MO MT, WiFI only mode, WIFI absent, Cellular weak 1830 1831 Set WiFi/Cellular network environment. 1832 Make Sure PhoneA is set correct WFC parameters. 1833 Make SUre PhoneB is able to make MO/MT call. 1834 Call from PhoneA to PhoneB, call should fail. 1835 Call from PhoneB to PhoneA, call should fail. 1836 1837 Returns: 1838 True if pass; False if fail. 1839 """ 1840 ########### 1841 ads = [self.android_devices[0], self.android_devices[1]] 1842 mo_result = self._wfc_call_sequence( 1843 ads, DIRECTION_MOBILE_ORIGINATED, 1844 self._wfc_set_wifi_absent_cell_weak, 1845 self._wfc_phone_setup_wifi_absent_wifi_only, 1846 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1847 "initiate_call fail.") 1848 1849 mt_result = self._wfc_call_sequence( 1850 ads, DIRECTION_MOBILE_TERMINATED, 1851 self._wfc_set_wifi_absent_cell_weak, 1852 self._wfc_phone_setup_wifi_absent_wifi_only, 1853 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1854 "wait_and_answer_call fail.") 1855 1856 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1857 return ((mo_result is True) and (mt_result is True)) 1858 1859 @TelephonyBaseTest.tel_test_wrap 1860 def test_call_epdg_wfc_wifi_preferred_wifi_absent_cellular_weak(self): 1861 """ Test WFC MO MT, WiFI preferred mode, WIFI absent, Cellular weak 1862 1863 Set WiFi/Cellular network environment. 1864 Make Sure PhoneA is set correct WFC parameters. 1865 Make SUre PhoneB is able to make MO/MT call. 1866 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1867 Call from PhoneB to PhoneA, call should succeed, call should on Cellular. 1868 1869 Returns: 1870 True if pass; False if fail. 1871 """ 1872 ads = [self.android_devices[0], self.android_devices[1]] 1873 mo_result = self._wfc_call_sequence( 1874 ads, DIRECTION_MOBILE_ORIGINATED, 1875 self._wfc_set_wifi_absent_cell_weak, 1876 self._wfc_phone_setup_wifi_absent_wifi_preferred, 1877 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1878 True) 1879 1880 mt_result = self._wfc_call_sequence( 1881 ads, DIRECTION_MOBILE_TERMINATED, 1882 self._wfc_set_wifi_absent_cell_weak, 1883 self._wfc_phone_setup_wifi_absent_wifi_preferred, 1884 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1885 True) 1886 1887 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1888 return ((mo_result is True) and (mt_result is True)) 1889 1890 @TelephonyBaseTest.tel_test_wrap 1891 def test_call_epdg_wfc_cellular_preferred_wifi_absent_cellular_weak(self): 1892 """ Test WFC MO MT, cellular preferred mode, WIFI absent, Cellular weak 1893 1894 Set WiFi/Cellular network environment. 1895 Make Sure PhoneA is set correct WFC parameters. 1896 Make SUre PhoneB is able to make MO/MT call. 1897 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1898 Call from PhoneB to PhoneA, call should succeed, call should on Cellular. 1899 1900 Returns: 1901 True if pass; False if fail. 1902 """ 1903 ads = [self.android_devices[0], self.android_devices[1]] 1904 mo_result = self._wfc_call_sequence( 1905 ads, DIRECTION_MOBILE_ORIGINATED, 1906 self._wfc_set_wifi_absent_cell_weak, 1907 self._wfc_phone_setup_wifi_absent_cellular_preferred, 1908 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1909 True) 1910 1911 mt_result = self._wfc_call_sequence( 1912 ads, DIRECTION_MOBILE_TERMINATED, 1913 self._wfc_set_wifi_absent_cell_weak, 1914 self._wfc_phone_setup_wifi_absent_cellular_preferred, 1915 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1916 True) 1917 1918 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1919 return ((mo_result is True) and (mt_result is True)) 1920 1921 @TelephonyBaseTest.tel_test_wrap 1922 def test_call_epdg_wfc_wifi_only_wifi_disabled_cellular_weak(self): 1923 """ Test WFC MO MT, WiFI only mode, WIFI disabled, Cellular weak 1924 1925 Set WiFi/Cellular network environment. 1926 Make Sure PhoneA is set correct WFC parameters. 1927 Make SUre PhoneB is able to make MO/MT call. 1928 Call from PhoneA to PhoneB, call should fail. 1929 Call from PhoneB to PhoneA, call should fail. 1930 1931 Returns: 1932 True if pass; False if fail. 1933 """ 1934 ########### 1935 ads = [self.android_devices[0], self.android_devices[1]] 1936 mo_result = self._wfc_call_sequence( 1937 ads, DIRECTION_MOBILE_ORIGINATED, 1938 self._wfc_set_wifi_strong_cell_weak, 1939 self._wfc_phone_setup_wifi_disabled_wifi_only, 1940 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1941 "initiate_call fail.") 1942 1943 mt_result = self._wfc_call_sequence( 1944 ads, DIRECTION_MOBILE_TERMINATED, 1945 self._wfc_set_wifi_strong_cell_weak, 1946 self._wfc_phone_setup_wifi_disabled_wifi_only, 1947 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 1948 "wait_and_answer_call fail.") 1949 1950 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1951 return ((mo_result is True) and (mt_result is True)) 1952 1953 @TelephonyBaseTest.tel_test_wrap 1954 def test_call_epdg_wfc_wifi_preferred_wifi_disabled_cellular_weak(self): 1955 """ Test WFC MO MT, WiFI preferred mode, WIFI disabled, Cellular weak 1956 1957 Set WiFi/Cellular network environment. 1958 Make Sure PhoneA is set correct WFC parameters. 1959 Make SUre PhoneB is able to make MO/MT call. 1960 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1961 Call from PhoneB to PhoneA, call should succeed, call should on Cellular. 1962 1963 Returns: 1964 True if pass; False if fail. 1965 """ 1966 ads = [self.android_devices[0], self.android_devices[1]] 1967 mo_result = self._wfc_call_sequence( 1968 ads, DIRECTION_MOBILE_ORIGINATED, 1969 self._wfc_set_wifi_strong_cell_weak, 1970 self._wfc_phone_setup_wifi_disabled_wifi_preferred, 1971 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1972 True) 1973 1974 mt_result = self._wfc_call_sequence( 1975 ads, DIRECTION_MOBILE_TERMINATED, 1976 self._wfc_set_wifi_strong_cell_weak, 1977 self._wfc_phone_setup_wifi_disabled_wifi_preferred, 1978 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 1979 True) 1980 1981 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 1982 return ((mo_result is True) and (mt_result is True)) 1983 1984 @TelephonyBaseTest.tel_test_wrap 1985 def test_call_epdg_wfc_cellular_preferred_wifi_disabled_cellular_weak( 1986 self): 1987 """ Test WFC MO MT, cellular preferred mode, WIFI disabled, Cellular weak 1988 1989 Set WiFi/Cellular network environment. 1990 Make Sure PhoneA is set correct WFC parameters. 1991 Make SUre PhoneB is able to make MO/MT call. 1992 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 1993 Call from PhoneB to PhoneA, call should succeed, call should on Cellular. 1994 1995 Returns: 1996 True if pass; False if fail. 1997 """ 1998 ads = [self.android_devices[0], self.android_devices[1]] 1999 mo_result = self._wfc_call_sequence( 2000 ads, DIRECTION_MOBILE_ORIGINATED, 2001 self._wfc_set_wifi_strong_cell_weak, 2002 self._wfc_phone_setup_wifi_disabled_cellular_preferred, 2003 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 2004 True) 2005 2006 mt_result = self._wfc_call_sequence( 2007 ads, DIRECTION_MOBILE_TERMINATED, 2008 self._wfc_set_wifi_strong_cell_weak, 2009 self._wfc_phone_setup_wifi_disabled_cellular_preferred, 2010 self._phone_idle_not_iwlan, self._is_phone_in_call_not_iwlan, None, 2011 True) 2012 2013 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2014 return ((mo_result is True) and (mt_result is True)) 2015 2016 @TelephonyBaseTest.tel_test_wrap 2017 def test_call_epdg_wfc_wifi_only_wifi_strong_cellular_absent(self): 2018 """ Test WFC MO MT, WiFI only mode, WIFI strong, Cellular absent 2019 2020 Set WiFi/Cellular network environment. 2021 Make Sure PhoneA is set correct WFC parameters. 2022 Make SUre PhoneB is able to make MO/MT call. 2023 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 2024 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 2025 2026 Returns: 2027 True if pass; False if fail. 2028 """ 2029 ########### 2030 ads = [self.android_devices[0], self.android_devices[1]] 2031 mo_result = self._wfc_call_sequence( 2032 ads, DIRECTION_MOBILE_ORIGINATED, 2033 self._wfc_set_wifi_strong_cell_absent, 2034 self._wfc_phone_setup_cellular_absent_wifi_only, 2035 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2036 2037 mt_result = self._wfc_call_sequence( 2038 ads, DIRECTION_MOBILE_TERMINATED, 2039 self._wfc_set_wifi_strong_cell_absent, 2040 self._wfc_phone_setup_cellular_absent_wifi_only, 2041 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2042 2043 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2044 return ((mo_result is True) and (mt_result is True)) 2045 2046 @TelephonyBaseTest.tel_test_wrap 2047 def test_call_epdg_wfc_wifi_preferred_wifi_strong_cellular_absent(self): 2048 """ Test WFC MO MT, WiFI preferred mode, WIFI strong, Cellular absent 2049 2050 Set WiFi/Cellular network environment. 2051 Make Sure PhoneA is set correct WFC parameters. 2052 Make SUre PhoneB is able to make MO/MT call. 2053 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 2054 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 2055 2056 Returns: 2057 True if pass; False if fail. 2058 """ 2059 ########### 2060 ads = [self.android_devices[0], self.android_devices[1]] 2061 mo_result = self._wfc_call_sequence( 2062 ads, DIRECTION_MOBILE_ORIGINATED, 2063 self._wfc_set_wifi_strong_cell_absent, 2064 self._wfc_phone_setup_cellular_absent_wifi_preferred, 2065 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2066 2067 mt_result = self._wfc_call_sequence( 2068 ads, DIRECTION_MOBILE_TERMINATED, 2069 self._wfc_set_wifi_strong_cell_absent, 2070 self._wfc_phone_setup_cellular_absent_wifi_preferred, 2071 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2072 2073 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2074 return ((mo_result is True) and (mt_result is True)) 2075 2076 @TelephonyBaseTest.tel_test_wrap 2077 def test_call_epdg_wfc_cellular_preferred_wifi_strong_cellular_absent( 2078 self): 2079 """ Test WFC MO MT, cellular preferred mode, WIFI strong, Cellular absent 2080 2081 Set WiFi/Cellular network environment. 2082 Make Sure PhoneA is set correct WFC parameters. 2083 Make SUre PhoneB is able to make MO/MT call. 2084 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 2085 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 2086 2087 Returns: 2088 True if pass; False if fail. 2089 """ 2090 ########### 2091 ads = [self.android_devices[0], self.android_devices[1]] 2092 mo_result = self._wfc_call_sequence( 2093 ads, DIRECTION_MOBILE_ORIGINATED, 2094 self._wfc_set_wifi_strong_cell_absent, 2095 self._wfc_phone_setup_cellular_absent_cellular_preferred, 2096 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2097 2098 mt_result = self._wfc_call_sequence( 2099 ads, DIRECTION_MOBILE_TERMINATED, 2100 self._wfc_set_wifi_strong_cell_absent, 2101 self._wfc_phone_setup_cellular_absent_cellular_preferred, 2102 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2103 2104 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2105 return ((mo_result is True) and (mt_result is True)) 2106 2107 @TelephonyBaseTest.tel_test_wrap 2108 def test_call_epdg_wfc_wifi_only_wifi_weak_cellular_absent(self): 2109 """ Test WFC MO MT, WiFI only mode, WIFI weak, Cellular absent 2110 2111 Set WiFi/Cellular network environment. 2112 Make Sure PhoneA is set correct WFC parameters. 2113 Make SUre PhoneB is able to make MO/MT call. 2114 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 2115 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 2116 2117 Returns: 2118 True if pass; False if fail. 2119 """ 2120 ########### 2121 ads = [self.android_devices[0], self.android_devices[1]] 2122 mo_result = self._wfc_call_sequence( 2123 ads, DIRECTION_MOBILE_ORIGINATED, 2124 self._wfc_set_wifi_weak_cell_absent, 2125 self._wfc_phone_setup_cellular_absent_wifi_only, 2126 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2127 2128 mt_result = self._wfc_call_sequence( 2129 ads, DIRECTION_MOBILE_TERMINATED, 2130 self._wfc_set_wifi_weak_cell_absent, 2131 self._wfc_phone_setup_cellular_absent_wifi_only, 2132 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2133 2134 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2135 return ((mo_result is True) and (mt_result is True)) 2136 2137 @TelephonyBaseTest.tel_test_wrap 2138 def test_call_epdg_wfc_wifi_preferred_wifi_weak_cellular_absent(self): 2139 """ Test WFC MO MT, WiFI preferred mode, WIFI weak, Cellular absent 2140 2141 Set WiFi/Cellular network environment. 2142 Make Sure PhoneA is set correct WFC parameters. 2143 Make SUre PhoneB is able to make MO/MT call. 2144 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 2145 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 2146 2147 Returns: 2148 True if pass; False if fail. 2149 """ 2150 ########### 2151 ads = [self.android_devices[0], self.android_devices[1]] 2152 mo_result = self._wfc_call_sequence( 2153 ads, DIRECTION_MOBILE_ORIGINATED, 2154 self._wfc_set_wifi_weak_cell_absent, 2155 self._wfc_phone_setup_cellular_absent_wifi_preferred, 2156 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2157 2158 mt_result = self._wfc_call_sequence( 2159 ads, DIRECTION_MOBILE_TERMINATED, 2160 self._wfc_set_wifi_weak_cell_absent, 2161 self._wfc_phone_setup_cellular_absent_wifi_preferred, 2162 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2163 2164 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2165 return ((mo_result is True) and (mt_result is True)) 2166 2167 @TelephonyBaseTest.tel_test_wrap 2168 def test_call_epdg_wfc_cellular_preferred_wifi_weak_cellular_absent(self): 2169 """ Test WFC MO MT, cellular preferred mode, WIFI weak, Cellular absent 2170 2171 Set WiFi/Cellular network environment. 2172 Make Sure PhoneA is set correct WFC parameters. 2173 Make SUre PhoneB is able to make MO/MT call. 2174 Call from PhoneA to PhoneB, call should succeed, call should on WiFi. 2175 Call from PhoneB to PhoneA, call should succeed, call should on WiFi. 2176 2177 Returns: 2178 True if pass; False if fail. 2179 """ 2180 ########### 2181 ads = [self.android_devices[0], self.android_devices[1]] 2182 mo_result = self._wfc_call_sequence( 2183 ads, DIRECTION_MOBILE_ORIGINATED, 2184 self._wfc_set_wifi_weak_cell_absent, 2185 self._wfc_phone_setup_cellular_absent_cellular_preferred, 2186 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2187 2188 mt_result = self._wfc_call_sequence( 2189 ads, DIRECTION_MOBILE_TERMINATED, 2190 self._wfc_set_wifi_weak_cell_absent, 2191 self._wfc_phone_setup_cellular_absent_cellular_preferred, 2192 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 2193 2194 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2195 return ((mo_result is True) and (mt_result is True)) 2196 2197 @TelephonyBaseTest.tel_test_wrap 2198 def test_call_epdg_wfc_wifi_only_wifi_absent_cellular_absent(self): 2199 """ Test WFC MO MT, WiFI only mode, WIFI absent, Cellular absent 2200 2201 Set WiFi/Cellular network environment. 2202 Make Sure PhoneA is set correct WFC parameters. 2203 Make SUre PhoneB is able to make MO/MT call. 2204 Call from PhoneA to PhoneB, call should fail. 2205 Call from PhoneB to PhoneA, call should fail. 2206 2207 Returns: 2208 True if pass; False if fail. 2209 """ 2210 ########### 2211 ads = [self.android_devices[0], self.android_devices[1]] 2212 mo_result = self._wfc_call_sequence( 2213 ads, DIRECTION_MOBILE_ORIGINATED, 2214 self._wfc_set_wifi_absent_cell_absent, 2215 self._wfc_phone_setup_cellular_absent_wifi_absent_wifi_only, 2216 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2217 "initiate_call fail.") 2218 2219 mt_result = self._wfc_call_sequence( 2220 ads, DIRECTION_MOBILE_TERMINATED, 2221 self._wfc_set_wifi_absent_cell_absent, 2222 self._wfc_phone_setup_cellular_absent_wifi_absent_wifi_only, 2223 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2224 "wait_and_answer_call fail.") 2225 2226 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2227 return ((mo_result is True) and (mt_result is True)) 2228 2229 @TelephonyBaseTest.tel_test_wrap 2230 def test_call_epdg_wfc_wifi_preferred_wifi_absent_cellular_absent(self): 2231 """ Test WFC MO MT, WiFI preferred mode, WIFI absent, Cellular absent 2232 2233 Set WiFi/Cellular network environment. 2234 Make Sure PhoneA is set correct WFC parameters. 2235 Make SUre PhoneB is able to make MO/MT call. 2236 Call from PhoneA to PhoneB, call should fail. 2237 Call from PhoneB to PhoneA, call should fail. 2238 2239 Returns: 2240 True if pass; False if fail. 2241 """ 2242 ########### 2243 ads = [self.android_devices[0], self.android_devices[1]] 2244 mo_result = self._wfc_call_sequence( 2245 ads, DIRECTION_MOBILE_ORIGINATED, 2246 self._wfc_set_wifi_absent_cell_absent, 2247 self._wfc_phone_setup_cellular_absent_wifi_absent_wifi_preferred, 2248 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2249 "initiate_call fail.") 2250 2251 mt_result = self._wfc_call_sequence( 2252 ads, DIRECTION_MOBILE_TERMINATED, 2253 self._wfc_set_wifi_absent_cell_absent, 2254 self._wfc_phone_setup_cellular_absent_wifi_absent_wifi_preferred, 2255 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2256 "wait_and_answer_call fail.") 2257 2258 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2259 return ((mo_result is True) and (mt_result is True)) 2260 2261 @TelephonyBaseTest.tel_test_wrap 2262 def test_call_epdg_wfc_cellular_preferred_wifi_absent_cellular_absent( 2263 self): 2264 """ Test WFC MO MT, cellular preferred mode, WIFI absent, Cellular absent 2265 2266 Set WiFi/Cellular network environment. 2267 Make Sure PhoneA is set correct WFC parameters. 2268 Make SUre PhoneB is able to make MO/MT call. 2269 Call from PhoneA to PhoneB, call should fail. 2270 Call from PhoneB to PhoneA, call should fail. 2271 2272 Returns: 2273 True if pass; False if fail. 2274 """ 2275 ########### 2276 ads = [self.android_devices[0], self.android_devices[1]] 2277 mo_result = self._wfc_call_sequence( 2278 ads, DIRECTION_MOBILE_ORIGINATED, 2279 self._wfc_set_wifi_absent_cell_absent, 2280 self._wfc_phone_setup_cellular_absent_wifi_absent_cellular_preferred, 2281 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2282 "initiate_call fail.") 2283 2284 mt_result = self._wfc_call_sequence( 2285 ads, DIRECTION_MOBILE_TERMINATED, 2286 self._wfc_set_wifi_absent_cell_absent, 2287 self._wfc_phone_setup_cellular_absent_wifi_absent_cellular_preferred, 2288 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2289 "wait_and_answer_call fail.") 2290 2291 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2292 return ((mo_result is True) and (mt_result is True)) 2293 2294 @TelephonyBaseTest.tel_test_wrap 2295 def test_call_epdg_wfc_wifi_only_wifi_disabled_cellular_absent(self): 2296 """ Test WFC MO MT, WiFI only mode, WIFI strong, Cellular absent 2297 2298 Set WiFi/Cellular network environment. 2299 Make Sure PhoneA is set correct WFC parameters. 2300 Make SUre PhoneB is able to make MO/MT call. 2301 Call from PhoneA to PhoneB, call should fail. 2302 Call from PhoneB to PhoneA, call should fail. 2303 2304 Returns: 2305 True if pass; False if fail. 2306 """ 2307 ########### 2308 ads = [self.android_devices[0], self.android_devices[1]] 2309 mo_result = self._wfc_call_sequence( 2310 ads, DIRECTION_MOBILE_ORIGINATED, 2311 self._wfc_set_wifi_strong_cell_absent, 2312 self._wfc_phone_setup_cellular_absent_wifi_disabled_wifi_only, 2313 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2314 "initiate_call fail.") 2315 2316 mt_result = self._wfc_call_sequence( 2317 ads, DIRECTION_MOBILE_TERMINATED, 2318 self._wfc_set_wifi_strong_cell_absent, 2319 self._wfc_phone_setup_cellular_absent_wifi_disabled_wifi_only, 2320 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2321 "wait_and_answer_call fail.") 2322 2323 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2324 return ((mo_result is True) and (mt_result is True)) 2325 2326 @TelephonyBaseTest.tel_test_wrap 2327 def test_call_epdg_wfc_wifi_preferred_wifi_disabled_cellular_absent(self): 2328 """ Test WFC MO MT, WiFI preferred mode, WIFI strong, Cellular absent 2329 2330 Set WiFi/Cellular network environment. 2331 Make Sure PhoneA is set correct WFC parameters. 2332 Make SUre PhoneB is able to make MO/MT call. 2333 Call from PhoneA to PhoneB, call should fail. 2334 Call from PhoneB to PhoneA, call should fail. 2335 2336 Returns: 2337 True if pass; False if fail. 2338 """ 2339 ########### 2340 ads = [self.android_devices[0], self.android_devices[1]] 2341 mo_result = self._wfc_call_sequence( 2342 ads, DIRECTION_MOBILE_ORIGINATED, 2343 self._wfc_set_wifi_strong_cell_absent, 2344 self._wfc_phone_setup_cellular_absent_wifi_disabled_wifi_preferred, 2345 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2346 "initiate_call fail.") 2347 2348 mt_result = self._wfc_call_sequence( 2349 ads, DIRECTION_MOBILE_TERMINATED, 2350 self._wfc_set_wifi_strong_cell_absent, 2351 self._wfc_phone_setup_cellular_absent_wifi_disabled_wifi_preferred, 2352 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2353 "wait_and_answer_call fail.") 2354 2355 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2356 return ((mo_result is True) and (mt_result is True)) 2357 2358 @TelephonyBaseTest.tel_test_wrap 2359 def test_call_epdg_wfc_cellular_preferred_wifi_disabled_cellular_absent( 2360 self): 2361 """ Test WFC MO MT, cellular preferred mode, WIFI strong, Cellular absent 2362 2363 Set WiFi/Cellular network environment. 2364 Make Sure PhoneA is set correct WFC parameters. 2365 Make SUre PhoneB is able to make MO/MT call. 2366 Call from PhoneA to PhoneB, call should fail. 2367 Call from PhoneB to PhoneA, call should fail. 2368 2369 Returns: 2370 True if pass; False if fail. 2371 """ 2372 ########### 2373 ads = [self.android_devices[0], self.android_devices[1]] 2374 mo_result = self._wfc_call_sequence( 2375 ads, DIRECTION_MOBILE_ORIGINATED, 2376 self._wfc_set_wifi_strong_cell_absent, 2377 self._wfc_phone_setup_cellular_absent_wifi_disabled_cellular_preferred, 2378 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2379 "initiate_call fail.") 2380 2381 mt_result = self._wfc_call_sequence( 2382 ads, DIRECTION_MOBILE_TERMINATED, 2383 self._wfc_set_wifi_strong_cell_absent, 2384 self._wfc_phone_setup_cellular_absent_wifi_disabled_cellular_preferred, 2385 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2386 "wait_and_answer_call fail.") 2387 2388 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2389 return ((mo_result is True) and (mt_result is True)) 2390 2391 @TelephonyBaseTest.tel_test_wrap 2392 def test_call_epdg_wfc_disabled_wifi_strong_cellular_strong(self): 2393 """ Test WFC MO MT, WFC disabled, WIFI strong, Cellular strong 2394 2395 Set WiFi/Cellular network environment. 2396 Make Sure PhoneA is set correct WFC parameters. 2397 Make SUre PhoneB is able to make MO/MT call. 2398 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 2399 Call from PhoneB to PHoneA, call should succeed, call should on Cellular. 2400 2401 Returns: 2402 True if pass; False if fail. 2403 """ 2404 ads = [self.android_devices[0], self.android_devices[1]] 2405 mo_result = self._wfc_call_sequence( 2406 ads, DIRECTION_MOBILE_ORIGINATED, 2407 self._wfc_set_wifi_strong_cell_strong, 2408 self._wfc_phone_setup_wfc_disabled, self._phone_idle_not_iwlan, 2409 self._is_phone_in_call_not_iwlan, None, True) 2410 2411 mt_result = self._wfc_call_sequence( 2412 ads, DIRECTION_MOBILE_TERMINATED, 2413 self._wfc_set_wifi_strong_cell_strong, 2414 self._wfc_phone_setup_wfc_disabled, self._phone_idle_not_iwlan, 2415 self._is_phone_in_call_not_iwlan, None, True) 2416 2417 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2418 return ((mo_result is True) and (mt_result is True)) 2419 2420 @TelephonyBaseTest.tel_test_wrap 2421 def test_call_epdg_wfc_disabled_wifi_strong_cellular_weak(self): 2422 """ Test WFC MO MT, WFC disabled, WIFI strong, Cellular weak 2423 2424 Set WiFi/Cellular network environment. 2425 Make Sure PhoneA is set correct WFC parameters. 2426 Make SUre PhoneB is able to make MO/MT call. 2427 Call from PhoneA to PhoneB, call should succeed, call should on Cellular. 2428 Call from PhoneB to PHoneA, call should succeed, call should on Cellular. 2429 2430 Returns: 2431 True if pass; False if fail. 2432 """ 2433 ads = [self.android_devices[0], self.android_devices[1]] 2434 mo_result = self._wfc_call_sequence( 2435 ads, DIRECTION_MOBILE_ORIGINATED, 2436 self._wfc_set_wifi_strong_cell_weak, 2437 self._wfc_phone_setup_wfc_disabled, self._phone_idle_not_iwlan, 2438 self._is_phone_in_call_not_iwlan, None, True) 2439 2440 mt_result = self._wfc_call_sequence( 2441 ads, DIRECTION_MOBILE_TERMINATED, 2442 self._wfc_set_wifi_strong_cell_weak, 2443 self._wfc_phone_setup_wfc_disabled, self._phone_idle_not_iwlan, 2444 self._is_phone_in_call_not_iwlan, None, True) 2445 2446 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2447 return ((mo_result is True) and (mt_result is True)) 2448 2449 @TelephonyBaseTest.tel_test_wrap 2450 def test_call_epdg_wfc_disabled_wifi_strong_cellular_absent(self): 2451 """ Test WFC MO MT, WFC disabled, WIFI strong, Cellular absent 2452 2453 Set WiFi/Cellular network environment. 2454 Make Sure PhoneA is set correct WFC parameters. 2455 Make SUre PhoneB is able to make MO/MT call. 2456 Call from PhoneA to PhoneB, call should fail. 2457 Call from PhoneB to PhoneA, call should fail. 2458 2459 Returns: 2460 True if pass; False if fail. 2461 """ 2462 ########### 2463 ads = [self.android_devices[0], self.android_devices[1]] 2464 mo_result = self._wfc_call_sequence( 2465 ads, DIRECTION_MOBILE_ORIGINATED, 2466 self._wfc_set_wifi_strong_cell_absent, 2467 self._wfc_phone_setup_cellular_absent_wfc_disabled, 2468 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2469 "initiate_call fail.") 2470 2471 mt_result = self._wfc_call_sequence( 2472 ads, DIRECTION_MOBILE_TERMINATED, 2473 self._wfc_set_wifi_strong_cell_absent, 2474 self._wfc_phone_setup_cellular_absent_wfc_disabled, 2475 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2476 "wait_and_answer_call fail.") 2477 2478 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2479 return ((mo_result is True) and (mt_result is True)) 2480 2481 @TelephonyBaseTest.tel_test_wrap 2482 def test_call_epdg_wfc_disabled_wifi_strong_apm(self): 2483 """ Test WFC MO MT, WFC disabled, WIFI strong, Phone in APM 2484 2485 Set WiFi/Cellular network environment. 2486 Make Sure PhoneA is set correct WFC parameters. 2487 Make SUre PhoneB is able to make MO/MT call. 2488 Call from PhoneA to PhoneB, call should fail. 2489 Call from PhoneB to PhoneA, call should fail. 2490 2491 Returns: 2492 True if pass; False if fail. 2493 """ 2494 ads = [self.android_devices[0], self.android_devices[1]] 2495 mo_result = self._wfc_call_sequence( 2496 ads, DIRECTION_MOBILE_ORIGINATED, 2497 self._wfc_set_wifi_strong_cell_strong, 2498 self._wfc_phone_setup_apm_wfc_disabled, self._phone_idle_not_iwlan, 2499 self._is_phone_not_in_call, None, "initiate_call fail.") 2500 2501 mt_result = self._wfc_call_sequence( 2502 ads, DIRECTION_MOBILE_TERMINATED, 2503 self._wfc_set_wifi_strong_cell_strong, 2504 self._wfc_phone_setup_apm_wfc_disabled, self._phone_idle_not_iwlan, 2505 self._is_phone_not_in_call, None, "wait_and_answer_call fail.") 2506 2507 self.log.info("MO: {}, MT: {}".format(mo_result, mt_result)) 2508 return ((mo_result is True) and (mt_result is True)) 2509 2510 def _rove_in_test(self, cellular_gen, wfc_mode): 2511 """Test utility for Rove-in Tests. 2512 2513 Cellular strong, WiFi RSSI < -100 dBm. 2514 Setup Cellular network and wfc_mode, WiFi enabled but not associated. 2515 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_NOT_ROVE_IN in 10s, 2516 PhoneA does not rove-in. 2517 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN in 10s, 2518 PhoneA rove-in. 2519 Make WFC call. 2520 """ 2521 self._wfc_set_wifi_absent_cell_strong() 2522 # ensure cellular rat, wfc mode, wifi not associated 2523 toggle_airplane_mode(self.log, self.android_devices[0], False) 2524 toggle_volte(self.log, self.android_devices[0], True) 2525 if not ensure_network_generation(self.log, self.android_devices[0], 2526 cellular_gen, voice_or_data=NETWORK_SERVICE_DATA): 2527 self.log.error("_rove_in_test: {} failed to be in rat: {}".format( 2528 self.android_devices[0].serial, cellular_rat)) 2529 return False 2530 if not set_wfc_mode(self.log, self.android_devices[0], wfc_mode): 2531 self.log.error("{} set WFC mode failed.".format( 2532 self.android_devices[0].serial)) 2533 return False 2534 2535 if ensure_wifi_connected(self.log, self.android_devices[0], 2536 self.live_network_ssid, 2537 self.live_network_pwd): 2538 self.log.error( 2539 "{} connect WiFI succeed, expected not succeed".format( 2540 self.android_devices[0].serial)) 2541 return False 2542 2543 # set up wifi to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_NOT_ROVE_IN in 10 seconds 2544 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 2545 self.wifi_rssi_with_no_atten, 2546 WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_NOT_ROVE_IN, 5, 1) 2547 if (not wait_for_wifi_data_connection(self.log, 2548 self.android_devices[0], True) or 2549 not verify_http_connection(self.log, self.android_devices[0])): 2550 self.log.error("No Data on Wifi") 2551 return False 2552 2553 if self._phone_idle_iwlan(): 2554 self.log.error("Phone should not report iwlan in WiFi {}Bm".format( 2555 WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_NOT_ROVE_IN)) 2556 return False 2557 2558 # set up wifi to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN in 10 seconds 2559 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 2560 self.wifi_rssi_with_no_atten, 2561 WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN, 1, 1) 2562 if not self._phone_idle_iwlan(): 2563 self.log.error("Phone should report iwlan in WiFi {}dBm".format( 2564 WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN)) 2565 return False 2566 2567 # make a wfc call. 2568 return self._wfc_call_sequence( 2569 [self.android_devices[0], self.android_devices[1]], 2570 DIRECTION_MOBILE_ORIGINATED, None, None, self._phone_idle_iwlan, 2571 self._is_phone_in_call_iwlan, None, True) 2572 2573 def _rove_out_test(self, cellular_gen, wfc_mode): 2574 """Test utility for Rove-out Tests. 2575 2576 Cellular strong, WiFi RSSI WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE. 2577 Setup Cellular network and wfc_mode, WiFi associated. 2578 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_NOT_ROVE_OUT in 10s, 2579 PhoneA does not rove-out. 2580 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT in 10s, 2581 PhoneA rove-out. 2582 Make a call. 2583 """ 2584 # set up cell strong 2585 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 2586 self.cell_rssi_with_no_atten, MAX_RSSI_RESERVED_VALUE) 2587 # set up wifi WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE 2588 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 2589 self.wifi_rssi_with_no_atten, 2590 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE) 2591 # ensure cellular rat, wfc mode, wifi associated 2592 toggle_airplane_mode(self.log, self.android_devices[0], False) 2593 toggle_volte(self.log, self.android_devices[0], True) 2594 if not ensure_network_generation(self.log, self.android_devices[0], 2595 GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): 2596 self.log.error("_rove_out_test: {} failed to be in rat: {}".format( 2597 self.android_devices[0].serial, cellular_rat)) 2598 return False 2599 if not set_wfc_mode(self.log, self.android_devices[0], wfc_mode): 2600 self.log.error("{} set WFC mode failed.".format( 2601 self.android_devices[0].serial)) 2602 return False 2603 if not ensure_wifi_connected(self.log, self.android_devices[0], 2604 self.live_network_ssid, 2605 self.live_network_pwd): 2606 self.log.error("{} connect WiFI failed, expected succeed".format( 2607 self.android_devices[0].serial)) 2608 return False 2609 if (not wait_for_wifi_data_connection(self.log, 2610 self.android_devices[0], True) or 2611 not verify_http_connection(self.log, self.android_devices[0])): 2612 self.log.error("No Data on Wifi") 2613 return False 2614 if not self._phone_idle_iwlan(): 2615 self.log.error("Phone failed to report iwlan in {}dBm.".format( 2616 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE)) 2617 return False 2618 2619 # set up wifi to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_NOT_ROVE_OUT in 10 seconds 2620 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 2621 self.wifi_rssi_with_no_atten, 2622 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_NOT_ROVE_OUT, 1, 1) 2623 if (not wait_for_wifi_data_connection(self.log, 2624 self.android_devices[0], True) or 2625 not verify_http_connection(self.log, self.android_devices[0])): 2626 self.log.error("No Data on Wifi") 2627 return False 2628 if self._phone_wait_for_not_wfc() or not self._phone_idle_iwlan(): 2629 self.log.error("Phone should not rove-out in {}dBm.".format( 2630 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_NOT_ROVE_OUT)) 2631 return False 2632 2633 # set up wifi to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT in 10 seconds 2634 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 2635 self.wifi_rssi_with_no_atten, 2636 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT, 2, 1) 2637 if (not wait_for_wifi_data_connection(self.log, 2638 self.android_devices[0], True) or 2639 not verify_http_connection(self.log, self.android_devices[0])): 2640 self.log.error("No Data on Wifi") 2641 return False 2642 2643 if not self._phone_wait_for_not_wfc() or self._phone_idle_iwlan(): 2644 self.log.error("Phone should rove-out in {}dBm.".format( 2645 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT)) 2646 return False 2647 # make a call. 2648 if wfc_mode == WFC_MODE_WIFI_ONLY: 2649 return self._wfc_call_sequence( 2650 [self.android_devices[0], self.android_devices[1]], 2651 DIRECTION_MOBILE_ORIGINATED, None, None, 2652 self._phone_idle_not_iwlan, self._is_phone_not_in_call, None, 2653 "initiate_call fail.") 2654 elif wfc_mode == WFC_MODE_WIFI_PREFERRED: 2655 if cellular_gen == GEN_4G: 2656 return self._wfc_call_sequence( 2657 [self.android_devices[0], self.android_devices[1]], 2658 DIRECTION_MOBILE_ORIGINATED, None, None, 2659 self._phone_idle_volte, self._is_phone_in_call_volte, None, 2660 True) 2661 else: 2662 return self._wfc_call_sequence( 2663 [self.android_devices[0], self.android_devices[1]], 2664 DIRECTION_MOBILE_ORIGINATED, None, None, 2665 self._phone_idle_3g, self._is_phone_in_call_3g, None, True) 2666 else: 2667 return False 2668 2669 @TelephonyBaseTest.tel_test_wrap 2670 def test_rove_out_in_stress(self): 2671 """WiFi Calling Rove out/in stress test. 2672 2673 Steps: 2674 1. PhoneA on LTE, VoLTE enabled. 2675 2. PhoneA WFC mode WiFi preferred, WiFi associated. 2676 3. Cellular strong, WiFi RSSI WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE. 2677 4. Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT in 10s, 2678 PhoneA rove-out. 2679 5. Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN in 10s, 2680 PhoneA rove-in. 2681 6. Repeat Step 4~5. 2682 2683 Expected Results: 2684 4. Phone should rove out. 2685 5. Phone should rove in. 2686 6. Stress test pass rate should be higher than pre-defined limit. 2687 """ 2688 self._wfc_set_wifi_strong_cell_strong() 2689 if not self._wfc_phone_setup_wifi_preferred(): 2690 self.log.error("Setup WFC failed.") 2691 return False 2692 if (not wait_for_wifi_data_connection(self.log, 2693 self.android_devices[0], True) or 2694 not verify_http_connection(self.log, self.android_devices[0])): 2695 self.log.error("No Data on Wifi") 2696 return False 2697 if not self._phone_idle_iwlan(): 2698 self.log.error("Phone failed to report iwlan in {}dBm.".format( 2699 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE)) 2700 return False 2701 total_iteration = self.stress_test_number 2702 self.log.info( 2703 "Rove_out/Rove_in stress test. Total iteration = {}.".format( 2704 total_iteration)) 2705 current_iteration = 1 2706 while (current_iteration <= total_iteration): 2707 self.log.info(">----Current iteration = {}/{}----<".format( 2708 current_iteration, total_iteration)) 2709 2710 # set up wifi to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT in 10 seconds 2711 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 2712 self.wifi_rssi_with_no_atten, 2713 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT, 2, 1) 2714 if (not wait_for_wifi_data_connection( 2715 self.log, self.android_devices[0], True) or 2716 not verify_http_connection(self.log, 2717 self.android_devices[0])): 2718 self.log.error("No Data on Wifi") 2719 break 2720 if not self._phone_wait_for_not_wfc(): 2721 self.log.error("Phone should rove-out in {}dBm.".format( 2722 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT)) 2723 break 2724 self.log.info("Rove-out succeed.") 2725 # set up wifi to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN in 10 seconds 2726 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 2727 self.wifi_rssi_with_no_atten, 2728 WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN, 2, 1) 2729 if (not wait_for_wifi_data_connection( 2730 self.log, self.android_devices[0], True) or 2731 not verify_http_connection(self.log, 2732 self.android_devices[0])): 2733 self.log.error("No Data on Wifi") 2734 break 2735 if not self._phone_wait_for_wfc(): 2736 self.log.error("Phone should rove-in in {}dBm.".format( 2737 WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN)) 2738 break 2739 self.log.info("Rove-in succeed.") 2740 2741 self.log.info(">----Iteration : {}/{} succeed.----<".format( 2742 current_iteration, total_iteration)) 2743 current_iteration += 1 2744 if current_iteration <= total_iteration: 2745 self.log.info(">----Iteration : {}/{} failed.----<".format( 2746 current_iteration, total_iteration)) 2747 return False 2748 else: 2749 return True 2750 2751 @TelephonyBaseTest.tel_test_wrap 2752 def test_rove_in_out_stress(self): 2753 """WiFi Calling Rove in/out stress test. 2754 2755 Steps: 2756 1. PhoneA on LTE, VoLTE enabled. 2757 2. PhoneA WFC mode WiFi preferred, WiFi associated. 2758 3. Cellular strong, WiFi RSSI weak. 2759 4. Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN in 10s, 2760 PhoneA rove-in. 2761 5. Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT in 10s, 2762 PhoneA rove-out. 2763 6. Repeat Step 4~5. 2764 2765 Expected Results: 2766 4. Phone should rove in. 2767 5. Phone should rove out. 2768 6. Stress test pass rate should be higher than pre-defined limit. 2769 """ 2770 self._wfc_set_wifi_weak_cell_strong() 2771 # ensure cellular rat, wfc mode, wifi not associated 2772 if not self._wfc_phone_setup_wifi_preferred(): 2773 self.log.error("Failed to setup for rove_in_out_stress") 2774 return False 2775 total_iteration = self.stress_test_number 2776 self.log.info( 2777 "Rove_in/Rove_out stress test. Total iteration = {}.".format( 2778 total_iteration)) 2779 current_iteration = 1 2780 while (current_iteration <= total_iteration): 2781 self.log.info(">----Current iteration = {}/{}----<".format( 2782 current_iteration, total_iteration)) 2783 2784 # set up wifi to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN in 10 seconds 2785 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 2786 self.wifi_rssi_with_no_atten, 2787 WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN, 2, 1) 2788 if (not wait_for_wifi_data_connection( 2789 self.log, self.android_devices[0], True) or 2790 not verify_http_connection(self.log, 2791 self.android_devices[0])): 2792 self.log.error("No Data on Wifi") 2793 break 2794 if not self._phone_wait_for_wfc(): 2795 self.log.error("Phone should rove-in in {}dBm.".format( 2796 WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN)) 2797 break 2798 self.log.info("Rove-in succeed.") 2799 2800 # set up wifi to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT in 10 seconds 2801 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 2802 self.wifi_rssi_with_no_atten, 2803 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT, 2, 1) 2804 if (not wait_for_wifi_data_connection( 2805 self.log, self.android_devices[0], True) or 2806 not verify_http_connection(self.log, 2807 self.android_devices[0])): 2808 self.log.error("No Data on Wifi") 2809 break 2810 if not self._phone_wait_for_not_wfc(): 2811 self.log.error("Phone should rove-out in {}dBm.".format( 2812 WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT)) 2813 break 2814 self.log.info("Rove-out succeed.") 2815 2816 self.log.info(">----Iteration : {}/{} succeed.----<".format( 2817 current_iteration, total_iteration)) 2818 current_iteration += 1 2819 if current_iteration <= total_iteration: 2820 self.log.info(">----Iteration : {}/{} failed.----<".format( 2821 current_iteration, total_iteration)) 2822 return False 2823 else: 2824 return True 2825 2826 @TelephonyBaseTest.tel_test_wrap 2827 def test_rove_in_lte_wifi_preferred(self): 2828 """ Test WFC rove-in features. 2829 2830 PhoneA on LTE, VoLTE enabled. 2831 PhoneA WFC mode WiFi preferred, WiFi enabled but not associated. 2832 Cellular strong, WiFi RSSI < -100 dBm. 2833 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_NOT_ROVE_IN in 10s, 2834 PhoneA does not rove-in. 2835 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN in 10s, 2836 PhoneA rove-in. 2837 Make WFC call. 2838 2839 Returns: 2840 True if pass; False if fail. 2841 """ 2842 return self._rove_in_test(GEN_4G, WFC_MODE_WIFI_PREFERRED) 2843 2844 @TelephonyBaseTest.tel_test_wrap 2845 def test_rove_in_lte_wifi_only(self): 2846 """ Test WFC rove-in features. 2847 2848 PhoneA on LTE, VoLTE enabled. 2849 PhoneA WFC mode WiFi only, WiFi enabled but not associated. 2850 Cellular strong, WiFi RSSI < -100 dBm. 2851 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_NOT_ROVE_IN in 10s, 2852 PhoneA does not rove-in. 2853 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN in 10s, 2854 PhoneA rove-in. 2855 Make WFC call. 2856 2857 Returns: 2858 True if pass; False if fail. 2859 """ 2860 ########### 2861 return self._rove_in_test(GEN_4G, WFC_MODE_WIFI_ONLY) 2862 2863 @TelephonyBaseTest.tel_test_wrap 2864 def test_rove_in_wcdma_wifi_preferred(self): 2865 """ Test WFC rove-in features. 2866 2867 PhoneA on WCDMA, VoLTE enabled. 2868 PhoneA WFC mode WiFi preferred, WiFi enabled but not associated. 2869 Cellular strong, WiFi RSSI < -100 dBm. 2870 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_NOT_ROVE_IN in 10s, 2871 PhoneA does not rove-in. 2872 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN in 10s, 2873 PhoneA rove-in. 2874 Make WFC call. 2875 2876 Returns: 2877 True if pass; False if fail. 2878 """ 2879 return self._rove_in_test(GEN_3G, WFC_MODE_WIFI_PREFERRED) 2880 2881 @TelephonyBaseTest.tel_test_wrap 2882 def test_rove_in_wcdma_wifi_only(self): 2883 """ Test WFC rove-in features. 2884 2885 PhoneA on WCDMA, VoLTE enabled. 2886 PhoneA WFC mode WiFi only, WiFi enabled but not associated. 2887 Cellular strong, WiFi RSSI < -100 dBm. 2888 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_NOT_ROVE_IN in 10s, 2889 PhoneA does not rove-in. 2890 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_IN_TEST_PHONE_ROVE_IN in 10s, 2891 PhoneA rove-in. 2892 Make WFC call. 2893 2894 Returns: 2895 True if pass; False if fail. 2896 """ 2897 ########### 2898 return self._rove_in_test(GEN_3G, WFC_MODE_WIFI_ONLY) 2899 2900 @TelephonyBaseTest.tel_test_wrap 2901 def test_rove_out_lte_wifi_preferred(self): 2902 """ Test WFC rove-out features. 2903 2904 PhoneA on LTE, VoLTE enabled. 2905 PhoneA WFC mode WiFi preferred, WiFi associated. 2906 Cellular strong, WiFi RSSI WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE. 2907 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_NOT_ROVE_OUT in 10s, 2908 PhoneA does not rove-out. 2909 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT in 10s, 2910 PhoneA rove-out. 2911 Make a call, call should succeed by cellular VoLTE. 2912 2913 Returns: 2914 True if pass; False if fail. 2915 """ 2916 return self._rove_out_test(GEN_4G, WFC_MODE_WIFI_PREFERRED) 2917 2918 @TelephonyBaseTest.tel_test_wrap 2919 def test_rove_out_lte_wifi_only(self): 2920 """ Test WFC rove-out features. 2921 2922 PhoneA on LTE, VoLTE enabled. 2923 PhoneA WFC mode WiFi only, WiFi associated. 2924 Cellular strong, WiFi RSSI WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE. 2925 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_NOT_ROVE_OUT in 10s, 2926 PhoneA does not rove-out. 2927 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT in 10s, 2928 PhoneA rove-out. 2929 Make a call, call should fail. 2930 2931 Returns: 2932 True if pass; False if fail. 2933 """ 2934 ########### 2935 return self._rove_out_test(GEN_4G, WFC_MODE_WIFI_ONLY) 2936 2937 @TelephonyBaseTest.tel_test_wrap 2938 def test_rove_out_wcdma_wifi_preferred(self): 2939 """ Test WFC rove-out features. 2940 2941 PhoneA on WCDMA, VoLTE enabled. 2942 PhoneA WFC mode WiFi preferred, WiFi associated. 2943 Cellular strong, WiFi RSSI WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE. 2944 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_NOT_ROVE_OUT in 10s, 2945 PhoneA does not rove-out. 2946 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT in 10s, 2947 PhoneA rove-out. 2948 Make a call, call should succeed by cellular 3g. 2949 2950 Returns: 2951 True if pass; False if fail. 2952 """ 2953 return self._rove_out_test(GEN_3G, WFC_MODE_WIFI_PREFERRED) 2954 2955 @TelephonyBaseTest.tel_test_wrap 2956 def test_rove_out_wcdma_wifi_only(self): 2957 """ Test WFC rove-out features. 2958 2959 PhoneA on WCDMA, VoLTE enabled. 2960 PhoneA WFC mode WiFi only, WiFi associated. 2961 Cellular strong, WiFi RSSI WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_INITIAL_STATE. 2962 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_NOT_ROVE_OUT in 10s, 2963 PhoneA does not rove-out. 2964 Set WiFI RSSI to WIFI_RSSI_FOR_ROVE_OUT_TEST_PHONE_ROVE_OUT in 10s, 2965 PhoneA rove-out. 2966 Make a call, call should fail. 2967 2968 Returns: 2969 True if pass; False if fail. 2970 """ 2971 ########### 2972 return self._rove_out_test(GEN_3G, WFC_MODE_WIFI_ONLY) 2973 2974 def _increase_wifi_rssi_check_phone_hand_in(self): 2975 """Private Test utility for hand_in test. 2976 2977 Increase WiFI RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_NOT_HAND_IN in 10s. 2978 PhoneA should connect to WiFi and have data on WiFi. 2979 PhoneA should not hand-in to iwlan. 2980 Increase WiFi RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN in 10s. 2981 PhoneA should hand-in to iwlan. 2982 PhoneA call should remain active. 2983 """ 2984 # Increase WiFI RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_NOT_HAND_IN in 10s 2985 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 2986 self.wifi_rssi_with_no_atten, 2987 WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_NOT_HAND_IN, 5, 1) 2988 # Make sure WiFI connected and data OK. 2989 if (not wait_for_wifi_data_connection(self.log, 2990 self.android_devices[0], True) or 2991 not verify_http_connection(self.log, self.android_devices[0])): 2992 self.log.error("No Data on Wifi") 2993 return False 2994 # Make sure phone not hand in to iwlan. 2995 if self._phone_wait_for_wfc(): 2996 self.log.error("Phone hand-in to wfc.") 2997 return False 2998 # Increase WiFI RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN in 10s 2999 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3000 self.wifi_rssi_with_no_atten, 3001 WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN, 2, 1) 3002 # Make sure phone hand in to iwlan. 3003 if not self._phone_wait_for_wfc(): 3004 self.log.error("Phone failed to hand-in to wfc.") 3005 return False 3006 if self._is_phone_not_in_call(): 3007 self.log.error("Phone call dropped.") 3008 return False 3009 return True 3010 3011 @TelephonyBaseTest.tel_test_wrap 3012 def test_hand_in_wifi_preferred(self): 3013 """WiFi Hand-In Threshold - WiFi Preferred 3014 3015 PhoneA on LTE, VoLTE enabled, WFC WiFi preferred. WiFI not associated. 3016 Cellular Strong, WiFi <-100 dBm 3017 Call from PhoneA to PhoneB, PhoneA should be on VoLTE. 3018 Increase WiFI RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_NOT_HAND_IN in 10s. 3019 PhoneA should connect to WiFi and have data on WiFi. 3020 PhoneA should not hand-in to iwlan. 3021 Increase WiFi RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN in 10s. 3022 PhoneA should hand-in to iwlan. 3023 PhoneA call should remain active. 3024 """ 3025 return self._wfc_call_sequence( 3026 [self.android_devices[0], self.android_devices[1]], 3027 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_absent_cell_strong, 3028 self._wfc_phone_setup_wifi_absent_wifi_preferred, 3029 self._phone_idle_volte, self._is_phone_in_call_volte, 3030 self._increase_wifi_rssi_check_phone_hand_in, True) 3031 3032 def _increase_wifi_rssi_hand_in_and_decrease_wifi_rssi_hand_out(self): 3033 if not self._increase_wifi_rssi_check_phone_hand_in(): 3034 return False 3035 if not self._decrease_wifi_rssi_check_phone_hand_out(): 3036 return False 3037 return True 3038 3039 @TelephonyBaseTest.tel_test_wrap 3040 def test_hand_in_out_wifi_preferred(self): 3041 """WiFi Hand-In-Out Threshold - WiFi Preferred 3042 3043 PhoneA on LTE, VoLTE enabled, WFC WiFi preferred. WiFI not associated. 3044 Cellular Strong, WiFi <-100 dBm 3045 Call from PhoneA to PhoneB, PhoneA should be on VoLTE. 3046 3047 Increase WiFI RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_NOT_HAND_IN in 10s. 3048 PhoneA should connect to WiFi and have data on WiFi. 3049 PhoneA should not hand-in to iwlan. 3050 Increase WiFi RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN in 10s. 3051 PhoneA should hand-in to iwlan. 3052 PhoneA call should remain active. 3053 3054 Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_NOT_HAND_OUT, in 10s. 3055 PhoneA should still be in call. 3056 PhoneA should not hand-out, PhoneA should have data on WiFi. 3057 Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT, in 10s. 3058 PhoneA should still be in call. PhoneA should hand-out to LTE. 3059 """ 3060 return self._wfc_call_sequence( 3061 [self.android_devices[0], self.android_devices[1]], 3062 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_absent_cell_strong, 3063 self._wfc_phone_setup_wifi_absent_wifi_preferred, 3064 self._phone_idle_volte, self._is_phone_in_call_volte, 3065 self._increase_wifi_rssi_hand_in_and_decrease_wifi_rssi_hand_out, 3066 True) 3067 3068 def _decrease_lte_rssi_check_phone_not_hand_in(self): 3069 """Private Test utility for hand_in test. 3070 3071 Decrease Cellular RSSI to CELL_WEAK_RSSI_VALUE in 30s. 3072 PhoneA should not hand-in to WFC. 3073 PhoneA should either drop or hands over to 3g/2g. 3074 """ 3075 # Decrease LTE RSSI to CELL_WEAK_RSSI_VALUE in 30 seconds 3076 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 3077 self.cell_rssi_with_no_atten, CELL_WEAK_RSSI_VALUE, 1, 1) 3078 # Make sure phone not hand in to iwlan. 3079 if self._phone_wait_for_wfc(): 3080 self.log.error("Phone hand-in to wfc.") 3081 return False 3082 3083 if is_phone_not_in_call(self.log, self.android_devices[0]): 3084 self.log.info("Call drop.") 3085 return True 3086 if self._is_phone_in_call_csfb(): 3087 self.log.info("Call hands over to 2g/3g.") 3088 return True 3089 return False 3090 3091 @TelephonyBaseTest.tel_test_wrap 3092 def test_hand_in_cellular_preferred(self): 3093 """WiFi Hand-In Not Attempted - Cellular Preferred 3094 3095 PhoneA on LTE, VoLTE enabled, WFC cellular preferred. WiFI associated. 3096 Cellular and WiFi signal strong. 3097 Call from PhoneA to PhoneB, PhoneA should be on VoLTE. 3098 Decrease Cellular RSSI to CELL_WEAK_RSSI_VALUE in 30s. 3099 PhoneA should not hand-in to WFC. 3100 PhoneA should either drop or hands over to 3g/2g. 3101 """ 3102 return self._wfc_call_sequence( 3103 [self.android_devices[0], self.android_devices[1]], 3104 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_strong_cell_strong, 3105 self._wfc_phone_setup_cellular_preferred, self._phone_idle_volte, 3106 self._is_phone_in_call_volte, 3107 self._decrease_lte_rssi_check_phone_not_hand_in, True) 3108 3109 def _decrease_wifi_rssi_check_phone_hand_out(self): 3110 """Private Test utility for hand_out test. 3111 3112 Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_NOT_HAND_OUT in 10s. 3113 PhoneA should still be in call. 3114 PhoneA should not hand-out, PhoneA should have data on WiFi. 3115 Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT in 10s. 3116 PhoneA should still be in call. PhoneA should hand-out to LTE. 3117 PhoneA should have data on WiFi. 3118 """ 3119 # Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_NOT_HAND_OUT 3120 # in 10 seconds 3121 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3122 self.wifi_rssi_with_no_atten, 3123 WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_NOT_HAND_OUT, 2, 1) 3124 # Make sure WiFi still connected and have data. 3125 if (not wait_for_wifi_data_connection(self.log, 3126 self.android_devices[0], True) or 3127 not verify_http_connection(self.log, self.android_devices[0])): 3128 self.log.error("No Data on Wifi") 3129 return False 3130 # Make sure phone not hand-out, not drop call 3131 if self._phone_wait_for_not_wfc(): 3132 self.log.error("Phone should not hand out.") 3133 return False 3134 if self._is_phone_not_in_call(): 3135 self.log.error("Phone should not drop call.") 3136 return False 3137 3138 # Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT 3139 # in 10 seconds 3140 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3141 self.wifi_rssi_with_no_atten, 3142 WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT, 2, 1) 3143 # Make sure WiFi still connected and have data. 3144 if (not wait_for_wifi_data_connection(self.log, 3145 self.android_devices[0], True) or 3146 not verify_http_connection(self.log, self.android_devices[0])): 3147 self.log.error("No Data on Wifi") 3148 return False 3149 # Make sure phone hand-out, not drop call 3150 if not self._phone_wait_for_not_wfc(): 3151 self.log.error("Phone should hand out.") 3152 return False 3153 if not self._is_phone_in_call_volte(): 3154 self.log.error("Phone should be in volte call.") 3155 return False 3156 3157 return True 3158 3159 @TelephonyBaseTest.tel_test_wrap 3160 def test_hand_out_wifi_preferred(self): 3161 """WiFi Hand-Out Threshold - WiFi Preferred 3162 3163 PhoneA on LTE, VoLTE enabled, WFC WiFi preferred, WiFi associated. 3164 Cellular and WiFi signal strong. 3165 Call from PhoneA to PhoneB, PhoneA should be on iwlan. 3166 Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_NOT_HAND_OUT in 10s. 3167 PhoneA should still be in call. 3168 PhoneA should not hand-out, PhoneA should have data on WiFi. 3169 Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT in 10s. 3170 PhoneA should still be in call. PhoneA should hand-out to LTE. 3171 PhoneA should have data on WiFi. 3172 """ 3173 return self._wfc_call_sequence( 3174 [self.android_devices[0], self.android_devices[1]], 3175 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_strong_cell_strong, 3176 self._wfc_phone_setup_wifi_preferred, self._phone_idle_iwlan, 3177 self._is_phone_in_call_iwlan, 3178 self._decrease_wifi_rssi_check_phone_hand_out, True) 3179 3180 def _decrease_wifi_rssi_hand_out_and_increase_wifi_rssi_hand_in(self): 3181 if not self._decrease_wifi_rssi_check_phone_hand_out(): 3182 return False 3183 if not self._increase_wifi_rssi_check_phone_hand_in(): 3184 return False 3185 return True 3186 3187 @TelephonyBaseTest.tel_test_wrap 3188 def test_hand_out_in_wifi_preferred(self): 3189 """WiFi Hand-Out Threshold - WiFi Preferred 3190 3191 PhoneA on LTE, VoLTE enabled, WFC WiFi preferred, WiFi associated. 3192 Cellular and WiFi signal strong. 3193 Call from PhoneA to PhoneB, PhoneA should be on iwlan. 3194 3195 Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_NOT_HAND_OUT in 10s. 3196 PhoneA should still be in call. 3197 PhoneA should not hand-out, PhoneA should have data on WiFi. 3198 Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT in 10s. 3199 PhoneA should still be in call. PhoneA should hand-out to LTE. 3200 PhoneA should have data on WiFi. 3201 3202 Increase WiFI RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_NOT_HAND_IN in 10s. 3203 PhoneA should connect to WiFi and have data on WiFi. 3204 PhoneA should not hand-in to iwlan. 3205 Increase WiFi RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN in 10s. 3206 PhoneA should hand-in to iwlan. 3207 PhoneA call should remain active. 3208 """ 3209 return self._wfc_call_sequence( 3210 [self.android_devices[0], self.android_devices[1]], 3211 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_strong_cell_strong, 3212 self._wfc_phone_setup_wifi_preferred, self._phone_idle_iwlan, 3213 self._is_phone_in_call_iwlan, 3214 self._decrease_wifi_rssi_hand_out_and_increase_wifi_rssi_hand_in, 3215 True) 3216 3217 def _hand_out_hand_in_stress(self): 3218 total_iteration = self.stress_test_number 3219 self.log.info( 3220 "Hand_out/Hand_in stress test. Total iteration = {}.".format( 3221 total_iteration)) 3222 current_iteration = 1 3223 if self._phone_wait_for_call_drop(): 3224 self.log.error("Call Drop.") 3225 return False 3226 while (current_iteration <= total_iteration): 3227 self.log.info(">----Current iteration = {}/{}----<".format( 3228 current_iteration, total_iteration)) 3229 3230 # Decrease WiFi RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT 3231 # in 10 seconds 3232 self.log.info("Decrease WiFi RSSI to hand out.") 3233 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3234 self.wifi_rssi_with_no_atten, 3235 WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT, 2, 1) 3236 # Make sure WiFi still connected and have data. 3237 if (not wait_for_wifi_data_connection( 3238 self.log, self.android_devices[0], True) or 3239 not verify_http_connection(self.log, 3240 self.android_devices[0])): 3241 self.log.error("No Data on Wifi") 3242 break 3243 # Make sure phone hand-out, not drop call 3244 if not self._phone_wait_for_not_wfc(): 3245 self.log.error("Phone failed to hand-out in RSSI {}.".format( 3246 WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT)) 3247 break 3248 if self._phone_wait_for_call_drop(): 3249 self.log.error("Call Drop.") 3250 break 3251 # Increase WiFI RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN in 10s 3252 self.log.info("Increase WiFi RSSI to hand in.") 3253 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3254 self.wifi_rssi_with_no_atten, 3255 WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN, 2, 1) 3256 # Make sure WiFi still connected and have data. 3257 if (not wait_for_wifi_data_connection( 3258 self.log, self.android_devices[0], True) or 3259 not verify_http_connection(self.log, 3260 self.android_devices[0])): 3261 self.log.error("No Data on Wifi") 3262 break 3263 # Make sure phone hand in to iwlan. 3264 if not self._phone_wait_for_wfc(): 3265 self.log.error("Phone failed to hand-in to wfc.") 3266 break 3267 if self._phone_wait_for_call_drop(): 3268 self.log.error("Call Drop.") 3269 break 3270 3271 self.log.info(">----Iteration : {}/{} succeed.----<".format( 3272 current_iteration, total_iteration)) 3273 current_iteration += 1 3274 if current_iteration <= total_iteration: 3275 self.log.info(">----Iteration : {}/{} failed.----<".format( 3276 current_iteration, total_iteration)) 3277 return False 3278 else: 3279 return True 3280 3281 @TelephonyBaseTest.tel_test_wrap 3282 def test_hand_out_in_stress(self): 3283 """WiFi Calling Hand out/in stress test. 3284 3285 Steps: 3286 1. PhoneA on LTE, VoLTE enabled. 3287 2. PhoneA WFC mode WiFi preferred, WiFi associated. 3288 3. Cellular strong, WiFi RSSI strong. Call from PhoneA to PhoneB, 3289 call should be on WFC. 3290 4. Set WiFI RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT in 10s, 3291 PhoneA hand-out. 3292 5. Set WiFI RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN in 10s, 3293 PhoneA hand-in. 3294 6. Repeat Step 4~5. Call should not drop. 3295 3296 Expected Results: 3297 4. Phone should hand out. 3298 5. Phone should hand in. 3299 6. Stress test pass rate should be higher than pre-defined limit. 3300 """ 3301 return self._wfc_call_sequence( 3302 [self.android_devices[0], self.android_devices[1]], 3303 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_strong_cell_strong, 3304 self._wfc_phone_setup_wifi_preferred, self._phone_idle_iwlan, 3305 self._is_phone_in_call_iwlan, self._hand_out_hand_in_stress, True) 3306 3307 def _hand_in_hand_out_stress(self): 3308 total_iteration = self.stress_test_number 3309 self.log.info( 3310 "Hand_in/Hand_out stress test. Total iteration = {}.".format( 3311 total_iteration)) 3312 current_iteration = 1 3313 if self._phone_wait_for_call_drop(): 3314 self.log.error("Call Drop.") 3315 return False 3316 while (current_iteration <= total_iteration): 3317 self.log.info(">----Current iteration = {}/{}----<".format( 3318 current_iteration, total_iteration)) 3319 3320 # Increase WiFi RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN 3321 # in 10 seconds 3322 self.log.info("Increase WiFi RSSI to hand in.") 3323 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3324 self.wifi_rssi_with_no_atten, 3325 WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN, 2, 1) 3326 # Make sure WiFi still connected and have data. 3327 if (not wait_for_wifi_data_connection( 3328 self.log, self.android_devices[0], True) or 3329 not verify_http_connection(self.log, 3330 self.android_devices[0])): 3331 self.log.error("No Data on Wifi") 3332 break 3333 # Make sure phone hand in to iwlan. 3334 if not self._phone_wait_for_wfc(): 3335 self.log.error("Phone failed to hand-in to wfc.") 3336 break 3337 if self._phone_wait_for_call_drop(): 3338 self.log.error("Call Drop.") 3339 break 3340 3341 # Decrease WiFI RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT in 10s 3342 self.log.info("Decrease WiFi RSSI to hand out.") 3343 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3344 self.wifi_rssi_with_no_atten, 3345 WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT, 2, 1) 3346 # Make sure WiFi still connected and have data. 3347 if (not wait_for_wifi_data_connection( 3348 self.log, self.android_devices[0], True) or 3349 not verify_http_connection(self.log, 3350 self.android_devices[0])): 3351 self.log.error("No Data on Wifi") 3352 break 3353 # Make sure phone hand-out, not drop call 3354 if not self._phone_wait_for_not_wfc(): 3355 self.log.error("Phone failed to hand-out in RSSI {}.".format( 3356 WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT)) 3357 break 3358 if self._phone_wait_for_call_drop(): 3359 self.log.error("Call Drop.") 3360 break 3361 3362 self.log.info(">----Iteration : {}/{} succeed.----<".format( 3363 current_iteration, total_iteration)) 3364 current_iteration += 1 3365 if current_iteration <= total_iteration: 3366 self.log.info(">----Iteration : {}/{} failed.----<".format( 3367 current_iteration, total_iteration)) 3368 return False 3369 else: 3370 return True 3371 3372 @TelephonyBaseTest.tel_test_wrap 3373 def test_hand_in_out_stress(self): 3374 """WiFi Calling Hand in/out stress test. 3375 3376 Steps: 3377 1. PhoneA on LTE, VoLTE enabled. 3378 2. PhoneA WFC mode WiFi preferred, WiFi associated. 3379 3. Cellular strong, WiFi RSSI weak. Call from PhoneA to PhoneB, 3380 call should be on VoLTE. 3381 4. Set WiFI RSSI to WIFI_RSSI_FOR_HAND_IN_TEST_PHONE_HAND_IN in 10s, 3382 PhoneA hand-in. 3383 5. Set WiFI RSSI to WIFI_RSSI_FOR_HAND_OUT_TEST_PHONE_HAND_OUT in 10s, 3384 PhoneA hand-out. 3385 6. Repeat Step 4~5. Call should not drop. 3386 3387 Expected Results: 3388 4. Phone should hand in. 3389 5. Phone should hand out. 3390 6. Stress test pass rate should be higher than pre-defined limit. 3391 """ 3392 return self._wfc_call_sequence( 3393 [self.android_devices[0], self.android_devices[1]], 3394 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_weak_cell_strong, 3395 self._wfc_phone_setup_wifi_preferred, self._phone_idle_volte, 3396 self._is_phone_in_call_volte, self._hand_in_hand_out_stress, True) 3397 3398 def _increase_cellular_rssi_check_phone_hand_out(self): 3399 """Private Test utility for hand_out test. 3400 3401 Increase Cellular RSSI to CELL_STRONG_RSSI_VALUE, in 30s. 3402 PhoneA should still be in call. PhoneA should hand-out to LTE. 3403 PhoneA should have data on WiFi. 3404 """ 3405 # Increase Cellular RSSI to CELL_STRONG_RSSI_VALUE in 30 seconds 3406 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_CELL], 3407 self.cell_rssi_with_no_atten, CELL_STRONG_RSSI_VALUE, 1, 1) 3408 # Make sure phone hand-out, not drop call 3409 if not self._phone_wait_for_not_wfc(): 3410 self.log.error("Phone should hand out.") 3411 return False 3412 if not self._is_phone_in_call_volte(): 3413 self.log.error("Phone should be in volte call.") 3414 return False 3415 # Make sure WiFi still connected and have data. 3416 if (not wait_for_wifi_data_connection(self.log, 3417 self.android_devices[0], True) or 3418 not verify_http_connection(self.log, self.android_devices[0])): 3419 self.log.error("No Data on Wifi") 3420 return False 3421 return True 3422 3423 @TelephonyBaseTest.tel_test_wrap 3424 def test_hand_out_cellular_preferred(self): 3425 """WiFi Hand-Out Threshold - Cellular Preferred 3426 3427 Cellular signal absent, WiFi signal strong. 3428 PhoneA VoLTE enabled, WFC Cellular preferred, WiFi associated. 3429 Call from PhoneA to PhoneB, PhoneA should be on iwlan. 3430 Increase Cellular RSSI to CELL_STRONG_RSSI_VALUE, in 30s. 3431 PhoneA should still be in call. PhoneA should hand-out to LTE. 3432 PhoneA should have data on WiFi. 3433 """ 3434 return self._wfc_call_sequence( 3435 [self.android_devices[0], self.android_devices[1]], 3436 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_strong_cell_absent, 3437 self._wfc_phone_setup_cellular_absent_cellular_preferred, 3438 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, 3439 self._increase_cellular_rssi_check_phone_hand_out, True) 3440 3441 def _decrease_wifi_rssi_check_phone_not_hand_out(self): 3442 """Private Test utility for hand_out test. 3443 3444 Decrease WiFi RSSI to <-100dBm, in 30s. 3445 PhoneA should drop call. PhoneA should not report LTE as voice RAT. 3446 PhoneA data should be on LTE. 3447 """ 3448 # Decrease WiFi RSSI to <-100dBm in 30 seconds 3449 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3450 self.wifi_rssi_with_no_atten, MIN_RSSI_RESERVED_VALUE) 3451 # Make sure PhoneA data is on LTE. 3452 if (not wait_for_cell_data_connection(self.log, 3453 self.android_devices[0], True) or 3454 not verify_http_connection(self.log, self.android_devices[0])): 3455 self.log.error("Data not on Cell.") 3456 return False 3457 # Make sure phone drop. 3458 self.log.info("Wait for call drop.") 3459 if not self._phone_wait_for_call_drop(): 3460 self.log.error("Phone should drop call.") 3461 return False 3462 # Make sure Voice RAT is not LTE. 3463 # FIXME: I think there's something wrong with this check 3464 if RAT_LTE == get_network_rat(self.log, self.android_devices[0], 3465 NETWORK_SERVICE_VOICE): 3466 self.log.error("Phone should not report lte as voice rat.") 3467 return False 3468 return True 3469 3470 @TelephonyBaseTest.tel_test_wrap 3471 def test_hand_out_wifi_only(self): 3472 """WiFi Hand-Out Not Attempted - WiFi Only 3473 3474 PhoneA on LTE, VoLTE enabled, WFC WiFi only, WiFi associated. 3475 Cellular and WiFi signal strong. 3476 Call from PhoneA to PhoneB, PhoneA should be on iwlan. 3477 Decrease WiFi RSSI to <-100dBm, in 30s. 3478 PhoneA should drop call. PhoneA should not report LTE as voice RAT. 3479 PhoneA data should be on LTE. 3480 """ 3481 return self._wfc_call_sequence( 3482 [self.android_devices[0], self.android_devices[1]], 3483 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_strong_cell_strong, 3484 self._wfc_phone_setup_wifi_only, self._phone_idle_iwlan, 3485 self._is_phone_in_call_iwlan, 3486 self._decrease_wifi_rssi_check_phone_not_hand_out, True) 3487 3488 @TelephonyBaseTest.tel_test_wrap 3489 def test_call_epdg_wfc_wifi_preferred_e4g_disabled(self): 3490 """WiFi Calling with E4G disabled. 3491 3492 PhoneA on LTE, VoLTE disabled, WFC WiFi preferred, WiFi associated. 3493 Cellular and WiFi signal strong. 3494 Call from PhoneA to PhoneB, PhoneA should be on iwlan. 3495 """ 3496 return self._wfc_call_sequence( 3497 [self.android_devices[0], self.android_devices[1]], 3498 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_strong_cell_strong, 3499 self._wfc_phone_setup_wifi_preferred_e4g_disabled, 3500 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, None, True) 3501 3502 @TelephonyBaseTest.tel_test_wrap 3503 def test_call_epdg_wfc_wifi_preferred_e4g_disabled_wifi_not_connected( 3504 self): 3505 """WiFi Calling with E4G disabled. 3506 3507 PhoneA on LTE, VoLTE disabled, WFC WiFi preferred, WiFi not associated. 3508 Cellular signal strong, WiFi absent. 3509 Call from PhoneA to PhoneB, PhoneA should be on CSFB. 3510 """ 3511 return self._wfc_call_sequence( 3512 [self.android_devices[0], self.android_devices[1]], 3513 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_absent_cell_strong, 3514 self._wfc_phone_setup_wifi_absent_wifi_preferred_e4g_disabled, 3515 self._phone_idle_not_iwlan, self._is_phone_in_call_csfb, None, 3516 True) 3517 3518 def _decrease_wifi_rssi_check_phone_drop(self): 3519 """Private Test utility for e4g_disabled_wfc test. 3520 3521 Decrease WiFi RSSI to make sure WiFI not connected. Call should Drop. 3522 """ 3523 # Decrease WiFi RSSI to <-100dBm in 30 seconds 3524 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3525 self.wifi_rssi_with_no_atten, MIN_RSSI_RESERVED_VALUE) 3526 # Make sure PhoneA data is on cellular. 3527 if (not wait_for_cell_data_connection(self.log, 3528 self.android_devices[0], True) or 3529 not verify_http_connection(self.log, self.android_devices[0])): 3530 self.log.error("Data not on Cell.") 3531 return False 3532 # Make sure phone drop. 3533 self.log.info("Wait for call drop.") 3534 if not self._phone_wait_for_call_drop(): 3535 self.log.error("Phone should drop call.") 3536 return False 3537 return True 3538 3539 @TelephonyBaseTest.tel_test_wrap 3540 def test_call_epdg_wfc_wifi_preferred_e4g_disabled_leave_wifi_coverage( 3541 self): 3542 """WiFi Calling with E4G disabled. 3543 3544 PhoneA on LTE, VoLTE disabled, WFC WiFi preferred, WiFi associated. 3545 Cellular and WiFi signal strong. 3546 Call from PhoneA to PhoneB, PhoneA should be on iwlan. 3547 Decrease WiFi RSSI to make sure WiFI not connected. Call should Drop. 3548 """ 3549 return self._wfc_call_sequence( 3550 [self.android_devices[0], self.android_devices[1]], 3551 DIRECTION_MOBILE_ORIGINATED, self._wfc_set_wifi_strong_cell_strong, 3552 self._wfc_phone_setup_wifi_preferred_e4g_disabled, 3553 self._phone_idle_iwlan, self._is_phone_in_call_iwlan, 3554 self._decrease_wifi_rssi_check_phone_drop, True) 3555 3556 @TelephonyBaseTest.tel_test_wrap 3557 def test_rssi_monitoring(self): 3558 """Test WiFi RSSI Monitoring API and Callback function. 3559 3560 Steps: 3561 1. Set WiFi RSSI to INITIAL_RSSI (-60dBm), connect WiFi on DUT. 3562 2. Start WiFi RSSI Monitoring for HIGHER_RSSI_THRESHOLD (-50dBm) and 3563 LOWER_RSSI_THRESHOLD (-70dBm) 3564 3. Increase WiFi RSSI to HIGHER_RSSI_THRESHOLD+5dBm 3565 4. Decrease WiFi RSSI to HIGHER_RSSI_THRESHOLD-5dBm 3566 5. Decrease WiFi RSSI to LOWER_RSSI_THRESHOLD-5dBm 3567 6. Increase WiFi RSSI to LOWER_RSSI_THRESHOLD+5dBm 3568 3569 Expected Results: 3570 1. WiFi Connected successfully. 3571 2. DUT report LOWER_RSSI_THRESHOLD available. 3572 3. DUT report HIGHER_RSSI_THRESHOLD available. 3573 4. DUT report HIGHER_RSSI_THRESHOLD lost. 3574 5. DUT report LOWER_RSSI_THRESHOLD lost. 3575 6. DUT report LOWER_RSSI_THRESHOLD available. 3576 """ 3577 INITIAL_RSSI = -60 3578 HIGHER_RSSI_THRESHOLD = -50 3579 LOWER_RSSI_THRESHOLD = -70 3580 RSSI_THRESHOLD_MARGIN = 5 3581 3582 WIFI_RSSI_CHANGE_STEP_SIZE = 2 3583 WIFI_RSSI_CHANGE_DELAY_PER_STEP = 1 3584 3585 ad = self.android_devices[0] 3586 3587 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3588 self.wifi_rssi_with_no_atten, INITIAL_RSSI) 3589 if not ensure_wifi_connected(self.log, ad, self.live_network_ssid, 3590 self.live_network_pwd): 3591 self.log.error("{} connect WiFI failed".format(ad.serial)) 3592 return False 3593 try: 3594 rssi_monitoring_id_higher = ad.droid.connectivitySetRssiThresholdMonitor( 3595 HIGHER_RSSI_THRESHOLD) 3596 rssi_monitoring_id_lower = ad.droid.connectivitySetRssiThresholdMonitor( 3597 LOWER_RSSI_THRESHOLD) 3598 3599 self.log.info( 3600 "Initial RSSI: {}," 3601 "rssi_monitoring_id_lower should be available.".format( 3602 INITIAL_RSSI)) 3603 try: 3604 event = ad.ed.wait_for_event( 3605 EventNetworkCallback, 3606 is_network_call_back_event_match, 3607 network_callback_id=rssi_monitoring_id_lower, 3608 network_callback_event=NetworkCallbackAvailable) 3609 self.log.info("Received Event: {}".format(event)) 3610 except Empty: 3611 self.log.error("No {} event for id {}".format( 3612 NetworkCallbackAvailable, rssi_monitoring_id_lower)) 3613 return False 3614 3615 self.log.info("Set RSSI to HIGHER_RSSI_THRESHOLD+5," 3616 "rssi_monitoring_id_higher should be available.") 3617 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3618 self.wifi_rssi_with_no_atten, 3619 HIGHER_RSSI_THRESHOLD + RSSI_THRESHOLD_MARGIN, 3620 WIFI_RSSI_CHANGE_STEP_SIZE, 3621 WIFI_RSSI_CHANGE_DELAY_PER_STEP) 3622 try: 3623 event = ad.ed.wait_for_event( 3624 EventNetworkCallback, 3625 is_network_call_back_event_match, 3626 network_callback_id=rssi_monitoring_id_higher, 3627 network_callback_event=NetworkCallbackAvailable) 3628 self.log.info("Received Event: {}".format(event)) 3629 except Empty: 3630 self.log.error("No {} event for id {}".format( 3631 NetworkCallbackAvailable, rssi_monitoring_id_higher)) 3632 return False 3633 3634 self.log.info("Set RSSI to HIGHER_RSSI_THRESHOLD-5," 3635 "rssi_monitoring_id_higher should be lost.") 3636 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3637 self.wifi_rssi_with_no_atten, 3638 HIGHER_RSSI_THRESHOLD - RSSI_THRESHOLD_MARGIN, 3639 WIFI_RSSI_CHANGE_STEP_SIZE, 3640 WIFI_RSSI_CHANGE_DELAY_PER_STEP) 3641 try: 3642 event = ad.ed.wait_for_event( 3643 EventNetworkCallback, 3644 is_network_call_back_event_match, 3645 network_callback_id=rssi_monitoring_id_higher, 3646 network_callback_event=NetworkCallbackLost) 3647 self.log.info("Received Event: {}".format(event)) 3648 except Empty: 3649 self.log.error("No {} event for id {}".format( 3650 NetworkCallbackLost, rssi_monitoring_id_higher)) 3651 return False 3652 3653 self.log.info("Set RSSI to LOWER_RSSI_THRESHOLD-5," 3654 "rssi_monitoring_id_lower should be lost.") 3655 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3656 self.wifi_rssi_with_no_atten, 3657 LOWER_RSSI_THRESHOLD - RSSI_THRESHOLD_MARGIN, 3658 WIFI_RSSI_CHANGE_STEP_SIZE, 3659 WIFI_RSSI_CHANGE_DELAY_PER_STEP) 3660 try: 3661 event = ad.ed.wait_for_event( 3662 EventNetworkCallback, 3663 is_network_call_back_event_match, 3664 network_callback_id=rssi_monitoring_id_lower, 3665 network_callback_event=NetworkCallbackLost) 3666 self.log.info("Received Event: {}".format(event)) 3667 except Empty: 3668 self.log.error("No {} event for id {}".format( 3669 NetworkCallbackLost, rssi_monitoring_id_lower)) 3670 return False 3671 3672 self.log.info("Set RSSI to LOWER_RSSI_THRESHOLD+5," 3673 "rssi_monitoring_id_lower should be available.") 3674 set_rssi(self.log, self.attens[ATTEN_NAME_FOR_WIFI], 3675 self.wifi_rssi_with_no_atten, 3676 LOWER_RSSI_THRESHOLD + RSSI_THRESHOLD_MARGIN, 3677 WIFI_RSSI_CHANGE_STEP_SIZE, 3678 WIFI_RSSI_CHANGE_DELAY_PER_STEP) 3679 try: 3680 event = ad.ed.wait_for_event( 3681 EventNetworkCallback, 3682 is_network_call_back_event_match, 3683 network_callback_id=rssi_monitoring_id_lower, 3684 network_callback_event=NetworkCallbackAvailable) 3685 self.log.info("Received Event: {}".format(event)) 3686 except Empty: 3687 self.log.error("No {} event for id {}".format( 3688 NetworkCallbackAvailable, rssi_monitoring_id_lower)) 3689 return False 3690 finally: 3691 ad.droid.connectivityStopRssiThresholdMonitor( 3692 rssi_monitoring_id_higher) 3693 ad.droid.connectivityStopRssiThresholdMonitor( 3694 rssi_monitoring_id_lower) 3695 return True 3696 3697 3698 """ Tests End """ 3699