From 183d092e5529867cd9eb49c55a0c6bad132ab8f3 Mon Sep 17 00:00:00 2001 From: Weilong Chen Date: Thu, 17 Apr 2014 19:52:29 +0800 Subject: BP: TCP Replay to pump pcap traffic for tests Establish basic sanity and regression tests, this is a special case test since it actually generates traffic for other test cases Change-Id: I711c5a4683b116ad54cc8c69e020dcf041fa7317 Signed-off-by: Weilong Chen --- common/scripts/generator.sh | 41 ++++++++++++++++++++++++++++++ common/scripts/pcapfiles/iperf.pcap | Bin 0 -> 80664 bytes openembedded/replay-client-multinode.yaml | 30 ++++++++++++++++++++++ openembedded/replay-server-multinode.yaml | 26 +++++++++++++++++++ ubuntu/replay-client-multinode.yaml | 33 +++++++++--------------- ubuntu/replay-server-multinode.yaml | 23 +++++++---------- 6 files changed, 118 insertions(+), 35 deletions(-) create mode 100755 common/scripts/generator.sh create mode 100644 common/scripts/pcapfiles/iperf.pcap create mode 100644 openembedded/replay-client-multinode.yaml create mode 100644 openembedded/replay-server-multinode.yaml diff --git a/common/scripts/generator.sh b/common/scripts/generator.sh new file mode 100755 index 0000000..61808c8 --- /dev/null +++ b/common/scripts/generator.sh @@ -0,0 +1,41 @@ +#!/bin/sh +set -x +usage() +{ + echo "usage:\n" \ + " - $1 (interface.Primary traffic output interface.)\n" \ + " - $2 (address.The IP address that the packages will be replayed to.)\n" \ + " - $3 (rate.Replay packets at a given packets/sec.It takes an integer number or 'max' as its argument.)\n" \ + " - $4 (loop number.Loop through the capture file X times.)" +} + +if [ $# -ne 4 ]; then + echo "param miss!" + usage + exit 1 +fi + +INTF=$1 +ADDR=$2 +RATE=$3 +LOOP=$4 + +local_ip=$(ifconfig $INTF |grep "inet addr"|grep -v "127.0.0.1"|cut -d: -f2|cut -d' ' -f1) +remote_ip=$ADDR +local_mac=$(ifconfig $INTF | grep "HWaddr" | awk '{print $5}') +ping -c 1 ${remote_ip} +if [ $? -ne 0 ]; then + echo "Address $remote_ip isn't reachable" + exit 1 +fi +remote_mac=$(arp -a | grep "${remote_ip}" | awk '{print $4}') + +opt="-t" +if [ $RATE != 'max' ]; then + opt="-p $RATE" +fi +infile="./common/scripts/pcapfiles/iperf.pcap" +tcpreplay -V +tcpprep -a client -i $infile -o tmpcap.cache +tcprewrite --enet-smac=$local_mac,$remote_mac --enet-dmac=$remote_mac,$local_mac --endpoints=$local_ip:$remote_ip -c tmpcap.cache -i $infile -o out.tmpcap.pcap --skipbroadcast +tcpreplay -i eth0 -l 100 $opt -c tmpcap.cache out.tmpcap.pcap | ./common/scripts/netperf2LAVA.py diff --git a/common/scripts/pcapfiles/iperf.pcap b/common/scripts/pcapfiles/iperf.pcap new file mode 100644 index 0000000..95dc994 Binary files /dev/null and b/common/scripts/pcapfiles/iperf.pcap differ diff --git a/openembedded/replay-client-multinode.yaml b/openembedded/replay-client-multinode.yaml new file mode 100644 index 0000000..24e4050 --- /dev/null +++ b/openembedded/replay-client-multinode.yaml @@ -0,0 +1,30 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: tcpreplay-client-multinode + description: "Basic MultiNode tcpreplay test on client side" + maintainer: + - weilong.chen@linaro.org + os: + - openembedded + scope: + - performance + devices: + - kvm + - arndale +params: + ETH: eth0 + REP: 100 +run: + steps: + - lava-sync start + - ifconfig -a + - route + - lava-network broadcast $ETH + - lava-network collect $ETH + - line=`lava-group | grep server | awk '{print $1}'` + - STR=`lava-network query $line ipv4` + - remote_ip=`echo $STR | sed -e 's/.*addr://'` + - lava-test-case multinode-lava-network --shell ./common/scripts/generator.sh $ETH $remote_ip max $REP + - lava-sync done +parse: + "pattern": "^test_case_id:(?P.+) units:(?P.+) measurement:(?P\\d+\\.\\d+) result:(?P\\w+)" diff --git a/openembedded/replay-server-multinode.yaml b/openembedded/replay-server-multinode.yaml new file mode 100644 index 0000000..595a7ca --- /dev/null +++ b/openembedded/replay-server-multinode.yaml @@ -0,0 +1,26 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: tcpreplay-server-multinode + description: "Basic MultiNode tcpreplay test on server side" + maintainer: + - weilong.chen@linaro.org + os: + - openembedded + scope: + - performance + devices: + - kvm + - arndale +params: + ETH: eth0 +run: + steps: + - lava-sync start + - ifconfig -a + - route + - lava-network broadcast $ETH + - lava-network collect $ETH + - echo "test-0:ignore" + - lava-sync done +parse: + "pattern": "(?P.*-*):\\s+(?P(pass|fail))" diff --git a/ubuntu/replay-client-multinode.yaml b/ubuntu/replay-client-multinode.yaml index 9c1b692..a6246b4 100644 --- a/ubuntu/replay-client-multinode.yaml +++ b/ubuntu/replay-client-multinode.yaml @@ -3,37 +3,28 @@ metadata: name: tcpreplay-client-multinode description: "Basic MultiNode tcpreplay test on client side" maintainer: - - guoqing.zhu@linaro.org + - weilong.chen@linaro.org os: - ubuntu scope: - - functional - performance - - latency - - cpu utilization devices: - kvm - arndale - - panda - - beaglebone-black - - beagle-xm - - mx53loco - -install: - deps: - - wget - - tcpreplay - - python-minimal - +params: + ETH: eth0 + REP: 100 run: steps: - - wget -O telnet.cap http://packetlife.net/captures/telnet.cap + - lava-sync start - ifconfig -a - route - - lava-network broadcast eth0 - - lava-network collect eth0 - - lava-test-case multinode-lava-network --shell ./common/scripts/replay.sh - - lava-sync done - + - lava-network broadcast $ETH + - lava-network collect $ETH + - line=`lava-group | grep server | awk '{print $1}'` + - STR=`lava-network query $line ipv4` + - remote_ip=`echo $STR | sed -e 's/.*addr://'` + - lava-test-case multinode-lava-network --shell ./common/scripts/generator.sh $ETH $remote_ip max $REP + - lava-sync done parse: "pattern": "^test_case_id:(?P.+) units:(?P.+) measurement:(?P\\d+\\.\\d+) result:(?P\\w+)" diff --git a/ubuntu/replay-server-multinode.yaml b/ubuntu/replay-server-multinode.yaml index 4d8b877..5ac8675 100644 --- a/ubuntu/replay-server-multinode.yaml +++ b/ubuntu/replay-server-multinode.yaml @@ -3,29 +3,24 @@ metadata: name: tcpreplay-server-multinode description: "Basic MultiNode tcpreplay test on server side" maintainer: - - guoqing.zhu@linaro.org + - weilong.chen@linaro.org os: - ubuntu scope: - - functional - performance - - latency - - cpu utilization devices: - kvm - arndale - - panda - - beaglebone-black - - beagle-xm - - mx53loco - +params: + ETH: eth0 run: steps: + - lava-sync start - ifconfig -a - route - - lava-network broadcast eth0 - - lava-network collect eth0 - - lava-sync done - + - lava-network broadcast $ETH + - lava-network collect $ETH + - echo "test-0:ignore" + - lava-sync done parse: - "pattern": "^test_case_id:(?P.+) units:(?P.+) measurement:(?P\\d+\\.\\d+) result:(?P\\w+)" + "pattern": "(?P.*-*):\\s+(?P(pass|fail))" -- cgit v1.2.3