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