def test_lte_volte_wfc_enabled_reset_wifi_stress(self): """Test for WiFi Calling settings: LTE + VoLTE Enabled + WFC enabled, Reset WiFi Stress test Steps: 1. Setup DUT Idle, LTE network type, VoLTE enabled. 2. Make sure DUT WiFi disconnected, WFC enabled (WiFi Preferred). 3. DUT connect WiFi, verify DUT WFC available, report iwlan rat. 4. DUT Reset WiFi, verify DUT WFC unavailable, not report iwlan rat. 5. Verify DUT report VoLTE available. 6. Repeat steps 3~5 for N times. Expected Results: 3. DUT WiFi Calling feature bit return True, network rat is iwlan. 4. DUT WiFi Calling feature bit return False, network rat is not iwlan. 5. DUT report VoLTE available. """ if not phone_setup_volte(self.log, self.ad): self.log.error("Failed to setup VoLTE") return False set_wfc_mode(self.log, self.ad, WFC_MODE_WIFI_PREFERRED) for i in range(1, self.stress_test_number + 1): self.log.info("Start Iteration {}.".format(i)) result = self._wifi_connected_enable_wfc_teardown_wfc( tear_down_operation=self._TEAR_DOWN_OPERATION_RESET_WIFI, initial_setup_wifi=True, initial_setup_wfc_mode=None, check_volte_after_wfc_disabled=True) if not result: self.log.error("Test Failed in iteration: {}.".format(i)) return False return True
def _wifi_connected_enable_wfc_teardown_wfc( self, tear_down_operation, initial_setup_wifi=True, initial_setup_wfc_mode=WFC_MODE_WIFI_PREFERRED, check_volte_after_wfc_disabled=False): if initial_setup_wifi and not ensure_wifi_connected( self.log, self.ad, self.wifi_network_ssid, self.wifi_network_pass): self.log.error("Failed to connect WiFi") return False if initial_setup_wfc_mode and not set_wfc_mode(self.log, self.ad, initial_setup_wfc_mode): self.log.error("Failed to set WFC mode.") return False if not phone_idle_iwlan(self.log, self.ad): self.log.error("WFC is not available.") return False # Tear Down WFC based on tear_down_operation if tear_down_operation == self._TEAR_DOWN_OPERATION_DISCONNECT_WIFI: if not WifiUtils.wifi_toggle_state(self.log, self.ad, False): self.log.error("Failed to turn off WiFi.") return False elif tear_down_operation == self._TEAR_DOWN_OPERATION_RESET_WIFI: if not WifiUtils.wifi_reset(self.log, self.ad, False): self.log.error("Failed to reset WiFi") return False elif tear_down_operation == self._TEAR_DOWN_OPERATION_DISABLE_WFC: if not set_wfc_mode(self.log, self.ad, WFC_MODE_DISABLED): self.log.error("Failed to turn off WFC.") return False else: self.log.error("No tear down operation") return False if not wait_for_not_network_rat(self.log, self.ad, RAT_FAMILY_WLAN, voice_or_data=NETWORK_SERVICE_DATA): self.log.error("Data Rat is still iwlan.") return False if not wait_for_wfc_disabled(self.log, self.ad): self.log.error("WFC is still available after turn off WFC.") return False # If VoLTE was previous available, after tear down WFC, DUT should have # VoLTE service. if check_volte_after_wfc_disabled and not wait_for_volte_enabled( self.log, self.ad, MAX_WAIT_TIME_VOLTE_ENABLED): self.log.error("Device failed to acquire VoLTE service") return False return True
def setup_class(self): """ Setup devices for tethering and unpack params """ self.dut = self.android_devices[0] self.dut_b = self.android_devices[1] for ad in self.android_devices: nutils.verify_lte_data_and_tethering_supported(ad) set_wfc_mode(self.log, ad, WFC_MODE_DISABLED) req_params = ("ping_hosts", "ipv4_only_network", "ipv4_ipv6_network",) self.unpack_userparams(req_params) self.tcpdump_pid = None self.private_dns_servers = [cconst.DNS_GOOGLE, cconst.DNS_QUAD9, cconst.DNS_CLOUDFLARE]
def phone_setup_video_for_subscription(log, ad, sub_id, wfc_mode=WFC_MODE_DISABLED): """Setup phone sub_id to make video call Args: log: log object. ad: android device object sub_id: ad's sub id. wfc_mode: WFC mode to set to. Valid mode includes: WFC_MODE_WIFI_ONLY, WFC_MODE_CELLULAR_PREFERRED, WFC_MODE_WIFI_PREFERRED, WFC_MODE_DISABLED. Returns: True if ad (sub_id) is setup correctly and idle for video call. """ toggle_airplane_mode(log, ad, False) if not set_wfc_mode(log, ad, wfc_mode): log.error("{} WFC mode failed to be set to {}.".format( ad.serial, wfc_mode)) return False toggle_volte(log, ad, True) if not ensure_network_generation( log, ad, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): log.error("{} voice not in LTE mode.".format(ad.serial)) return False return phone_idle_video_for_subscription(log, ad, sub_id)
def phone_setup_data_for_subscription(log, ad, sub_id, network_generation): """Setup Phone <sub_id> Data to <network_generation> Args: log: log object ad: android device object sub_id: subscription id network_generation: network generation, e.g. GEN_2G, GEN_3G, GEN_4G Returns: True if success, False if fail. """ toggle_airplane_mode(log, ad, False, strict_checking=False) set_wifi_to_default(log, ad) if not set_wfc_mode(log, ad, WFC_MODE_DISABLED): ad.log.error("Disable WFC failed.") return False if not ensure_network_generation_for_subscription( log, ad, sub_id, network_generation, voice_or_data=NETWORK_SERVICE_DATA): get_telephony_signal_strength(ad) return False return True
def phone_setup_rat_for_subscription(log, ad, sub_id, network_preference, rat_family): toggle_airplane_mode(log, ad, False, strict_checking=False) if not set_wfc_mode(log, ad, WFC_MODE_DISABLED): ad.log.error("Disable WFC failed.") return False return ensure_network_rat_for_subscription(log, ad, sub_id, network_preference, rat_family)
def phone_setup_rat_for_subscription(log, ad, sub_id, network_preference, rat_family): toggle_airplane_mode(log, ad, False) if not set_wfc_mode(log, ad, WFC_MODE_DISABLED): log.error("{} Disable WFC failed.".format(ad.serial)) return False return ensure_network_rat_for_subscription(log, ad, sub_id, network_preference, rat_family)
def _setup_wfc(self): if not set_wfc_mode(self.log, self.ad, WFC_MODE_WIFI_PREFERRED): self.log.error("Phone failed to enable Wifi-Calling.") return False self.log.info("Phone is set in Wifi-Calling successfully.") if not phone_idle_iwlan(self.log, self.ad): self.log.error("DUT not in WFC enabled state.") return False return True
def _wifi_connected_set_wfc_mode_change_wfc_mode( self, initial_wfc_mode, new_wfc_mode, is_wfc_available_in_initial_wfc_mode, is_wfc_available_in_new_wfc_mode, initial_setup_wifi=True, check_volte_after_wfc_disabled=False): if initial_setup_wifi and not ensure_wifi_connected( self.log, self.ad, self.wifi_network_ssid, self.wifi_network_pass): self.log.error("Failed to connect WiFi") return False # Set to initial_wfc_mode first, then change to new_wfc_mode for (wfc_mode, is_wfc_available) in \ [(initial_wfc_mode, is_wfc_available_in_initial_wfc_mode), (new_wfc_mode, is_wfc_available_in_new_wfc_mode)]: current_wfc_status = is_wfc_enabled(self.log, self.ad) self.log.info("Current WFC: {}, Set WFC to {}".format( current_wfc_status, wfc_mode)) if not set_wfc_mode(self.log, self.ad, wfc_mode): self.log.error("Failed to set WFC mode.") return False if is_wfc_available: if current_wfc_status: # Previous is True, after set it still need to be true # wait and check if DUT WFC got disabled. if wait_for_wfc_disabled(self.log, self.ad): self.log.error("WFC is not available.") return False else: # Previous is False, after set it will be true, # wait and check if DUT WFC got enabled. if not wait_for_wfc_enabled(self.log, self.ad): self.log.error("WFC is not available.") return False else: if current_wfc_status: # Previous is True, after set it will be false, # wait and check if DUT WFC got disabled. if not wait_for_wfc_disabled(self.log, self.ad): self.log.error("WFC is available.") return False else: # Previous is False, after set it still need to be false # Wait and check if DUT WFC got enabled. if wait_for_wfc_enabled(self.log, self.ad): self.log.error("WFC is available.") return False if check_volte_after_wfc_disabled and not wait_for_volte_enabled( self.log, self.ad, MAX_WAIT_TIME_VOLTE_ENABLED): self.log.error("Device failed to acquire VoLTE service") return False return True
def phone_setup_iwlan_for_subscription(log, ad, sub_id, is_airplane_mode, wfc_mode, wifi_ssid=None, wifi_pwd=None): """Phone setup function for epdg call test for subscription id. Set WFC mode according to wfc_mode. Set airplane mode according to is_airplane_mode. Make sure phone connect to WiFi. (If wifi_ssid is not None.) Wait for phone to be in iwlan data network type. Wait for phone to report wfc enabled flag to be true. Args: log: Log object. ad: Android device object. sub_id: subscription id. is_airplane_mode: True to turn on airplane mode. False to turn off airplane mode. wfc_mode: WFC mode to set to. wifi_ssid: WiFi network SSID. This is optional. If wifi_ssid is None, then phone_setup_iwlan will not attempt to connect to wifi. wifi_pwd: WiFi network password. This is optional. Returns: True if success. False if fail. """ # VoLTE settings are unavailable in airplane mode toggle_airplane_mode(log, ad, False) # Now that we are out of APM, toggle VoLTE if necessary if ad.droid.imsIsEnhanced4gLteModeSettingEnabledByPlatform(): toggle_volte(log, ad, True) if not is_airplane_mode and not ensure_network_generation_for_subscription( log, ad, sub_id, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): return False if not set_wfc_mode(log, ad, wfc_mode): log.error("{} set WFC mode failed.".format(ad.serial)) return False if not toggle_airplane_mode(log, ad, is_airplane_mode): log.error("Failed to enable airplane mode on {}".format(ad.serial)) return False if wifi_ssid is not None: if not ensure_wifi_connected(log, ad, wifi_ssid, wifi_pwd): log.error("{} connect to WiFi failed.".format(ad.serial)) return False return phone_idle_iwlan_for_subscription(log, ad, sub_id)
def phone_setup_iwlan_cellular_preferred(log, ad, wifi_ssid=None, wifi_pwd=None): """Phone setup function for iwlan Non-APM CELLULAR_PREFERRED test. Set WFC mode according to CELLULAR_PREFERRED. Set airplane mode according to False. Make sure phone connect to WiFi. (If wifi_ssid is not None.) Make sure phone don't report iwlan data network type. Make sure phone don't report wfc enabled flag to be true. Args: log: Log object. ad: Android device object. wifi_ssid: WiFi network SSID. This is optional. If wifi_ssid is None, then phone_setup_iwlan will not attempt to connect to wifi. wifi_pwd: WiFi network password. This is optional. Returns: True if success. False if fail. """ toggle_airplane_mode(log, ad, False, strict_checking=False) try: toggle_volte(log, ad, True) if not wait_for_network_generation( log, ad, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): if not ensure_network_generation( log, ad, GEN_4G, voice_or_data=NETWORK_SERVICE_DATA): ad.log.error("Fail to ensure data in 4G") return False except Exception as e: ad.log.error(e) ad.droid.telephonyToggleDataConnection(True) if wifi_ssid is not None: if not ensure_wifi_connected(log, ad, wifi_ssid, wifi_pwd): ad.log.error("Connect to WiFi failed.") return False if not set_wfc_mode(log, ad, WFC_MODE_CELLULAR_PREFERRED): ad.log.error("Set WFC mode failed.") return False if not wait_for_not_network_rat( log, ad, RAT_FAMILY_WLAN, voice_or_data=NETWORK_SERVICE_DATA): ad.log.error("Data rat in iwlan mode.") return False elif not wait_for_wfc_disabled(log, ad, MAX_WAIT_TIME_WFC_ENABLED): ad.log.error("Should report wifi calling disabled within %s.", MAX_WAIT_TIME_WFC_ENABLED) return False return True
def _setup_wfc(self): if not ensure_wifi_connected( self.log, self.dut, self.wifi_network_ssid, self.wifi_network_pass, retry=3): self.dut.log.error("Phone Wifi connection fails.") return False self.dut.log.info("Phone WIFI is connected successfully.") if not set_wfc_mode(self.log, self.dut, WFC_MODE_WIFI_PREFERRED): self.dut.log.error("Phone failed to enable Wifi-Calling.") return False self.dut.log.info("Phone is set in Wifi-Calling successfully.") if not phone_idle_iwlan(self.log, self.dut): self.dut.log.error("Phone is not in WFC enabled state.") return False self.dut.log.info("Phone is in WFC enabled state.") return True
def _setup_wfc(self): for ad in self.android_devices: if not ensure_wifi_connected(ad.log, ad, self.wifi_network_ssid, self.wifi_network_pass, retries=3): ad.log.error("Phone Wifi connection fails.") return False ad.log.info("Phone WIFI is connected successfully.") if not set_wfc_mode(self.log, ad, WFC_MODE_WIFI_PREFERRED): ad.log.error("Phone failed to enable Wifi-Calling.") return False ad.log.info("Phone is set in Wifi-Calling successfully.") if not phone_idle_iwlan(self.log, ad): ad.log.error("Phone is not in WFC enabled state.") return False ad.log.info("Phone is in WFC enabled state.") return True
def phone_setup_data_for_subscription(log, ad, sub_id, network_generation): """Setup Phone <sub_id> Data to <network_generation> Args: log: log object ad: android device object sub_id: subscription id network_generation: network generation, e.g. GEN_2G, GEN_3G, GEN_4G Returns: True if success, False if fail. """ toggle_airplane_mode(log, ad, False) if not set_wfc_mode(log, ad, WFC_MODE_DISABLED): log.error("{} Disable WFC failed.".format(ad.serial)) return False if not ensure_network_generation_for_subscription( log, ad, sub_id, network_generation, voice_or_data=NETWORK_SERVICE_DATA): return False return True
def _wifi_connected_set_wfc_mode_turn_off_apm( self, wfc_mode, is_wfc_available_after_turn_off_apm): if not ensure_wifi_connected(self.log, self.ad, self.wifi_network_ssid, self.wifi_network_pass): self.log.error("Failed to connect WiFi") return False if not set_wfc_mode(self.log, self.ad, wfc_mode): self.log.error("Failed to set WFC mode.") return False if not phone_idle_iwlan(self.log, self.ad): self.log.error("WFC is not available.") return False if not toggle_airplane_mode(self.log, self.ad, False): self.log.error("Failed to turn off airplane mode") return False is_wfc_not_available = wait_for_wfc_disabled(self.log, self.ad) if is_wfc_available_after_turn_off_apm and is_wfc_not_available: self.log.error("WFC is not available.") return False elif (not is_wfc_available_after_turn_off_apm and not is_wfc_not_available): self.log.error("WFC is available.") return False return True
def change_ims_setting(self, airplane_mode, wifi_enabled, volte_enabled, wfc_enabled, wfc_mode=None): result = True self.dut.log.info( "Setting APM %s, WIFI %s, VoLTE %s, WFC %s, WFC mode %s", airplane_mode, wifi_enabled, volte_enabled, wfc_enabled, wfc_mode) toggle_airplane_mode_by_adb(self.log, self.dut, airplane_mode) if wifi_enabled: if not ensure_wifi_connected(self.log, self.dut, self.wifi_network_ssid, self.wifi_network_pass, apm=airplane_mode): self.dut.log.error("Fail to connected to WiFi") result = False else: if not wifi_toggle_state(self.log, self.dut, False): self.dut.log.error("Failed to turn off WiFi.") result = False toggle_volte(self.log, self.dut, volte_enabled) toggle_wfc(self.log, self.dut, wfc_enabled) if wfc_mode: set_wfc_mode(self.log, self.dut, wfc_mode) wfc_mode = self.dut.droid.imsGetWfcMode() if wifi_enabled or not airplane_mode: if not ensure_phone_subscription(self.log, self.dut): self.dut.log.error("Failed to find valid subscription") result = False if airplane_mode: if (CAPABILITY_WFC in self.dut_capabilities) and (wifi_enabled and wfc_enabled): if not wait_for_wfc_enabled(self.log, self.dut): result = False elif not self.check_call_in_wfc(): result = False else: if not wait_for_state( self.dut.droid.telephonyGetCurrentVoiceNetworkType, RAT_UNKNOWN): self.dut.log.error( "Voice RAT is %s not UNKNOWN", self.dut.droid.telephonyGetCurrentVoiceNetworkType()) result = False else: self.dut.log.info("Voice RAT is in UNKKNOWN") else: if (wifi_enabled and wfc_enabled) and ( wfc_mode == WFC_MODE_WIFI_PREFERRED) and ( CAPABILITY_WFC in self.dut_capabilities): if not wait_for_wfc_enabled(self.log, self.dut): result = False if not wait_for_state( self.dut.droid.telephonyGetCurrentVoiceNetworkType, RAT_UNKNOWN): self.dut.log.error( "Voice RAT is %s, not UNKNOWN", self.dut.droid.telephonyGetCurrentVoiceNetworkType()) if not self.check_call_in_wfc(): result = False else: if not wait_for_wfc_disabled(self.log, self.dut): self.dut.log.error("WFC is not disabled") result = False if volte_enabled and CAPABILITY_VOLTE in self.dut_capabilities: if not wait_for_volte_enabled(self.log, self.dut): result = False if not self.check_call_in_volte(): result = False else: if not wait_for_not_network_rat( self.log, self.dut, RAT_LTE, voice_or_data=NETWORK_SERVICE_VOICE): self.dut.log.error( "Voice RAT is %s", self.dut.droid.telephonyGetCurrentVoiceNetworkType( )) result = False if not wait_for_voice_attach(self.log, self.dut): result = False if not self.check_call(): result = False user_config_profile = get_user_config_profile(self.dut) self.dut.log.info("user_config_profile: %s ", sorted(user_config_profile.items())) return result
def test_wfc_setup_timing(self): """ Measures the time delay in enabling WiFi calling Steps: 1. Make sure DUT idle. 2. Turn on Airplane Mode, Set WiFi Calling to WiFi_Preferred. 3. Turn on WiFi, connect to WiFi AP and measure time delay. 4. Wait for WiFi connected, verify Internet and measure time delay. 5. Wait for rat to be reported as iwlan and measure time delay. 6. Wait for ims registered and measure time delay. 7. Wait for WiFi Calling feature bit to be True and measure time delay. Expected results: Time Delay in each step should be within pre-defined limit. Returns: Currently always return True. """ # TODO: b/26338119 Set pass/fail criteria ad = self.android_devices[0] time_values = { 'start': 0, 'wifi_enabled': 0, 'wifi_connected': 0, 'wifi_data': 0, 'iwlan_rat': 0, 'ims_registered': 0, 'wfc_enabled': 0, 'mo_call_success': 0 } WifiUtils.wifi_reset(self.log, ad) toggle_airplane_mode(self.log, ad, True) set_wfc_mode(self.log, ad, WFC_MODE_WIFI_PREFERRED) time_values['start'] = time.time() self.log.info("Start Time {}s".format(time_values['start'])) WifiUtils.wifi_toggle_state(self.log, ad, True) time_values['wifi_enabled'] = time.time() self.log.info( "WiFi Enabled After {}s".format(time_values['wifi_enabled'] - time_values['start'])) WifiUtils.wifi_connect(self.log, ad, self.wifi_network_ssid, self.wifi_network_pass) ad.droid.wakeUpNow() if not wait_for_wifi_data_connection(self.log, ad, True, MAX_WAIT_TIME_WIFI_CONNECTION): self.log.error("Failed WiFi connection, aborting!") return False time_values['wifi_connected'] = time.time() self.log.info( "WiFi Connected After {}s".format(time_values['wifi_connected'] - time_values['wifi_enabled'])) if not verify_http_connection(self.log, ad, 'http://www.google.com', 100, .1): self.log.error("Failed to get user-plane traffic, aborting!") return False time_values['wifi_data'] = time.time() self.log.info( "WifiData After {}s".format(time_values['wifi_data'] - time_values['wifi_connected'])) if not wait_for_network_rat( self.log, ad, RAT_FAMILY_WLAN, voice_or_data=NETWORK_SERVICE_DATA): self.log.error("Failed to set-up iwlan, aborting!") if is_droid_in_rat_family(self.log, ad, RAT_FAMILY_WLAN, NETWORK_SERVICE_DATA): self.log.error("Never received the event, but droid in iwlan") else: return False time_values['iwlan_rat'] = time.time() self.log.info( "iWLAN Reported After {}s".format(time_values['iwlan_rat'] - time_values['wifi_data'])) if not wait_for_ims_registered(self.log, ad, MAX_WAIT_TIME_IMS_REGISTRATION): self.log.error("Never received IMS registered, aborting") return False time_values['ims_registered'] = time.time() self.log.info( "Ims Registered After {}s".format(time_values['ims_registered'] - time_values['iwlan_rat'])) if not wait_for_wfc_enabled(self.log, ad, MAX_WAIT_TIME_WFC_ENABLED): self.log.error("Never received WFC feature, aborting") return False time_values['wfc_enabled'] = time.time() self.log.info("Wifi Calling Feature Enabled After {}s".format( time_values['wfc_enabled'] - time_values['ims_registered'])) set_wfc_mode(self.log, ad, WFC_MODE_DISABLED) wait_for_not_network_rat(self.log, ad, RAT_FAMILY_WLAN, voice_or_data=NETWORK_SERVICE_DATA) self.log.info("\n\n------------------summary-----------------") self.log.info( "WiFi Enabled After {0:.2f} s".format(time_values['wifi_enabled'] - time_values['start'])) self.log.info("WiFi Connected After {0:.2f} s".format( time_values['wifi_connected'] - time_values['wifi_enabled'])) self.log.info( "WifiData After {0:.2f} s".format(time_values['wifi_data'] - time_values['wifi_connected'])) self.log.info( "iWLAN Reported After {0:.2f} s".format(time_values['iwlan_rat'] - time_values['wifi_data'])) self.log.info("Ims Registered After {0:.2f} s".format( time_values['ims_registered'] - time_values['iwlan_rat'])) self.log.info("Wifi Calling Feature Enabled After {0:.2f} s".format( time_values['wfc_enabled'] - time_values['ims_registered'])) self.log.info("\n\n") return True
def phone_setup_iwlan_for_subscription(log, ad, sub_id, is_airplane_mode, wfc_mode, wifi_ssid=None, wifi_pwd=None): """Phone setup function for epdg call test for subscription id. Set WFC mode according to wfc_mode. Set airplane mode according to is_airplane_mode. Make sure phone connect to WiFi. (If wifi_ssid is not None.) Wait for phone to be in iwlan data network type. Wait for phone to report wfc enabled flag to be true. Args: log: Log object. ad: Android device object. sub_id: subscription id. is_airplane_mode: True to turn on airplane mode. False to turn off airplane mode. wfc_mode: WFC mode to set to. wifi_ssid: WiFi network SSID. This is optional. If wifi_ssid is None, then phone_setup_iwlan will not attempt to connect to wifi. wifi_pwd: WiFi network password. This is optional. Returns: True if success. False if fail. """ toggle_airplane_mode(log, ad, is_airplane_mode, strict_checking=False) # check if WFC supported phones if wfc_mode != WFC_MODE_DISABLED and not ad.droid.imsIsWfcEnabledByPlatform( ): ad.log.error("WFC is not enabled on this device by checking " "ImsManager.isWfcEnabledByPlatform") return False if wifi_ssid is not None: if not ensure_wifi_connected(log, ad, wifi_ssid, wifi_pwd): ad.log.error("Fail to bring up WiFi connection on %s.", wifi_ssid) return False if not set_wfc_mode(log, ad, wfc_mode): ad.log.error("Unable to set WFC mode to %s.", wfc_mode) return False if not wait_for_wfc_enabled(log, ad, max_time=MAX_WAIT_TIME_WFC_ENABLED): ad.log.error("WFC is not enabled") return False if wait_for_network_rat_for_subscription( log, ad, sub_id, RAT_FAMILY_WLAN, voice_or_data=NETWORK_SERVICE_DATA): ad.log.info( "Data rat is in iwlan mode successfully with APM %s WFC %s", is_airplane_mode, wfc_mode) return True else: ad.log.error( "Unable to bring data rat in iwlan mode with APM %s WFC %s", is_airplane_mode, wfc_mode) return False
def test_wfc_setup_timing(self): """ Measures the time delay in enabling WiFi calling Steps: 1. Make sure DUT idle. 2. Turn on Airplane Mode, Set WiFi Calling to WiFi_Preferred. 3. Turn on WiFi, connect to WiFi AP and measure time delay. 4. Wait for WiFi connected, verify Internet and measure time delay. 5. Wait for rat to be reported as iwlan and measure time delay. 6. Wait for ims registered and measure time delay. 7. Wait for WiFi Calling feature bit to be True and measure time delay. Expected results: Time Delay in each step should be within pre-defined limit. Returns: Currently always return True. """ # TODO: b/26338119 Set pass/fail criteria time_values = { 'start': 0, 'wifi_enabled': 0, 'wifi_connected': 0, 'wifi_data': 0, 'iwlan_rat': 0, 'ims_registered': 0, 'wfc_enabled': 0, 'mo_call_success': 0 } wifi_reset(self.log, self.dut) toggle_airplane_mode_by_adb(self.log, self.dut, True) set_wfc_mode(self.log, self.dut, WFC_MODE_WIFI_PREFERRED) time_values['start'] = time.time() self.dut.log.info("Start Time %ss", time_values['start']) wifi_toggle_state(self.log, self.dut, True) time_values['wifi_enabled'] = time.time() self.dut.log.info("WiFi Enabled After %ss", time_values['wifi_enabled'] - time_values['start']) network = {WIFI_SSID_KEY: self.wifi_network_ssid} if self.wifi_network_pass: network[WIFI_PWD_KEY] = self.wifi_network_pass try: self.dut.droid.wifiConnectByConfig(network) except Exception: self.dut.log.info("Connecting to wifi by RPC wifiConnect instead") self.dut.droid.wifiConnect(network) self.dut.droid.wakeUpNow() if not wait_for_wifi_data_connection(self.log, self.dut, True, MAX_WAIT_TIME_WIFI_CONNECTION): self.dut.log.error("Failed WiFi connection, aborting!") return False time_values['wifi_connected'] = time.time() self.dut.log.info( "WiFi Connected After %ss", time_values['wifi_connected'] - time_values['wifi_enabled']) if not verify_internet_connection(self.log, self.dut, retries=3): self.dut.log.error("Failed to get user-plane traffic, aborting!") return False time_values['wifi_data'] = time.time() self.dut.log.info( "WifiData After %ss", time_values['wifi_data'] - time_values['wifi_connected']) if not wait_for_network_rat( self.log, self.dut, RAT_FAMILY_WLAN, voice_or_data=NETWORK_SERVICE_DATA): self.dut.log.error("Failed to set-up iwlan, aborting!") if is_droid_in_rat_family(self.log, self.dut, RAT_FAMILY_WLAN, NETWORK_SERVICE_DATA): self.dut.log.error( "Never received the event, but droid in iwlan") else: return False time_values['iwlan_rat'] = time.time() self.dut.log.info("iWLAN Reported After %ss", time_values['iwlan_rat'] - time_values['wifi_data']) if not wait_for_ims_registered(self.log, self.dut, MAX_WAIT_TIME_IMS_REGISTRATION): self.dut.log.error("Never received IMS registered, aborting") return False time_values['ims_registered'] = time.time() self.dut.log.info( "Ims Registered After %ss", time_values['ims_registered'] - time_values['iwlan_rat']) if not wait_for_wfc_enabled(self.log, self.dut, MAX_WAIT_TIME_WFC_ENABLED): self.dut.log.error("Never received WFC feature, aborting") return False time_values['wfc_enabled'] = time.time() self.dut.log.info( "Wifi Calling Feature Enabled After %ss", time_values['wfc_enabled'] - time_values['ims_registered']) set_wfc_mode(self.log, self.dut, WFC_MODE_DISABLED) wait_for_not_network_rat( self.log, self.dut, RAT_FAMILY_WLAN, voice_or_data=NETWORK_SERVICE_DATA) self.dut.log.info("\n\n------------------summary-----------------") self.dut.log.info("WiFi Enabled After %.2f seconds", time_values['wifi_enabled'] - time_values['start']) self.dut.log.info( "WiFi Connected After %.2f seconds", time_values['wifi_connected'] - time_values['wifi_enabled']) self.dut.log.info( "WifiData After %.2f s", time_values['wifi_data'] - time_values['wifi_connected']) self.dut.log.info("iWLAN Reported After %.2f seconds", time_values['iwlan_rat'] - time_values['wifi_data']) self.dut.log.info( "Ims Registered After %.2f seconds", time_values['ims_registered'] - time_values['iwlan_rat']) self.dut.log.info( "Wifi Calling Feature Enabled After %.2f seconds", time_values['wfc_enabled'] - time_values['ims_registered']) self.dut.log.info("\n\n") return True