diff options
author | PMR <pmr@pmr-lander> | 2017-11-09 14:45:28 +0000 |
---|---|---|
committer | PMR <pmr@pmr-lander> | 2017-11-09 14:45:28 +0000 |
commit | 95380fb6ce65d5966415e985688fffc285a5c0bb (patch) | |
tree | 672414012ed96f3280af89618b3ad8d7236f77a9 | |
parent | e414333bbe052903f16b874d17595649a0b6d321 (diff) | |
parent | 754f075c2179c3e9100d3659c732e58695135550 (diff) |
Merge #332116 from ~jocave/plainbox-provider-checkbox:move-wireless-jobs-to-newer-templated-version
-rwxr-xr-x | bin/net_driver_info | 41 | ||||
-rwxr-xr-x | bin/wifi_nmcli_test | 154 | ||||
-rw-r--r-- | units/suspend/suspend.pxu | 425 | ||||
-rw-r--r-- | units/wireless/jobs.pxu | 400 | ||||
-rw-r--r-- | units/wireless/test-plan.pxu | 52 |
5 files changed, 347 insertions, 725 deletions
diff --git a/bin/net_driver_info b/bin/net_driver_info new file mode 100755 index 0000000..ee5db46 --- /dev/null +++ b/bin/net_driver_info @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +# Copyright 2017 Canonical Ltd. +# All rights reserved. +# +# Written by: +# Jonathan Cave <jonathan.cave@canonical.com> +# +# Print info about drivers we can identify automatically and also those we +# identify in the special interest list! + +from pathlib import Path +import sys + +# Store pairs of (interface, driver) +driver_list = [] + +# Find drivers in sysfs +for interface in Path("/sys/class/net").iterdir(): + mod_path = Path("{}/device/driver/module".format(interface)) + if mod_path.is_symlink(): + driver_list.append((interface.name, mod_path.resolve().name)) + +# Add user requested modules to the list. Create "unknown" interfaces if none +# of the identified interfaces above are using it +for user_driver in sys.argv[1:]: + if Path("/sys/module/{}".format(user_driver)).exists(): + if not any(x[1] == user_driver for x in driver_list): + driver_list.append(("unknown", user_driver)) + else: + print("Requested driver {} not loaded\n".format(user_driver)) + +# Produce the output +for interface, driver in driver_list: + print("Interface {} using module {}".format(interface, driver)) + sysfs_path = Path("/sys/module/{}/parameters".format(driver)) + if sysfs_path.is_dir(): + print(" Parameters:") + for path in Path(sysfs_path).iterdir(): + if path.is_file(): + print(" {}: {}".format(path.name, path.read_text().strip())) + print() diff --git a/bin/wifi_nmcli_test b/bin/wifi_nmcli_test new file mode 100755 index 0000000..24359c2 --- /dev/null +++ b/bin/wifi_nmcli_test @@ -0,0 +1,154 @@ +#!/usr/bin/env python3 +# Copyright 2017 Canonical Ltd. +# All rights reserved. +# +# Written by: +# Jonathan Cave <jonathan.cave@canonical.com> +# +# wireless connection tests using nmcli + + +import argparse +import functools +import subprocess as sp +import sys + + +print = functools.partial(print, flush=True) + + +def print_head(txt): + print("##", txt) + + +def print_cmd(cmd): + print("+", cmd) + + +def cleanup_nm_connections(): + print_head("Cleaning up NM connections") + cmd = "nmcli -t -f TYPE,UUID,NAME c" + print_cmd(cmd) + output = sp.check_output(cmd, shell=True) + for line in output.decode(sys.stdout.encoding).splitlines(): + type, uuid, name = line.strip().split(':') + if type == '802-11-wireless': + print("Deleting connection", name) + cmd = "nmcli c delete {}".format(uuid) + print_cmd(cmd) + sp.call(cmd, shell=True) + print() + + +def device_rescan(): + print_head("Calling a rescan") + cmd = "nmcli d wifi rescan" + print_cmd(cmd) + sp.call(cmd, shell=True) + print() + + +def list_aps(args): + print_head("List APs") + count = 0 + cmd = "nmcli -t -f SSID,CHAN,FREQ,SIGNAL d wifi list ifname {}".format( + args.device) + print_cmd(cmd) + output = sp.check_output(cmd, shell=True) + for line in output.decode(sys.stdout.encoding).splitlines(): + # lp bug #1723372 - extra line in output on zesty + if line.strip() == args.device: + continue + ssid, channel, frequency, signal = line.strip().split(':') + print("SSID: {} Chan: {} Freq: {} Signal: {}".format( + ssid, channel, frequency, signal)) + if hasattr(args, 'essid'): + if ssid == args.essid: + count += 1 + else: + count += 1 + print() + return count + + +def open_connection(args): + print_head("Connection attempt") + cmd = "nmcli d wifi connect {} ifname {} name TEST_CON".format( + args.essid, args.device) + print_cmd(cmd) + sp.call(cmd, shell=True) + cmd = "nmcli -m tabular -t -f GENERAL.STATE d show {}".format(args.device) + print_cmd(cmd) + output = sp.check_output(cmd, shell=True) + state = output.decode(sys.stdout.encoding).strip() + print(state) + rc = 1 + if state.startswith('100'): + rc = 0 + print() + return rc + + +def secured_connection(args): + print_head("Connection attempt") + cmd = "nmcli d wifi connect {} password {} ifname {} name TEST_CON".format( + args.essid, args.psk, args.device) + print_cmd(cmd) + sp.call(cmd, shell=True) + cmd = "nmcli -m tabular -t -f GENERAL.STATE d show {}".format(args.device) + print_cmd(cmd) + output = sp.check_output(cmd, shell=True) + state = output.decode(sys.stdout.encoding).strip() + print(state) + rc = 1 + if state.startswith('100'): + rc = 0 + print() + return rc + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description='WiFi connection test using mmcli') + + subparsers = parser.add_subparsers(dest='test_type') + subparsers.required = True + + parser_scan = subparsers.add_parser( + 'scan', help='Test can scan for networks only') + parser_scan.add_argument( + 'device', type=str, help='Device name e.g. wlan0') + + parser_open = subparsers.add_parser( + 'open', help='Test connection to an open access point') + parser_open.add_argument( + 'device', type=str, help='Device name e.g. wlan0') + parser_open.add_argument('essid', type=str, help='ESSID') + parser_open.set_defaults(func=open_connection) + + parser_secured = subparsers.add_parser( + 'secured', help='Test connection to a secured access point') + parser_secured.add_argument( + 'device', type=str, help='Device name e.g. wlan0') + parser_secured.add_argument('essid', type=str, help='ESSID') + parser_secured.add_argument('psk', type=str, help='Pre-Shared Key') + parser_secured.set_defaults(func=secured_connection) + args = parser.parse_args() + + cleanup_nm_connections() + device_rescan() + count = list_aps(args) + + if args.test_type == 'scan': + if count == 0: + print("Failed to find any APs") + sys.exit(1) + else: + print("Found {} access points".format(count)) + sys.exit(0) + + if args.func: + try: + sys.exit(args.func(args)) + finally: + cleanup_nm_connections() diff --git a/units/suspend/suspend.pxu b/units/suspend/suspend.pxu index 136adfb..4b09bbd 100644 --- a/units/suspend/suspend.pxu +++ b/units/suspend/suspend.pxu @@ -49,17 +49,6 @@ _description: Dumps memory info to a file for comparison after suspend test has been run command: meminfo_resource > $PLAINBOX_SESSION_SHARE/meminfo_before_suspend -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_before_suspend -depends: wireless/wireless_connection -requires: device.category == 'WIRELESS' -command: nmcli -t -f UUID con status > $PLAINBOX_SESSION_SHARE/connections && connect_wireless && gateway_ping_test --interface=`(nmcli dev list 2>/dev/null || nmcli dev show) | grep -B 1 -e 'wireless' -e 'wifi' | grep GENERAL.DEVICE | awk '{print $2}'` && for con in `cat $PLAINBOX_SESSION_SHARE/connections`; do nmcli con up uuid "$con"; done -estimated_duration: 20.0 -_description: - This test disconnects all connections and then connects to the wireless - interface. It then checks the connection to confirm it's working as expected. - unit: template template-resource: device template-filter: device.category == 'NETWORK' @@ -76,22 +65,6 @@ command: network -i {interface} -t iperf _description: This test executes iperf connection performance/stability against device {__index__} ({interface}) before suspend. -unit: template -template-resource: device -template-filter: device.category == 'WIRELESS' -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/iperf_before_suspend_wifi_auto_device{__index__}_{interface} -depends: wireless/wireless_connection -estimated_duration: 20.0 -requires: - package.name == 'iperf' -user: root -environ: TEST_TARGET_FTP TEST_TARGET_IPERF TEST_USER TEST_PASS -command: network -i {interface} -t iperf -_description: - This test executes iperf connection performance/stability against device {__index__} ({interface}) before suspend. - plugin: shell category_id: com.canonical.plainbox::suspend id: suspend/iperf_before_suspend_mobilebroadband_gsm_auto @@ -99,7 +72,7 @@ depends: mobilebroadband/gsm_connection estimated_duration: 20.0 user: root environ: TEST_TARGET_FTP TEST_TARGET_IPERF TEST_USER TEST_PASS -command: +command: INTERFACE=`(nmcli -t -f GENERAL -m tabular dev list 2>/dev/null || nmcli -t -f GENERAL -m tabular dev show) |grep gsm |cut -d ":" -f 13` [ -z $INTERFACE ] && exit 1 network test -i $INTERFACE -t iperf @@ -113,7 +86,7 @@ depends: mobilebroadband/cdma_connection estimated_duration: 20.0 user: root environ: TEST_TARGET_FTP TEST_TARGET_IPERF TEST_USER TEST_PASS -command: +command: INTERFACE=`(nmcli -t -f GENERAL -m tabular dev list 2>/dev/null || nmcli -t -f GENERAL -m tabular dev show) |grep cdma |cut -d ":" -f 13` [ -z $INTERFACE ] && exit 1 network test -i $INTERFACE -t iperf @@ -630,395 +603,6 @@ _description: VERIFICATION: Does the display work normally after resuming from suspend using the {vendor} {product} graphics card? -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_after_suspend -depends: suspend/suspend_advanced suspend/wireless_before_suspend -requires: - device.category == 'WIRELESS' -command: connect_wireless && gateway_ping_test --interface=`(nmcli dev list 2>/dev/null || nmcli dev show) | grep -B 1 -e wireless -e wifi | grep GENERAL.DEVICE | awk '{print $2}'` && for con in `cat $PLAINBOX_SESSION_SHARE/connections`; do nmcli con up uuid "$con"; done -estimated_duration: 20.0 -_description: - This test checks that the wireless interface is working after suspending the system. It - disconnects all interfaces and then connects to the wireless interface and checks that the - connection is working as expected. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_wpa_bg -depends: suspend/suspend_advanced -estimated_duration: 20.0 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: WPA_BG_SSID WPA_BG_PSK -command: - trap "nmcli con delete id $WPA_BG_SSID" EXIT - if create_connection wifi $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using WPA - security and the 802.11b/g protocols after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_open_bg -depends: suspend/suspend_advanced -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: OPEN_BG_SSID -command: - trap "nmcli con delete id $OPEN_BG_SSID" EXIT - if create_connection wifi $OPEN_BG_SSID; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using no - security and the 802.11b/g protocols after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_wpa_n -depends: suspend/suspend_advanced -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: WPA_N_SSID WPA_N_PSK -command: - trap "nmcli con delete id $WPA_N_SSID" EXIT - if create_connection wifi $WPA_N_SSID --security=wpa --key=$WPA_N_PSK; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using WPA - security and the 802.11n protocol after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_open_n -depends: suspend/suspend_advanced -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: OPEN_N_SSID -command: - trap "nmcli con delete id $OPEN_N_SSID" EXIT - if create_connection wifi $OPEN_N_SSID; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using no - security and the 802.11n protocol after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_wpa_ac -depends: suspend/suspend_advanced -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' - IEEE_80211.ac == 'supported' -user: root -environ: WPA_AC_SSID WPA_AC_PSK -command: - trap "nmcli con delete id $WPA_AC_SSID" EXIT - if create_connection wifi $WPA_AC_SSID --security=wpa --key=$WPA_AC_PSK; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using WPA - security and the 802.11ac protocol after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_open_ac -depends: suspend/suspend_advanced -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' - IEEE_80211.ac == 'supported' -user: root -environ: OPEN_AC_SSID -command: - trap "nmcli con delete id $OPEN_AC_SSID" EXIT - if create_connection wifi $OPEN_AC_SSID; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using no - security and the 802.11ac protocol after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_wpa_bg_auto -depends: suspend/suspend_advanced_auto -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: WPA_BG_SSID WPA_BG_PSK -command: - trap "nmcli con delete id $WPA_BG_SSID" EXIT - if create_connection wifi $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using WPA - security and the 802.11b/g protocols after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_open_bg_auto -depends: suspend/suspend_advanced_auto -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: OPEN_BG_SSID -command: - trap "nmcli con delete id $OPEN_BG_SSID" EXIT - if create_connection wifi $OPEN_BG_SSID; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using no - security and the 802.11b/g protocols after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_wpa_n_auto -depends: suspend/suspend_advanced_auto -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: WPA_N_SSID WPA_N_PSK -command: - trap "nmcli con delete id $WPA_N_SSID" EXIT - if create_connection wifi $WPA_N_SSID --security=wpa --key=$WPA_N_PSK; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using WPA - security and the 802.11n protocol after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_open_n_auto -depends: suspend/suspend_advanced_auto -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: OPEN_N_SSID -command: - trap "nmcli con delete id $OPEN_N_SSID" EXIT - if create_connection wifi $OPEN_N_SSID; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using no - security and the 802.11n protocol after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_wpa_ac_auto -depends: suspend/suspend_advanced_auto -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' - IEEE_80211.ac == 'supported' -user: root -environ: WPA_AC_SSID WPA_AC_PSK -command: - trap "nmcli con delete id $WPA_AC_SSID" EXIT - if create_connection wifi $WPA_AC_SSID --security=wpa --key=$WPA_AC_PSK; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using WPA - security and the 802.11ac protocol after the system has been suspended. - -plugin: shell -category_id: com.canonical.plainbox::suspend -id: suspend/wireless_connection_after_suspend_open_ac_auto -depends: suspend/suspend_advanced_auto -estimated_duration: 1.2 -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' - IEEE_80211.ac == 'supported' -user: root -environ: OPEN_AC_SSID -command: - trap "nmcli con delete id $OPEN_AC_SSID" EXIT - if create_connection wifi $OPEN_AC_SSID; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi -_description: - Tests that the systems wireless hardware can connect to a router using no - security and the 802.11ac protocol after the system has been suspended. - unit: template template-resource: device template-filter: device.category == 'NETWORK' @@ -1058,7 +642,7 @@ depends: suspend/suspend_advanced_auto estimated_duration: 20.0 user: root environ: TEST_TARGET_FTP TEST_TARGET_IPERF TEST_USER TEST_PASS -command: +command: INTERFACE=`(nmcli -t -f GENERAL -m tabular dev list 2>/dev/null || nmcli -t -f GENERAL -m tabular dev show) |grep gsm |cut -d ":" -f 13` [ -z $INTERFACE ] && exit 1 network test -i $INTERFACE -t iperf @@ -1072,7 +656,7 @@ depends: suspend/suspend_advanced_auto estimated_duration: 20.0 user: root environ: TEST_TARGET_FTP TEST_TARGET_IPERF TEST_USER TEST_PASS -command: +command: INTERFACE=`(nmcli -t -f GENERAL -m tabular dev list 2>/dev/null || nmcli -t -f GENERAL -m tabular dev show) |grep cdma |cut -d ":" -f 13` [ -z $INTERFACE ] && exit 1 network test -i $INTERFACE -t iperf @@ -2726,4 +2310,3 @@ estimated_duration: 0.5 command: [ -e ${PLAINBOX_SESSION_SHARE}/fwts_oops_results_after_s3.log ] && xz -c ${PLAINBOX_SESSION_SHARE}/fwts_oops_results_after_s3.log | base64 _description: Attaches the FWTS oops results log to the submission after suspend - diff --git a/units/wireless/jobs.pxu b/units/wireless/jobs.pxu index 89868ef..2834c1d 100644 --- a/units/wireless/jobs.pxu +++ b/units/wireless/jobs.pxu @@ -1,234 +1,153 @@ -plugin: shell -category_id: com.canonical.plainbox::wireless -id: wireless/wireless_scanning -requires: - package.name == 'network-manager' - device.category == 'WIRELESS' +unit: template +template-resource: device +template-filter: device.category == 'WIRELESS' +template-engine: jinja2 +template-unit: job +id: wireless/wireless_scanning_{{ interface }} +_summary: Test system can discover Wi-Fi networks on {{ interface }} command: - rfkill unblock wlan wifi - if rfkill list wlan wifi | grep -q 'Hard blocked: yes'; then - echo "Hard block is applied to WiFi device. Please remove and retest." - exit 1 - fi - wireless_networks=`(nmcli -f SSID dev wifi list 2>/dev/null || nmcli -f SSID dev wifi)` - if [ `echo "$wireless_networks" | wc -l` -gt 1 ]; then - echo "Wireless networks discovered: " - echo "$wireless_networks" - exit 0 - fi - echo "No wireless networks discovered." - exit 1 -estimated_duration: 0.645 -_description: Wireless scanning test. It scans and reports on discovered APs. - + net_driver_info $NET_DRIVER_INFO + wifi_nmcli_test scan {{ interface }} plugin: shell category_id: com.canonical.plainbox::wireless -id: wireless/info_automated -requires: - package.name == 'network-manager' - device.category == 'WIRELESS' -command: udev_resource -f WIRELESS | awk "/interface: / { print \$2 }" | xargs -n 1 network_info -estimated_duration: 1.2 -_description: - This is an automated test to gather some info on the current state of your wireless devices. If no devices are found, the test will exit with an error. - -plugin: user-interact-verify -category_id: com.canonical.plainbox::wireless -id: wireless/wireless_connection -command: network_check -estimated_duration: 120.0 -requires: device.category == 'WIRELESS' +estimated_duration: 6 _description: - PURPOSE: - This test will check your wireless connection. - STEPS: - 1. Click on the Network icon in the panel. - 2. Select a network below the 'Wireless networks' section. - 3. Click "Test" to verify that it's possible to establish an HTTP connection. - VERIFICATION: - Did a notification show and was the connection correctly established? + Check system can find a wireless network AP nearby +flags: preserve-locale also-after-suspend +requires: + {%- if "SNAP_NAME" in __system_env__ %} + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' + {% endif -%} +unit: template +template-resource: device +template-filter: device.category == 'WIRELESS' +template-engine: jinja2 +template-unit: job +id: wireless/wireless_connection_wpa_bg_nm_{{ interface }} +_summary: Connect to WPA-encrypted 802.11b/g Wi-Fi network on {{ interface }} +_purpose: + Check system can connect to 802.11b/g AP with wpa security plugin: shell -category_id: com.canonical.plainbox::wireless -id: wireless/wireless_connection_wpa_bg -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: WPA_BG_SSID WPA_BG_PSK command: - trap "nmcli con delete id $WPA_BG_SSID" EXIT - if create_connection wifi $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi + net_driver_info $NET_DRIVER_INFO + wifi_nmcli_test secured {{ interface }} "$WPA_BG_SSID" "$WPA_BG_PSK" +category_id: com.canonical.plainbox::wireless estimated_duration: 30.0 -_description: - Tests that the systems wireless hardware can connect to a router using WPA - security and the 802.11b/g protocols. +flags: preserve-locale also-after-suspend +requires: + {%- if "SNAP_NAME" in __system_env__ %} + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' + {% endif -%} +unit: template +template-resource: device +template-filter: device.category == 'WIRELESS' +template-engine: jinja2 +template-unit: job +id: wireless/wireless_connection_open_bg_nm_{{ interface }} +_summary: Connect to unencrypted 802.11b/g Wi-Fi network on {{ interface }} +_purpose: + Check system can connect to insecure 802.11b/g AP plugin: shell -category_id: com.canonical.plainbox::wireless -id: wireless/wireless_connection_open_bg -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: OPEN_BG_SSID command: - trap "nmcli con delete id $OPEN_BG_SSID" EXIT - if create_connection wifi $OPEN_BG_SSID; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi + net_driver_info $NET_DRIVER_INFO + wifi_nmcli_test open {{ interface }} "$OPEN_BG_SSID" +category_id: com.canonical.plainbox::wireless estimated_duration: 30.0 -_description: - Tests that the systems wireless hardware can connect to a router using no - security and the 802.11b/g protocols. +flags: preserve-locale also-after-suspend +requires: + {%- if "SNAP_NAME" in __system_env__ %} + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' + {% endif -%} +unit: template +template-resource: device +template-filter: device.category == 'WIRELESS' +template-engine: jinja2 +template-unit: job +id: wireless/wireless_connection_wpa_n_nm_{{ interface }} +_summary: Connect to WPA-encrypted 802.11n Wi-Fi network on {{ interface }} +_purpose: + Check system can connect to 802.11n AP with wpa security plugin: shell -category_id: com.canonical.plainbox::wireless -id: wireless/wireless_connection_wpa_n -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: WPA_N_SSID WPA_N_PSK command: - trap "nmcli con delete id $WPA_N_SSID" EXIT - if create_connection wifi $WPA_N_SSID --security=wpa --key=$WPA_N_PSK; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi + net_driver_info $NET_DRIVER_INFO + wifi_nmcli_test secured {{ interface }} "$WPA_N_SSID" "$WPA_N_PSK" +category_id: com.canonical.plainbox::wireless estimated_duration: 30.0 -_description: - Tests that the systems wireless hardware can connect to a router using WPA - security and the 802.11n protocol. +flags: preserve-locale also-after-suspend +requires: + wireless_sta_protocol.{{ interface }}_n == 'supported' + {%- if "SNAP_NAME" in __system_env__ %} + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' + {% endif -%} +unit: template +template-resource: device +template-filter: device.category == 'WIRELESS' +template-engine: jinja2 +template-unit: job +id: wireless/wireless_connection_open_n_nm_{{ interface }} +_summary: Connect to unencrypted 802.11n Wi-Fi network on {{ interface }} +_purpose: + Check system can connect to insecure 802.11n AP plugin: shell -category_id: com.canonical.plainbox::wireless -id: wireless/wireless_connection_open_n -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' -user: root -environ: OPEN_N_SSID command: - trap "nmcli con delete id $OPEN_N_SSID" EXIT - if create_connection wifi $OPEN_N_SSID; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi + net_driver_info $NET_DRIVER_INFO + wifi_nmcli_test open {{ interface }} "$OPEN_N_SSID" +category_id: com.canonical.plainbox::wireless estimated_duration: 30.0 -_description: - Tests that the systems wireless hardware can connect to a router using no - security and the 802.11n protocol. +flags: preserve-locale also-after-suspend +requires: + wireless_sta_protocol.{{ interface }}_n == 'supported' + {%- if "SNAP_NAME" in __system_env__ %} + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' + {% endif -%} +unit: template +template-resource: device +template-filter: device.category == 'WIRELESS' +template-engine: jinja2 +template-unit: job +id: wireless/wireless_connection_wpa_ac_nm_{{ interface }} +_summary: Connect to WPA-encrypted 802.11ac Wi-Fi network on {{ interface }} +_purpose: + Check system can connect to 802.11ac AP with wpa security plugin: shell -category_id: com.canonical.plainbox::wireless -id: wireless/wireless_connection_wpa_ac -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' - IEEE_80211.ac == 'supported' -user: root -environ: WPA_AC_SSID WPA_AC_PSK command: - trap "nmcli con delete id $WPA_AC_SSID" EXIT - if create_connection wifi $WPA_AC_SSID --security=wpa --key=$WPA_AC_PSK; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi + net_driver_info $NET_DRIVER_INFO + wifi_nmcli_test secured {{ interface }} "$WPA_AC_SSID" "$WPA_AC_PSK" +category_id: com.canonical.plainbox::wireless estimated_duration: 30.0 -_description: - Tests that the systems wireless hardware can connect to a router using WPA - security and the 802.11ac protocol. +flags: preserve-locale also-after-suspend +requires: + wireless_sta_protocol.{{ interface }}_ac == 'supported' + {%- if "SNAP_NAME" in __system_env__ %} + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' + {% endif -%} +unit: template +template-resource: device +template-filter: device.category == 'WIRELESS' +template-engine: jinja2 +template-unit: job +id: wireless/wireless_connection_open_ac_nm_{{ interface }} +_summary: Connect to unencrypted 802.11ac Wi-Fi network on {{ interface }} +_purpose: + Check system can connect to insecure 802.11ac AP plugin: shell -category_id: com.canonical.plainbox::wireless -id: wireless/wireless_connection_open_ac -requires: - device.category == 'WIRELESS' - environment.ROUTERS == 'multiple' - IEEE_80211.ac == 'supported' -user: root -environ: OPEN_AC_SSID command: - trap "nmcli con delete id $OPEN_AC_SSID" EXIT - if create_connection wifi $OPEN_AC_SSID; then - connect_wireless # lp:1471663 - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` - iw dev $INTERFACE link - gateway_ping_test --interface=$INTERFACE - STATUS=$? - # We reconnect the Ethernet connection if any (lp:1471663) - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") - if [[ ! -z $WIRED ]]; then - nmcli c up uuid $WIRED - fi - exit $STATUS - else - exit 1 - fi + net_driver_info $NET_DRIVER_INFO + wifi_nmcli_test open {{ interface }} "$OPEN_AC_SSID" +category_id: com.canonical.plainbox::wireless estimated_duration: 30.0 -_description: - Tests that the systems wireless hardware can connect to a router using no - security and the 802.11ac protocol. +flags: preserve-locale also-after-suspend +requires: + wireless_sta_protocol.{{ interface }}_ac == 'supported' + {%- if "SNAP_NAME" in __system_env__ %} + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' + {% endif -%} plugin: user-interact-verify category_id: com.canonical.plainbox::wireless @@ -525,78 +444,3 @@ command: estimated_duration: 330.0 _description: Tests the performance of a system's wireless connection through the iperf tool, using UDP packets. - -unit: template -template-resource: device -template-filter: - device.category == 'WIRELESS' -plugin: shell -category_id: com.canonical.plainbox::wireless -id: wireless/stress_performance_device{__index__}_{interface} -estimated_duration: 330.0 -requires: - package.name == 'iperf' -environ: TEST_TARGET_IPERF -user: root -command: network test -i {interface} -t stress -_description: - This test executes iperf to generate a load on the network device {__index__} ({interface}) and then performs a ping test to watch for dropped packets and very large latency periods. - -plugin: shell -category_id: com.canonical.plainbox::wireless -id: wireless/wireless_extension -requires: device.category == 'WIRELESS' -command: wireless_ext -estimated_duration: 1.2 -_description: - Test that the MAC80211 modules are loaded and wireless extensions are working. - -unit: template -template-resource: device -template-filter: device.category == 'WIRELESS' -plugin: shell -category_id: com.canonical.plainbox::wireless -id: wireless/iwconfig_check_device{__index__}_{interface} -estimated_duration: 1.2 -command: iwconfig {interface} -_description: - This test executes iwconfig requests against wireless device {__index__} ({interface}). - -plugin: user-interact-verify -category_id: com.canonical.plainbox::wireless -id: wireless/wireless_rfkill -command: rfkill list | zenity --text-info --title rfkill-Info -estimated_duration: 120.0 -requires: device.category == 'WIRELESS' -_description: - PURPOSE: - This test will check whether or not your driver responds to rfkill commands. - STEPS: - 1. Use the hardware switch on the side of your device to switch off wireless. - 2. If you do not have a hardware switch disable wireless from the network manager icon in the panel - 3. Click "Test" to verify that the hard or soft blocks are in place. - VERIFICATION: - Did the hard or soft blocks show on in the dialog? - -unit: template -template-resource: device -template-filter: device.category == 'WIRELESS' -plugin: user-interact-verify -category_id: com.canonical.plainbox::wireless -id: wireless/maximum_bandwidth_device{__index__}_{interface} -estimated_duration: 120.0 -requires: - package.name == 'zenity' - package.name == 'iperf' -environ: TEST_TARGET_IPERF -user: root -command: network test -i {interface} -t iperf 2>&1 | cat - <(echo; echo "Verify the result and click OK to decide on the outcome") | zenity --text-info --title 'mobile broadband max bw {interface}' -_purpose: - User verification of whether the observed transfer throughput is acceptable - for the type and maximum speed of wireless device {__index__} ({interface}). -_steps: - 1. Click "Test". - 2. Read the network test summary and confirm that the throughput is acceptable. - 3. If needed, click "Test" again to repeat the transfer test. -_verification: - Was the reported throughput acceptable for the type and maximum speed of this interface? diff --git a/units/wireless/test-plan.pxu b/units/wireless/test-plan.pxu index b4cf2f7..e1b6cfd 100644 --- a/units/wireless/test-plan.pxu +++ b/units/wireless/test-plan.pxu @@ -19,38 +19,38 @@ unit: test plan _name: Wireless tests _description: Wireless connection tests include: - wireless/wireless_scanning certification-status=blocker - wireless/wireless_connection_wpa_bg certification-status=blocker - wireless/wireless_connection_open_bg certification-status=blocker - wireless/wireless_connection_wpa_n certification-status=blocker - wireless/wireless_connection_open_n certification-status=blocker - wireless/wireless_connection_wpa_ac certification-status=blocker - wireless/wireless_connection_open_ac certification-status=blocker + wireless/wireless_scanning_.* certification-status=blocker + wireless/wireless_connection_wpa_bg_nm_.* certification-status=blocker + wireless/wireless_connection_open_bg_nm_.* certification-status=blocker + wireless/wireless_connection_wpa_n_nm_.* certification-status=blocker + wireless/wireless_connection_open_n_nm_.* certification-status=blocker + wireless/wireless_connection_wpa_ac_nm_.* certification-status=blocker + wireless/wireless_connection_open_ac_nm_.* certification-status=blocker id: after-suspend-wireless-cert-automated unit: test plan _name: Wireless tests (after suspend, automated) _description: Wireless connection tests (after suspend, automated) include: - suspend/wireless_connection_after_suspend_wpa_bg certification-status=blocker - suspend/wireless_connection_after_suspend_open_bg certification-status=blocker - suspend/wireless_connection_after_suspend_wpa_n certification-status=blocker - suspend/wireless_connection_after_suspend_open_n certification-status=blocker - suspend/wireless_connection_after_suspend_wpa_ac certification-status=blocker - suspend/wireless_connection_after_suspend_open_ac certification-status=blocker + after-suspend-wireless/wireless_connection_wpa_bg_nm_.* certification-status=blocker + after-suspend-wireless/wireless_connection_open_bg_nm_.* certification-status=blocker + after-suspend-wireless/wireless_connection_wpa_n_nm_.* certification-status=blocker + after-suspend-wireless/wireless_connection_open_n_nm_.* certification-status=blocker + after-suspend-wireless/wireless_connection_wpa_ac_nm_.* certification-status=blocker + after-suspend-wireless/wireless_connection_open_ac_nm_.* certification-status=blocker id: wireless-cert-blockers unit: test plan _name: Wireless tests (certification blockers only) _description: Wireless connection tests (certification blockers only) include: - wireless/wireless_scanning certification-status=blocker - wireless/wireless_connection_wpa_bg certification-status=blocker - wireless/wireless_connection_open_bg certification-status=blocker - wireless/wireless_connection_wpa_n certification-status=blocker - wireless/wireless_connection_open_n certification-status=blocker - wireless/wireless_connection_wpa_ac certification-status=blocker - wireless/wireless_connection_open_ac certification-status=blocker + wireless/wireless_scanning_.* certification-status=blocker + wireless/wireless_connection_wpa_bg_nm_.* certification-status=blocker + wireless/wireless_connection_open_bg_nm_.* certification-status=blocker + wireless/wireless_connection_wpa_n_nm_.* certification-status=blocker + wireless/wireless_connection_open_n_nm_.* certification-status=blocker + wireless/wireless_connection_wpa_ac_nm_.* certification-status=blocker + wireless/wireless_connection_open_ac_nm_.* certification-status=blocker id: after-suspend-wireless-cert-blockers unit: test plan @@ -58,9 +58,9 @@ _name: Wireless tests (after suspend, certification blockers only) _description: Wireless connection tests (after suspend, certification blockers only) include: - suspend/wireless_connection_after_suspend_wpa_bg certification-status=blocker - suspend/wireless_connection_after_suspend_open_bg certification-status=blocker - suspend/wireless_connection_after_suspend_wpa_n certification-status=blocker - suspend/wireless_connection_after_suspend_open_n certification-status=blocker - suspend/wireless_connection_after_suspend_wpa_ac certification-status=blocker - suspend/wireless_connection_after_suspend_open_ac certification-status=blocker + after-suspend-wireless/wireless_connection_wpa_bg_nm_.* certification-status=blocker + after-suspend-wireless/wireless_connection_open_bg_nm_.* certification-status=blocker + after-suspend-wireless/wireless_connection_wpa_n_nm_.* certification-status=blocker + after-suspend-wireless/wireless_connection_open_n_nm_.* certification-status=blocker + after-suspend-wireless/wireless_connection_wpa_ac_nm_.* certification-status=blocker + after-suspend-wireless/wireless_connection_open_ac_nm_.* certification-status=blocker |