Merge ~jocave/plainbox-provider-checkbox:move-wireless-jobs-to-newer-templated-version into plainbox-provider-checkbox:master
- Git
- lp:~jocave/plainbox-provider-checkbox
- move-wireless-jobs-to-newer-templated-version
- Merge into master
Status: | Merged |
---|---|
Approved by: | Sylvain Pineau |
Approved revision: | 754f075c2179c3e9100d3659c732e58695135550 |
Merged at revision: | 95380fb6ce65d5966415e985688fffc285a5c0bb |
Proposed branch: | ~jocave/plainbox-provider-checkbox:move-wireless-jobs-to-newer-templated-version |
Merge into: | plainbox-provider-checkbox:master |
Diff against target: |
1208 lines (+347/-725) 5 files modified
bin/net_driver_info (+41/-0) bin/wifi_nmcli_test (+154/-0) units/suspend/suspend.pxu (+4/-421) units/wireless/jobs.pxu (+122/-278) units/wireless/test-plan.pxu (+26/-26) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sylvain Pineau (community) | Approve | ||
Review via email: mp+332116@code.launchpad.net |
Commit message
Description of the change
Big import of newer templated wireless jobs and removal of old suspend jobs that should now be covered by the after suspend flag.
Landing this will require quick follow ups in:
- plainbox-
- plainbox-
- plainbox-
Sylvain Pineau (sylvain-pineau) wrote : | # |
Jonathan Cave (jocave) wrote : | # |
1. Previous job definitions were running commands as root, are we able to run the python wrapper as the normal user now?
The python wrapper is inherited from p-p-s where is was run non-root for quite a while. I believe it should be find running as non-root. I tried running this on my desktop as my normal user and it worked fine (apart from a bug in zesty's nmcli itself).
2. Lots of new jobs are using the environ filed which is not needed when running command as a non root user (See http://
Thanks, updated branch to remove those. (squashed into first commit)
3. What happens if $NET_DRIVER_INFO is not set? should we condition the call to bin/net_driver_info only if the variable exists?
The environment variable is used to request the script print the information it can find about drivers that are of special interest to the user. If the variable is missing the script should still work and only print information for drivers that sysfs indicates are of class network.
4. Can all _manual connection tests benefit from the python tool? to get rid again of the inline bash commands?
I decide to not touch these jobs as I didn't know anything about what their target audience is. They are quite different to any of the other tests as the manual part of the test seems to refer to configuration Access Points.
Sylvain Pineau (sylvain-pineau) wrote : | # |
Thanks for the update.
For Zesty (as it will hit sru testing), I'd add a special case handler and/or execute the split in a try/except block.
Taihsiang Ho (tai271828) wrote : | # |
For desktop we are testing trusty, xenial, zesty and artful(soon), so if these four releases are compatible with this script and could use this script to perform the tests. That would be great.
Jonathan Cave (jocave) wrote : | # |
Updated with zesty bug handling
Sylvain Pineau (sylvain-pineau) wrote : | # |
Thanks for bringing this improved version to p-p-c, LGTM.
Sylvain Pineau (sylvain-pineau) wrote : | # |
One thing I didin't notice is that using the also-after-suspend flag adds a dependency on suspend/
We can still land this MR, I'll propose the fix to add support for manual nested part.
Preview Diff
1 | diff --git a/bin/net_driver_info b/bin/net_driver_info |
2 | new file mode 100755 |
3 | index 0000000..ee5db46 |
4 | --- /dev/null |
5 | +++ b/bin/net_driver_info |
6 | @@ -0,0 +1,41 @@ |
7 | +#!/usr/bin/env python3 |
8 | +# Copyright 2017 Canonical Ltd. |
9 | +# All rights reserved. |
10 | +# |
11 | +# Written by: |
12 | +# Jonathan Cave <jonathan.cave@canonical.com> |
13 | +# |
14 | +# Print info about drivers we can identify automatically and also those we |
15 | +# identify in the special interest list! |
16 | + |
17 | +from pathlib import Path |
18 | +import sys |
19 | + |
20 | +# Store pairs of (interface, driver) |
21 | +driver_list = [] |
22 | + |
23 | +# Find drivers in sysfs |
24 | +for interface in Path("/sys/class/net").iterdir(): |
25 | + mod_path = Path("{}/device/driver/module".format(interface)) |
26 | + if mod_path.is_symlink(): |
27 | + driver_list.append((interface.name, mod_path.resolve().name)) |
28 | + |
29 | +# Add user requested modules to the list. Create "unknown" interfaces if none |
30 | +# of the identified interfaces above are using it |
31 | +for user_driver in sys.argv[1:]: |
32 | + if Path("/sys/module/{}".format(user_driver)).exists(): |
33 | + if not any(x[1] == user_driver for x in driver_list): |
34 | + driver_list.append(("unknown", user_driver)) |
35 | + else: |
36 | + print("Requested driver {} not loaded\n".format(user_driver)) |
37 | + |
38 | +# Produce the output |
39 | +for interface, driver in driver_list: |
40 | + print("Interface {} using module {}".format(interface, driver)) |
41 | + sysfs_path = Path("/sys/module/{}/parameters".format(driver)) |
42 | + if sysfs_path.is_dir(): |
43 | + print(" Parameters:") |
44 | + for path in Path(sysfs_path).iterdir(): |
45 | + if path.is_file(): |
46 | + print(" {}: {}".format(path.name, path.read_text().strip())) |
47 | + print() |
48 | diff --git a/bin/wifi_nmcli_test b/bin/wifi_nmcli_test |
49 | new file mode 100755 |
50 | index 0000000..24359c2 |
51 | --- /dev/null |
52 | +++ b/bin/wifi_nmcli_test |
53 | @@ -0,0 +1,154 @@ |
54 | +#!/usr/bin/env python3 |
55 | +# Copyright 2017 Canonical Ltd. |
56 | +# All rights reserved. |
57 | +# |
58 | +# Written by: |
59 | +# Jonathan Cave <jonathan.cave@canonical.com> |
60 | +# |
61 | +# wireless connection tests using nmcli |
62 | + |
63 | + |
64 | +import argparse |
65 | +import functools |
66 | +import subprocess as sp |
67 | +import sys |
68 | + |
69 | + |
70 | +print = functools.partial(print, flush=True) |
71 | + |
72 | + |
73 | +def print_head(txt): |
74 | + print("##", txt) |
75 | + |
76 | + |
77 | +def print_cmd(cmd): |
78 | + print("+", cmd) |
79 | + |
80 | + |
81 | +def cleanup_nm_connections(): |
82 | + print_head("Cleaning up NM connections") |
83 | + cmd = "nmcli -t -f TYPE,UUID,NAME c" |
84 | + print_cmd(cmd) |
85 | + output = sp.check_output(cmd, shell=True) |
86 | + for line in output.decode(sys.stdout.encoding).splitlines(): |
87 | + type, uuid, name = line.strip().split(':') |
88 | + if type == '802-11-wireless': |
89 | + print("Deleting connection", name) |
90 | + cmd = "nmcli c delete {}".format(uuid) |
91 | + print_cmd(cmd) |
92 | + sp.call(cmd, shell=True) |
93 | + print() |
94 | + |
95 | + |
96 | +def device_rescan(): |
97 | + print_head("Calling a rescan") |
98 | + cmd = "nmcli d wifi rescan" |
99 | + print_cmd(cmd) |
100 | + sp.call(cmd, shell=True) |
101 | + print() |
102 | + |
103 | + |
104 | +def list_aps(args): |
105 | + print_head("List APs") |
106 | + count = 0 |
107 | + cmd = "nmcli -t -f SSID,CHAN,FREQ,SIGNAL d wifi list ifname {}".format( |
108 | + args.device) |
109 | + print_cmd(cmd) |
110 | + output = sp.check_output(cmd, shell=True) |
111 | + for line in output.decode(sys.stdout.encoding).splitlines(): |
112 | + # lp bug #1723372 - extra line in output on zesty |
113 | + if line.strip() == args.device: |
114 | + continue |
115 | + ssid, channel, frequency, signal = line.strip().split(':') |
116 | + print("SSID: {} Chan: {} Freq: {} Signal: {}".format( |
117 | + ssid, channel, frequency, signal)) |
118 | + if hasattr(args, 'essid'): |
119 | + if ssid == args.essid: |
120 | + count += 1 |
121 | + else: |
122 | + count += 1 |
123 | + print() |
124 | + return count |
125 | + |
126 | + |
127 | +def open_connection(args): |
128 | + print_head("Connection attempt") |
129 | + cmd = "nmcli d wifi connect {} ifname {} name TEST_CON".format( |
130 | + args.essid, args.device) |
131 | + print_cmd(cmd) |
132 | + sp.call(cmd, shell=True) |
133 | + cmd = "nmcli -m tabular -t -f GENERAL.STATE d show {}".format(args.device) |
134 | + print_cmd(cmd) |
135 | + output = sp.check_output(cmd, shell=True) |
136 | + state = output.decode(sys.stdout.encoding).strip() |
137 | + print(state) |
138 | + rc = 1 |
139 | + if state.startswith('100'): |
140 | + rc = 0 |
141 | + print() |
142 | + return rc |
143 | + |
144 | + |
145 | +def secured_connection(args): |
146 | + print_head("Connection attempt") |
147 | + cmd = "nmcli d wifi connect {} password {} ifname {} name TEST_CON".format( |
148 | + args.essid, args.psk, args.device) |
149 | + print_cmd(cmd) |
150 | + sp.call(cmd, shell=True) |
151 | + cmd = "nmcli -m tabular -t -f GENERAL.STATE d show {}".format(args.device) |
152 | + print_cmd(cmd) |
153 | + output = sp.check_output(cmd, shell=True) |
154 | + state = output.decode(sys.stdout.encoding).strip() |
155 | + print(state) |
156 | + rc = 1 |
157 | + if state.startswith('100'): |
158 | + rc = 0 |
159 | + print() |
160 | + return rc |
161 | + |
162 | + |
163 | +if __name__ == '__main__': |
164 | + parser = argparse.ArgumentParser( |
165 | + description='WiFi connection test using mmcli') |
166 | + |
167 | + subparsers = parser.add_subparsers(dest='test_type') |
168 | + subparsers.required = True |
169 | + |
170 | + parser_scan = subparsers.add_parser( |
171 | + 'scan', help='Test can scan for networks only') |
172 | + parser_scan.add_argument( |
173 | + 'device', type=str, help='Device name e.g. wlan0') |
174 | + |
175 | + parser_open = subparsers.add_parser( |
176 | + 'open', help='Test connection to an open access point') |
177 | + parser_open.add_argument( |
178 | + 'device', type=str, help='Device name e.g. wlan0') |
179 | + parser_open.add_argument('essid', type=str, help='ESSID') |
180 | + parser_open.set_defaults(func=open_connection) |
181 | + |
182 | + parser_secured = subparsers.add_parser( |
183 | + 'secured', help='Test connection to a secured access point') |
184 | + parser_secured.add_argument( |
185 | + 'device', type=str, help='Device name e.g. wlan0') |
186 | + parser_secured.add_argument('essid', type=str, help='ESSID') |
187 | + parser_secured.add_argument('psk', type=str, help='Pre-Shared Key') |
188 | + parser_secured.set_defaults(func=secured_connection) |
189 | + args = parser.parse_args() |
190 | + |
191 | + cleanup_nm_connections() |
192 | + device_rescan() |
193 | + count = list_aps(args) |
194 | + |
195 | + if args.test_type == 'scan': |
196 | + if count == 0: |
197 | + print("Failed to find any APs") |
198 | + sys.exit(1) |
199 | + else: |
200 | + print("Found {} access points".format(count)) |
201 | + sys.exit(0) |
202 | + |
203 | + if args.func: |
204 | + try: |
205 | + sys.exit(args.func(args)) |
206 | + finally: |
207 | + cleanup_nm_connections() |
208 | diff --git a/units/suspend/suspend.pxu b/units/suspend/suspend.pxu |
209 | index 287071a..2949ba0 100644 |
210 | --- a/units/suspend/suspend.pxu |
211 | +++ b/units/suspend/suspend.pxu |
212 | @@ -49,17 +49,6 @@ _description: |
213 | Dumps memory info to a file for comparison after suspend test has been run |
214 | command: meminfo_resource > $PLAINBOX_SESSION_SHARE/meminfo_before_suspend |
215 | |
216 | -plugin: shell |
217 | -category_id: com.canonical.plainbox::suspend |
218 | -id: suspend/wireless_before_suspend |
219 | -depends: wireless/wireless_connection |
220 | -requires: device.category == 'WIRELESS' |
221 | -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 |
222 | -estimated_duration: 20.0 |
223 | -_description: |
224 | - This test disconnects all connections and then connects to the wireless |
225 | - interface. It then checks the connection to confirm it's working as expected. |
226 | - |
227 | unit: template |
228 | template-resource: device |
229 | template-filter: device.category == 'NETWORK' |
230 | @@ -76,22 +65,6 @@ command: network -i {interface} -t iperf |
231 | _description: |
232 | This test executes iperf connection performance/stability against device {__index__} ({interface}) before suspend. |
233 | |
234 | -unit: template |
235 | -template-resource: device |
236 | -template-filter: device.category == 'WIRELESS' |
237 | -plugin: shell |
238 | -category_id: com.canonical.plainbox::suspend |
239 | -id: suspend/iperf_before_suspend_wifi_auto_device{__index__}_{interface} |
240 | -depends: wireless/wireless_connection |
241 | -estimated_duration: 20.0 |
242 | -requires: |
243 | - package.name == 'iperf' |
244 | -user: root |
245 | -environ: TEST_TARGET_FTP TEST_TARGET_IPERF TEST_USER TEST_PASS |
246 | -command: network -i {interface} -t iperf |
247 | -_description: |
248 | - This test executes iperf connection performance/stability against device {__index__} ({interface}) before suspend. |
249 | - |
250 | plugin: shell |
251 | category_id: com.canonical.plainbox::suspend |
252 | id: suspend/iperf_before_suspend_mobilebroadband_gsm_auto |
253 | @@ -99,7 +72,7 @@ depends: mobilebroadband/gsm_connection |
254 | estimated_duration: 20.0 |
255 | user: root |
256 | environ: TEST_TARGET_FTP TEST_TARGET_IPERF TEST_USER TEST_PASS |
257 | -command: |
258 | +command: |
259 | 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` |
260 | [ -z $INTERFACE ] && exit 1 |
261 | network test -i $INTERFACE -t iperf |
262 | @@ -113,7 +86,7 @@ depends: mobilebroadband/cdma_connection |
263 | estimated_duration: 20.0 |
264 | user: root |
265 | environ: TEST_TARGET_FTP TEST_TARGET_IPERF TEST_USER TEST_PASS |
266 | -command: |
267 | +command: |
268 | 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` |
269 | [ -z $INTERFACE ] && exit 1 |
270 | network test -i $INTERFACE -t iperf |
271 | @@ -630,395 +603,6 @@ _description: |
272 | VERIFICATION: |
273 | Does the display work normally after resuming from suspend using the {vendor} {product} graphics card? |
274 | |
275 | -plugin: shell |
276 | -category_id: com.canonical.plainbox::suspend |
277 | -id: suspend/wireless_after_suspend |
278 | -depends: suspend/suspend_advanced suspend/wireless_before_suspend |
279 | -requires: |
280 | - device.category == 'WIRELESS' |
281 | -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 |
282 | -estimated_duration: 20.0 |
283 | -_description: |
284 | - This test checks that the wireless interface is working after suspending the system. It |
285 | - disconnects all interfaces and then connects to the wireless interface and checks that the |
286 | - connection is working as expected. |
287 | - |
288 | -plugin: shell |
289 | -category_id: com.canonical.plainbox::suspend |
290 | -id: suspend/wireless_connection_after_suspend_wpa_bg |
291 | -depends: suspend/suspend_advanced |
292 | -estimated_duration: 20.0 |
293 | -requires: |
294 | - device.category == 'WIRELESS' |
295 | - environment.ROUTERS == 'multiple' |
296 | -user: root |
297 | -environ: WPA_BG_SSID WPA_BG_PSK |
298 | -command: |
299 | - trap "nmcli con delete id $WPA_BG_SSID" EXIT |
300 | - if create_connection wifi $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK; then |
301 | - connect_wireless # lp:1471663 |
302 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
303 | - iw dev $INTERFACE link |
304 | - gateway_ping_test --interface=$INTERFACE |
305 | - STATUS=$? |
306 | - # We reconnect the Ethernet connection if any (lp:1471663) |
307 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
308 | - if [[ ! -z $WIRED ]]; then |
309 | - nmcli c up uuid $WIRED |
310 | - fi |
311 | - exit $STATUS |
312 | - else |
313 | - exit 1 |
314 | - fi |
315 | -_description: |
316 | - Tests that the systems wireless hardware can connect to a router using WPA |
317 | - security and the 802.11b/g protocols after the system has been suspended. |
318 | - |
319 | -plugin: shell |
320 | -category_id: com.canonical.plainbox::suspend |
321 | -id: suspend/wireless_connection_after_suspend_open_bg |
322 | -depends: suspend/suspend_advanced |
323 | -estimated_duration: 1.2 |
324 | -requires: |
325 | - device.category == 'WIRELESS' |
326 | - environment.ROUTERS == 'multiple' |
327 | -user: root |
328 | -environ: OPEN_BG_SSID |
329 | -command: |
330 | - trap "nmcli con delete id $OPEN_BG_SSID" EXIT |
331 | - if create_connection wifi $OPEN_BG_SSID; then |
332 | - connect_wireless # lp:1471663 |
333 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
334 | - iw dev $INTERFACE link |
335 | - gateway_ping_test --interface=$INTERFACE |
336 | - STATUS=$? |
337 | - # We reconnect the Ethernet connection if any (lp:1471663) |
338 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
339 | - if [[ ! -z $WIRED ]]; then |
340 | - nmcli c up uuid $WIRED |
341 | - fi |
342 | - exit $STATUS |
343 | - else |
344 | - exit 1 |
345 | - fi |
346 | -_description: |
347 | - Tests that the systems wireless hardware can connect to a router using no |
348 | - security and the 802.11b/g protocols after the system has been suspended. |
349 | - |
350 | -plugin: shell |
351 | -category_id: com.canonical.plainbox::suspend |
352 | -id: suspend/wireless_connection_after_suspend_wpa_n |
353 | -depends: suspend/suspend_advanced |
354 | -estimated_duration: 1.2 |
355 | -requires: |
356 | - device.category == 'WIRELESS' |
357 | - environment.ROUTERS == 'multiple' |
358 | -user: root |
359 | -environ: WPA_N_SSID WPA_N_PSK |
360 | -command: |
361 | - trap "nmcli con delete id $WPA_N_SSID" EXIT |
362 | - if create_connection wifi $WPA_N_SSID --security=wpa --key=$WPA_N_PSK; then |
363 | - connect_wireless # lp:1471663 |
364 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
365 | - iw dev $INTERFACE link |
366 | - gateway_ping_test --interface=$INTERFACE |
367 | - STATUS=$? |
368 | - # We reconnect the Ethernet connection if any (lp:1471663) |
369 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
370 | - if [[ ! -z $WIRED ]]; then |
371 | - nmcli c up uuid $WIRED |
372 | - fi |
373 | - exit $STATUS |
374 | - else |
375 | - exit 1 |
376 | - fi |
377 | -_description: |
378 | - Tests that the systems wireless hardware can connect to a router using WPA |
379 | - security and the 802.11n protocol after the system has been suspended. |
380 | - |
381 | -plugin: shell |
382 | -category_id: com.canonical.plainbox::suspend |
383 | -id: suspend/wireless_connection_after_suspend_open_n |
384 | -depends: suspend/suspend_advanced |
385 | -estimated_duration: 1.2 |
386 | -requires: |
387 | - device.category == 'WIRELESS' |
388 | - environment.ROUTERS == 'multiple' |
389 | -user: root |
390 | -environ: OPEN_N_SSID |
391 | -command: |
392 | - trap "nmcli con delete id $OPEN_N_SSID" EXIT |
393 | - if create_connection wifi $OPEN_N_SSID; then |
394 | - connect_wireless # lp:1471663 |
395 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
396 | - iw dev $INTERFACE link |
397 | - gateway_ping_test --interface=$INTERFACE |
398 | - STATUS=$? |
399 | - # We reconnect the Ethernet connection if any (lp:1471663) |
400 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
401 | - if [[ ! -z $WIRED ]]; then |
402 | - nmcli c up uuid $WIRED |
403 | - fi |
404 | - exit $STATUS |
405 | - else |
406 | - exit 1 |
407 | - fi |
408 | -_description: |
409 | - Tests that the systems wireless hardware can connect to a router using no |
410 | - security and the 802.11n protocol after the system has been suspended. |
411 | - |
412 | -plugin: shell |
413 | -category_id: com.canonical.plainbox::suspend |
414 | -id: suspend/wireless_connection_after_suspend_wpa_ac |
415 | -depends: suspend/suspend_advanced |
416 | -estimated_duration: 1.2 |
417 | -requires: |
418 | - device.category == 'WIRELESS' |
419 | - environment.ROUTERS == 'multiple' |
420 | - IEEE_80211.ac == 'supported' |
421 | -user: root |
422 | -environ: WPA_AC_SSID WPA_AC_PSK |
423 | -command: |
424 | - trap "nmcli con delete id $WPA_AC_SSID" EXIT |
425 | - if create_connection wifi $WPA_AC_SSID --security=wpa --key=$WPA_AC_PSK; then |
426 | - connect_wireless # lp:1471663 |
427 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
428 | - iw dev $INTERFACE link |
429 | - gateway_ping_test --interface=$INTERFACE |
430 | - STATUS=$? |
431 | - # We reconnect the Ethernet connection if any (lp:1471663) |
432 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
433 | - if [[ ! -z $WIRED ]]; then |
434 | - nmcli c up uuid $WIRED |
435 | - fi |
436 | - exit $STATUS |
437 | - else |
438 | - exit 1 |
439 | - fi |
440 | -_description: |
441 | - Tests that the systems wireless hardware can connect to a router using WPA |
442 | - security and the 802.11ac protocol after the system has been suspended. |
443 | - |
444 | -plugin: shell |
445 | -category_id: com.canonical.plainbox::suspend |
446 | -id: suspend/wireless_connection_after_suspend_open_ac |
447 | -depends: suspend/suspend_advanced |
448 | -estimated_duration: 1.2 |
449 | -requires: |
450 | - device.category == 'WIRELESS' |
451 | - environment.ROUTERS == 'multiple' |
452 | - IEEE_80211.ac == 'supported' |
453 | -user: root |
454 | -environ: OPEN_AC_SSID |
455 | -command: |
456 | - trap "nmcli con delete id $OPEN_AC_SSID" EXIT |
457 | - if create_connection wifi $OPEN_AC_SSID; then |
458 | - connect_wireless # lp:1471663 |
459 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
460 | - iw dev $INTERFACE link |
461 | - gateway_ping_test --interface=$INTERFACE |
462 | - STATUS=$? |
463 | - # We reconnect the Ethernet connection if any (lp:1471663) |
464 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
465 | - if [[ ! -z $WIRED ]]; then |
466 | - nmcli c up uuid $WIRED |
467 | - fi |
468 | - exit $STATUS |
469 | - else |
470 | - exit 1 |
471 | - fi |
472 | -_description: |
473 | - Tests that the systems wireless hardware can connect to a router using no |
474 | - security and the 802.11ac protocol after the system has been suspended. |
475 | - |
476 | -plugin: shell |
477 | -category_id: com.canonical.plainbox::suspend |
478 | -id: suspend/wireless_connection_after_suspend_wpa_bg_auto |
479 | -depends: suspend/suspend_advanced_auto |
480 | -estimated_duration: 1.2 |
481 | -requires: |
482 | - device.category == 'WIRELESS' |
483 | - environment.ROUTERS == 'multiple' |
484 | -user: root |
485 | -environ: WPA_BG_SSID WPA_BG_PSK |
486 | -command: |
487 | - trap "nmcli con delete id $WPA_BG_SSID" EXIT |
488 | - if create_connection wifi $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK; then |
489 | - connect_wireless # lp:1471663 |
490 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
491 | - iw dev $INTERFACE link |
492 | - gateway_ping_test --interface=$INTERFACE |
493 | - STATUS=$? |
494 | - # We reconnect the Ethernet connection if any (lp:1471663) |
495 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
496 | - if [[ ! -z $WIRED ]]; then |
497 | - nmcli c up uuid $WIRED |
498 | - fi |
499 | - exit $STATUS |
500 | - else |
501 | - exit 1 |
502 | - fi |
503 | -_description: |
504 | - Tests that the systems wireless hardware can connect to a router using WPA |
505 | - security and the 802.11b/g protocols after the system has been suspended. |
506 | - |
507 | -plugin: shell |
508 | -category_id: com.canonical.plainbox::suspend |
509 | -id: suspend/wireless_connection_after_suspend_open_bg_auto |
510 | -depends: suspend/suspend_advanced_auto |
511 | -estimated_duration: 1.2 |
512 | -requires: |
513 | - device.category == 'WIRELESS' |
514 | - environment.ROUTERS == 'multiple' |
515 | -user: root |
516 | -environ: OPEN_BG_SSID |
517 | -command: |
518 | - trap "nmcli con delete id $OPEN_BG_SSID" EXIT |
519 | - if create_connection wifi $OPEN_BG_SSID; then |
520 | - connect_wireless # lp:1471663 |
521 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
522 | - iw dev $INTERFACE link |
523 | - gateway_ping_test --interface=$INTERFACE |
524 | - STATUS=$? |
525 | - # We reconnect the Ethernet connection if any (lp:1471663) |
526 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
527 | - if [[ ! -z $WIRED ]]; then |
528 | - nmcli c up uuid $WIRED |
529 | - fi |
530 | - exit $STATUS |
531 | - else |
532 | - exit 1 |
533 | - fi |
534 | -_description: |
535 | - Tests that the systems wireless hardware can connect to a router using no |
536 | - security and the 802.11b/g protocols after the system has been suspended. |
537 | - |
538 | -plugin: shell |
539 | -category_id: com.canonical.plainbox::suspend |
540 | -id: suspend/wireless_connection_after_suspend_wpa_n_auto |
541 | -depends: suspend/suspend_advanced_auto |
542 | -estimated_duration: 1.2 |
543 | -requires: |
544 | - device.category == 'WIRELESS' |
545 | - environment.ROUTERS == 'multiple' |
546 | -user: root |
547 | -environ: WPA_N_SSID WPA_N_PSK |
548 | -command: |
549 | - trap "nmcli con delete id $WPA_N_SSID" EXIT |
550 | - if create_connection wifi $WPA_N_SSID --security=wpa --key=$WPA_N_PSK; then |
551 | - connect_wireless # lp:1471663 |
552 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
553 | - iw dev $INTERFACE link |
554 | - gateway_ping_test --interface=$INTERFACE |
555 | - STATUS=$? |
556 | - # We reconnect the Ethernet connection if any (lp:1471663) |
557 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
558 | - if [[ ! -z $WIRED ]]; then |
559 | - nmcli c up uuid $WIRED |
560 | - fi |
561 | - exit $STATUS |
562 | - else |
563 | - exit 1 |
564 | - fi |
565 | -_description: |
566 | - Tests that the systems wireless hardware can connect to a router using WPA |
567 | - security and the 802.11n protocol after the system has been suspended. |
568 | - |
569 | -plugin: shell |
570 | -category_id: com.canonical.plainbox::suspend |
571 | -id: suspend/wireless_connection_after_suspend_open_n_auto |
572 | -depends: suspend/suspend_advanced_auto |
573 | -estimated_duration: 1.2 |
574 | -requires: |
575 | - device.category == 'WIRELESS' |
576 | - environment.ROUTERS == 'multiple' |
577 | -user: root |
578 | -environ: OPEN_N_SSID |
579 | -command: |
580 | - trap "nmcli con delete id $OPEN_N_SSID" EXIT |
581 | - if create_connection wifi $OPEN_N_SSID; then |
582 | - connect_wireless # lp:1471663 |
583 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
584 | - iw dev $INTERFACE link |
585 | - gateway_ping_test --interface=$INTERFACE |
586 | - STATUS=$? |
587 | - # We reconnect the Ethernet connection if any (lp:1471663) |
588 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
589 | - if [[ ! -z $WIRED ]]; then |
590 | - nmcli c up uuid $WIRED |
591 | - fi |
592 | - exit $STATUS |
593 | - else |
594 | - exit 1 |
595 | - fi |
596 | -_description: |
597 | - Tests that the systems wireless hardware can connect to a router using no |
598 | - security and the 802.11n protocol after the system has been suspended. |
599 | - |
600 | -plugin: shell |
601 | -category_id: com.canonical.plainbox::suspend |
602 | -id: suspend/wireless_connection_after_suspend_wpa_ac_auto |
603 | -depends: suspend/suspend_advanced_auto |
604 | -estimated_duration: 1.2 |
605 | -requires: |
606 | - device.category == 'WIRELESS' |
607 | - environment.ROUTERS == 'multiple' |
608 | - IEEE_80211.ac == 'supported' |
609 | -user: root |
610 | -environ: WPA_AC_SSID WPA_AC_PSK |
611 | -command: |
612 | - trap "nmcli con delete id $WPA_AC_SSID" EXIT |
613 | - if create_connection wifi $WPA_AC_SSID --security=wpa --key=$WPA_AC_PSK; then |
614 | - connect_wireless # lp:1471663 |
615 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
616 | - iw dev $INTERFACE link |
617 | - gateway_ping_test --interface=$INTERFACE |
618 | - STATUS=$? |
619 | - # We reconnect the Ethernet connection if any (lp:1471663) |
620 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
621 | - if [[ ! -z $WIRED ]]; then |
622 | - nmcli c up uuid $WIRED |
623 | - fi |
624 | - exit $STATUS |
625 | - else |
626 | - exit 1 |
627 | - fi |
628 | -_description: |
629 | - Tests that the systems wireless hardware can connect to a router using WPA |
630 | - security and the 802.11ac protocol after the system has been suspended. |
631 | - |
632 | -plugin: shell |
633 | -category_id: com.canonical.plainbox::suspend |
634 | -id: suspend/wireless_connection_after_suspend_open_ac_auto |
635 | -depends: suspend/suspend_advanced_auto |
636 | -estimated_duration: 1.2 |
637 | -requires: |
638 | - device.category == 'WIRELESS' |
639 | - environment.ROUTERS == 'multiple' |
640 | - IEEE_80211.ac == 'supported' |
641 | -user: root |
642 | -environ: OPEN_AC_SSID |
643 | -command: |
644 | - trap "nmcli con delete id $OPEN_AC_SSID" EXIT |
645 | - if create_connection wifi $OPEN_AC_SSID; then |
646 | - connect_wireless # lp:1471663 |
647 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
648 | - iw dev $INTERFACE link |
649 | - gateway_ping_test --interface=$INTERFACE |
650 | - STATUS=$? |
651 | - # We reconnect the Ethernet connection if any (lp:1471663) |
652 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
653 | - if [[ ! -z $WIRED ]]; then |
654 | - nmcli c up uuid $WIRED |
655 | - fi |
656 | - exit $STATUS |
657 | - else |
658 | - exit 1 |
659 | - fi |
660 | -_description: |
661 | - Tests that the systems wireless hardware can connect to a router using no |
662 | - security and the 802.11ac protocol after the system has been suspended. |
663 | - |
664 | unit: template |
665 | template-resource: device |
666 | template-filter: device.category == 'NETWORK' |
667 | @@ -1058,7 +642,7 @@ depends: suspend/suspend_advanced_auto |
668 | estimated_duration: 20.0 |
669 | user: root |
670 | environ: TEST_TARGET_FTP TEST_TARGET_IPERF TEST_USER TEST_PASS |
671 | -command: |
672 | +command: |
673 | 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` |
674 | [ -z $INTERFACE ] && exit 1 |
675 | network test -i $INTERFACE -t iperf |
676 | @@ -1072,7 +656,7 @@ depends: suspend/suspend_advanced_auto |
677 | estimated_duration: 20.0 |
678 | user: root |
679 | environ: TEST_TARGET_FTP TEST_TARGET_IPERF TEST_USER TEST_PASS |
680 | -command: |
681 | +command: |
682 | 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` |
683 | [ -z $INTERFACE ] && exit 1 |
684 | network test -i $INTERFACE -t iperf |
685 | @@ -2895,4 +2479,3 @@ estimated_duration: 0.5 |
686 | command: |
687 | [ -e ${PLAINBOX_SESSION_SHARE}/fwts_oops_results_after_s3.log ] && xz -c ${PLAINBOX_SESSION_SHARE}/fwts_oops_results_after_s3.log | base64 |
688 | _description: Attaches the FWTS oops results log to the submission after suspend |
689 | - |
690 | diff --git a/units/wireless/jobs.pxu b/units/wireless/jobs.pxu |
691 | index 89868ef..2834c1d 100644 |
692 | --- a/units/wireless/jobs.pxu |
693 | +++ b/units/wireless/jobs.pxu |
694 | @@ -1,234 +1,153 @@ |
695 | -plugin: shell |
696 | -category_id: com.canonical.plainbox::wireless |
697 | -id: wireless/wireless_scanning |
698 | -requires: |
699 | - package.name == 'network-manager' |
700 | - device.category == 'WIRELESS' |
701 | +unit: template |
702 | +template-resource: device |
703 | +template-filter: device.category == 'WIRELESS' |
704 | +template-engine: jinja2 |
705 | +template-unit: job |
706 | +id: wireless/wireless_scanning_{{ interface }} |
707 | +_summary: Test system can discover Wi-Fi networks on {{ interface }} |
708 | command: |
709 | - rfkill unblock wlan wifi |
710 | - if rfkill list wlan wifi | grep -q 'Hard blocked: yes'; then |
711 | - echo "Hard block is applied to WiFi device. Please remove and retest." |
712 | - exit 1 |
713 | - fi |
714 | - wireless_networks=`(nmcli -f SSID dev wifi list 2>/dev/null || nmcli -f SSID dev wifi)` |
715 | - if [ `echo "$wireless_networks" | wc -l` -gt 1 ]; then |
716 | - echo "Wireless networks discovered: " |
717 | - echo "$wireless_networks" |
718 | - exit 0 |
719 | - fi |
720 | - echo "No wireless networks discovered." |
721 | - exit 1 |
722 | -estimated_duration: 0.645 |
723 | -_description: Wireless scanning test. It scans and reports on discovered APs. |
724 | - |
725 | + net_driver_info $NET_DRIVER_INFO |
726 | + wifi_nmcli_test scan {{ interface }} |
727 | plugin: shell |
728 | category_id: com.canonical.plainbox::wireless |
729 | -id: wireless/info_automated |
730 | -requires: |
731 | - package.name == 'network-manager' |
732 | - device.category == 'WIRELESS' |
733 | -command: udev_resource -f WIRELESS | awk "/interface: / { print \$2 }" | xargs -n 1 network_info |
734 | -estimated_duration: 1.2 |
735 | -_description: |
736 | - 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. |
737 | - |
738 | -plugin: user-interact-verify |
739 | -category_id: com.canonical.plainbox::wireless |
740 | -id: wireless/wireless_connection |
741 | -command: network_check |
742 | -estimated_duration: 120.0 |
743 | -requires: device.category == 'WIRELESS' |
744 | +estimated_duration: 6 |
745 | _description: |
746 | - PURPOSE: |
747 | - This test will check your wireless connection. |
748 | - STEPS: |
749 | - 1. Click on the Network icon in the panel. |
750 | - 2. Select a network below the 'Wireless networks' section. |
751 | - 3. Click "Test" to verify that it's possible to establish an HTTP connection. |
752 | - VERIFICATION: |
753 | - Did a notification show and was the connection correctly established? |
754 | + Check system can find a wireless network AP nearby |
755 | +flags: preserve-locale also-after-suspend |
756 | +requires: |
757 | + {%- if "SNAP_NAME" in __system_env__ %} |
758 | + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' |
759 | + {% endif -%} |
760 | |
761 | +unit: template |
762 | +template-resource: device |
763 | +template-filter: device.category == 'WIRELESS' |
764 | +template-engine: jinja2 |
765 | +template-unit: job |
766 | +id: wireless/wireless_connection_wpa_bg_nm_{{ interface }} |
767 | +_summary: Connect to WPA-encrypted 802.11b/g Wi-Fi network on {{ interface }} |
768 | +_purpose: |
769 | + Check system can connect to 802.11b/g AP with wpa security |
770 | plugin: shell |
771 | -category_id: com.canonical.plainbox::wireless |
772 | -id: wireless/wireless_connection_wpa_bg |
773 | -requires: |
774 | - device.category == 'WIRELESS' |
775 | - environment.ROUTERS == 'multiple' |
776 | -user: root |
777 | -environ: WPA_BG_SSID WPA_BG_PSK |
778 | command: |
779 | - trap "nmcli con delete id $WPA_BG_SSID" EXIT |
780 | - if create_connection wifi $WPA_BG_SSID --security=wpa --key=$WPA_BG_PSK; then |
781 | - connect_wireless # lp:1471663 |
782 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
783 | - iw dev $INTERFACE link |
784 | - gateway_ping_test --interface=$INTERFACE |
785 | - STATUS=$? |
786 | - # We reconnect the Ethernet connection if any (lp:1471663) |
787 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
788 | - if [[ ! -z $WIRED ]]; then |
789 | - nmcli c up uuid $WIRED |
790 | - fi |
791 | - exit $STATUS |
792 | - else |
793 | - exit 1 |
794 | - fi |
795 | + net_driver_info $NET_DRIVER_INFO |
796 | + wifi_nmcli_test secured {{ interface }} "$WPA_BG_SSID" "$WPA_BG_PSK" |
797 | +category_id: com.canonical.plainbox::wireless |
798 | estimated_duration: 30.0 |
799 | -_description: |
800 | - Tests that the systems wireless hardware can connect to a router using WPA |
801 | - security and the 802.11b/g protocols. |
802 | +flags: preserve-locale also-after-suspend |
803 | +requires: |
804 | + {%- if "SNAP_NAME" in __system_env__ %} |
805 | + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' |
806 | + {% endif -%} |
807 | |
808 | +unit: template |
809 | +template-resource: device |
810 | +template-filter: device.category == 'WIRELESS' |
811 | +template-engine: jinja2 |
812 | +template-unit: job |
813 | +id: wireless/wireless_connection_open_bg_nm_{{ interface }} |
814 | +_summary: Connect to unencrypted 802.11b/g Wi-Fi network on {{ interface }} |
815 | +_purpose: |
816 | + Check system can connect to insecure 802.11b/g AP |
817 | plugin: shell |
818 | -category_id: com.canonical.plainbox::wireless |
819 | -id: wireless/wireless_connection_open_bg |
820 | -requires: |
821 | - device.category == 'WIRELESS' |
822 | - environment.ROUTERS == 'multiple' |
823 | -user: root |
824 | -environ: OPEN_BG_SSID |
825 | command: |
826 | - trap "nmcli con delete id $OPEN_BG_SSID" EXIT |
827 | - if create_connection wifi $OPEN_BG_SSID; then |
828 | - connect_wireless # lp:1471663 |
829 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
830 | - iw dev $INTERFACE link |
831 | - gateway_ping_test --interface=$INTERFACE |
832 | - STATUS=$? |
833 | - # We reconnect the Ethernet connection if any (lp:1471663) |
834 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
835 | - if [[ ! -z $WIRED ]]; then |
836 | - nmcli c up uuid $WIRED |
837 | - fi |
838 | - exit $STATUS |
839 | - else |
840 | - exit 1 |
841 | - fi |
842 | + net_driver_info $NET_DRIVER_INFO |
843 | + wifi_nmcli_test open {{ interface }} "$OPEN_BG_SSID" |
844 | +category_id: com.canonical.plainbox::wireless |
845 | estimated_duration: 30.0 |
846 | -_description: |
847 | - Tests that the systems wireless hardware can connect to a router using no |
848 | - security and the 802.11b/g protocols. |
849 | +flags: preserve-locale also-after-suspend |
850 | +requires: |
851 | + {%- if "SNAP_NAME" in __system_env__ %} |
852 | + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' |
853 | + {% endif -%} |
854 | |
855 | +unit: template |
856 | +template-resource: device |
857 | +template-filter: device.category == 'WIRELESS' |
858 | +template-engine: jinja2 |
859 | +template-unit: job |
860 | +id: wireless/wireless_connection_wpa_n_nm_{{ interface }} |
861 | +_summary: Connect to WPA-encrypted 802.11n Wi-Fi network on {{ interface }} |
862 | +_purpose: |
863 | + Check system can connect to 802.11n AP with wpa security |
864 | plugin: shell |
865 | -category_id: com.canonical.plainbox::wireless |
866 | -id: wireless/wireless_connection_wpa_n |
867 | -requires: |
868 | - device.category == 'WIRELESS' |
869 | - environment.ROUTERS == 'multiple' |
870 | -user: root |
871 | -environ: WPA_N_SSID WPA_N_PSK |
872 | command: |
873 | - trap "nmcli con delete id $WPA_N_SSID" EXIT |
874 | - if create_connection wifi $WPA_N_SSID --security=wpa --key=$WPA_N_PSK; then |
875 | - connect_wireless # lp:1471663 |
876 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
877 | - iw dev $INTERFACE link |
878 | - gateway_ping_test --interface=$INTERFACE |
879 | - STATUS=$? |
880 | - # We reconnect the Ethernet connection if any (lp:1471663) |
881 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
882 | - if [[ ! -z $WIRED ]]; then |
883 | - nmcli c up uuid $WIRED |
884 | - fi |
885 | - exit $STATUS |
886 | - else |
887 | - exit 1 |
888 | - fi |
889 | + net_driver_info $NET_DRIVER_INFO |
890 | + wifi_nmcli_test secured {{ interface }} "$WPA_N_SSID" "$WPA_N_PSK" |
891 | +category_id: com.canonical.plainbox::wireless |
892 | estimated_duration: 30.0 |
893 | -_description: |
894 | - Tests that the systems wireless hardware can connect to a router using WPA |
895 | - security and the 802.11n protocol. |
896 | +flags: preserve-locale also-after-suspend |
897 | +requires: |
898 | + wireless_sta_protocol.{{ interface }}_n == 'supported' |
899 | + {%- if "SNAP_NAME" in __system_env__ %} |
900 | + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' |
901 | + {% endif -%} |
902 | |
903 | +unit: template |
904 | +template-resource: device |
905 | +template-filter: device.category == 'WIRELESS' |
906 | +template-engine: jinja2 |
907 | +template-unit: job |
908 | +id: wireless/wireless_connection_open_n_nm_{{ interface }} |
909 | +_summary: Connect to unencrypted 802.11n Wi-Fi network on {{ interface }} |
910 | +_purpose: |
911 | + Check system can connect to insecure 802.11n AP |
912 | plugin: shell |
913 | -category_id: com.canonical.plainbox::wireless |
914 | -id: wireless/wireless_connection_open_n |
915 | -requires: |
916 | - device.category == 'WIRELESS' |
917 | - environment.ROUTERS == 'multiple' |
918 | -user: root |
919 | -environ: OPEN_N_SSID |
920 | command: |
921 | - trap "nmcli con delete id $OPEN_N_SSID" EXIT |
922 | - if create_connection wifi $OPEN_N_SSID; then |
923 | - connect_wireless # lp:1471663 |
924 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
925 | - iw dev $INTERFACE link |
926 | - gateway_ping_test --interface=$INTERFACE |
927 | - STATUS=$? |
928 | - # We reconnect the Ethernet connection if any (lp:1471663) |
929 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
930 | - if [[ ! -z $WIRED ]]; then |
931 | - nmcli c up uuid $WIRED |
932 | - fi |
933 | - exit $STATUS |
934 | - else |
935 | - exit 1 |
936 | - fi |
937 | + net_driver_info $NET_DRIVER_INFO |
938 | + wifi_nmcli_test open {{ interface }} "$OPEN_N_SSID" |
939 | +category_id: com.canonical.plainbox::wireless |
940 | estimated_duration: 30.0 |
941 | -_description: |
942 | - Tests that the systems wireless hardware can connect to a router using no |
943 | - security and the 802.11n protocol. |
944 | +flags: preserve-locale also-after-suspend |
945 | +requires: |
946 | + wireless_sta_protocol.{{ interface }}_n == 'supported' |
947 | + {%- if "SNAP_NAME" in __system_env__ %} |
948 | + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' |
949 | + {% endif -%} |
950 | |
951 | +unit: template |
952 | +template-resource: device |
953 | +template-filter: device.category == 'WIRELESS' |
954 | +template-engine: jinja2 |
955 | +template-unit: job |
956 | +id: wireless/wireless_connection_wpa_ac_nm_{{ interface }} |
957 | +_summary: Connect to WPA-encrypted 802.11ac Wi-Fi network on {{ interface }} |
958 | +_purpose: |
959 | + Check system can connect to 802.11ac AP with wpa security |
960 | plugin: shell |
961 | -category_id: com.canonical.plainbox::wireless |
962 | -id: wireless/wireless_connection_wpa_ac |
963 | -requires: |
964 | - device.category == 'WIRELESS' |
965 | - environment.ROUTERS == 'multiple' |
966 | - IEEE_80211.ac == 'supported' |
967 | -user: root |
968 | -environ: WPA_AC_SSID WPA_AC_PSK |
969 | command: |
970 | - trap "nmcli con delete id $WPA_AC_SSID" EXIT |
971 | - if create_connection wifi $WPA_AC_SSID --security=wpa --key=$WPA_AC_PSK; then |
972 | - connect_wireless # lp:1471663 |
973 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
974 | - iw dev $INTERFACE link |
975 | - gateway_ping_test --interface=$INTERFACE |
976 | - STATUS=$? |
977 | - # We reconnect the Ethernet connection if any (lp:1471663) |
978 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
979 | - if [[ ! -z $WIRED ]]; then |
980 | - nmcli c up uuid $WIRED |
981 | - fi |
982 | - exit $STATUS |
983 | - else |
984 | - exit 1 |
985 | - fi |
986 | + net_driver_info $NET_DRIVER_INFO |
987 | + wifi_nmcli_test secured {{ interface }} "$WPA_AC_SSID" "$WPA_AC_PSK" |
988 | +category_id: com.canonical.plainbox::wireless |
989 | estimated_duration: 30.0 |
990 | -_description: |
991 | - Tests that the systems wireless hardware can connect to a router using WPA |
992 | - security and the 802.11ac protocol. |
993 | +flags: preserve-locale also-after-suspend |
994 | +requires: |
995 | + wireless_sta_protocol.{{ interface }}_ac == 'supported' |
996 | + {%- if "SNAP_NAME" in __system_env__ %} |
997 | + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' |
998 | + {% endif -%} |
999 | |
1000 | +unit: template |
1001 | +template-resource: device |
1002 | +template-filter: device.category == 'WIRELESS' |
1003 | +template-engine: jinja2 |
1004 | +template-unit: job |
1005 | +id: wireless/wireless_connection_open_ac_nm_{{ interface }} |
1006 | +_summary: Connect to unencrypted 802.11ac Wi-Fi network on {{ interface }} |
1007 | +_purpose: |
1008 | + Check system can connect to insecure 802.11ac AP |
1009 | plugin: shell |
1010 | -category_id: com.canonical.plainbox::wireless |
1011 | -id: wireless/wireless_connection_open_ac |
1012 | -requires: |
1013 | - device.category == 'WIRELESS' |
1014 | - environment.ROUTERS == 'multiple' |
1015 | - IEEE_80211.ac == 'supported' |
1016 | -user: root |
1017 | -environ: OPEN_AC_SSID |
1018 | command: |
1019 | - trap "nmcli con delete id $OPEN_AC_SSID" EXIT |
1020 | - if create_connection wifi $OPEN_AC_SSID; then |
1021 | - connect_wireless # lp:1471663 |
1022 | - INTERFACE=`nmcli dev status | awk '/802-11-wireless|wifi/ {print $1}'` |
1023 | - iw dev $INTERFACE link |
1024 | - gateway_ping_test --interface=$INTERFACE |
1025 | - STATUS=$? |
1026 | - # We reconnect the Ethernet connection if any (lp:1471663) |
1027 | - WIRED=$(nmcli -f UUID,TYPE c | grep -oP ".*(?=\s+.*ethernet)") |
1028 | - if [[ ! -z $WIRED ]]; then |
1029 | - nmcli c up uuid $WIRED |
1030 | - fi |
1031 | - exit $STATUS |
1032 | - else |
1033 | - exit 1 |
1034 | - fi |
1035 | + net_driver_info $NET_DRIVER_INFO |
1036 | + wifi_nmcli_test open {{ interface }} "$OPEN_AC_SSID" |
1037 | +category_id: com.canonical.plainbox::wireless |
1038 | estimated_duration: 30.0 |
1039 | -_description: |
1040 | - Tests that the systems wireless hardware can connect to a router using no |
1041 | - security and the 802.11ac protocol. |
1042 | +flags: preserve-locale also-after-suspend |
1043 | +requires: |
1044 | + wireless_sta_protocol.{{ interface }}_ac == 'supported' |
1045 | + {%- if "SNAP_NAME" in __system_env__ %} |
1046 | + connections.slot == 'network-manager:service' and connections.plug == '{{ __system_env__["SNAP_NAME"] }}:network-manager' |
1047 | + {% endif -%} |
1048 | |
1049 | plugin: user-interact-verify |
1050 | category_id: com.canonical.plainbox::wireless |
1051 | @@ -525,78 +444,3 @@ command: |
1052 | estimated_duration: 330.0 |
1053 | _description: |
1054 | Tests the performance of a system's wireless connection through the iperf tool, using UDP packets. |
1055 | - |
1056 | -unit: template |
1057 | -template-resource: device |
1058 | -template-filter: |
1059 | - device.category == 'WIRELESS' |
1060 | -plugin: shell |
1061 | -category_id: com.canonical.plainbox::wireless |
1062 | -id: wireless/stress_performance_device{__index__}_{interface} |
1063 | -estimated_duration: 330.0 |
1064 | -requires: |
1065 | - package.name == 'iperf' |
1066 | -environ: TEST_TARGET_IPERF |
1067 | -user: root |
1068 | -command: network test -i {interface} -t stress |
1069 | -_description: |
1070 | - 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. |
1071 | - |
1072 | -plugin: shell |
1073 | -category_id: com.canonical.plainbox::wireless |
1074 | -id: wireless/wireless_extension |
1075 | -requires: device.category == 'WIRELESS' |
1076 | -command: wireless_ext |
1077 | -estimated_duration: 1.2 |
1078 | -_description: |
1079 | - Test that the MAC80211 modules are loaded and wireless extensions are working. |
1080 | - |
1081 | -unit: template |
1082 | -template-resource: device |
1083 | -template-filter: device.category == 'WIRELESS' |
1084 | -plugin: shell |
1085 | -category_id: com.canonical.plainbox::wireless |
1086 | -id: wireless/iwconfig_check_device{__index__}_{interface} |
1087 | -estimated_duration: 1.2 |
1088 | -command: iwconfig {interface} |
1089 | -_description: |
1090 | - This test executes iwconfig requests against wireless device {__index__} ({interface}). |
1091 | - |
1092 | -plugin: user-interact-verify |
1093 | -category_id: com.canonical.plainbox::wireless |
1094 | -id: wireless/wireless_rfkill |
1095 | -command: rfkill list | zenity --text-info --title rfkill-Info |
1096 | -estimated_duration: 120.0 |
1097 | -requires: device.category == 'WIRELESS' |
1098 | -_description: |
1099 | - PURPOSE: |
1100 | - This test will check whether or not your driver responds to rfkill commands. |
1101 | - STEPS: |
1102 | - 1. Use the hardware switch on the side of your device to switch off wireless. |
1103 | - 2. If you do not have a hardware switch disable wireless from the network manager icon in the panel |
1104 | - 3. Click "Test" to verify that the hard or soft blocks are in place. |
1105 | - VERIFICATION: |
1106 | - Did the hard or soft blocks show on in the dialog? |
1107 | - |
1108 | -unit: template |
1109 | -template-resource: device |
1110 | -template-filter: device.category == 'WIRELESS' |
1111 | -plugin: user-interact-verify |
1112 | -category_id: com.canonical.plainbox::wireless |
1113 | -id: wireless/maximum_bandwidth_device{__index__}_{interface} |
1114 | -estimated_duration: 120.0 |
1115 | -requires: |
1116 | - package.name == 'zenity' |
1117 | - package.name == 'iperf' |
1118 | -environ: TEST_TARGET_IPERF |
1119 | -user: root |
1120 | -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}' |
1121 | -_purpose: |
1122 | - User verification of whether the observed transfer throughput is acceptable |
1123 | - for the type and maximum speed of wireless device {__index__} ({interface}). |
1124 | -_steps: |
1125 | - 1. Click "Test". |
1126 | - 2. Read the network test summary and confirm that the throughput is acceptable. |
1127 | - 3. If needed, click "Test" again to repeat the transfer test. |
1128 | -_verification: |
1129 | - Was the reported throughput acceptable for the type and maximum speed of this interface? |
1130 | diff --git a/units/wireless/test-plan.pxu b/units/wireless/test-plan.pxu |
1131 | index b4cf2f7..e1b6cfd 100644 |
1132 | --- a/units/wireless/test-plan.pxu |
1133 | +++ b/units/wireless/test-plan.pxu |
1134 | @@ -19,38 +19,38 @@ unit: test plan |
1135 | _name: Wireless tests |
1136 | _description: Wireless connection tests |
1137 | include: |
1138 | - wireless/wireless_scanning certification-status=blocker |
1139 | - wireless/wireless_connection_wpa_bg certification-status=blocker |
1140 | - wireless/wireless_connection_open_bg certification-status=blocker |
1141 | - wireless/wireless_connection_wpa_n certification-status=blocker |
1142 | - wireless/wireless_connection_open_n certification-status=blocker |
1143 | - wireless/wireless_connection_wpa_ac certification-status=blocker |
1144 | - wireless/wireless_connection_open_ac certification-status=blocker |
1145 | + wireless/wireless_scanning_.* certification-status=blocker |
1146 | + wireless/wireless_connection_wpa_bg_nm_.* certification-status=blocker |
1147 | + wireless/wireless_connection_open_bg_nm_.* certification-status=blocker |
1148 | + wireless/wireless_connection_wpa_n_nm_.* certification-status=blocker |
1149 | + wireless/wireless_connection_open_n_nm_.* certification-status=blocker |
1150 | + wireless/wireless_connection_wpa_ac_nm_.* certification-status=blocker |
1151 | + wireless/wireless_connection_open_ac_nm_.* certification-status=blocker |
1152 | |
1153 | id: after-suspend-wireless-cert-automated |
1154 | unit: test plan |
1155 | _name: Wireless tests (after suspend, automated) |
1156 | _description: Wireless connection tests (after suspend, automated) |
1157 | include: |
1158 | - suspend/wireless_connection_after_suspend_wpa_bg certification-status=blocker |
1159 | - suspend/wireless_connection_after_suspend_open_bg certification-status=blocker |
1160 | - suspend/wireless_connection_after_suspend_wpa_n certification-status=blocker |
1161 | - suspend/wireless_connection_after_suspend_open_n certification-status=blocker |
1162 | - suspend/wireless_connection_after_suspend_wpa_ac certification-status=blocker |
1163 | - suspend/wireless_connection_after_suspend_open_ac certification-status=blocker |
1164 | + after-suspend-wireless/wireless_connection_wpa_bg_nm_.* certification-status=blocker |
1165 | + after-suspend-wireless/wireless_connection_open_bg_nm_.* certification-status=blocker |
1166 | + after-suspend-wireless/wireless_connection_wpa_n_nm_.* certification-status=blocker |
1167 | + after-suspend-wireless/wireless_connection_open_n_nm_.* certification-status=blocker |
1168 | + after-suspend-wireless/wireless_connection_wpa_ac_nm_.* certification-status=blocker |
1169 | + after-suspend-wireless/wireless_connection_open_ac_nm_.* certification-status=blocker |
1170 | |
1171 | id: wireless-cert-blockers |
1172 | unit: test plan |
1173 | _name: Wireless tests (certification blockers only) |
1174 | _description: Wireless connection tests (certification blockers only) |
1175 | include: |
1176 | - wireless/wireless_scanning certification-status=blocker |
1177 | - wireless/wireless_connection_wpa_bg certification-status=blocker |
1178 | - wireless/wireless_connection_open_bg certification-status=blocker |
1179 | - wireless/wireless_connection_wpa_n certification-status=blocker |
1180 | - wireless/wireless_connection_open_n certification-status=blocker |
1181 | - wireless/wireless_connection_wpa_ac certification-status=blocker |
1182 | - wireless/wireless_connection_open_ac certification-status=blocker |
1183 | + wireless/wireless_scanning_.* certification-status=blocker |
1184 | + wireless/wireless_connection_wpa_bg_nm_.* certification-status=blocker |
1185 | + wireless/wireless_connection_open_bg_nm_.* certification-status=blocker |
1186 | + wireless/wireless_connection_wpa_n_nm_.* certification-status=blocker |
1187 | + wireless/wireless_connection_open_n_nm_.* certification-status=blocker |
1188 | + wireless/wireless_connection_wpa_ac_nm_.* certification-status=blocker |
1189 | + wireless/wireless_connection_open_ac_nm_.* certification-status=blocker |
1190 | |
1191 | id: after-suspend-wireless-cert-blockers |
1192 | unit: test plan |
1193 | @@ -58,9 +58,9 @@ _name: Wireless tests (after suspend, certification blockers only) |
1194 | _description: |
1195 | Wireless connection tests (after suspend, certification blockers only) |
1196 | include: |
1197 | - suspend/wireless_connection_after_suspend_wpa_bg certification-status=blocker |
1198 | - suspend/wireless_connection_after_suspend_open_bg certification-status=blocker |
1199 | - suspend/wireless_connection_after_suspend_wpa_n certification-status=blocker |
1200 | - suspend/wireless_connection_after_suspend_open_n certification-status=blocker |
1201 | - suspend/wireless_connection_after_suspend_wpa_ac certification-status=blocker |
1202 | - suspend/wireless_connection_after_suspend_open_ac certification-status=blocker |
1203 | + after-suspend-wireless/wireless_connection_wpa_bg_nm_.* certification-status=blocker |
1204 | + after-suspend-wireless/wireless_connection_open_bg_nm_.* certification-status=blocker |
1205 | + after-suspend-wireless/wireless_connection_wpa_n_nm_.* certification-status=blocker |
1206 | + after-suspend-wireless/wireless_connection_open_n_nm_.* certification-status=blocker |
1207 | + after-suspend-wireless/wireless_connection_wpa_ac_nm_.* certification-status=blocker |
1208 | + after-suspend-wireless/wireless_connection_open_ac_nm_.* certification-status=blocker |
1. Previous job definitions were running commands as root, are we able to run the python wrapper as the normal user now? plainbox. readthedocs. io/en/latest/ manpages/ plainbox- job-units. html). You can delete those lines.
2. Lots of new jobs are using the environ filed which is not needed when running command as a non root user (See http://
3. What happens if $NET_DRIVER_INFO is not set? should we condition the call to bin/net_driver_info only if the variable exists?
4. Can all _manual connection tests benefit from the python tool? to get rid again of the inline bash commands?