Merge lp:~rodsmith/hwcert-tools/multi-iperf3 into lp:~leftyfb/hwcert-tools/cert-precheck

Proposed by Rod Smith
Status: Merged
Approved by: Mike Rushton
Approved revision: 20
Merged at revision: 20
Proposed branch: lp:~rodsmith/hwcert-tools/multi-iperf3
Merge into: lp:~leftyfb/hwcert-tools/cert-precheck
Diff against target: 45 lines (+29/-7)
1 file modified
cert-precheck (+29/-7)
To merge this branch: bzr merge lp:~rodsmith/hwcert-tools/multi-iperf3
Reviewer Review Type Date Requested Status
Mike Rushton Approve
Review via email: mp+283701@code.launchpad.net

Description of the change

Mike,

I've looked over your pre-certification script, and have these changes for you. The issue is that your script didn't parse multiple iperf targets in /etc/xdg/canonical-certification.conf, or check for iperf3 servers. My patch does that. A few notes:

* It mostly-replicates the iperf2 code to test iperf3. I'd rather do a loop, but that started to get hairy in various ways, so I left it with mostly-replicated code instead.
* I use an iperf3 call to check for the presence of the server rather than nc because I discovered that the iperf3 server terminates after several unsuccessful connection attempts by nc, so the test could end up causing problems if nc were used. This has the drawback that the script will pause for a bit if an IP address is invalid, but otherwise it seems to work fine.
* My change is a little verbose in what it reports, but trimming it more might make it less useful.

To post a comment you must log in.
Revision history for this message
Mike Rushton (leftyfb) :
review: Approve
Revision history for this message
Mike Rushton (leftyfb) wrote :

Looks good. Thanks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cert-precheck'
2--- cert-precheck 2016-01-19 20:16:41 +0000
3+++ cert-precheck 2016-01-22 21:22:08 +0000
4@@ -162,13 +162,35 @@
5 fail
6 fi
7 fi
8-iperfserver=$(grep ^TEST_TARGET_IPERF /etc/xdg/canonical-certification.conf|awk '{print $3}')
9-nc -z $iperfserver 5001
10-if [ $? = 0 ]; then
11- echo " Iperf server found on port 5001 on $iperfserver"
12-elif [ $? = 1 ]; then
13- echo " No Iperf server configured at $iperfserver"
14- fail
15+local iperf2found=0
16+local iperf3found=0
17+for iperfserver in $(grep ^TEST_TARGET_IPERF /etc/xdg/canonical-certification.conf | cut -d = -f 2 | sed s/,/\\n/g)
18+ do
19+ echo " Testing $iperfserver"
20+ local iperffound=0
21+ nc -z $iperfserver 5001
22+ if [ $? = 0 ]; then
23+ echo " Iperf server found on port 5001 on $iperfserver"
24+ iperf2found=1
25+ iperffound=1
26+ fi
27+ iperf3 -c $iperfserver -n 1 &> /dev/null
28+ if [ $? = 0 ]; then
29+ echo " Iperf3 server found on port 5201 on $iperfserver"
30+ iperf3found=1
31+ iperffound=1
32+ fi
33+ if [ $iperffound = 0 ]; then
34+ echo " No Iperf (2) or iperf3 server found on $iperfserver"
35+ fi
36+done
37+if [[ $iperf2found == 0 ]]; then
38+ echo " No iperf (2) server found"
39+ fail
40+fi
41+if [[ $iperf3found == 0 ]]; then
42+ echo " No iperf3 server found"
43+ fail
44 fi
45 }
46

Subscribers

People subscribed via source and target branches

to all changes: