wireless_antenna¶
Source code: wireless_antenna.py
A factory test for basic Wifi.
Description¶
This test checks if the signal strength of the antennas satisfy the input spec.
This test can accept a list of wireless services but only the strongest one is used as the test AP and the other APs are ignored.
This test can test signal strength via iw dev {device} scan
or radiotap.
Be sure to set AP correctly. 1. Select a fixed channel instead of auto. 2. Disable the power control in AP. 3. Make sure SSID of AP is unique.
Test Procedure¶
Accepts a dict of antenna:strength and a list of (ssid, frequency).
For each (antenna, AP=(ssid, frequency)), we test the signal strength of it.
Chooses AP with maximum strength as the test AP.
Checks if (antenna, test AP) is greater than the spec for all antennas.
Dependency¶
iw utility
ifconfig utility
ip utility (radiotap)
tcpdump utility (radiotap)
iw phy {phy_name} set antenna 1 1
(switch_antenna)
Examples¶
To run this test on DUT, add a test item in the test list:
{
"pytest_name": "wireless_antenna",
"label": "Wireless Antenna",
"exclusive_resources": [
"NETWORK"
],
"related_components": [
"test_tags.TestCategory.WIFI"
],
"args": {
"device_name": "wlan0",
"ignore_missing_services": true,
"services": "eval! constants.wireless_services",
"switch_antenna_config": {
"main": [
1,
1
],
"aux": [
2,
2
],
"all": [
3,
3
]
},
"strength": {
"main": -60,
"aux": -60,
"all": -60
},
"wifi_chip_type": null,
"press_space_to_start": false
}
}
Set the 2nd element in a service if you only want to use a specific frequency:
{
"pytest_name": "wireless_antenna",
"label": "Wireless Antenna With Specific Frequency",
"exclusive_resources": [
"NETWORK"
],
"related_components": [
"test_tags.TestCategory.WIFI"
],
"args": {
"device_name": "wlan0",
"ignore_missing_services": true,
"services": [
[
"GoogleGuest-Legacy",
2412,
null
]
],
"switch_antenna_config": {
"main": [
1,
1
],
"aux": [
2,
2
],
"all": [
3,
3
]
},
"strength": {
"main": -60,
"aux": -60,
"all": -60
},
"wifi_chip_type": null,
"press_space_to_start": false
}
}
Test Arguments¶
Name |
Type |
Description |
---|---|---|
device_name |
str, None |
(optional; default: |
services |
list |
A list of |
ignore_missing_services |
bool |
(optional; default: |
scan_timeout |
int |
(optional; default: |
connect_timeout |
int |
(optional; default: |
strength |
dict |
A dict of minimal signal strengths. For example, a dict like |
scan_count |
int |
(optional; default: |
switch_antenna_config |
dict |
(optional; default: |
switch_antenna_sleep_secs |
int |
(optional; default: |
press_space_to_start |
bool |
(optional; default: |
wifi_chip_type |
str, None |
(optional; default: |
keep_monitor |
bool |
(optional; default: |