1# 2# Copyright 2017 - The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16import logging 17import random 18import socket 19import time 20 21from acts import asserts 22from acts import test_runner 23from acts import utils 24from acts.controllers import adb 25from acts.test_decorators import test_tracker_info 26from acts_contrib.test_utils.tel import tel_defines 27from acts_contrib.test_utils.tel.tel_data_utils import wait_for_cell_data_connection 28from acts_contrib.test_utils.tel.tel_test_utils import get_operator_name 29from acts_contrib.test_utils.tel.tel_test_utils import verify_http_connection 30from acts_contrib.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_2G 31from acts_contrib.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_5G 32from acts_contrib.test_utils.net import socket_test_utils as sutils 33from acts_contrib.test_utils.net import arduino_test_utils as dutils 34from acts_contrib.test_utils.net import net_test_utils as nutils 35from acts_contrib.test_utils.wifi import wifi_test_utils as wutils 36from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest 37 38WAIT_TIME = 5 39 40class WifiTetheringTest(WifiBaseTest): 41 """ Tests for Wifi Tethering """ 42 43 def setup_class(self): 44 """ Setup devices for tethering and unpack params """ 45 super().setup_class() 46 self.hotspot_device = self.android_devices[0] 47 self.tethered_devices = self.android_devices[1:] 48 req_params = ("url", "open_network", "wifi6_models") 49 self.unpack_userparams(req_params) 50 self.network = {"SSID": "hotspot_%s" % utils.rand_ascii_str(6), 51 "password": "pass_%s" % utils.rand_ascii_str(6)} 52 self.new_ssid = "hs_%s" % utils.rand_ascii_str(6) 53 54 nutils.verify_lte_data_and_tethering_supported(self.hotspot_device) 55 for ad in self.tethered_devices: 56 wutils.wifi_test_device_init(ad) 57 58 def setup_test(self): 59 super().setup_test() 60 self.tethered_devices[0].droid.telephonyToggleDataConnection(False) 61 62 def teardown_test(self): 63 super().teardown_test() 64 if self.hotspot_device.droid.wifiIsApEnabled(): 65 wutils.stop_wifi_tethering(self.hotspot_device) 66 self.tethered_devices[0].droid.telephonyToggleDataConnection(True) 67 68 def teardown_class(self): 69 """ Reset devices """ 70 for ad in self.tethered_devices: 71 wutils.reset_wifi(ad) 72 73 """ Helper functions """ 74 75 def _is_ipaddress_ipv6(self, ip_address): 76 """ Verify if the given string is a valid IPv6 address 77 78 Args: 79 1. string which contains the IP address 80 81 Returns: 82 True: if valid ipv6 address 83 False: if not 84 """ 85 try: 86 socket.inet_pton(socket.AF_INET6, ip_address) 87 return True 88 except socket.error: 89 return False 90 91 def _supports_ipv6_tethering(self, dut): 92 """ Check if provider supports IPv6 tethering. 93 Currently, only Verizon supports IPv6 tethering 94 95 Returns: 96 True: if provider supports IPv6 tethering 97 False: if not 98 """ 99 # Currently only Verizon support IPv6 tethering 100 carrier_supports_tethering = ["vzw", "tmo", "Far EasTone", "Chunghwa Telecom"] 101 operator = get_operator_name(self.log, dut) 102 return operator in carrier_supports_tethering 103 104 def _carrier_supports_ipv6(self,dut): 105 """ Verify if carrier supports ipv6 106 Currently, only verizon and t-mobile supports IPv6 107 108 Returns: 109 True: if carrier supports ipv6 110 False: if not 111 """ 112 carrier_supports_ipv6 = ["vzw", "tmo", "Far EasTone", "Chunghwa Telecom"] 113 operator = get_operator_name(self.log, dut) 114 self.log.info("Carrier is %s" % operator) 115 return operator in carrier_supports_ipv6 116 117 def _verify_ipv6_tethering(self, dut): 118 """ Verify IPv6 tethering """ 119 http_response = dut.droid.httpRequestString(self.url) 120 self.log.info("IP address %s " % http_response) 121 active_link_addrs = dut.droid.connectivityGetAllAddressesOfActiveLink() 122 if dut==self.hotspot_device and self._carrier_supports_ipv6(dut)\ 123 or self._supports_ipv6_tethering(self.hotspot_device): 124 asserts.assert_true(self._is_ipaddress_ipv6(http_response), 125 "The http response did not return IPv6 address") 126 asserts.assert_true( 127 active_link_addrs and http_response in str(active_link_addrs), 128 "Could not find IPv6 address in link properties") 129 asserts.assert_true( 130 dut.droid.connectivityHasIPv6DefaultRoute(), 131 "Could not find IPv6 default route in link properties") 132 else: 133 asserts.assert_true( 134 not dut.droid.connectivityHasIPv6DefaultRoute(), 135 "Found IPv6 default route in link properties") 136 137 def _start_wifi_tethering(self, wifi_band=WIFI_CONFIG_APBAND_2G): 138 """ Start wifi tethering on hotspot device 139 140 Args: 141 1. wifi_band: specifies the wifi band to start the hotspot 142 on. The current options are 2G and 5G 143 """ 144 wutils.start_wifi_tethering(self.hotspot_device, 145 self.network[wutils.WifiEnums.SSID_KEY], 146 self.network[wutils.WifiEnums.PWD_KEY], 147 wifi_band) 148 149 def _connect_disconnect_devices(self): 150 """ Randomly connect and disconnect devices from the 151 self.tethered_devices list to hotspot device 152 """ 153 device_connected = [ False ] * len(self.tethered_devices) 154 for _ in range(50): 155 dut_id = random.randint(0, len(self.tethered_devices)-1) 156 dut = self.tethered_devices[dut_id] 157 # wait for 1 sec between connect & disconnect stress test 158 time.sleep(1) 159 if device_connected[dut_id]: 160 wutils.wifi_forget_network(dut, self.network["SSID"]) 161 else: 162 wutils.wifi_connect(dut, self.network) 163 device_connected[dut_id] = not device_connected[dut_id] 164 165 def _connect_disconnect_android_device(self, dut_id, wifi_state): 166 """ Connect or disconnect wifi on android device depending on the 167 current wifi state 168 169 Args: 170 1. dut_id: tethered device to change the wifi state 171 2. wifi_state: current wifi state 172 """ 173 ad = self.tethered_devices[dut_id] 174 if wifi_state: 175 self.log.info("Disconnecting wifi on android device") 176 wutils.wifi_forget_network(ad, self.network["SSID"]) 177 else: 178 self.log.info("Connecting to wifi on android device") 179 wutils.wifi_connect(ad, self.network) 180 181 def _connect_disconnect_wifi_dongle(self, dut_id, wifi_state): 182 """ Connect or disconnect wifi on wifi dongle depending on the 183 current wifi state 184 185 Args: 186 1. dut_id: wifi dongle to change the wifi state 187 2. wifi_state: current wifi state 188 """ 189 wd = self.arduino_wifi_dongles[dut_id] 190 if wifi_state: 191 self.log.info("Disconnecting wifi on dongle") 192 dutils.disconnect_wifi(wd) 193 else: 194 self.log.info("Connecting to wifi on dongle") 195 dutils.connect_wifi(wd, self.network) 196 197 def _connect_disconnect_tethered_devices(self): 198 """ Connect disconnect tethered devices to wifi hotspot """ 199 num_android_devices = len(self.tethered_devices) 200 num_wifi_dongles = 0 201 if hasattr(self, 'arduino_wifi_dongles'): 202 num_wifi_dongles = len(self.arduino_wifi_dongles) 203 total_devices = num_android_devices + num_wifi_dongles 204 device_connected = [False] * total_devices 205 for _ in range(50): 206 dut_id = random.randint(0, total_devices-1) 207 wifi_state = device_connected[dut_id] 208 if dut_id < num_android_devices: 209 self._connect_disconnect_android_device(dut_id, wifi_state) 210 else: 211 self._connect_disconnect_wifi_dongle(dut_id-num_android_devices, 212 wifi_state) 213 device_connected[dut_id] = not device_connected[dut_id] 214 215 def _verify_ping(self, dut, ip, isIPv6=False): 216 """ Verify ping works from the dut to IP/hostname 217 218 Args: 219 1. dut - ad object to check ping from 220 2. ip - ip/hostname to ping (IPv4 and IPv6) 221 222 Returns: 223 True - if ping is successful 224 False - if not 225 """ 226 self.log.info("Pinging %s from dut %s" % (ip, dut.serial)) 227 if isIPv6 or self._is_ipaddress_ipv6(ip): 228 return dut.droid.pingHost(ip, 5, "ping6") 229 return dut.droid.pingHost(ip) 230 231 def _return_ip_for_interface(self, dut, iface_name): 232 """ Return list of IP addresses for an interface 233 234 Args: 235 1. dut - ad object 236 2. iface_name - interface name 237 238 Returns: 239 List of IPv4 and IPv6 addresses 240 """ 241 return dut.droid.connectivityGetIPv4Addresses(iface_name) + \ 242 dut.droid.connectivityGetIPv6Addresses(iface_name) 243 244 def _test_traffic_between_two_tethered_devices(self, ad, wd): 245 """ Verify pinging interfaces of one DUT from another 246 247 Args: 248 1. ad - android device 249 2. wd - wifi dongle 250 """ 251 wutils.wifi_connect(ad, self.network) 252 dutils.connect_wifi(wd, self.network) 253 local_ip = ad.droid.connectivityGetIPv4Addresses('wlan0')[0] 254 remote_ip = wd.ip_address() 255 port = 8888 256 257 time.sleep(6) # wait until UDP packets method is invoked 258 socket = sutils.open_datagram_socket(ad, local_ip, port) 259 sutils.send_recv_data_datagram_sockets( 260 ad, ad, socket, socket, remote_ip, port) 261 sutils.close_datagram_socket(ad, socket) 262 263 def _ping_hotspot_interfaces_from_tethered_device(self, dut): 264 """ Ping hotspot interfaces from tethered device 265 266 Args: 267 1. dut - tethered device 268 269 Returns: 270 True - if all IP addresses are pingable 271 False - if not 272 """ 273 ifaces = self.hotspot_device.droid.connectivityGetNetworkInterfaces() 274 return_result = True 275 for interface in ifaces: 276 iface_name = interface.split()[0].split(':')[1] 277 if iface_name == "lo": 278 continue 279 ip_list = self._return_ip_for_interface( 280 self.hotspot_device, iface_name) 281 for ip in ip_list: 282 ping_result = self._verify_ping(dut, ip) 283 self.log.info("Ping result: %s %s %s" % 284 (iface_name, ip, ping_result)) 285 return_result = return_result and ping_result 286 287 return return_result 288 289 def _save_wifi_softap_configuration(self, ad, config): 290 """ Save soft AP configuration 291 292 Args: 293 1. dut - device to save configuration on 294 2. config - soft ap configuration 295 """ 296 asserts.assert_true(ad.droid.wifiSetWifiApConfiguration(config), 297 "Failed to set WifiAp Configuration") 298 wifi_ap = ad.droid.wifiGetApConfiguration() 299 asserts.assert_true(wifi_ap[wutils.WifiEnums.SSID_KEY] == config[wutils.WifiEnums.SSID_KEY], 300 "Configured wifi hotspot SSID does not match with the expected SSID") 301 302 def _turn_on_wifi_hotspot(self, ad): 303 """ Turn on wifi hotspot with a config that is already saved 304 305 Args: 306 1. dut - device to turn wifi hotspot on 307 """ 308 ad.droid.wifiStartTrackingTetherStateChange() 309 ad.droid.connectivityStartTethering(tel_defines.TETHERING_WIFI, False) 310 try: 311 ad.ed.pop_event("ConnectivityManagerOnTetheringStarted") 312 ad.ed.wait_for_event("TetherStateChanged", 313 lambda x: x["data"]["ACTIVE_TETHER"], 30) 314 except: 315 asserts.fail("Didn't receive wifi tethering starting confirmation") 316 ad.droid.wifiStopTrackingTetherStateChange() 317 318 """ Test Cases """ 319 320 @test_tracker_info(uuid="36d03295-bea3-446e-8342-b9f8f1962a32") 321 def test_ipv6_tethering(self): 322 """ IPv6 tethering test 323 324 Steps: 325 1. Start wifi tethering on hotspot device 326 2. Verify IPv6 address on hotspot device (VZW & TMO only) 327 3. Connect tethered device to hotspot device 328 4. Verify IPv6 address on the client's link properties (VZW only) 329 5. Verify ping on client using ping6 which should pass (VZW only) 330 6. Disable mobile data on provider and verify that link properties 331 does not have IPv6 address and default route (VZW only) 332 """ 333 # Start wifi tethering on the hotspot device 334 wutils.toggle_wifi_off_and_on(self.hotspot_device) 335 self._start_wifi_tethering() 336 337 # Verify link properties on hotspot device 338 self.log.info("Check IPv6 properties on the hotspot device. " 339 "Verizon & T-mobile should have IPv6 in link properties") 340 self._verify_ipv6_tethering(self.hotspot_device) 341 342 # Connect the client to the SSID 343 wutils.wifi_connect(self.tethered_devices[0], self.network) 344 345 # Need to wait atleast 2 seconds for IPv6 address to 346 # show up in the link properties 347 time.sleep(WAIT_TIME) 348 349 # Verify link properties on tethered device 350 self.log.info("Check IPv6 properties on the tethered device. " 351 "Device should have IPv6 if carrier is Verizon") 352 self._verify_ipv6_tethering(self.tethered_devices[0]) 353 354 # Verify ping6 on tethered device 355 ping_result = self._verify_ping(self.tethered_devices[0], 356 wutils.DEFAULT_PING_ADDR, True) 357 if self._supports_ipv6_tethering(self.hotspot_device): 358 asserts.assert_true(ping_result, "Ping6 failed on the client") 359 else: 360 asserts.assert_true(not ping_result, "Ping6 failed as expected") 361 362 # Disable mobile data on hotspot device 363 # and verify the link properties on tethered device 364 self.log.info("Disabling mobile data to verify ipv6 default route") 365 self.hotspot_device.droid.telephonyToggleDataConnection(False) 366 asserts.assert_equal( 367 self.hotspot_device.droid.telephonyGetDataConnectionState(), 368 tel_defines.DATA_STATE_CONNECTED, 369 "Could not disable cell data") 370 371 time.sleep(WAIT_TIME) # wait until the IPv6 is removed from link properties 372 373 result = self.tethered_devices[0].droid.connectivityHasIPv6DefaultRoute() 374 self.hotspot_device.droid.telephonyToggleDataConnection(True) 375 if result: 376 asserts.fail("Found IPv6 default route in link properties:Data off") 377 self.log.info("Did not find IPv6 address in link properties") 378 379 # Disable wifi tethering 380 wutils.stop_wifi_tethering(self.hotspot_device) 381 382 @test_tracker_info(uuid="110b61d1-8af2-4589-8413-11beac7a3025") 383 def test_wifi_tethering_2ghz_traffic_between_2tethered_devices(self): 384 """ Steps: 385 386 1. Start wifi hotspot with 2G band 387 2. Connect 2 tethered devices to the hotspot device 388 3. Ping interfaces between the tethered devices 389 """ 390 asserts.skip_if(not hasattr(self, 'arduino_wifi_dongles'), 391 "No wifi dongles connected. Skipping test") 392 wutils.toggle_wifi_off_and_on(self.hotspot_device) 393 self._start_wifi_tethering(WIFI_CONFIG_APBAND_2G) 394 self._test_traffic_between_two_tethered_devices(self.tethered_devices[0], 395 self.arduino_wifi_dongles[0]) 396 wutils.stop_wifi_tethering(self.hotspot_device) 397 398 @test_tracker_info(uuid="953f6e2e-27bd-4b73-85a6-d2eaa4e755d5") 399 def wifi_tethering_5ghz_traffic_between_2tethered_devices(self): 400 """ Steps: 401 402 1. Start wifi hotspot with 5ghz band 403 2. Connect 2 tethered devices to the hotspot device 404 3. Send traffic between the tethered devices 405 """ 406 wutils.toggle_wifi_off_and_on(self.hotspot_device) 407 self._start_wifi_tethering(WIFI_CONFIG_APBAND_5G) 408 self._test_traffic_between_two_tethered_devices(self.tethered_devices[0], 409 self.arduino_wifi_dongles[0]) 410 wutils.stop_wifi_tethering(self.hotspot_device) 411 412 @test_tracker_info(uuid="d7d5aa51-682d-4882-a334-61966d93b68c") 413 def test_wifi_tethering_2ghz_connect_disconnect_devices(self): 414 """ Steps: 415 416 1. Start wifi hotspot with 2ghz band 417 2. Connect and disconnect multiple devices randomly 418 3. Verify the correct functionality 419 """ 420 wutils.toggle_wifi_off_and_on(self.hotspot_device) 421 self._start_wifi_tethering(WIFI_CONFIG_APBAND_2G) 422 self._connect_disconnect_tethered_devices() 423 wutils.stop_wifi_tethering(self.hotspot_device) 424 425 @test_tracker_info(uuid="34abd6c9-c7f1-4d89-aa2b-a66aeabed9aa") 426 def test_wifi_tethering_5ghz_connect_disconnect_devices(self): 427 """ Steps: 428 429 1. Start wifi hotspot with 5ghz band 430 2. Connect and disconnect multiple devices randomly 431 3. Verify the correct functionality 432 """ 433 wutils.toggle_wifi_off_and_on(self.hotspot_device) 434 self._start_wifi_tethering(WIFI_CONFIG_APBAND_5G) 435 self._connect_disconnect_devices() 436 wutils.stop_wifi_tethering(self.hotspot_device) 437 438 @test_tracker_info(uuid="7edfb220-37f8-42ea-8d7c-39712fbe9be5") 439 def test_wifi_tethering_wpapsk_network_2g(self): 440 """ Steps: 441 442 1. Start wifi tethering with wpapsk network 2G band 443 2. Connect tethered device to the SSID 444 3. Verify internet connectivity 445 """ 446 self._start_wifi_tethering() 447 wutils.connect_to_wifi_network(self.tethered_devices[0], 448 self.network, 449 check_connectivity=True) 450 wutils.verify_11ax_softap(self.hotspot_device, 451 self.tethered_devices[0], 452 self.wifi6_models) 453 454 @test_tracker_info(uuid="17e450f4-795f-4e67-adab-984940dffedc") 455 def test_wifi_tethering_wpapsk_network_5g(self): 456 """ Steps: 457 458 1. Start wifi tethering with wpapsk network 5G band 459 2. Connect tethered device to the SSID 460 3. Verify internet connectivity 461 """ 462 self._start_wifi_tethering(WIFI_CONFIG_APBAND_5G) 463 wutils.connect_to_wifi_network(self.tethered_devices[0], 464 self.network, 465 check_connectivity=True) 466 wutils.verify_11ax_softap(self.hotspot_device, 467 self.tethered_devices[0], 468 self.wifi6_models) 469 470 @test_tracker_info(uuid="2bc344cb-0277-4f06-b6cc-65b3972086ed") 471 def test_change_wifi_hotspot_ssid_when_hotspot_enabled(self): 472 """ Steps: 473 474 1. Start wifi tethering 475 2. Verify wifi Ap configuration 476 3. Change the SSID of the wifi hotspot while hotspot is on 477 4. Verify the new SSID in wifi ap configuration 478 5. Restart tethering and verify that the tethered device is able 479 to connect to the new SSID 480 """ 481 dut = self.hotspot_device 482 483 # start tethering and verify the wifi ap configuration settings 484 self._start_wifi_tethering() 485 wifi_ap = dut.droid.wifiGetApConfiguration() 486 asserts.assert_true( 487 wifi_ap[wutils.WifiEnums.SSID_KEY] == \ 488 self.network[wutils.WifiEnums.SSID_KEY], 489 "Configured wifi hotspot SSID did not match with the expected SSID") 490 wutils.connect_to_wifi_network(self.tethered_devices[0], self.network) 491 wutils.verify_11ax_softap(self.hotspot_device, 492 self.tethered_devices[0], 493 self.wifi6_models) 494 495 # update the wifi ap configuration with new ssid 496 config = {wutils.WifiEnums.SSID_KEY: self.new_ssid} 497 config[wutils.WifiEnums.PWD_KEY] = self.network[wutils.WifiEnums.PWD_KEY] 498 config[wutils.WifiEnums.AP_BAND_KEY] = WIFI_CONFIG_APBAND_2G 499 self._save_wifi_softap_configuration(dut, config) 500 501 # start wifi tethering with new wifi ap configuration 502 wutils.stop_wifi_tethering(dut) 503 self._turn_on_wifi_hotspot(dut) 504 505 # verify dut can connect to new wifi ap configuration 506 new_network = {wutils.WifiEnums.SSID_KEY: self.new_ssid, 507 wutils.WifiEnums.PWD_KEY: \ 508 self.network[wutils.WifiEnums.PWD_KEY]} 509 wutils.connect_to_wifi_network(self.tethered_devices[0], new_network) 510 wutils.verify_11ax_softap(self.hotspot_device, 511 self.tethered_devices[0], 512 self.wifi6_models) 513 514 @test_tracker_info(uuid="4cf7ab26-ca2d-46f6-9d3f-a935c7e04c97") 515 def test_wifi_tethering_open_network_2g(self): 516 """ Steps: 517 518 1. Start wifi tethering with open network 2G band 519 (Not allowed manually. b/72412729) 520 2. Connect tethered device to the SSID 521 3. Verify internet connectivity 522 """ 523 open_network = { 524 wutils.WifiEnums.SSID_KEY: "hs_2g_%s" % utils.rand_ascii_str(6) 525 } 526 wutils.start_wifi_tethering( 527 self.hotspot_device, 528 open_network[wutils.WifiEnums.SSID_KEY], 529 None, 530 WIFI_CONFIG_APBAND_2G) 531 wutils.connect_to_wifi_network(self.tethered_devices[0], 532 open_network, 533 check_connectivity=True) 534 wutils.verify_11ax_softap(self.hotspot_device, 535 self.tethered_devices[0], 536 self.wifi6_models) 537 538 @test_tracker_info(uuid="f407049b-1324-40ea-a8d1-f90587933310") 539 def test_wifi_tethering_open_network_5g(self): 540 """ Steps: 541 542 1. Start wifi tethering with open network 5G band 543 (Not allowed manually. b/72412729) 544 2. Connect tethered device to the SSID 545 3. Verify internet connectivity 546 """ 547 open_network = { 548 wutils.WifiEnums.SSID_KEY: "hs_5g_%s" % utils.rand_ascii_str(6) 549 } 550 wutils.start_wifi_tethering( 551 self.hotspot_device, 552 open_network[wutils.WifiEnums.SSID_KEY], 553 None, 554 WIFI_CONFIG_APBAND_5G) 555 wutils.connect_to_wifi_network(self.tethered_devices[0], 556 open_network, 557 check_connectivity=True) 558 wutils.verify_11ax_softap(self.hotspot_device, 559 self.tethered_devices[0], 560 self.wifi6_models) 561 562 @test_tracker_info(uuid="d964f2e6-0acb-417c-ada9-eb9fc5a470e4") 563 def test_wifi_tethering_open_network_2g_stress(self): 564 """ Steps: 565 566 1. Save wifi hotspot configuration with open network 2G band 567 (Not allowed manually. b/72412729) 568 2. Turn on wifi hotspot 569 3. Connect tethered device and verify internet connectivity 570 4. Turn off wifi hotspot 571 5. Repeat steps 2 to 4 572 """ 573 # save open network wifi ap configuration with 2G band 574 config = {wutils.WifiEnums.SSID_KEY: 575 self.open_network[wutils.WifiEnums.SSID_KEY]} 576 config[wutils.WifiEnums.AP_BAND_KEY] = WIFI_CONFIG_APBAND_2G 577 self._save_wifi_softap_configuration(self.hotspot_device, config) 578 579 # turn on/off wifi hotspot, connect device 580 for _ in range(9): 581 self._turn_on_wifi_hotspot(self.hotspot_device) 582 wutils.connect_to_wifi_network(self.tethered_devices[0], self.open_network) 583 wutils.stop_wifi_tethering(self.hotspot_device) 584 time.sleep(1) # wait for some time before turning on hotspot 585 586 @test_tracker_info(uuid="c7ef840c-4003-41fc-80e3-755f9057b542") 587 def test_wifi_tethering_open_network_5g_stress(self): 588 """ Steps: 589 590 1. Save wifi hotspot configuration with open network 5G band 591 (Not allowed manually. b/72412729) 592 2. Turn on wifi hotspot 593 3. Connect tethered device and verify internet connectivity 594 4. Turn off wifi hotspot 595 5. Repeat steps 2 to 4 596 """ 597 # save open network wifi ap configuration with 5G band 598 config = {wutils.WifiEnums.SSID_KEY: 599 self.open_network[wutils.WifiEnums.SSID_KEY]} 600 config[wutils.WifiEnums.AP_BAND_KEY] = WIFI_CONFIG_APBAND_5G 601 self._save_wifi_softap_configuration(self.hotspot_device, config) 602 603 # turn on/off wifi hotspot, connect device 604 for _ in range(9): 605 self._turn_on_wifi_hotspot(self.hotspot_device) 606 wutils.connect_to_wifi_network(self.tethered_devices[0], self.open_network) 607 wutils.stop_wifi_tethering(self.hotspot_device) 608 time.sleep(1) # wait for some time before turning on hotspot 609