1# 2# Copyright 2021 - 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 16from acts.controllers.ap_lib import hostapd_constants 17import acts.signals as signals 18import acts_contrib.test_utils.wifi.wifi_test_utils as wutils 19from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest 20from WifiStaApConcurrencyTest import WifiStaApConcurrencyTest 21 22 23class WifiStaApConcurrency11axTest(WifiStaApConcurrencyTest): 24 """Tests for STA+AP concurrency 11ax. 25 26 Test Bed Requirement: 27 One Android device, 1 Asus AXE11000 Access Point and Radius server 28 """ 29 30 def __init__(self, configs): 31 super().__init__(configs) 32 self.tests = ( 33 "test_wifi_connection_5G_softap_5G", 34 "test_wifi_connection_5G_softap_2G", 35 "test_wifi_connection_5G_softap_2G_with_location_scan_on", 36 "test_softap_5G_wifi_connection_5G", 37 "test_softap_2G_wifi_connection_5G", 38 "test_wifi_connection_2G_softap_2G", 39 "test_wifi_connection_2G_softap_5G", 40 "test_softap_2G_wifi_connection_2G", 41 "test_wifi_connection_2G_softap_2G_to_softap_5g", 42 "test_softap_5G_wifi_connection_2G", 43 "test_softap_5G_wifi_connection_2G_with_location_scan_on", 44 "test_wifi_connection_5G_softap_2G_to_softap_5g", 45 "test_wifi_connection_5G_DFS_softap_5G", 46 "test_wifi_connection_5G_DFS_softap_2G", 47 "test_softap_5G_wifi_connection_5G_DFS", 48 "test_softap_2G_wifi_connection_5G_DFS", 49 ) 50 51 def setup_class(self): 52 WifiBaseTest.setup_class(self) 53 54 self.dut = self.android_devices[0] 55 self.dut_client = self.android_devices[1] 56 req_params = ["iperf_server_address", "iperf_server_port", "wifi6_models"] 57 self.unpack_userparams(req_param_names=req_params,) 58 self.ap = self.access_points[0] 59 self.ap.configure_ap({"2g": {"security": "open"}, 60 "5g": {"security": "open"}}) 61 self.open_2g = self.ap.get_wifi_network("2g") 62 self.open_5g = self.ap.get_wifi_network("5g") 63 64 def teardown_test(self): 65 WifiBaseTest.teardown_test(self) 66 # Prevent the stop wifi tethering failure to block ap close 67 try: 68 wutils.stop_wifi_tethering(self.dut) 69 except signals.TestFailure: 70 pass 71 for ad in self.android_devices: 72 ad.droid.wakeLockRelease() 73 ad.droid.goToSleepNow() 74 wutils.reset_wifi(ad) 75 self.turn_location_on_and_scan_toggle_on() 76 77 ### Helper Methods ### 78 79 def configure_ap(self, channel_2g=None, channel_5g=None): 80 """Configure and bring up AP on required channel. 81 82 Args: 83 channel_2g: The channel number to use for 2GHz network. 84 channel_5g: The channel number to use for 5GHz network. 85 """ 86 if not channel_2g: 87 channel_2g = hostapd_constants.AP_DEFAULT_CHANNEL_2G 88 if not channel_5g: 89 channel_5g = hostapd_constants.AP_DEFAULT_CHANNEL_5G 90 if int(self.ap.get_configured_channel("5g")) != channel_5g: 91 self.ap.set_channel_and_apply("5g", channel_5g) 92 if int(self.ap.get_configured_channel("2g")) != channel_2g: 93 self.ap.set_channel_and_apply("2g", channel_2g) 94 95