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