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