Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 1 | #!/usr/bin/env python3.4 |
| 2 | |
| 3 | import queue |
| 4 | import time |
| 5 | |
| 6 | import acts.base_test |
Xianyuan Jia | 63751fb | 2020-11-17 00:07:40 +0000 | [diff] [blame] | 7 | import acts_contrib.test_utils.wifi.wifi_test_utils as wifi_utils |
| 8 | import acts_contrib.test_utils.tel.tel_test_utils as tele_utils |
lutina | 1d21ae4 | 2021-08-13 19:30:20 +0800 | [diff] [blame] | 9 | import acts_contrib.test_utils.tel.tel_mms_utils as mms_utils |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 10 | import acts.utils |
| 11 | |
| 12 | from acts import asserts |
| 13 | from acts import signals |
Girish Moturu | 43faec8 | 2017-06-12 10:46:51 +0530 | [diff] [blame] | 14 | from acts.test_decorators import test_tracker_info |
Xianyuan Jia | 63751fb | 2020-11-17 00:07:40 +0000 | [diff] [blame] | 15 | from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest |
Markus Liu | 7b42b3b | 2021-11-02 16:56:11 +0800 | [diff] [blame] | 16 | from acts_contrib.test_utils.tel.tel_ims_utils import toggle_volte |
| 17 | from acts_contrib.test_utils.tel.tel_ims_utils import set_wfc_mode |
Markus Liu | 44b04be | 2021-11-05 13:59:32 +0800 | [diff] [blame] | 18 | from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_setup_voice_general |
Conor Henson | 1c3abf7 | 2021-12-15 20:26:00 +0000 | [diff] [blame] | 19 | from acts_contrib.test_utils.tel.tel_phone_setup_utils import ensure_phones_idle |
Xianyuan Jia | 63751fb | 2020-11-17 00:07:40 +0000 | [diff] [blame] | 20 | from acts_contrib.test_utils.tel.tel_voice_utils import two_phone_call_short_seq |
lutina | a786a29 | 2021-06-08 21:19:12 +0800 | [diff] [blame] | 21 | from acts_contrib.test_utils.tel.tel_voice_utils import is_phone_in_call_iwlan |
Markus Liu | 44b04be | 2021-11-05 13:59:32 +0800 | [diff] [blame] | 22 | from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_idle_iwlan |
lutina | a786a29 | 2021-06-08 21:19:12 +0800 | [diff] [blame] | 23 | from acts_contrib.test_utils.tel.tel_defines import DIRECTION_MOBILE_ORIGINATED |
| 24 | from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED |
| 25 | from acts_contrib.test_utils.tel.tel_defines import GEN_4G |
| 26 | from acts_contrib.test_utils.tel.tel_defines import NETWORK_SERVICE_DATA |
| 27 | from acts_contrib.test_utils.net import net_test_utils as nutil |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 28 | |
| 29 | WifiEnums = wifi_utils.WifiEnums |
| 30 | |
| 31 | ATTENUATORS = "attenuators" |
| 32 | WIFI_SSID = "wifi_network_ssid" |
| 33 | WIFI_PWD = "wifi_network_pass" |
| 34 | STRESS_COUNT = "stress_iteration" |
lutina | 1d21ae4 | 2021-08-13 19:30:20 +0800 | [diff] [blame] | 35 | DEFAULT_TIMEOUT = 10 |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 36 | |
| 37 | class WifiTeleCoexTest(TelephonyBaseTest): |
| 38 | """Tests for WiFi, Celular Co-existance.""" |
| 39 | |
| 40 | |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 41 | def setup_class(self): |
| 42 | TelephonyBaseTest.setup_class(self) |
Xianyuan Jia | 2a8522e | 2019-09-05 17:21:40 -0700 | [diff] [blame] | 43 | |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 44 | self.dut = self.android_devices[0] |
| 45 | wifi_utils.wifi_test_device_init(self.dut) |
| 46 | # Set attenuation to 0 on all channels. |
| 47 | if getattr(self, ATTENUATORS, []): |
| 48 | for a in self.attenuators: |
| 49 | a.set_atten(0) |
| 50 | self.ads = self.android_devices |
| 51 | self.dut = self.android_devices[0] |
| 52 | self.wifi_network_ssid = self.user_params.get(WIFI_SSID) |
| 53 | self.wifi_network_pass = self.user_params.get(WIFI_PWD) |
| 54 | self.network = { WifiEnums.SSID_KEY : self.wifi_network_ssid, |
| 55 | WifiEnums.PWD_KEY : self.wifi_network_pass |
| 56 | } |
| 57 | self.stress_count = self.user_params.get(STRESS_COUNT) |
| 58 | |
| 59 | |
| 60 | def setup_test(self): |
lutina | a786a29 | 2021-06-08 21:19:12 +0800 | [diff] [blame] | 61 | """ Setup test make sure the DUT is wake and screen unlock""" |
| 62 | for ad in self.android_devices: |
| 63 | ad.droid.wakeLockAcquireBright() |
| 64 | ad.droid.wakeUpNow() |
lutina | 1d21ae4 | 2021-08-13 19:30:20 +0800 | [diff] [blame] | 65 | ad.droid.telephonyToggleDataConnection(True) |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 66 | wifi_utils.wifi_toggle_state(self.dut, True) |
| 67 | |
| 68 | |
| 69 | def teardown_test(self): |
lutina | a786a29 | 2021-06-08 21:19:12 +0800 | [diff] [blame] | 70 | """ End test make sure the DUT return idle""" |
| 71 | for ad in self.android_devices: |
| 72 | wifi_utils.reset_wifi(ad) |
lutina | 1d21ae4 | 2021-08-13 19:30:20 +0800 | [diff] [blame] | 73 | ad.droid.telephonyToggleDataConnection(False) |
Conor Henson | 1c3abf7 | 2021-12-15 20:26:00 +0000 | [diff] [blame] | 74 | ensure_phones_idle(self.log, self.android_devices) |
lutina | 1d21ae4 | 2021-08-13 19:30:20 +0800 | [diff] [blame] | 75 | nutil.stop_usb_tethering(self.dut) |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 76 | |
| 77 | """Helper Functions""" |
| 78 | |
| 79 | |
| 80 | def connect_to_wifi(self, ad, network): |
| 81 | """Connection logic for open and psk wifi networks. |
| 82 | |
| 83 | Args: |
| 84 | ad: Android device object. |
| 85 | network: A JSON dict of the WiFi network configuration. |
| 86 | |
| 87 | """ |
| 88 | ad.ed.clear_all_events() |
| 89 | wifi_utils.start_wifi_connection_scan(ad) |
| 90 | scan_results = ad.droid.wifiGetScanResults() |
| 91 | wifi_utils.assert_network_in_list({WifiEnums.SSID_KEY: |
| 92 | self.wifi_network_ssid}, scan_results) |
| 93 | wifi_utils.wifi_connect(ad, network) |
| 94 | self.log.debug("Connected to %s network on %s device" % ( |
| 95 | network[WifiEnums.SSID_KEY], ad.serial)) |
| 96 | |
| 97 | |
| 98 | def stress_toggle_wifi(self, stress_count): |
| 99 | """Toggle WiFi in a loop. |
| 100 | |
| 101 | Args: |
| 102 | stress_count: Number of times to toggle WiFi OFF and ON. |
| 103 | |
| 104 | """ |
| 105 | for count in range(stress_count): |
| 106 | self.log.debug("stress_toggle_wifi: Iteration %d" % count) |
| 107 | wifi_utils.toggle_wifi_off_and_on(self.dut) |
| 108 | |
| 109 | if not self.dut.droid.wifiGetisWifiEnabled(): |
| 110 | raise signals.TestFailure("WiFi did not turn on after toggling it" |
| 111 | " %d times" % self.stress_count) |
| 112 | |
| 113 | |
| 114 | def stress_toggle_airplane(self, stress_count): |
| 115 | """Toggle Airplane mode in a loop. |
| 116 | |
| 117 | Args: |
| 118 | stress_count: Number of times to toggle Airplane mode OFF and ON. |
| 119 | |
| 120 | """ |
| 121 | for count in range(stress_count): |
| 122 | self.log.debug("stress_toggle_airplane: Iteration %d" % count) |
| 123 | wifi_utils.toggle_airplane_mode_on_and_off(self.dut) |
| 124 | |
| 125 | if not self.dut.droid.wifiGetisWifiEnabled(): |
| 126 | raise signals.TestFailure("WiFi did not turn on after toggling it" |
| 127 | " %d times" % self.stress_count) |
| 128 | |
| 129 | |
| 130 | def stress_toggle_airplane_and_wifi(self, stress_count): |
| 131 | """Toggle Airplane and WiFi modes in a loop. |
| 132 | |
| 133 | Args: |
| 134 | stress_count: Number of times to perform Airplane mode ON, WiFi ON, |
| 135 | Airplane mode OFF, in a sequence. |
| 136 | |
| 137 | """ |
lutina | 9f0a476 | 2019-08-30 17:06:06 +0800 | [diff] [blame] | 138 | for count in range(stress_count): |
| 139 | self.log.debug("stress_toggle_airplane_and_wifi: Iteration %d" % count) |
| 140 | self.log.debug("Toggling Airplane mode ON") |
| 141 | asserts.assert_true( |
| 142 | acts.utils.force_airplane_mode(self.dut, True), |
| 143 | "Can not turn on airplane mode on: %s" % self.dut.serial) |
| 144 | # Sleep for atleast 500ms so that, call to enable wifi is not deferred. |
| 145 | time.sleep(1) |
| 146 | self.log.debug("Toggling wifi ON") |
| 147 | wifi_utils.wifi_toggle_state(self.dut, True) |
| 148 | # Sleep for 1s before getting new WiFi state. |
| 149 | time.sleep(1) |
| 150 | if not self.dut.droid.wifiGetisWifiEnabled(): |
| 151 | raise signals.TestFailure("WiFi did not turn on after turning ON" |
| 152 | " Airplane mode") |
| 153 | asserts.assert_true( |
| 154 | acts.utils.force_airplane_mode(self.dut, False), |
| 155 | "Can not turn on airplane mode on: %s" % self.dut.serial) |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 156 | |
| 157 | if not self.dut.droid.wifiGetisWifiEnabled(): |
| 158 | raise signals.TestFailure("WiFi did not turn on after toggling it" |
| 159 | " %d times" % self.stress_count) |
| 160 | |
| 161 | |
| 162 | def setup_cellular_voice_calling(self): |
| 163 | """Setup phone for voice general calling and make sure phone is |
| 164 | attached to voice.""" |
| 165 | # Make sure Phone A and B are attached to voice network. |
| 166 | for ad in self.ads: |
| 167 | if not phone_setup_voice_general(self.log, ad): |
| 168 | raise signals.TestFailure("Phone failed to setup for voice" |
| 169 | " calling serial:%s" % ad.serial) |
| 170 | self.log.debug("Finished setting up phones for voice calling") |
| 171 | |
| 172 | |
| 173 | def validate_cellular_and_wifi(self): |
| 174 | """Validate WiFi, make some cellular calls. |
| 175 | |
| 176 | Steps: |
| 177 | 1. Check if device is still connected to the WiFi network. |
| 178 | 2. If WiFi looks good, check if deivce is attached to voice. |
| 179 | 3. Make a short sequence voice call between Phone A and B. |
| 180 | |
| 181 | """ |
lutina | 9f0a476 | 2019-08-30 17:06:06 +0800 | [diff] [blame] | 182 | # Sleep for 30s before getting new WiFi state. |
| 183 | time.sleep(30) |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 184 | wifi_info = self.dut.droid.wifiGetConnectionInfo() |
| 185 | if wifi_info[WifiEnums.SSID_KEY] != self.wifi_network_ssid: |
| 186 | raise signals.TestFailure("Phone failed to connect to %s network on" |
| 187 | " %s" % (self.wifi_network_ssid, |
| 188 | self.dut.serial)) |
| 189 | |
| 190 | # Make short call sequence between Phone A and Phone B. |
| 191 | two_phone_call_short_seq(self.log, self.ads[0], None, None, self.ads[1], |
| 192 | None, None) |
| 193 | |
lutina | a786a29 | 2021-06-08 21:19:12 +0800 | [diff] [blame] | 194 | def _phone_idle_iwlan(self): |
| 195 | return phone_idle_iwlan(self.log, self.android_devices[0]) |
| 196 | |
| 197 | def _wfc_phone_setup_apm_wifi_preferred(self): |
| 198 | return self._wfc_phone_setup(True, WFC_MODE_WIFI_PREFERRED) |
| 199 | |
| 200 | def _wfc_phone_setup(self, is_airplane_mode, wfc_mode, volte_mode=True): |
| 201 | """Enables WiFi calling by turning off Airplane Mode and setting up volte |
| 202 | |
| 203 | Args: |
| 204 | is_airplane_mode: boolean, True/False to turn on/off Airplane Mode. |
| 205 | wfc_mode: str, String stating what WFC Mode is used. |
| 206 | volte_mode: boolean, True/False to turn on/off VoLTE Mode. |
| 207 | |
| 208 | Returns: |
| 209 | False, when 4G fails or wrong wfc_mode or WiFi does not connect, |
| 210 | (failure is logged) True otherwise. |
| 211 | |
| 212 | """ |
| 213 | tele_utils.toggle_airplane_mode(self.log, self.android_devices[0], False) |
Markus Liu | 7b42b3b | 2021-11-02 16:56:11 +0800 | [diff] [blame] | 214 | toggle_volte(self.log, self.android_devices[0], volte_mode) |
lutina | a786a29 | 2021-06-08 21:19:12 +0800 | [diff] [blame] | 215 | if not tele_utils.ensure_network_generation( |
| 216 | self.log, |
| 217 | self.android_devices[0], |
| 218 | GEN_4G, |
| 219 | voice_or_data=NETWORK_SERVICE_DATA): |
| 220 | return False |
Markus Liu | 7b42b3b | 2021-11-02 16:56:11 +0800 | [diff] [blame] | 221 | if not set_wfc_mode(self.log, self.android_devices[0], wfc_mode): |
lutina | a786a29 | 2021-06-08 21:19:12 +0800 | [diff] [blame] | 222 | self.log.error("{} set WFC mode failed.".format( |
| 223 | self.android_devices[0].serial)) |
| 224 | return False |
| 225 | tele_utils.toggle_airplane_mode(self.log, self.android_devices[0], |
| 226 | is_airplane_mode) |
| 227 | if not tele_utils.ensure_wifi_connected(self.log, self.android_devices[0], |
| 228 | self.wifi_network_ssid, |
| 229 | self.wifi_network_pass): |
| 230 | self.log.error("{} connect WiFI failed".format( |
| 231 | self.android_devices[0].serial)) |
| 232 | return False |
| 233 | return True |
| 234 | |
| 235 | |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 236 | """Tests""" |
| 237 | |
| 238 | |
Girish Moturu | 43faec8 | 2017-06-12 10:46:51 +0530 | [diff] [blame] | 239 | @test_tracker_info(uuid="8b9b6fb9-964b-43e7-b75f-675774ee346f") |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 240 | @TelephonyBaseTest.tel_test_wrap |
| 241 | def test_toggle_wifi_call(self): |
| 242 | """Test to toggle WiFi and then perform WiFi connection and |
| 243 | cellular calls. |
| 244 | |
| 245 | Steps: |
| 246 | 1. Attach device to voice subscription network. |
| 247 | 2. Connect to a WiFi network. |
| 248 | 3. Toggle WiFi OFF and ON. |
| 249 | 4. Verify device auto-connects to the WiFi network. |
| 250 | 5. Verify device is attached to voice network. |
| 251 | 6. Make short sequence voice calls. |
| 252 | |
| 253 | """ |
| 254 | self.setup_cellular_voice_calling() |
| 255 | self.connect_to_wifi(self.dut, self.network) |
| 256 | wifi_utils.toggle_wifi_off_and_on(self.dut) |
| 257 | self.validate_cellular_and_wifi() |
Bindu Mahadev | 6077af2 | 2018-02-08 15:04:51 -0800 | [diff] [blame] | 258 | return True |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 259 | |
| 260 | |
Girish Moturu | 43faec8 | 2017-06-12 10:46:51 +0530 | [diff] [blame] | 261 | @test_tracker_info(uuid="caf22447-6354-4a2e-99e5-0ff235fc8f20") |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 262 | @TelephonyBaseTest.tel_test_wrap |
| 263 | def test_toggle_airplane_call(self): |
| 264 | """Test to toggle Airplane mode and perform WiFi connection and |
| 265 | cellular calls. |
| 266 | |
| 267 | Steps: |
| 268 | 1. Attach device to voice subscription network. |
| 269 | 2. Connect to a WiFi network. |
| 270 | 3. Toggle Airplane mode OFF and ON. |
| 271 | 4. Verify device auto-connects to the WiFi network. |
| 272 | 5. Verify device is attached to voice network. |
| 273 | 6. Make short sequence voice calls. |
| 274 | |
| 275 | """ |
| 276 | self.setup_cellular_voice_calling() |
| 277 | self.connect_to_wifi(self.dut, self.network) |
| 278 | wifi_utils.toggle_airplane_mode_on_and_off(self.dut) |
| 279 | self.validate_cellular_and_wifi() |
Bindu Mahadev | 6077af2 | 2018-02-08 15:04:51 -0800 | [diff] [blame] | 280 | return True |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 281 | |
| 282 | |
Girish Moturu | 43faec8 | 2017-06-12 10:46:51 +0530 | [diff] [blame] | 283 | @test_tracker_info(uuid="dd888b35-f820-409a-89af-4b0f6551e4d6") |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 284 | @TelephonyBaseTest.tel_test_wrap |
| 285 | def test_toggle_airplane_and_wifi_call(self): |
| 286 | """Test to toggle WiFi in a loop and perform WiFi connection and |
| 287 | cellular calls. |
| 288 | |
| 289 | Steps: |
| 290 | 1. Attach device to voice subscription network. |
| 291 | 2. Connect to a WiFi network. |
| 292 | 3. Toggle Airplane mode ON. |
| 293 | 4. Turn WiFi ON. |
| 294 | 5. Toggle Airplane mode OFF. |
| 295 | 3. Verify device auto-connects to the WiFi network. |
| 296 | 4. Verify device is attached to voice network. |
| 297 | 5. Make short sequence voice calls. |
| 298 | |
| 299 | """ |
| 300 | self.setup_cellular_voice_calling() |
| 301 | self.connect_to_wifi(self.dut, self.network) |
| 302 | self.stress_toggle_airplane_and_wifi(1) |
| 303 | self.validate_cellular_and_wifi() |
Bindu Mahadev | 6077af2 | 2018-02-08 15:04:51 -0800 | [diff] [blame] | 304 | return True |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 305 | |
| 306 | |
Girish Moturu | 43faec8 | 2017-06-12 10:46:51 +0530 | [diff] [blame] | 307 | @test_tracker_info(uuid="15db5b7e-827e-4bc8-8e77-7fcce343a323") |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 308 | @TelephonyBaseTest.tel_test_wrap |
| 309 | def test_stress_toggle_wifi_call(self): |
| 310 | """Stress test to toggle WiFi in a loop, then perform WiFi connection |
| 311 | and cellular calls. |
| 312 | |
| 313 | Steps: |
| 314 | 1. Attach device to voice subscription network. |
| 315 | 2. Connect to a WiFi network. |
| 316 | 3. Toggle WiFi OFF and ON in a loop. |
| 317 | 4. Verify device auto-connects to the WiFi network. |
| 318 | 5. Verify device is attached to voice network. |
| 319 | 6. Make short sequence voice calls. |
| 320 | |
| 321 | """ |
| 322 | self.setup_cellular_voice_calling() |
| 323 | self.connect_to_wifi(self.dut, self.network) |
| 324 | self.stress_toggle_wifi(self.stress_count) |
| 325 | self.validate_cellular_and_wifi() |
Bindu Mahadev | 6077af2 | 2018-02-08 15:04:51 -0800 | [diff] [blame] | 326 | return True |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 327 | |
| 328 | |
Girish Moturu | 43faec8 | 2017-06-12 10:46:51 +0530 | [diff] [blame] | 329 | @test_tracker_info(uuid="80a2f1bf-5e41-453a-9b8e-be3b41d4d313") |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 330 | @TelephonyBaseTest.tel_test_wrap |
| 331 | def test_stress_toggle_airplane_call(self): |
| 332 | """Stress test to toggle Airplane mode in a loop, then perform WiFi and |
| 333 | cellular calls. |
| 334 | |
| 335 | Steps: |
| 336 | 1. Attach device to voice subscription network. |
| 337 | 2. Connect to a WiFi network. |
| 338 | 3. Toggle Airplane mode OFF and ON in a loop. |
| 339 | 4. Verify device auto-connects to the WiFi network. |
| 340 | 5. Verify device is attached to voice network. |
| 341 | 6. Make short sequence voice calls. |
| 342 | |
| 343 | """ |
| 344 | self.setup_cellular_voice_calling() |
| 345 | self.connect_to_wifi(self.dut, self.network) |
| 346 | self.stress_toggle_airplane(self.stress_count) |
| 347 | self.validate_cellular_and_wifi() |
Bindu Mahadev | 6077af2 | 2018-02-08 15:04:51 -0800 | [diff] [blame] | 348 | return True |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 349 | |
| 350 | |
Girish Moturu | 43faec8 | 2017-06-12 10:46:51 +0530 | [diff] [blame] | 351 | @test_tracker_info(uuid="b88ad3e7-6462-4280-ad57-22d0ac91fdd8") |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 352 | @TelephonyBaseTest.tel_test_wrap |
| 353 | def test_stress_toggle_airplane_and_wifi_call(self): |
| 354 | """Stress test to toggle Airplane and WiFi mode in a loop, then perform |
| 355 | WiFi connection and cellular calls. |
| 356 | |
| 357 | Steps: |
| 358 | 1. Attach device to voice subscription network. |
| 359 | 2. Connect to a WiFi network. |
| 360 | 3. Toggle Airplane mode ON. |
| 361 | 4. Turn WiFi ON. |
| 362 | 5. Toggle Airplane mode OFF. |
| 363 | 6. Repeat 3, 4 & 5, in a loop. |
| 364 | 7. Verify device auto-connects to the WiFi network. |
| 365 | 8. Verify device is attached to voice network. |
| 366 | 9. Make short sequence voice calls. |
| 367 | |
| 368 | """ |
| 369 | self.setup_cellular_voice_calling() |
| 370 | self.connect_to_wifi(self.dut, self.network) |
Bindu Mahadev | 65d547e | 2017-05-19 23:58:32 +0000 | [diff] [blame] | 371 | self.stress_toggle_airplane_and_wifi(self.stress_count) |
Bindu Mahadev | ae92381 | 2017-04-12 22:57:49 +0000 | [diff] [blame] | 372 | self.validate_cellular_and_wifi() |
Bindu Mahadev | 6077af2 | 2018-02-08 15:04:51 -0800 | [diff] [blame] | 373 | return True |
lutina | a786a29 | 2021-06-08 21:19:12 +0800 | [diff] [blame] | 374 | |
| 375 | @test_tracker_info(uuid="7cd9698c-7cde-4c99-b73a-67a2246ca4ec") |
| 376 | @TelephonyBaseTest.tel_test_wrap |
| 377 | def test_toggle_WFC_call(self): |
| 378 | |
| 379 | """Test to toggle WiFi and then perform WiFi connection and |
| 380 | cellular calls. |
| 381 | |
| 382 | Raises: |
| 383 | signals.TestFailure:The Wifi calling test is failed. |
| 384 | |
| 385 | Steps: |
| 386 | 1. Attach device to voice subscription network. |
| 387 | 2. Connect to a WiFi network. |
| 388 | 3. Turn on airplane mode |
| 389 | 4. Toggle WiFi OFF and ON. |
| 390 | 5. Make WiFi calling |
| 391 | 6. Verify device is in WiFi calling |
| 392 | 5. Hang up the call |
| 393 | |
| 394 | Verification: |
| 395 | The device is using WiFi calling to call out. |
| 396 | |
| 397 | """ |
| 398 | mo_mt=[] |
| 399 | if mo_mt == DIRECTION_MOBILE_ORIGINATED: |
| 400 | ad_caller = self.ads[0] |
| 401 | ad_callee = self.ads[1] |
| 402 | else: |
| 403 | ad_caller = self.ads[1] |
| 404 | ad_callee = self.ads[0] |
| 405 | caller_number = tele_utils.get_phone_number(self.log, ad_caller) |
| 406 | callee_number = tele_utils.get_phone_number(self.log, ad_callee) |
| 407 | self._wfc_phone_setup_apm_wifi_preferred() |
| 408 | |
| 409 | self.connect_to_wifi(self.dut, self.network) |
| 410 | asserts.assert_true( |
| 411 | acts.utils.force_airplane_mode(self.dut, True), |
| 412 | "Can not turn on airplane mode on: %s" % self.dut.serial) |
| 413 | time.sleep(1) |
| 414 | self.log.info("Toggling wifi ON") |
| 415 | wifi_utils.wifi_toggle_state(self.dut, True) |
| 416 | time.sleep(10) |
| 417 | tele_utils.initiate_call(self.log, ad_caller, callee_number) |
| 418 | tele_utils.wait_and_answer_call(self.log, ad_callee, caller_number) |
| 419 | if not self._phone_idle_iwlan(): |
| 420 | self.log.error("no in wifi calling") |
| 421 | raise signals.TestFailure("The Wifi calling test is failed." |
| 422 | "WiFi State = %d" %self.dut.droid.wifiCheckState()) |
| 423 | tele_utils.hangup_call(self.log, self.ads[0]) |
| 424 | |
| 425 | @test_tracker_info(uuid="c1f0e0a7-b651-4d6c-a4a5-f946cabf56ef") |
| 426 | @TelephonyBaseTest.tel_test_wrap |
| 427 | def test_back_to_back_of_the_modem_restart(self): |
| 428 | |
| 429 | """Make sure DUT can connect to AP after modem restart |
| 430 | |
| 431 | Raises: |
| 432 | signals.TestFailure: The Wifi connect failed after modem restart. |
| 433 | |
| 434 | From b/171275893: |
| 435 | b/170702695 has modem back to back restart, |
| 436 | it causes WIFi failure and only reboot device can recover. |
| 437 | Currently modem team has this test case but they only check modem status. |
| 438 | Therefore, we need to add the same test case and the criteria is to check |
| 439 | if WiFi works well after back to back modem restart. |
| 440 | For the interval setting between 2 restarts, we suggest to use 20s. |
| 441 | We can change to different interval if necessary. |
| 442 | |
| 443 | Steps: |
| 444 | 1.Restart the modem once |
| 445 | 2.Waiting for 20s |
| 446 | 3.Restart the modem again |
| 447 | 4.Go to Settings ->Network & internet ->Wi-Fi |
| 448 | 5.To check the DUT can find WiFi AP then connect it |
| 449 | Verification: |
| 450 | DUT can connect to AP successfully |
| 451 | DUT can access the Internet after connect to AP. |
| 452 | |
| 453 | """ |
| 454 | self.dut = self.android_devices[0] |
| 455 | try: |
| 456 | tele_utils.trigger_modem_crash_by_modem(self.dut) |
| 457 | time.sleep(20) |
| 458 | tele_utils.trigger_modem_crash_by_modem(self.dut) |
| 459 | time.sleep(20) |
| 460 | self.connect_to_wifi(self.dut, self.network) |
| 461 | except: |
| 462 | raise signals.TestFailure("The Wifi connect failed after modem restart." |
lutina | 1d21ae4 | 2021-08-13 19:30:20 +0800 | [diff] [blame] | 463 | "WiFi State = %d" %self.dut.droid.wifiCheckState()) |
| 464 | |
| 465 | @test_tracker_info(uuid="a72ff9da-3855-4c21-b447-b80f43227961") |
| 466 | @TelephonyBaseTest.tel_test_wrap |
| 467 | def test_internet_accessing_over_wifi_and_mms_test(self): |
| 468 | |
| 469 | """Verify when MMS is working WLAN connection can work normally as well. |
| 470 | |
| 471 | Raises: |
| 472 | signals.TestFailure: Internet_connection is stop |
| 473 | |
| 474 | Steps: |
| 475 | 1. Connect to WiFi |
| 476 | 2. Prepare two DUT for testing (DUT1 and DUT2) |
| 477 | 3. Send 5 MMS from DUT1 to DUT2 |
| 478 | |
| 479 | Verification: |
| 480 | The internet cannot be impacted by MMS delivery. |
| 481 | MMS can be sent / received successfully and content is correct. |
| 482 | """ |
| 483 | self.dut1 = self.android_devices[0] |
| 484 | self.dut2 = self.android_devices[1] |
| 485 | self.connect_to_wifi(self.dut1, self.network) |
| 486 | wifi_utils.wifi_toggle_state(self.dut2, True) |
| 487 | self.connect_to_wifi(self.dut2, self.network) |
| 488 | mms = 5 |
| 489 | for count in range(mms): |
| 490 | mms_utils._mms_test(self.log, self.ads) |
| 491 | if not tele_utils.verify_internet_connection( |
| 492 | self.dut2.log, self.dut2): |
| 493 | raise signals.TestFailure("The internet connection is stop." |
| 494 | "Current WiFi state is %d" |
| 495 | % self.dut2.droid.wifiCheckState()) |
| 496 | time.sleep(30) |
| 497 | |
| 498 | @test_tracker_info(uuid="a7d774e4-ead3-465c-b4a6-f39a6397dfe3") |
| 499 | @TelephonyBaseTest.tel_test_wrap |
| 500 | def test_internet_accessing_wifi_and_data_test(self): |
| 501 | |
| 502 | """Verify interwork between Wi-Fi and data. |
| 503 | |
| 504 | Raises: |
| 505 | signals.TestFailure: Internet_connection is stop for WiFi off or |
| 506 | Data off |
| 507 | |
| 508 | Steps: |
| 509 | 1. Connect to WiFi |
| 510 | 2. To Wi-Fi and data switched for 5 times, |
| 511 | 3. DUT is kept awake during testing. |
| 512 | Verification: |
| 513 | The internet cannot be impacted after data path switched |
| 514 | |
| 515 | """ |
| 516 | self.dut = self.android_devices[0] |
| 517 | self.connect_to_wifi(self.dut, self.network) |
| 518 | data_count = 5 |
| 519 | for count in range(data_count): |
| 520 | wifi_utils.wifi_toggle_state(self.dut, False) |
| 521 | time.sleep(60) |
| 522 | if not tele_utils.verify_internet_connection( |
| 523 | self.dut.log, self.dut): |
| 524 | raise signals.TestFailure( |
| 525 | "The internet connection is stop" |
| 526 | "for WiFi off. Current WiFi state is %d" |
| 527 | % self.dut.droid.wifiCheckState()) |
| 528 | wifi_utils.wifi_toggle_state(self.dut, True) |
| 529 | time.sleep(DEFAULT_TIMEOUT) |
| 530 | self.dut.log.info("DUT data is disable") |
| 531 | self.dut.droid.telephonyToggleDataConnection(False) |
| 532 | time.sleep(30) |
| 533 | if not tele_utils.verify_internet_connection( |
| 534 | self.dut.log, self.dut): |
| 535 | raise signals.TestFailure( |
| 536 | "The internet connection is stop" |
| 537 | "for Data off. Current WiFi state is %d" |
| 538 | % self.dut.droid.wifiCheckState()) |
| 539 | self.dut.log.info("DUT data is enable") |
| 540 | self.dut.droid.telephonyToggleDataConnection(True) |
| 541 | time.sleep(DEFAULT_TIMEOUT) |
| 542 | |
| 543 | @test_tracker_info(uuid="e53adef6-d537-4098-a354-1e63457ab444") |
| 544 | @TelephonyBaseTest.tel_test_wrap |
| 545 | def test_internet_accessing_wifi_and_usb_tethering(self): |
| 546 | |
| 547 | """Verify interwork between Wi-Fi and USB_TETHERED. |
| 548 | |
| 549 | Raises: |
| 550 | signals.TestFailure: Internet_connection is stop for enable or |
| 551 | disable USB tethering |
| 552 | |
| 553 | Steps: |
| 554 | 1.Connect to WiFi |
| 555 | 2. enable/disable USB tethering for 5 cycles, |
| 556 | |
| 557 | Verification: |
| 558 | The Internet cannot be impacted after enable/disable USB tethering |
| 559 | |
| 560 | """ |
| 561 | self.dut = self.android_devices[0] |
| 562 | nutil.verify_lte_data_and_tethering_supported(self.dut) |
| 563 | self.connect_to_wifi(self.dut, self.network) |
| 564 | usb_count = 5 |
| 565 | for count in range(usb_count): |
| 566 | time.sleep(DEFAULT_TIMEOUT) |
| 567 | nutil.start_usb_tethering(self.dut) |
| 568 | time.sleep(DEFAULT_TIMEOUT) |
| 569 | if not tele_utils.verify_internet_connection( |
| 570 | self.dut.log, self.dut): |
| 571 | raise signals.TestFailure("The internet connection is stop" |
| 572 | "for tethering enable. Current WiFi state is %d" |
| 573 | % self.dut.droid.wifiCheckState()) |
| 574 | nutil.stop_usb_tethering(self.dut) |
| 575 | time.sleep(DEFAULT_TIMEOUT) |
| 576 | if not tele_utils.verify_internet_connection( |
| 577 | self.dut.log, self.dut): |
| 578 | raise signals.TestFailure("The internet connection is stop" |
| 579 | "for tethering disable. Current WiFi state is %d" |
| 580 | % self.dut.droid.wifiCheckState()) |