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