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