diff mbox

Initial multinode netperf test.

Message ID 1378733973-4525-1-git-send-email-guoqing.zhu@linaro.org
State New
Headers show

Commit Message

Guoqing Zhu Sept. 9, 2013, 1:39 p.m. UTC
---
 lng-netperf/netperf-client.sh | 34 +++++++++++++++++++++++
 lng-netperf/netperf-server.sh |  5 ++++
 lng-netperf/netperf2LAVA.py   | 63 +++++++++++++++++++++++++++++++++++++++++++
 netperf-client-multinode.yaml | 39 +++++++++++++++++++++++++++
 netperf-server-multinode.yaml | 39 +++++++++++++++++++++++++++
 5 files changed, 180 insertions(+)
 create mode 100755 lng-netperf/netperf-client.sh
 create mode 100755 lng-netperf/netperf-server.sh
 create mode 100755 lng-netperf/netperf2LAVA.py
 create mode 100644 netperf-client-multinode.yaml
 create mode 100644 netperf-server-multinode.yaml
diff mbox

Patch

diff --git a/lng-netperf/netperf-client.sh b/lng-netperf/netperf-client.sh
new file mode 100755
index 0000000..324978a
--- /dev/null
+++ b/lng-netperf/netperf-client.sh
@@ -0,0 +1,34 @@ 
+#!/bin/sh
+
+set -x
+
+local_ip=$(ifconfig|grep "inet addr"|grep -v "127.0.0.1"|cut -d: -f2|cut -d' ' -f1)
+
+for line in `lava-group | grep server | awk '{print $1}'` ; do
+	echo $line
+	# get the ipv4 for this device
+	STR=`lava-network query $line ipv4`
+	echo "STR: "$STR
+	# strip off the prefix for ipv4
+	DUT=`echo $STR | sed -e 's/.*addr://'`
+	echo "DUT: "$DUT
+	if [ "${local_ip}" != "${DUT}" ]; then
+		remote_ip=${DUT}
+		echo ${remote_ip}
+		break
+	fi
+done
+
+if [ -z ${remote_ip} ]
+then
+	echo "Missing remote ip!"
+	exit 1
+fi
+
+ifconfig -a
+ping -c 1 ${remote_ip} || exit 1
+ping -c 30 ${remote_ip} | ./lng-netperf/netperf2LAVA.py
+for m in 64 128 256 512 1024 2048 4096 8192 16384; do netperf -H ${remote_ip} -l 20 -c -C -- -m $m -D; done | ./lng-netperf/netperf2LAVA.py
+for m in 64 128 256 512 1024 2048 4096 8192 16384; do netperf -H ${remote_ip} -l 20 -t UDP_STREAM -c -C -- -m $m -D; done | ./lng-netperf/netperf2LAVA.py
+for m in 1 32 64 128 512 1024 4096 8192 16384; do netperf -t TCP_RR -H ${remote_ip} -l 20 -c -C -- -r $m,$m -D; done | ./lng-netperf/netperf2LAVA.py
+for m in 1 32 64 128 512 1024 4096 8192 16384; do netperf -t UDP_RR -H ${remote_ip} -l 20 -c -C -- -r $m,$m -D; done | ./lng-netperf/netperf2LAVA.py
diff --git a/lng-netperf/netperf-server.sh b/lng-netperf/netperf-server.sh
new file mode 100755
index 0000000..7e2fc3c
--- /dev/null
+++ b/lng-netperf/netperf-server.sh
@@ -0,0 +1,5 @@ 
+#!/bin/sh
+
+set -x
+
+netserver && echo 'test_case_id:netserver units:none measurement:0 result:pass' || echo 'test_case_id:netserver units:none measurement:0 result:fail'
diff --git a/lng-netperf/netperf2LAVA.py b/lng-netperf/netperf2LAVA.py
new file mode 100755
index 0000000..ee1199d
--- /dev/null
+++ b/lng-netperf/netperf2LAVA.py
@@ -0,0 +1,63 @@ 
+#!/usr/bin/python
+import re
+import sys
+
+#Parse netperf results looking for the data in the form of
+#line = "87380 16384 2048 10.00 4289.48 51.12 51.12 3.905 3.905" ./netperf -l 10 -c -C -- -m 2048 -D
+#line = "180224    8192   10.00     1654855      0    10845.1     52.60    1.589" ./netperf -t UDP_STREAM -l 10 -c -C -- -m 8192 -D 
+#line = "180224           10.00     1649348           10809.0     52.60    1.589" rcv side of UDP_STREAM
+#line = "16384  87380  1       1      10.00   47469.68  29.84  29.84  25.146  25.146" ./netperf -t TCP_RR -l 10 -c -C -- -r 1,1
+
+found_result = "false"
+parser_rtt = re.compile("^rtt\s+\S+\s+\=\s+(?P<min>\d+\.\d+)\/(?P<avg>\d+\.\d+)\/(?P<max>\d+\.\d+)\/(?P<mdev>\d+\.\d+)")
+parser_tcp = re.compile("^\s*(?P<Recv>\d+)\s+(?P<Send>\d+)\s+(?P<Msg>\d+)\s+(?P<time>\d+\.\d+)\s+(?P<throughput>\d+\.\d+)\s+(?P<cpu_s>\d+\.\d+)\s+(?P<cpu_r>\d+\.\d+)\s+(?P<srv_s>\d+\.\d+)\s+(?P<dem_r>\d+\.\d+)\s*$")
+parser_udp_l = re.compile("^\s*(?P<Sock>\d+)\s+(?P<Msg>\d+)\s+(?P<time>\d+\.\d+)\s+(?P<Okey>\d+)\s+(?P<Errs>\d+)\s+(?P<throughput>\d+\.\d+)\s+(?P<cpu_s>\d+\.\d+)\s+(?P<srv_s>\d+\.\d+)\s*$")
+parser_udp_r = re.compile("^\s*(?P<Sock>\d+)\s+(?P<time>\d+\.\d+)\s+(?P<Okey>\d+)\s+(?P<throughput>\d+\.\d+)\s+(?P<cpu_r>\d+\.\d+)\s+(?P<srv_r>\d+\.\d+)\s*$")
+parser_rr = re.compile("^\s*(?P<Send>\d+)\s+(?P<Recv>\d+)\s+(?P<Req>\d+)\s+(?P<Res>\d+)\s+(?P<time>\d+\.\d+)\s+(?P<trans>\d+\.\d+)\s+(?P<cpu_s>\d+\.\d+)\s+(?P<cpu_r>\d+\.\d+)\s+(?P<srv_s>\d+\.\d+)\s+(?P<dem_r>\d+\.\d+)\s*$")
+parser_rr_tcp = re.compile("TCP REQUEST/RESPONSE")
+parser_rr_udp = re.compile("UDP REQUEST/RESPONSE")
+
+for line in sys.stdin:
+        for parser in [parser_rtt, parser_tcp, parser_udp_l, parser_udp_r, parser_rr, parser_rr_tcp, parser_rr_udp]:
+                result = parser.search(line)
+                if result is not None:
+                        if parser is parser_rr_tcp:
+                                rr_type = "TCP_RR"
+                                break
+                        if parser is parser_rr_udp:
+                                rr_type = "UDP_RR"
+                                break
+                        if parser is parser_rtt:
+                                print "test_case_id:PING_RTT min" + " units:ms " + "measurement:" + result.group('min') + " result:pass" 
+                                print "test_case_id:PING_RTT avg" + " units:ms " + "measurement:" + result.group('avg') + " result:pass"
+                                print "test_case_id:PING_RTT max" + " units:ms " + "measurement:" + result.group('max') + " result:pass"
+                                print "test_case_id:PING_RTT mdev" + " units:ms " + "measurement:" + result.group('mdev') + " result:pass"
+                                found_result = "true"
+                                break
+                        if parser is parser_tcp:
+                                print "test_case_id:TCP_STREAM throughput" + "(Msg Sz: " + result.group('Msg') + ")" + " units:10^bits/sec " + "measurement:" + result.group('throughput') + " result:pass"
+                                print "test_case_id:TCP_STREAM snd cpu utilization" + "(Msg Sz: " + result.group('Msg') + ")" + " units:% " + "measurement:" + result.group('cpu_s') + " result:pass"
+                                print "test_case_id:TCP_STREAM rcv cpu utilization" + "(Msg Sz: " + result.group('Msg') + ")" + " units:% " + "measurement:" + result.group('cpu_r') + " result:pass"
+                                found_result = "true"
+                                break
+                        if parser is parser_udp_l:
+                                print "test_case_id:UDP_STREAM snd throughput" + "(Msg Sz: " + result.group('Msg') + ")" + " units:10^bits/sec " + "measurement:" + result.group('throughput') + " result:pass"
+                                print "test_case_id:UDP_STREAM snd cpu utilization" + "(Msg Sz: " + result.group('Msg') + ")" + " units:% " + "measurement:" + result.group('cpu_s') + " result:pass"
+                                found_result = "true"
+                                break
+                        if parser is parser_udp_r:
+                                print "test_case_id:UDP_STREAM rcv throughput" + " units:10^bits/sec " + "measurement:" + result.group('throughput') + " result:pass"
+                                print "test_case_id:UDP_STREAM rcv cpu utilization" + " units:% " + "measurement:" + result.group('cpu_r') + " result:pass"
+                                found_result = "true"
+                                break
+                        if parser is parser_rr:
+                                print "test_case_id:" + rr_type + " transaction rate" + "(Req Sz: " + result.group('Req') + " Res Sz: " + result.group('Res') + ")" + " units:trans/sec " + "measurement:" + result.group('trans') + " result:pass"
+                                print "test_case_id:" + rr_type + " snd cpu utilization" + "(Req Sz: " + result.group('Req') + " Res Sz: " + result.group('Res') + ")" + " units:% " + "measurement:" + result.group('cpu_s') + " result:pass"
+                                print "test_case_id:" + rr_type + " rcv cpu utilization" + "(Req Sz: " + result.group('Req') + " Res Sz: " + result.group('Res') + ")" + " units:% " + "measurement:" + result.group('cpu_r') + " result:pass"
+                                found_result = "true"
+                                break
+                else:
+                        continue
+
+if found_result == "false":
+        print "units:none " + "measurement:" + "0" + " result:fail"
diff --git a/netperf-client-multinode.yaml b/netperf-client-multinode.yaml
new file mode 100644
index 0000000..89374ed
--- /dev/null
+++ b/netperf-client-multinode.yaml
@@ -0,0 +1,39 @@ 
+metadata:
+    format: Lava-Test Test Definition 1.0
+    name: netperf-client-multinode
+    description: "Basic MultiNode netperf/ping test on client side"
+    maintainer:
+        - guoqing.zhu@linaro.org
+    os:
+        - ubuntu
+    scope:
+        - functional
+        - performance
+        - latency
+        - cpu utilization
+    devices:
+        - kvm
+        - arndale
+        - panda
+        - beaglebone-black
+        - beagle-xm
+        - mx53loco
+
+install:
+     deps:
+         - curl
+         - python
+         - netperf
+
+run:
+    steps:
+        - ifconfig -a
+        - route
+        - lava-network broadcast eth0
+        - lava-network collect eth0
+        - lava-sync ready 
+        - lava-test-case multinode-lava-network --shell ./lng-netperf/netperf-client.sh
+        - lava-sync done 
+
+parse:
+        "pattern": "^test_case_id:(?P<test_case_id>.+) units:(?P<units>.+) measurement:(?P<measurement>\\d+\\.\\d+) result:(?P<result>\\w+)"
diff --git a/netperf-server-multinode.yaml b/netperf-server-multinode.yaml
new file mode 100644
index 0000000..c8ce158
--- /dev/null
+++ b/netperf-server-multinode.yaml
@@ -0,0 +1,39 @@ 
+metadata:
+    format: Lava-Test Test Definition 1.0
+    name: netperf-server-multinode
+    description: "Basic MultiNode netperf/ping test on server side"
+    maintainer:
+        - guoqing.zhu@linaro.org
+    os:
+        - ubuntu
+    scope:
+        - functional
+        - performance
+        - latency
+        - cpu utilization
+    devices:
+        - kvm
+        - arndale
+        - panda
+        - beaglebone-black
+        - beagle-xm
+        - mx53loco
+
+install:
+     deps:
+         - curl
+         - python
+         - netperf
+
+run:
+    steps:
+        - ifconfig -a
+        - route
+        - lava-network broadcast eth0
+        - lava-network collect eth0
+        - lava-sync ready 
+        - lava-test-case multinode-lava-network --shell ./lng-netperf/netperf-server.sh
+        - lava-sync done 
+
+parse:
+        "pattern": "^test_case_id:(?P<test_case_id>.+) units:(?P<units>.+) measurement:(?P<measurement>\\d+\\.\\d+) result:(?P<result>\\w+)"