blob: e153259d9b821412fdf92bb4766e6121e3792617 [file] [log] [blame]
Hayden Nix3f2eebf2020-01-14 10:39:21 -08001#!/usr/bin/env python3
2#
3# Copyright 2020 - 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
Hayden Nixc8a02bf2020-04-14 19:12:34 +000017import json
18import os
19import time
Hayden Nix3f2eebf2020-01-14 10:39:21 -080020
Hayden Nixc8a02bf2020-04-14 19:12:34 +000021from statistics import pstdev
22
23from bokeh.models import FixedTicker
24from bokeh.plotting import ColumnDataSource
25from bokeh.plotting import figure
26from bokeh.plotting import output_file
27from bokeh.plotting import save
28
29from acts import asserts
30from acts import context
Hayden Nix3f2eebf2020-01-14 10:39:21 -080031from acts import utils
Hayden Nix3f2eebf2020-01-14 10:39:21 -080032from acts.controllers.ap_lib import hostapd_config
Hayden Nixc8a02bf2020-04-14 19:12:34 +000033from acts.controllers.ap_lib import hostapd_constants
34from acts.controllers.ap_lib.hostapd_security import Security
35from acts.controllers.iperf_server import IPerfResult
36from acts.test_utils.abstract_devices.utils_lib import wlan_utils
Hayden Nix3f2eebf2020-01-14 10:39:21 -080037from acts.test_utils.abstract_devices.wlan_device import create_wlan_device
Hayden Nix3f2eebf2020-01-14 10:39:21 -080038from acts.test_utils.wifi.WifiBaseTest import WifiBaseTest
Hayden Nix3f2eebf2020-01-14 10:39:21 -080039
40N_CAPABILITIES_DEFAULT = [
41 hostapd_constants.N_CAPABILITY_LDPC, hostapd_constants.N_CAPABILITY_SGI20,
42 hostapd_constants.N_CAPABILITY_SGI40,
43 hostapd_constants.N_CAPABILITY_TX_STBC,
44 hostapd_constants.N_CAPABILITY_RX_STBC1
45]
46
47AC_CAPABILITIES_DEFAULT = [
48 hostapd_constants.AC_CAPABILITY_MAX_MPDU_11454,
49 hostapd_constants.AC_CAPABILITY_RXLDPC,
50 hostapd_constants.AC_CAPABILITY_SHORT_GI_80,
51 hostapd_constants.AC_CAPABILITY_TX_STBC_2BY1,
52 hostapd_constants.AC_CAPABILITY_RX_STBC_1,
53 hostapd_constants.AC_CAPABILITY_MAX_A_MPDU_LEN_EXP7,
54 hostapd_constants.AC_CAPABILITY_RX_ANTENNA_PATTERN,
55 hostapd_constants.AC_CAPABILITY_TX_ANTENNA_PATTERN
56]
57
Hayden Nixc8a02bf2020-04-14 19:12:34 +000058DEFAULT_MIN_THROUGHPUT = 0
59DEFAULT_MAX_STD_DEV = 1
Hayden Nix3f2eebf2020-01-14 10:39:21 -080060
Hayden Nixc8a02bf2020-04-14 19:12:34 +000061DEFAULT_TIME_TO_WAIT_FOR_IP_ADDR = 30
62GRAPH_CIRCLE_SIZE = 10
63IPERF_NO_THROUGHPUT_VALUE = 0
64MAX_2_4_CHANNEL = 14
65TIME_TO_SLEEP_BETWEEN_RETRIES = 1
Hayden Nix484f48c2020-04-14 20:54:17 +000066TIME_TO_WAIT_FOR_COUNTRY_CODE = 10
Hayden Nixc8a02bf2020-04-14 19:12:34 +000067WEP_HEX_STRING_LENGTH = 10
Hayden Nix3f2eebf2020-01-14 10:39:21 -080068
Hayden Nix3f2eebf2020-01-14 10:39:21 -080069
Hayden Nixc8a02bf2020-04-14 19:12:34 +000070def get_test_name(settings):
71 """Retrieves the test_name value from test_settings"""
72 return settings.get('test_name')
Hayden Nix3f2eebf2020-01-14 10:39:21 -080073
74
75class ChannelSweepTest(WifiBaseTest):
Hayden Nix484f48c2020-04-14 20:54:17 +000076 """Tests channel performance and regulatory compliance..
Hayden Nix3f2eebf2020-01-14 10:39:21 -080077
78 Testbed Requirement:
79 * One ACTS compatible device (dut)
80 * One Access Point
Hayden Nixc8a02bf2020-04-14 19:12:34 +000081 * One Linux Machine used as IPerfServer if running performance tests
82 Note: Performance tests should be done in isolated testbed.
Hayden Nix3f2eebf2020-01-14 10:39:21 -080083 """
84 def __init__(self, controllers):
85 WifiBaseTest.__init__(self, controllers)
Hayden Nixc8a02bf2020-04-14 19:12:34 +000086 if 'channel_sweep_test_params' in self.user_params:
87 self.time_to_wait_for_ip_addr = self.user_params[
88 'channel_sweep_test_params'].get(
89 'time_to_wait_for_ip_addr',
90 DEFAULT_TIME_TO_WAIT_FOR_IP_ADDR)
91 else:
92 self.time_to_wait_for_ip_addr = DEFAULT_TIME_TO_WAIT_FOR_IP_ADDR
Hayden Nix3f2eebf2020-01-14 10:39:21 -080093
94 def setup_class(self):
95 super().setup_class()
96 if 'dut' in self.user_params:
97 if self.user_params['dut'] == 'fuchsia_devices':
98 self.dut = create_wlan_device(self.fuchsia_devices[0])
99 elif self.user_params['dut'] == 'android_devices':
100 self.dut = create_wlan_device(self.android_devices[0])
101 else:
102 raise ValueError('Invalid DUT specified in config. (%s)' %
103 self.user_params['dut'])
104 else:
105 # Default is an android device, just like the other tests
106 self.dut = create_wlan_device(self.android_devices[0])
107
108 self.android_devices = getattr(self, 'android_devices', [])
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000109
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800110 self.access_point = self.access_points[0]
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000111 self.iperf_server = self.iperf_servers[0]
112 self.iperf_server.start()
113 self.iperf_client = self.iperf_clients[0]
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800114 self.access_point.stop_all_aps()
115
116 def setup_test(self):
Hayden Nix484f48c2020-04-14 20:54:17 +0000117 # TODO(fxb/46417): Uncomment when wlanClearCountry is implemented up any
118 # country code changes.
119 # for fd in self.fuchsia_devices:
120 # phy_ids_response = fd.wlan_lib.wlanPhyIdList()
121 # if phy_ids_response.get('error'):
122 # raise ConnectionError(
123 # 'Failed to retrieve phy ids from FuchsiaDevice (%s). '
124 # 'Error: %s' % (fd.ip, phy_ids_response['error']))
125 # for id in phy_ids_response['result']:
126 # clear_country_response = fd.wlan_lib.wlanClearCountry(id)
127 # if clear_country_response.get('error'):
128 # raise EnvironmentError(
129 # 'Failed to reset country code on FuchsiaDevice (%s). '
130 # 'Error: %s' % (fd.ip, clear_country_response['error'])
131 # )
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000132 self.access_point.stop_all_aps()
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800133 for ad in self.android_devices:
134 ad.droid.wakeLockAcquireBright()
135 ad.droid.wakeUpNow()
136 self.dut.wifi_toggle_state(True)
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000137 self.dut.disconnect()
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800138
139 def teardown_test(self):
140 for ad in self.android_devices:
141 ad.droid.wakeLockRelease()
142 ad.droid.goToSleepNow()
143 self.dut.turn_location_off_and_scan_toggle_off()
144 self.dut.disconnect()
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800145 self.access_point.stop_all_aps()
146
147 def on_fail(self, test_name, begin_time):
148 self.dut.take_bug_report(test_name, begin_time)
149 self.dut.get_log(test_name, begin_time)
150
Hayden Nix484f48c2020-04-14 20:54:17 +0000151 def set_dut_country_code(self, country_code):
152 """Set the country code on the DUT. Then verify that the country
153 code was set successfully
154
155 Args:
156 country_code: string, the 2 character country code to set
157 """
158 self.log.info('Setting DUT country code to %s' % country_code)
159 country_code_response = self.dut.device.regulatory_region_lib.setRegion(
160 country_code)
161 if country_code_response.get('error'):
162 raise EnvironmentError(
163 'Failed to set country code (%s) on DUT. Error: %s' %
164 (country_code, country_code_response['error']))
165
166 self.log.info('Verifying DUT country code was correctly set to %s.' %
167 country_code)
168 phy_ids_response = self.dut.device.wlan_lib.wlanPhyIdList()
169 if phy_ids_response.get('error'):
170 raise ConnectionError('Failed to get phy ids from DUT. Error: %s' %
171 (country_code, phy_ids_response['error']))
172
173 end_time = time.time() + TIME_TO_WAIT_FOR_COUNTRY_CODE
174 while time.time() < end_time:
175 for id in phy_ids_response['result']:
176 get_country_response = self.dut.device.wlan_lib.wlanGetCountry(
177 id)
178 if get_country_response.get('error'):
179 raise ConnectionError(
180 'Failed to query PHY ID (%s) for country. Error: %s' %
181 (id, get_country_response['error']))
182
183 set_code = ''.join([
184 chr(ascii_char)
185 for ascii_char in get_country_response['result']
186 ])
187 if set_code != country_code:
188 self.log.debug(
189 'PHY (id: %s) has incorrect country code set. '
190 'Expected: %s, Got: %s' % (id, country_code, set_code))
191 break
192 else:
193 self.log.info('All PHYs have expected country code (%s)' %
194 country_code)
195 break
196 time.sleep(TIME_TO_SLEEP_BETWEEN_RETRIES)
197 else:
198 raise EnvironmentError('Failed to set DUT country code to %s.' %
199 country_code)
200
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000201 def setup_ap(self, channel, channel_bandwidth, security_profile=None):
202 """Start network on AP with basic configuration.
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800203
204 Args:
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000205 channel: int, channel to use for network
206 channel_bandwidth: int, channel bandwidth in mhz to use for network,
207 security_profile: Security object, or None if open
208
209 Returns:
210 string, ssid of network running
211
212 Raises:
213 ConnectionError if network is not started successfully.
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800214 """
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000215 if channel > MAX_2_4_CHANNEL:
216 vht_bandwidth = channel_bandwidth
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800217 else:
218 vht_bandwidth = None
219
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000220 if channel_bandwidth == hostapd_constants.CHANNEL_BANDWIDTH_20MHZ:
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800221 n_capabilities = N_CAPABILITIES_DEFAULT + [
222 hostapd_constants.N_CAPABILITY_HT20
223 ]
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000224 elif (channel_bandwidth == hostapd_constants.CHANNEL_BANDWIDTH_40MHZ or
225 channel_bandwidth == hostapd_constants.CHANNEL_BANDWIDTH_80MHZ):
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800226 if hostapd_config.ht40_plus_allowed(channel):
227 extended_channel = [hostapd_constants.N_CAPABILITY_HT40_PLUS]
228 elif hostapd_config.ht40_minus_allowed(channel):
229 extended_channel = [hostapd_constants.N_CAPABILITY_HT40_MINUS]
230 else:
231 raise ValueError('Invalid Channel: %s' % channel)
232 n_capabilities = N_CAPABILITIES_DEFAULT + extended_channel
233 else:
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000234 raise ValueError('Invalid Bandwidth: %s' % channel_bandwidth)
235 ssid = utils.rand_ascii_str(hostapd_constants.AP_SSID_LENGTH_2G)
236 try:
237 wlan_utils.setup_ap(access_point=self.access_point,
238 profile_name='whirlwind',
239 channel=channel,
240 security=security_profile,
241 n_capabilities=n_capabilities,
242 ac_capabilities=None,
243 force_wmm=True,
244 ssid=ssid,
245 vht_bandwidth=vht_bandwidth,
246 setup_bridge=True)
247 except Exception as err:
248 raise ConnectionError(
249 'Failed to setup ap on channel: %s, channel bandwidth: %smhz. '
250 'Error: %s' % (channel, channel_bandwidth, err))
251 else:
252 self.log.info(
253 'Network (ssid: %s) up on channel %s w/ channel bandwidth %smhz'
254 % (ssid, channel, channel_bandwidth))
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800255
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000256 return ssid
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800257
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000258 def get_and_verify_iperf_address(self, channel, device, interface=None):
259 """Get ip address from a devices interface and verify it belongs to
260 expected subnet based on APs DHCP config.
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800261
262 Args:
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000263 channel: int, channel network is running on, to determine subnet
264 device: device to get ip address for
265 interface (default: None): interface on device to get ip address.
266 If None, uses device.test_interface.
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800267
268 Returns:
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000269 String, ip address of device on given interface (or test_interface)
270
271 Raises:
272 ConnectionError, if device does not have a valid ip address after
273 all retries.
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800274 """
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000275 if channel <= MAX_2_4_CHANNEL:
276 subnet = self.access_point._AP_2G_SUBNET_STR
277 else:
278 subnet = self.access_point._AP_5G_SUBNET_STR
279 end_time = time.time() + self.time_to_wait_for_ip_addr
280 while time.time() < end_time:
281 if interface:
282 device_addresses = device.get_interface_ip_addresses(interface)
283 else:
284 device_addresses = device.get_interface_ip_addresses(
285 device.test_interface)
286
287 if device_addresses['ipv4_private']:
288 for ip_addr in device_addresses['ipv4_private']:
289 if utils.ip_in_subnet(ip_addr, subnet):
290 return ip_addr
291 else:
292 self.log.debug(
293 'Device has an ip address (%s), but it is not in '
294 'subnet %s' % (ip_addr, subnet))
295 else:
296 self.log.debug(
297 'Device does not have a valid ip address. Retrying.')
298 time.sleep(TIME_TO_SLEEP_BETWEEN_RETRIES)
299 raise ConnectionError('Device failed to get an ip address.')
300
301 def get_iperf_throughput(self,
302 iperf_server_address,
303 iperf_client_address,
304 reverse=False):
305 """Run iperf between client and server and get the throughput.
306
307 Args:
308 iperf_server_address: string, ip address of running iperf server
309 iperf_client_address: string, ip address of iperf client (dut)
310 reverse (default: False): If True, run traffic in reverse direction,
311 from server to client.
312
313 Returns:
314 int, iperf throughput OR IPERF_NO_THROUGHPUT_VALUE, if iperf fails
315 """
316 if reverse:
317 self.log.info(
318 'Running IPerf traffic from server (%s) to dut (%s).' %
319 (iperf_server_address, iperf_client_address))
320 iperf_results_file = self.iperf_client.start(
321 iperf_server_address, '-i 1 -t 10 -R -J', 'channel_sweep_rx')
322 else:
323 self.log.info(
324 'Running IPerf traffic from dut (%s) to server (%s).' %
325 (iperf_client_address, iperf_server_address))
326 iperf_results_file = self.iperf_client.start(
327 iperf_server_address, '-i 1 -t 10 -J', 'channel_sweep_tx')
328 if iperf_results_file:
329 iperf_results = IPerfResult(iperf_results_file)
330 return iperf_results.avg_send_rate
331 else:
332 return IPERF_NO_THROUGHPUT_VALUE
333
334 def log_to_file_and_throughput_data(self, channel, channel_bandwidth,
335 tx_throughput, rx_throughput):
336 """Write performance info to csv file and to throughput data.
337
338 Args:
339 channel: int, channel that test was run on
340 channel_bandwidth: int, channel bandwidth the test used
341 tx_throughput: float, throughput value from dut to iperf server
342 rx_throughput: float, throughput value from iperf server to dut
343 """
344 test_name = self.throughput_data['test']
345 output_path = context.get_current_context().get_base_output_path()
346 log_path = '%s/ChannelSweepTest/%s' % (output_path, test_name)
347 if not os.path.exists(log_path):
348 os.makedirs(log_path)
349 log_file = '%s/%s_%smhz.csv' % (log_path, test_name, channel_bandwidth)
350 self.log.info('Writing IPerf results for %s to %s' %
351 (test_name, log_file))
352 with open(log_file, 'a') as csv_file:
353 csv_file.write('%s,%s,%s\n' %
354 (channel, tx_throughput, rx_throughput))
355 self.throughput_data['results'][str(channel)] = {
356 'tx_throughput': tx_throughput,
357 'rx_throughput': rx_throughput
358 }
359
360 def write_graph(self):
361 """Create graph html files from throughput data, plotting channel vs
362 tx_throughput and channel vs rx_throughput.
363 """
364 output_path = context.get_current_context().get_base_output_path()
365 test_name = self.throughput_data['test']
366 channel_bandwidth = self.throughput_data['channel_bandwidth']
367 output_file_name = '%s/ChannelSweepTest/%s/%s_%smhz.html' % (
368 output_path, test_name, test_name, channel_bandwidth)
369 output_file(output_file_name)
370 channels = []
371 tx_throughputs = []
372 rx_throughputs = []
373 for channel in self.throughput_data['results']:
374 channels.append(str(channel))
375 tx_throughputs.append(
376 self.throughput_data['results'][channel]['tx_throughput'])
377 rx_throughputs.append(
378 self.throughput_data['results'][channel]['rx_throughput'])
379 channel_vs_throughput_data = ColumnDataSource(
380 data=dict(channels=channels,
381 tx_throughput=tx_throughputs,
382 rx_throughput=rx_throughputs))
383 TOOLTIPS = [('Channel', '@channels'),
384 ('TX_Throughput', '@tx_throughput'),
385 ('RX_Throughput', '@rx_throughput')]
386 channel_vs_throughput_graph = figure(title='Channels vs. Throughput',
387 x_axis_label='Channels',
388 x_range=channels,
389 y_axis_label='Throughput',
390 tooltips=TOOLTIPS)
391 channel_vs_throughput_graph.sizing_mode = 'stretch_both'
392 channel_vs_throughput_graph.title.align = 'center'
393 channel_vs_throughput_graph.line('channels',
394 'tx_throughput',
395 source=channel_vs_throughput_data,
396 line_width=2,
397 line_color='blue',
398 legend_label='TX_Throughput')
399 channel_vs_throughput_graph.circle('channels',
400 'tx_throughput',
401 source=channel_vs_throughput_data,
402 size=GRAPH_CIRCLE_SIZE,
403 color='blue')
404 channel_vs_throughput_graph.line('channels',
405 'rx_throughput',
406 source=channel_vs_throughput_data,
407 line_width=2,
408 line_color='red',
409 legend_label='RX_Throughput')
410 channel_vs_throughput_graph.circle('channels',
411 'rx_throughput',
412 source=channel_vs_throughput_data,
413 size=GRAPH_CIRCLE_SIZE,
414 color='red')
415
416 channel_vs_throughput_graph.legend.location = "top_left"
417 graph_file = save([channel_vs_throughput_graph])
418 self.log.info('Saved graph to %s' % graph_file)
419
420 def verify_standard_deviation(self, max_std_dev):
421 """Verifies the standard deviation of the throughput across the channels
422 does not exceed the max_std_dev value.
423
424 Args:
425 max_std_dev: float, max standard deviation of throughput for a test
426 to pass (in mb/s)
427
428 Raises:
429 TestFailure, if standard deviation of throughput exceeds max_std_dev
430 """
431 self.log.info('Verifying standard deviation across channels does not '
432 'exceed max standard deviation of %s mb/s' % max_std_dev)
433 tx_values = []
434 rx_values = []
435 for channel in self.throughput_data['results']:
436 if self.throughput_data['results'][channel][
437 'tx_throughput'] is not None:
438 tx_values.append(
439 self.throughput_data['results'][channel]['tx_throughput'])
440 if self.throughput_data['results'][channel][
441 'rx_throughput'] is not None:
442 rx_values.append(
443 self.throughput_data['results'][channel]['rx_throughput'])
444 tx_std_dev = pstdev(tx_values)
445 rx_std_dev = pstdev(rx_values)
446 if tx_std_dev > max_std_dev or rx_std_dev > max_std_dev:
447 asserts.fail(
448 'With %smhz channel bandwidth, throughput standard '
Hayden Nix484f48c2020-04-14 20:54:17 +0000449 'deviation (tx: %s mb/s, rx: %s mb/s) exceeds max standard '
450 'deviation (%s mb/s).' %
451 (self.throughput_data['channel_bandwidth'], tx_std_dev,
452 rx_std_dev, max_std_dev))
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000453 else:
454 asserts.explicit_pass(
455 'Throughput standard deviation (tx: %s mb/s, rx: %s mb/s) '
456 'with %smhz channel bandwidth does not exceed maximum (%s mb/s).'
457 % (tx_std_dev, rx_std_dev,
458 self.throughput_data['channel_bandwidth'], max_std_dev))
459
460 def run_channel_performance_tests(self, settings):
461 """Test function for running channel performance tests. Used by both
462 explicit test cases and debug test cases from config. Runs a performance
463 test for each channel in test_channels with test_channel_bandwidth, then
464 writes a graph and csv file of the channel vs throughput.
465
466 Args:
467 settings: dict, containing the following test settings
468 test_channels: list of channels to test.
469 test_channel_bandwidth: int, channel bandwidth to use for test.
470 test_security (optional): string, security type to use for test.
471 min_tx_throughput (optional, default: 0): float, minimum tx
472 throughput threshold to pass individual channel tests
473 (in mb/s).
474 min_rx_throughput (optional, default: 0): float, minimum rx
475 throughput threshold to pass individual channel tests
476 (in mb/s).
477 max_std_dev (optional, default: 1): float, maximum standard
478 deviation of throughput across all test channels to pass
479 test (in mb/s).
480 base_test_name (optional): string, test name prefix to use with
481 generated subtests.
Hayden Nix484f48c2020-04-14 20:54:17 +0000482 country_name (optional): string, country name from
483 hostapd_constants to set on device.
484 country_code (optional): string, two-char country code to set on
485 the DUT. Takes priority over country_name.
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000486 test_name (debug tests only): string, the test name for this
487 parent test case from the config file. In explicit tests,
488 this is not necessary.
489
490 Writes:
491 CSV file: channel, tx_throughput, rx_throughput
492 for every test channel.
493 Graph: channel vs tx_throughput & channel vs rx_throughput
494
495 Raises:
496 TestFailure, if throughput standard deviation across channels
497 exceeds max_std_dev
498
499 Example Explicit Test (see EOF for debug JSON example):
500 def test_us_2g_20mhz_wpa2(self):
501 self.run_channel_performance_tests(
502 dict(
503 test_channels=hostapd_constants.US_CHANNELS_2G,
504 test_channel_bandwidth=20,
505 test_security=hostapd_constants.WPA2_STRING,
506 min_tx_throughput=2,
507 min_rx_throughput=4,
508 max_std_dev=0.75,
Hayden Nix484f48c2020-04-14 20:54:17 +0000509 country_code='US',
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000510 base_test_name='test_us'))
511 """
512 test_channels = settings['test_channels']
513 test_channel_bandwidth = settings['test_channel_bandwidth']
514 test_security = settings.get('test_security')
515 test_name = settings.get('test_name', self.test_name)
516 base_test_name = settings.get('base_test_name', 'test')
517 min_tx_throughput = settings.get('min_tx_throughput',
518 DEFAULT_MIN_THROUGHPUT)
519 min_rx_throughput = settings.get('min_rx_throughput',
520 DEFAULT_MIN_THROUGHPUT)
521 max_std_dev = settings.get('max_std_dev', DEFAULT_MAX_STD_DEV)
Hayden Nix484f48c2020-04-14 20:54:17 +0000522 country_code = settings.get('country_code')
523 country_name = settings.get('country_name')
524 country_label = None
525
526 if country_code:
527 country_label = country_code
528 self.set_dut_country_code(country_code)
529 elif country_name:
530 country_label = country_name
531 code = hostapd_constants.COUNTRY_CODE[country_name]['country_code']
532 self.set_dut_country_code(code)
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000533
534 self.throughput_data = {
535 'test': test_name,
536 'channel_bandwidth': test_channel_bandwidth,
537 'results': {}
538 }
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800539 test_list = []
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000540 for channel in test_channels:
Hayden Nix484f48c2020-04-14 20:54:17 +0000541 sub_test_name = '%schannel_%s_%smhz_performance' % (
542 '%s_' % country_label if country_label else '', channel,
543 test_channel_bandwidth)
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000544 test_list.append({
545 'test_name': sub_test_name,
546 'channel': int(channel),
547 'channel_bandwidth': int(test_channel_bandwidth),
548 'security': test_security,
549 'min_tx_throughput': min_tx_throughput,
550 'min_rx_throughput': min_rx_throughput
551 })
552 self.run_generated_testcases(self.get_channel_performance,
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800553 settings=test_list,
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000554 name_func=get_test_name)
555 self.log.info('Channel tests completed.')
556 self.write_graph()
557 self.verify_standard_deviation(max_std_dev)
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800558
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000559 def get_channel_performance(self, settings):
560 """Run a single channel performance test and logs results to csv file
561 and throughput data. Run with generated sub test cases in
562 run_channel_performance_tests.
563
564 1. Sets up network with test settings
565 2. Associates DUT
566 3. Runs traffic between DUT and iperf server (both directions)
567 4. Logs channel, tx_throughput (mb/s), and rx_throughput (mb/s) to
568 log file and throughput data.
569 5. Checks throughput values against minimum throughput thresholds.
570
571 Args:
572 settings: see run_channel_performance_tests
573
574 Raises:
575 TestFailure, if throughput (either direction) is less than
576 the directions given minimum throughput threshold.
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800577 """
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000578 channel = settings['channel']
579 channel_bandwidth = settings['channel_bandwidth']
580 security = settings['security']
581 test_name = settings['test_name']
582 min_tx_throughput = settings['min_tx_throughput']
583 min_rx_throughput = settings['min_rx_throughput']
584 if security:
585 if security == hostapd_constants.WEP_STRING:
586 password = utils.rand_hex_str(WEP_HEX_STRING_LENGTH)
587 else:
588 password = utils.rand_ascii_str(
589 hostapd_constants.MIN_WPA_PSK_LENGTH)
590 security_profile = Security(security_mode=security,
591 password=password)
592 else:
593 password = None
594 security_profile = None
595 ssid = self.setup_ap(channel, channel_bandwidth, security_profile)
596 associated = wlan_utils.associate(client=self.dut,
597 ssid=ssid,
598 password=password)
599 if not associated:
600 self.log_to_file_and_throughput_data(channel, channel_bandwidth,
601 None, None)
602 asserts.fail('Device failed to associate with network %s' % ssid)
603 self.log.info('DUT (%s) connected to network %s.' %
604 (self.dut.device.ip, ssid))
605 self.iperf_server.renew_test_interface_ip_address()
606 self.log.info(
607 'Getting ip address for iperf server. Will retry for %s seconds.' %
608 self.time_to_wait_for_ip_addr)
609 iperf_server_address = self.get_and_verify_iperf_address(
610 channel, self.iperf_server)
611 self.log.info(
612 'Getting ip address for DUT. Will retry for %s seconds.' %
613 self.time_to_wait_for_ip_addr)
614 iperf_client_address = self.get_and_verify_iperf_address(
615 channel, self.dut, self.iperf_client.test_interface)
616 tx_throughput = self.get_iperf_throughput(iperf_server_address,
617 iperf_client_address)
618 rx_throughput = self.get_iperf_throughput(iperf_server_address,
619 iperf_client_address,
620 reverse=True)
621 self.log_to_file_and_throughput_data(channel, channel_bandwidth,
622 tx_throughput, rx_throughput)
623 self.log.info('Throughput (tx, rx): (%s mb/s, %s mb/s), '
624 'Minimum threshold (tx, rx): (%s mb/s, %s mb/s)' %
625 (tx_throughput, rx_throughput, min_tx_throughput,
626 min_rx_throughput))
Hayden Nix484f48c2020-04-14 20:54:17 +0000627 base_message = 'Actual throughput (on channel: %s, channel bandwidth: '
628 '%s, security: %s)' % (channel, channel_bandwidth, security)
629 if (tx_throughput < min_tx_throughput
630 or rx_throughput < min_rx_throughput):
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000631 asserts.fail('%s below the minimum threshold.' % base_message)
632 asserts.explicit_pass('%s above the minimum threshold.' % base_message)
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800633
Hayden Nix484f48c2020-04-14 20:54:17 +0000634 def verify_regulatory_compliance(self, settings):
635 """Test function for regulatory compliance tests. Verify device complies
636 with provided regulatory requirements.
637
638 Args:
639 settings: dict, containing the following test settings
640 test_channels: dict, mapping channels to a set of the channel
641 bandwidths to test (see example for using JSON). Defaults
642 to hostapd_constants.ALL_CHANNELS.
643 country_code: string, two-char country code to set on device
644 (prioritized over country_name)
645 country_name: string, country name from hostapd_constants to set
646 on device.
647 base_test_name (optional): string, test name prefix to use with
648 generatedsubtests.
649 test_name: string, the test name for this
650 parent test case from the config file. In explicit tests,
651 this is not necessary.
652 """
653 country_name = settings.get('country_name')
654 country_code = settings.get('country_code')
655 if not (country_code or country_name):
656 raise ValueError('No country code or name provided.')
657
658 test_channels = settings.get('test_channels',
659 hostapd_constants.ALL_CHANNELS)
660 allowed_channels = settings['allowed_channels']
661
662 base_test_name = settings.get('base_test_name', 'test_compliance')
663
664 if country_code:
665 code = country_code
666 else:
667 code = hostapd_constants.COUNTRY_CODE[country_name]['country_code']
668
669 self.set_dut_country_code(code)
670
671 test_list = []
672 for channel in test_channels:
673 for channel_bandwidth in test_channels[channel]:
674 sub_test_name = '%s_channel_%s_%smhz' % (
675 base_test_name, channel, channel_bandwidth)
676 should_associate = (
677 channel in allowed_channels
678 and channel_bandwidth in allowed_channels[channel])
679 # Note: these int conversions because when these tests are
680 # imported via JSON, they may be strings since the channels
681 # will be keys. This makes the json/list test_channels param
682 # behave exactly like the in code dict/set test_channels.
683 test_list.append({
684 'country_code': code,
685 'channel': int(channel),
686 'channel_bandwidth': int(channel_bandwidth),
687 'should_associate': should_associate,
688 'test_name': sub_test_name
689 })
690 self.run_generated_testcases(test_func=self.verify_channel_compliance,
691 settings=test_list,
692 name_func=get_test_name)
693
694 def verify_channel_compliance(self, settings):
695 """Verify device complies with provided regulatory requirements for a
696 specific channel and channel bandwidth. Run with generated test cases
697 in the verify_regulatory_compliance parent test.
698_
699 Args:
700 settings: see verify_regulatory_compliance`
701 """
702 channel = settings['channel']
703 channel_bandwidth = settings['channel_bandwidth']
704 code = settings['country_code']
705 should_associate = settings['should_associate']
706
707 ssid = self.setup_ap(channel, channel_bandwidth)
708
709 self.log.info(
710 'Attempting to associate with network (%s) on channel %s @ %smhz. '
711 'Expected behavior: %s' %
712 (ssid, channel, channel_bandwidth, 'Device should associate'
713 if should_associate else 'Device should NOT associate.'))
714
715 associated = wlan_utils.associate(client=self.dut, ssid=ssid)
716 if associated == should_associate:
717 asserts.explicit_pass(
718 'Device complied with %s regulatory requirement for channel %s '
719 ' with channel bandwidth %smhz. %s' %
720 (code, channel, channel_bandwidth,
721 'Associated.' if associated else 'Refused to associate.'))
722 else:
723 asserts.fail(
724 'Device failed compliance with regulatory domain %s for '
725 'channel %s with channel bandwidth %smhz. Expected: %s, Got: %s'
726 % (code, channel, channel_bandwidth, 'Should associate'
727 if should_associate else 'Should not associate',
728 'Associated' if associated else 'Did not associate'))
729
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000730 # Helper functions to allow explicit tests throughput and standard deviation
731 # thresholds to be passed in via config.
732 def _get_min_tx_throughput(self, test_name):
733 return self.user_params.get('channel_sweep_test_params',
734 {}).get(test_name,
735 {}).get('min_tx_throughput',
736 DEFAULT_MIN_THROUGHPUT)
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800737
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000738 def _get_min_rx_throughput(self, test_name):
739 return self.user_params.get('channel_sweep_test_params',
740 {}).get(test_name,
741 {}).get('min_rx_throughput',
742 DEFAULT_MIN_THROUGHPUT)
743
744 def _get_max_std_dev(self, test_name):
745 return self.user_params.get('channel_sweep_test_params',
746 {}).get(test_name,
747 {}).get('min_std_dev',
748 DEFAULT_MAX_STD_DEV)
749
750 # Test cases
751 def test_us_20mhz_open_channel_performance(self):
752 self.run_channel_performance_tests(
753 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
754 hostapd_constants.US_CHANNELS_5G,
755 test_channel_bandwidth=hostapd_constants.
756 CHANNEL_BANDWIDTH_20MHZ,
757 base_test_name=self.test_name,
758 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
759 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
760 max_std_dev=self._get_max_std_dev(self.test_name)))
761
762 def test_us_40mhz_open_channel_performance(self):
763 self.run_channel_performance_tests(
764 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
765 hostapd_constants.US_CHANNELS_5G[:-1],
766 test_channel_bandwidth=hostapd_constants.
767 CHANNEL_BANDWIDTH_40MHZ,
768 base_test_name=self.test_name,
769 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
770 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
771 max_std_dev=self._get_max_std_dev(self.test_name)))
772
773 def test_us_80mhz_open_channel_performance(self):
774 self.run_channel_performance_tests(
775 dict(test_channels=hostapd_constants.US_CHANNELS_5G[:-1],
776 test_channel_bandwidth=hostapd_constants.
777 CHANNEL_BANDWIDTH_80MHZ,
778 base_test_name=self.test_name,
779 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
780 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
781 max_std_dev=self._get_max_std_dev(self.test_name)))
782
783 def test_us_20mhz_wep_channel_performance(self):
784 self.run_channel_performance_tests(
785 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
786 hostapd_constants.US_CHANNELS_5G,
787 test_channel_bandwidth=hostapd_constants.
788 CHANNEL_BANDWIDTH_20MHZ,
789 test_security=hostapd_constants.WEP_STRING,
790 base_test_name=self.test_name,
791 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
792 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
793 max_std_dev=self._get_max_std_dev(self.test_name)))
794
795 def test_us_40mhz_wep_channel_performance(self):
796 self.run_channel_performance_tests(
797 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
798 hostapd_constants.US_CHANNELS_5G[:-1],
799 test_channel_bandwidth=hostapd_constants.
800 CHANNEL_BANDWIDTH_40MHZ,
801 test_security=hostapd_constants.WEP_STRING,
802 base_test_name=self.test_name,
803 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
804 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
805 max_std_dev=self._get_max_std_dev(self.test_name)))
806
807 def test_us_80mhz_wep_channel_performance(self):
808 self.run_channel_performance_tests(
809 dict(test_channels=hostapd_constants.US_CHANNELS_5G[:-1],
810 test_channel_bandwidth=hostapd_constants.
811 CHANNEL_BANDWIDTH_80MHZ,
812 test_security=hostapd_constants.WEP_STRING,
813 base_test_name=self.test_name,
814 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
815 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
816 max_std_dev=self._get_max_std_dev(self.test_name)))
817
818 def test_us_20mhz_wpa_channel_performance(self):
819 self.run_channel_performance_tests(
820 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
821 hostapd_constants.US_CHANNELS_5G,
822 test_channel_bandwidth=hostapd_constants.
823 CHANNEL_BANDWIDTH_20MHZ,
824 test_security=hostapd_constants.WPA_STRING,
825 base_test_name=self.test_name,
826 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
827 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
828 max_std_dev=self._get_max_std_dev(self.test_name)))
829
830 def test_us_40mhz_wpa_channel_performance(self):
831 self.run_channel_performance_tests(
832 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
833 hostapd_constants.US_CHANNELS_5G[:-1],
834 test_channel_bandwidth=hostapd_constants.
835 CHANNEL_BANDWIDTH_40MHZ,
836 test_security=hostapd_constants.WPA_STRING,
837 base_test_name=self.test_name,
838 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
839 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
840 max_std_dev=self._get_max_std_dev(self.test_name)))
841
842 def test_us_80mhz_wpa_channel_performance(self):
843 self.run_channel_performance_tests(
844 dict(test_channels=hostapd_constants.US_CHANNELS_5G[:-1],
845 test_channel_bandwidth=hostapd_constants.
846 CHANNEL_BANDWIDTH_80MHZ,
847 test_security=hostapd_constants.WPA_STRING,
848 base_test_name=self.test_name,
849 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
850 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
851 max_std_dev=self._get_max_std_dev(self.test_name)))
852
853 def test_us_20mhz_wpa2_channel_performance(self):
854 self.run_channel_performance_tests(
855 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
856 hostapd_constants.US_CHANNELS_5G,
857 test_channel_bandwidth=hostapd_constants.
858 CHANNEL_BANDWIDTH_20MHZ,
859 test_security=hostapd_constants.WPA2_STRING,
860 base_test_name=self.test_name,
861 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
862 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
863 max_std_dev=self._get_max_std_dev(self.test_name)))
864
865 def test_us_40mhz_wpa2_channel_performance(self):
866 self.run_channel_performance_tests(
867 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
868 hostapd_constants.US_CHANNELS_5G[:-1],
869 test_channel_bandwidth=hostapd_constants.
870 CHANNEL_BANDWIDTH_40MHZ,
871 test_security=hostapd_constants.WPA2_STRING,
872 base_test_name=self.test_name,
873 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
874 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
875 max_std_dev=self._get_max_std_dev(self.test_name)))
876
877 def test_us_80mhz_wpa2_channel_performance(self):
878 self.run_channel_performance_tests(
879 dict(test_channels=hostapd_constants.US_CHANNELS_5G[:-1],
880 test_channel_bandwidth=hostapd_constants.
881 CHANNEL_BANDWIDTH_80MHZ,
882 test_security=hostapd_constants.WPA2_STRING,
883 base_test_name=self.test_name,
884 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
885 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
886 max_std_dev=self._get_max_std_dev(self.test_name)))
887
888 def test_us_20mhz_wpa_wpa2_channel_performance(self):
889 self.run_channel_performance_tests(
890 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
891 hostapd_constants.US_CHANNELS_5G,
892 test_channel_bandwidth=hostapd_constants.
893 CHANNEL_BANDWIDTH_20MHZ,
894 test_security=hostapd_constants.WPA_MIXED_STRING,
895 base_test_name=self.test_name,
896 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
897 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
898 max_std_dev=self._get_max_std_dev(self.test_name)))
899
900 def test_us_40mhz_wpa_wpa2_channel_performance(self):
901 self.run_channel_performance_tests(
902 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
903 hostapd_constants.US_CHANNELS_5G[:-1],
904 test_channel_bandwidth=hostapd_constants.
905 CHANNEL_BANDWIDTH_40MHZ,
906 test_security=hostapd_constants.WPA_MIXED_STRING,
907 base_test_name=self.test_name,
908 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
909 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
910 max_std_dev=self._get_max_std_dev(self.test_name)))
911
912 def test_us_80mhz_wpa_wpa2_channel_performance(self):
913 self.run_channel_performance_tests(
914 dict(test_channels=hostapd_constants.US_CHANNELS_5G[:-1],
915 test_channel_bandwidth=hostapd_constants.
916 CHANNEL_BANDWIDTH_80MHZ,
917 test_security=hostapd_constants.WPA_MIXED_STRING,
918 base_test_name=self.test_name,
919 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
920 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
921 max_std_dev=self._get_max_std_dev(self.test_name)))
922
923 def test_us_20mhz_wpa3_channel_performance(self):
924 self.run_channel_performance_tests(
925 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
926 hostapd_constants.US_CHANNELS_5G,
927 test_channel_bandwidth=hostapd_constants.
928 CHANNEL_BANDWIDTH_20MHZ,
929 test_security=hostapd_constants.WPA3_STRING,
930 base_test_name=self.test_name,
931 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
932 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
933 max_std_dev=self._get_max_std_dev(self.test_name)))
934
935 def test_us_40mhz_wpa3_channel_performance(self):
936 self.run_channel_performance_tests(
937 dict(test_channels=hostapd_constants.US_CHANNELS_2G +
938 hostapd_constants.US_CHANNELS_5G[:-1],
939 test_channel_bandwidth=hostapd_constants.
940 CHANNEL_BANDWIDTH_40MHZ,
941 test_security=hostapd_constants.WPA3_STRING,
942 base_test_name=self.test_name,
943 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
944 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
945 max_std_dev=self._get_max_std_dev(self.test_name)))
946
947 def test_us_80mhz_wpa3_channel_performance(self):
948 self.run_channel_performance_tests(
949 dict(test_channels=hostapd_constants.US_CHANNELS_5G[:-1],
950 test_channel_bandwidth=hostapd_constants.
951 CHANNEL_BANDWIDTH_80MHZ,
952 test_security=hostapd_constants.WPA3_STRING,
953 base_test_name=self.test_name,
954 min_tx_throughput=self._get_min_tx_throughput(self.test_name),
955 min_rx_throughput=self._get_min_rx_throughput(self.test_name),
956 max_std_dev=self._get_max_std_dev(self.test_name)))
957
958 def test_channel_performance_debug(self):
959 """Run channel performance test cases from the ACTS config file.
960
961 Example:
962 "channel_sweep_test_params": {
963 "debug_channel_performance_tests": [
964 {
965 "test_name": "test_123_20mhz_wpa2_performance"
966 "test_channels": [1, 2, 3],
967 "test_channel_bandwidth": 20,
968 "test_security": "wpa2",
969 "base_test_name": "test_123_perf",
970 "min_tx_throughput": 1.1,
971 "min_rx_throughput": 3,
972 "max_std_dev": 0.5
973 },
974 ...
975 ]
976 }
977
Hayden Nix3f2eebf2020-01-14 10:39:21 -0800978 """
Hayden Nixc8a02bf2020-04-14 19:12:34 +0000979 asserts.skip_if(
980 'debug_channel_performance_tests' not in self.user_params.get(
981 'channel_sweep_test_params', {}),
982 'No custom channel performance tests provided in config.')
983 base_tests = self.user_params['channel_sweep_test_params'][
984 'debug_channel_performance_tests']
985 self.run_generated_testcases(self.run_channel_performance_tests,
986 settings=base_tests,
987 name_func=get_test_name)
Hayden Nix484f48c2020-04-14 20:54:17 +0000988
989 def test_regulatory_compliance(self):
990 """Run regulatory compliance test case from the ACTS config file.
991 Note: only one country_name OR country_code is required.
992
993 Example:
994 "channel_sweep_test_params": {
995 "regulatory_compliance_tests": [
996 {
997 "test_name": "test_japan_compliance_1_13_36"
998 "country_name": "JAPAN",
999 "country_code": "JP",
1000 "test_channels": {
1001 "1": [20, 40], "13": [40], "36": [20, 40, 80]
1002 },
1003 "allowed_channels": {
1004 "1": [20, 40], "36": [20, 40, 80]
1005 },
1006 "base_test_name": "test_japan"
1007 },
1008 ...
1009 ]
1010 }
1011 """
1012 asserts.skip_if(
1013 'regulatory_compliance_tests' not in self.user_params.get(
1014 'channel_sweep_test_params', {}),
1015 'No custom regulatory compliance tests provided in config.')
1016 base_tests = self.user_params['channel_sweep_test_params'][
1017 'regulatory_compliance_tests']
1018 self.run_generated_testcases(self.verify_regulatory_compliance,
1019 settings=base_tests,
1020 name_func=get_test_name)