diff options
author | Weilong Chen <weilong.chen@linaro.org> | 2014-04-17 19:52:29 +0800 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-05-07 14:23:51 +0000 |
commit | 183d092e5529867cd9eb49c55a0c6bad132ab8f3 (patch) | |
tree | a9942a7fa369dedae377c4980e6f90ba72c4e2cc /common | |
parent | 97cd698f46250318184f064e0c9b16dbe593bfe2 (diff) |
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 <weilong.chen@linaro.org>
Diffstat (limited to 'common')
-rwxr-xr-x | common/scripts/generator.sh | 41 | ||||
-rw-r--r-- | common/scripts/pcapfiles/iperf.pcap | bin | 0 -> 80664 bytes |
2 files changed, 41 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 0000000..95dc994 --- /dev/null +++ b/common/scripts/pcapfiles/iperf.pcap |