1#!/usr/bin/env python3.4
2#
3#   Copyright 2018 - The Android Open Source Project
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16
17import itertools
18import pprint
19import queue
20import sys
21import time
22
23import acts.base_test
24import acts.signals as signals
25import acts_contrib.test_utils.wifi.wifi_test_utils as wutils
26import acts.utils as utils
27
28from acts import asserts
29from acts.controllers.ap_lib import hostapd_constants
30from acts.test_decorators import test_tracker_info
31from acts_contrib.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_2G
32from acts_contrib.test_utils.tel.tel_test_utils import WIFI_CONFIG_APBAND_5G
33from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest
34from threading import Thread
35
36WifiEnums = wutils.WifiEnums
37WIFI_CONFIG_APBAND_AUTO = WifiEnums.WIFI_CONFIG_SOFTAP_BAND_2G_5G
38GET_FREQUENCY_NUM_RETRIES = 3
39
40class WifiSoftApAcsTest(WifiBaseTest):
41    """Tests for Automatic Channel Selection.
42
43    Test Bed Requirement:
44    * Two Android devices and an AP.
45    * 2GHz and 5GHz  Wi-Fi network visible to the device.
46    """
47
48    def setup_class(self):
49        super().setup_class()
50
51        self.dut = self.android_devices[0]
52        self.dut_client = self.android_devices[1]
53        utils.require_sl4a((self.dut, self.dut_client))
54        utils.sync_device_time(self.dut)
55        utils.sync_device_time(self.dut_client)
56        # Enable verbose logging on the duts
57        self.dut.droid.wifiEnableVerboseLogging(1)
58        asserts.assert_equal(self.dut.droid.wifiGetVerboseLoggingLevel(), 1,
59            "Failed to enable WiFi verbose logging on the softap dut.")
60        self.dut_client.droid.wifiEnableVerboseLogging(1)
61        asserts.assert_equal(self.dut_client.droid.wifiGetVerboseLoggingLevel(), 1,
62            "Failed to enable WiFi verbose logging on the client dut.")
63        req_params = ["wifi6_models",]
64        opt_param = ["iperf_server_address", "reference_networks",
65                     "iperf_server_port", "pixel_models"]
66        self.unpack_userparams(
67            req_param_names=req_params, opt_param_names=opt_param)
68        self.chan_map = {v: k for k, v in hostapd_constants.CHANNEL_MAP.items()}
69        self.pcap_procs = None
70
71    def setup_test(self):
72        super().setup_test()
73        if hasattr(self, 'packet_capture'):
74            chan = self.test_name.split('_')[-1]
75            if chan.isnumeric():
76                band = '2G' if self.chan_map[int(chan)] < 5000 else '5G'
77                self.packet_capture[0].configure_monitor_mode(band, int(chan))
78                self.pcap_procs = wutils.start_pcap(
79                    self.packet_capture[0], band, self.test_name)
80        self.dut.droid.wakeLockAcquireBright()
81        self.dut.droid.wakeUpNow()
82
83    def teardown_test(self):
84        super().teardown_test()
85        self.dut.droid.wakeLockRelease()
86        self.dut.droid.goToSleepNow()
87        wutils.stop_wifi_tethering(self.dut)
88        wutils.reset_wifi(self.dut)
89        wutils.reset_wifi(self.dut_client)
90        if hasattr(self, 'packet_capture') and self.pcap_procs:
91            wutils.stop_pcap(self.packet_capture[0], self.pcap_procs, False)
92            self.pcap_procs = None
93        try:
94            if "AccessPoint" in self.user_params:
95                del self.user_params["reference_networks"]
96                del self.user_params["open_network"]
97        except:
98            pass
99        self.access_points[0].close()
100
101    """Helper Functions"""
102
103    def run_iperf_client(self, params):
104        """Run iperf traffic after connection.
105
106        Args:
107            params: A tuple of network info and AndroidDevice object.
108
109        """
110        if "iperf_server_address" in self.user_params:
111            network, ad = params
112            SSID = network[WifiEnums.SSID_KEY]
113            self.log.info("Starting iperf traffic through {}".format(SSID))
114            port_arg = "-p {} -t {}".format(self.iperf_server_port, 3)
115            success, data = ad.run_iperf_client(self.iperf_server_address,
116                                                port_arg)
117            self.log.debug(pprint.pformat(data))
118            asserts.assert_true(success, "Error occurred in iPerf traffic.")
119            self.log.info("Finished iperf traffic through {}".format(SSID))
120
121    def start_softap_and_verify(self, band):
122        """Bring-up softap and verify AP mode and in scan results.
123
124        Args:
125            band: The band to use for softAP.
126
127        """
128        config = wutils.create_softap_config()
129        wutils.start_wifi_tethering(self.dut,
130                                    config[wutils.WifiEnums.SSID_KEY],
131                                    config[wutils.WifiEnums.PWD_KEY], band=band)
132        asserts.assert_true(self.dut.droid.wifiIsApEnabled(),
133                             "SoftAp is not reported as running")
134        wutils.start_wifi_connection_scan_and_ensure_network_found(
135            self.dut_client, config[wutils.WifiEnums.SSID_KEY])
136        return config
137
138    def get_softap_acs(self, softap):
139        """Connect to the softap on client-dut and get the softap channel
140           information.
141
142        Args:
143            softap: The softap network configuration information.
144
145        """
146        wutils.connect_to_wifi_network(self.dut_client, softap,
147            check_connectivity=False)
148        for _ in range(GET_FREQUENCY_NUM_RETRIES):
149            softap_info = self.dut_client.droid.wifiGetConnectionInfo()
150            self.log.debug("DUT is connected to softAP %s with details: %s" %
151                           (softap[wutils.WifiEnums.SSID_KEY], softap_info))
152            frequency = softap_info['frequency']
153            self.dut.log.info("DUT SoftAp operates on Channel: {}".
154                              format(WifiEnums.freq_to_channel[frequency]))
155            if frequency > 0:
156                break
157            time.sleep(1) # frequency not updated yet, try again after a delay
158        wutils.verify_11ax_softap(self.dut, self.dut_client, self.wifi6_models)
159        return hostapd_constants.CHANNEL_MAP[frequency]
160
161    def configure_ap(self, channel_2g=None, channel_5g=None):
162        """Configure and bring up AP on required channel.
163
164        Args:
165            channel_2g: The channel number to use for 2GHz network.
166            channel_5g: The channel number to use for 5GHz network.
167
168        """
169        if not channel_2g:
170            channel_2g = hostapd_constants.AP_DEFAULT_CHANNEL_2G
171        if not channel_5g:
172            channel_5g = hostapd_constants.AP_DEFAULT_CHANNEL_5G
173        if "AccessPoint" in self.user_params:
174            self.legacy_configure_ap_and_start(wpa_network=True,
175                                               wep_network=True,
176                                               channel_2g=channel_2g,
177                                               channel_5g=channel_5g)
178        elif "OpenWrtAP" in self.user_params:
179            self.configure_openwrt_ap_and_start(wpa_network=True,
180                                                wep_network=True,
181                                                channel_2g=channel_2g,
182                                                channel_5g=channel_5g)
183
184    def start_traffic_and_softap(self, network, softap_band):
185        """Start iPerf traffic on client dut, during softAP bring-up on dut.
186
187        Args:
188            network: Network information of the network to connect to.
189            softap_band: The band to use for softAP.
190
191        """
192        if not network:
193            # For a clean environment just bring up softap and return channel.
194            softap = self.start_softap_and_verify(softap_band)
195            channel = self.get_softap_acs(softap)
196            return channel
197        # Connect to the AP and start IPerf traffic, while we bring up softap.
198        wutils.connect_to_wifi_network(self.dut_client, network)
199        freq = self.dut_client.droid.wifiGetConnectionInfo()["frequency"]
200        ap_chan = wutils.WifiEnums.freq_to_channel[freq]
201        self.dut_client.log.info("{} operates on channel: {}"
202                                 .format(network["SSID"], ap_chan))
203        wutils.verify_11ax_wifi_connection(
204            self.dut_client, self.wifi6_models, "wifi6_ap" in self.user_params)
205        t = Thread(target=self.run_iperf_client,args=((network,self.dut_client),))
206        t.setDaemon(True)
207        t.start()
208        time.sleep(1)
209        softap = self.start_softap_and_verify(softap_band)
210        t.join()
211        channel = self.get_softap_acs(softap)
212        return channel
213
214    def verify_acs_channel(self, chan, avoid_chan):
215        """Verify ACS algorithm by ensuring that softAP came up on a channel,
216           different than the active channels.
217
218        Args:
219            chan: The channel number softap came-up on.
220            avoid_chan: The channel to avoid during this test.
221
222        """
223        if avoid_chan in range(1,12):
224            avoid_chan2 = hostapd_constants.AP_DEFAULT_CHANNEL_5G
225        elif avoid_chan in range(36, 166):
226            avoid_chan2 = hostapd_constants.AP_DEFAULT_CHANNEL_2G
227        if chan == avoid_chan or chan == avoid_chan2:
228            raise signals.TestFailure("ACS chose the same channel that the "
229                "AP was beaconing on. Channel = %d" % chan)
230
231    """Tests"""
232    @test_tracker_info(uuid="3507bd18-e787-4380-8725-1872916d4267")
233    def test_softap_2G_clean_env(self):
234        """Test to bring up SoftAp on 2GHz in clean environment."""
235        network = None
236        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
237        if not chan in range(1, 12):
238            raise signals.TestFailure("ACS chose incorrect channel %d for 2GHz "
239                "band" % chan)
240
241    @test_tracker_info(uuid="3d18da8b-d29a-45f9-8018-5348e10099e9")
242    def test_softap_5G_clean_env(self):
243        """Test to bring up SoftAp on 5GHz in clean environment."""
244        network = None
245        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
246        if not chan in range(36, 166):
247            # Note: This does not treat DFS channel separately.
248            raise signals.TestFailure("ACS chose incorrect channel %d for 5GHz "
249                "band" % chan)
250
251    @test_tracker_info(uuid="cc353bda-3831-4d6e-b990-e501b8e4eafe")
252    def test_softap_auto_clean_env(self):
253        """Test to bring up SoftAp on AUTO-band in clean environment."""
254        network = None
255        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_AUTO)
256        if not chan in range(36, 166):
257            # Note: This does not treat DFS channel separately.
258            raise signals.TestFailure("ACS chose incorrect channel %d for 5GHz "
259                "band" % chan)
260
261    @test_tracker_info(uuid="a5f6a926-76d2-46a7-8136-426e35b5a5a8")
262    def test_softap_2G_avoid_channel_1(self):
263        """Test to configure AP and bring up SoftAp on 2G."""
264        self.configure_ap(channel_2g=1)
265        network = self.reference_networks[0]["2g"]
266        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
267        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
268        self.verify_acs_channel(chan, avoid_chan)
269
270    @test_tracker_info(uuid="757e2019-b027-40bf-a562-2b01f3e5957e")
271    def test_softap_5G_avoid_channel_1(self):
272        """Test to configure AP and bring up SoftAp on 5G."""
273        self.configure_ap(channel_2g=1)
274        network = self.reference_networks[0]["2g"]
275        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
276        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
277        self.verify_acs_channel(chan, avoid_chan)
278
279    @test_tracker_info(uuid="b96e39d1-9041-4662-a55f-22641c2e2b02")
280    def test_softap_2G_avoid_channel_2(self):
281        """Test to configure AP and bring up SoftAp on 2G."""
282        self.configure_ap(channel_2g=2)
283        network = self.reference_networks[0]["2g"]
284        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
285        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
286        self.verify_acs_channel(chan, avoid_chan)
287
288    @test_tracker_info(uuid="941c4e2b-ae35-4b49-aa81-13d3dc44b5b6")
289    def test_softap_5G_avoid_channel_2(self):
290        """Test to configure AP and bring up SoftAp on 5G."""
291        self.configure_ap(channel_2g=2)
292        network = self.reference_networks[0]["2g"]
293        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
294        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
295        self.verify_acs_channel(chan, avoid_chan)
296
297    @test_tracker_info(uuid="444c4a34-7f6b-4f02-9802-2e896e7d1796")
298    def test_softap_2G_avoid_channel_3(self):
299        """Test to configure AP and bring up SoftAp on 2G."""
300        self.configure_ap(channel_2g=3)
301        network = self.reference_networks[0]["2g"]
302        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
303        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
304        self.verify_acs_channel(chan, avoid_chan)
305
306    @test_tracker_info(uuid="eccd06b1-6df5-4144-8fda-1504cb822375")
307    def test_softap_5G_avoid_channel_3(self):
308        """Test to configure AP and bring up SoftAp on 5G."""
309        self.configure_ap(channel_2g=3)
310        network = self.reference_networks[0]["2g"]
311        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
312        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
313        self.verify_acs_channel(chan, avoid_chan)
314
315    @test_tracker_info(uuid="fb257644-2081-4c3d-8394-7a308dde0047")
316    def test_softap_2G_avoid_channel_4(self):
317        """Test to configure AP and bring up SoftAp on 2G."""
318        self.configure_ap(channel_2g=4)
319        network = self.reference_networks[0]["2g"]
320        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
321        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
322        self.verify_acs_channel(chan, avoid_chan)
323
324    @test_tracker_info(uuid="88b9cd16-4541-408a-8607-415fe60001f2")
325    def test_softap_5G_avoid_channel_4(self):
326        """Test to configure AP and bring up SoftAp on 5G."""
327        self.configure_ap(channel_2g=4)
328        network = self.reference_networks[0]["2g"]
329        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
330        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
331        self.verify_acs_channel(chan, avoid_chan)
332
333    @test_tracker_info(uuid="b3626ec8-50e8-412c-bdbe-5c5ade647d7b")
334    def test_softap_2G_avoid_channel_5(self):
335        """Test to configure AP and bring up SoftAp on 2G."""
336        self.configure_ap(channel_2g=5)
337        network = self.reference_networks[0]["2g"]
338        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
339        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
340        self.verify_acs_channel(chan, avoid_chan)
341
342    @test_tracker_info(uuid="45c4396b-9b0c-44f3-adf2-ea9c86fcab1d")
343    def test_softap_5G_avoid_channel_5(self):
344        """Test to configure AP and bring up SoftAp on 5G."""
345        self.configure_ap(channel_2g=5)
346        network = self.reference_networks[0]["2g"]
347        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
348        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
349        self.verify_acs_channel(chan, avoid_chan)
350
351    @test_tracker_info(uuid="f70634e7-c6fd-403d-8cd7-439fbbda6af0")
352    def test_softap_2G_avoid_channel_6(self):
353        """Test to configure AP and bring up SoftAp on 2G."""
354        self.configure_ap(channel_2g=6)
355        network = self.reference_networks[0]["2g"]
356        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
357        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
358        self.verify_acs_channel(chan, avoid_chan)
359
360    @test_tracker_info(uuid="f3341136-10bc-44e2-b9a8-2d27d3284b73")
361    def test_softap_5G_avoid_channel_6(self):
362        """Test to configure AP and bring up SoftAp on 5G."""
363        self.configure_ap(channel_2g=6)
364        network = self.reference_networks[0]["2g"]
365        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
366        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
367        self.verify_acs_channel(chan, avoid_chan)
368
369    @test_tracker_info(uuid="8129594d-1608-448b-8548-5a8c4022f2a1")
370    def test_softap_2G_avoid_channel_7(self):
371        """Test to configure AP and bring up SoftAp on 2G."""
372        self.configure_ap(channel_2g=7)
373        network = self.reference_networks[0]["2g"]
374        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
375        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
376        self.verify_acs_channel(chan, avoid_chan)
377
378    @test_tracker_info(uuid="7b470b82-d19b-438c-8f98-ce697e0eb474")
379    def test_softap_5G_avoid_channel_7(self):
380        """Test to configure AP and bring up SoftAp on 5G."""
381        self.configure_ap(channel_2g=7)
382        network = self.reference_networks[0]["2g"]
383        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
384        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
385        self.verify_acs_channel(chan, avoid_chan)
386
387    @test_tracker_info(uuid="11540182-d471-4bf0-8f8b-add89443c329")
388    def test_softap_2G_avoid_channel_8(self):
389        """Test to configure AP and bring up SoftAp on 2G."""
390        self.configure_ap(channel_2g=8)
391        network = self.reference_networks[0]["2g"]
392        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
393        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
394        self.verify_acs_channel(chan, avoid_chan)
395
396    @test_tracker_info(uuid="1280067c-389e-42e9-aa75-6bfbd61340f3")
397    def test_softap_5G_avoid_channel_8(self):
398        """Test to configure AP and bring up SoftAp on 5G."""
399        self.configure_ap(channel_2g=8)
400        network = self.reference_networks[0]["2g"]
401        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
402        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
403        self.verify_acs_channel(chan, avoid_chan)
404
405    @test_tracker_info(uuid="6feeb83c-2723-49cb-93c1-6297d4a3d853")
406    def test_softap_2G_avoid_channel_9(self):
407        """Test to configure AP and bring up SoftAp on 2G."""
408        self.configure_ap(channel_2g=9)
409        network = self.reference_networks[0]["2g"]
410        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
411        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
412        self.verify_acs_channel(chan, avoid_chan)
413
414    @test_tracker_info(uuid="49a110cd-03e8-4e99-9327-5123eab40902")
415    def test_softap_5G_avoid_channel_9(self):
416        """Test to configure AP and bring up SoftAp on 5G."""
417        self.configure_ap(channel_2g=9)
418        network = self.reference_networks[0]["2g"]
419        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
420        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
421        self.verify_acs_channel(chan, avoid_chan)
422
423    @test_tracker_info(uuid="a03c9e45-8763-4b5c-bead-e574fb9899a2")
424    def test_softap_2G_avoid_channel_10(self):
425        """Test to configure AP and bring up SoftAp on 2G."""
426        self.configure_ap(channel_2g=10)
427        network = self.reference_networks[0]["2g"]
428        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
429        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
430        self.verify_acs_channel(chan, avoid_chan)
431
432    @test_tracker_info(uuid="c1a1d272-a646-4c2d-8425-09d2ae6ae8e6")
433    def test_softap_5G_avoid_channel_10(self):
434        """Test to configure AP and bring up SoftAp on 5G."""
435        self.configure_ap(channel_2g=10)
436        network = self.reference_networks[0]["2g"]
437        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
438        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
439        self.verify_acs_channel(chan, avoid_chan)
440
441    @test_tracker_info(uuid="f38d8911-92d4-4dcd-ba23-1e1667fa1f5a")
442    def test_softap_2G_avoid_channel_11(self):
443        """Test to configure AP and bring up SoftAp on 2G."""
444        self.configure_ap(channel_2g=11)
445        network = self.reference_networks[0]["2g"]
446        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
447        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
448        self.verify_acs_channel(chan, avoid_chan)
449
450    @test_tracker_info(uuid="24cc35ba-45e3-4b7a-9bc9-25b7abe92fa9")
451    def test_softap_5G_avoid_channel_11(self):
452        """Test to configure AP and bring up SoftAp on 5G."""
453        self.configure_ap(channel_2g=11)
454        network = self.reference_networks[0]["2g"]
455        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
456        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
457        self.verify_acs_channel(chan, avoid_chan)
458
459    @test_tracker_info(uuid="85aef720-4f3c-43bb-9de0-615b88c2bfe0")
460    def test_softap_2G_avoid_channel_36(self):
461        """Test to configure AP and bring up SoftAp on 2G."""
462        self.configure_ap(channel_5g=36)
463        network = self.reference_networks[0]["5g"]
464        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
465        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
466        self.verify_acs_channel(chan, avoid_chan)
467
468    @test_tracker_info(uuid="433e8db3-93b5-463e-a83c-0d4b9b9a8700")
469    def test_softap_5G_avoid_channel_36(self):
470        """Test to configure AP and bring up SoftAp on 5G."""
471        self.configure_ap(channel_5g=36)
472        network = self.reference_networks[0]["5g"]
473        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
474        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
475        self.verify_acs_channel(chan, avoid_chan)
476
477    @test_tracker_info(uuid="326e0e42-3219-4e63-a18d-5dc32c58e7d8")
478    def test_softap_2G_avoid_channel_40(self):
479        """Test to configure AP and bring up SoftAp on 2G."""
480        self.configure_ap(channel_5g=40)
481        network = self.reference_networks[0]["5g"]
482        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
483        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
484        self.verify_acs_channel(chan, avoid_chan)
485
486    @test_tracker_info(uuid="45953c03-c978-4775-a39b-fb7e70c8990a")
487    def test_softap_5G_avoid_channel_40(self):
488        """Test to configure AP and bring up SoftAp on 5G."""
489        self.configure_ap(channel_5g=40)
490        network = self.reference_networks[0]["5g"]
491        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
492        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
493        self.verify_acs_channel(chan, avoid_chan)
494
495    @test_tracker_info(uuid="e8e89cec-aa27-4780-8ff8-546d5af820f7")
496    def test_softap_2G_avoid_channel_44(self):
497        """Test to configure AP and bring up SoftAp on 2G."""
498        self.configure_ap(channel_5g=44)
499        network = self.reference_networks[0]["5g"]
500        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
501        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
502        self.verify_acs_channel(chan, avoid_chan)
503
504    @test_tracker_info(uuid="5e386d7d-d4c9-40cf-9333-06da55e11ba1")
505    def test_softap_5G_avoid_channel_44(self):
506        """Test to configure AP and bring up SoftAp on 5G."""
507        self.configure_ap(channel_5g=44)
508        network = self.reference_networks[0]["5g"]
509        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
510        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
511        self.verify_acs_channel(chan, avoid_chan)
512
513    @test_tracker_info(uuid="cb51dfca-f8de-4dfc-b513-e590c838c766")
514    def test_softap_2G_avoid_channel_48(self):
515        """Test to configure AP and bring up SoftAp on 2G."""
516        self.configure_ap(channel_5g=48)
517        network = self.reference_networks[0]["5g"]
518        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
519        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
520        self.verify_acs_channel(chan, avoid_chan)
521
522    @test_tracker_info(uuid="490b8ed1-196c-4941-b06b-5f0721ca440b")
523    def test_softap_5G_avoid_channel_48(self):
524        """Test to configure AP and bring up SoftAp on 5G."""
525        self.configure_ap(channel_5g=48)
526        network = self.reference_networks[0]["5g"]
527        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
528        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
529        self.verify_acs_channel(chan, avoid_chan)
530
531    @test_tracker_info(uuid="c5ab141b-e145-4cc1-b0d7-dd610cbfb462")
532    def test_softap_2G_avoid_channel_149(self):
533        """Test to configure AP and bring up SoftAp on 2G."""
534        self.configure_ap(channel_5g=149)
535        network = self.reference_networks[0]["5g"]
536        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
537        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
538        self.verify_acs_channel(chan, avoid_chan)
539
540    @test_tracker_info(uuid="108d7ef8-6fe7-49ba-b684-3820e881fcf0")
541    def test_softap_5G_avoid_channel_149(self):
542        """Test to configure AP and bring up SoftAp on 5G."""
543        self.configure_ap(channel_5g=149)
544        network = self.reference_networks[0]["5g"]
545        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
546        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
547        self.verify_acs_channel(chan, avoid_chan)
548
549    @test_tracker_info(uuid="f6926f40-0afc-41c5-9b38-c95a99788ff5")
550    def test_softap_2G_avoid_channel_153(self):
551        """Test to configure AP and bring up SoftAp on 2G."""
552        self.configure_ap(channel_5g=153)
553        network = self.reference_networks[0]["5g"]
554        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
555        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
556        self.verify_acs_channel(chan, avoid_chan)
557
558    @test_tracker_info(uuid="3d7b653b-c094-4c57-8e6a-047629b05216")
559    def test_softap_5G_avoid_channel_153(self):
560        """Test to configure AP and bring up SoftAp on 5G."""
561        self.configure_ap(channel_5g=153)
562        network = self.reference_networks[0]["5g"]
563        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
564        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
565        self.verify_acs_channel(chan, avoid_chan)
566
567    @test_tracker_info(uuid="b866ceea-d3ca-45d4-964a-4edea96026e6")
568    def test_softap_2G_avoid_channel_157(self):
569        """Test to configure AP and bring up SoftAp on 2G."""
570        self.configure_ap(channel_5g=157)
571        network = self.reference_networks[0]["5g"]
572        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
573        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
574        self.verify_acs_channel(chan, avoid_chan)
575
576    @test_tracker_info(uuid="03cb9163-bca3-442e-9691-6df82f8c51c7")
577    def test_softap_5G_avoid_channel_157(self):
578        """Test to configure AP and bring up SoftAp on 5G."""
579        self.configure_ap(channel_5g=157)
580        network = self.reference_networks[0]["5g"]
581        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
582        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
583        self.verify_acs_channel(chan, avoid_chan)
584
585    @test_tracker_info(uuid="ae10f23a-da70-43c8-9991-2c2f4a602724")
586    def test_softap_2G_avoid_channel_161(self):
587        """Test to configure AP and bring up SoftAp on 2G."""
588        self.configure_ap(channel_5g=161)
589        network = self.reference_networks[0]["5g"]
590        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
591        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
592        self.verify_acs_channel(chan, avoid_chan)
593
594    @test_tracker_info(uuid="521686c2-acfa-42d1-861b-aa10ac4dad34")
595    def test_softap_5G_avoid_channel_161(self):
596        """Test to configure AP and bring up SoftAp on 5G."""
597        self.configure_ap(channel_5g=161)
598        network = self.reference_networks[0]["5g"]
599        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
600        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
601        self.verify_acs_channel(chan, avoid_chan)
602
603    @test_tracker_info(uuid="77ebecd7-c036-463f-b77d-2cd70d89bc81")
604    def test_softap_2G_avoid_channel_165(self):
605        """Test to configure AP and bring up SoftAp on 2G."""
606        self.configure_ap(channel_5g=165)
607        network = self.reference_networks[0]["5g"]
608        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_2G)
609        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
610        self.verify_acs_channel(chan, avoid_chan)
611
612    @test_tracker_info(uuid="85d9386d-fe60-4708-9f91-75bbf8bec54f")
613    def test_softap_5G_avoid_channel_165(self):
614        """Test to configure AP and bring up SoftAp on 5G."""
615        self.configure_ap(channel_5g=165)
616        network = self.reference_networks[0]["5g"]
617        chan = self.start_traffic_and_softap(network, WIFI_CONFIG_APBAND_5G)
618        avoid_chan = int(sys._getframe().f_code.co_name.split('_')[-1])
619        self.verify_acs_channel(chan, avoid_chan)
620