summaryrefslogtreecommitdiff
path: root/common/scripts/replay.sh
blob: 5776fd45e0aa0ee678d357cb62463f0136e43f8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/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
local_mac=$(ifconfig eth0 | grep "HWaddr" | awk '{print $5}')
ping -c 1 ${remote_ip} || exit 1
remote_mac=$(arp -a | grep "${remote_ip}" | awk '{print $4}')

tcpprep -a client -i telnet.cap -o telnet.cache
tcprewrite  --enet-smac=$local_mac,$remote_mac --enet-dmac=$remote_mac,$local_mac --endpoints=$local_ip:$remote_ip -c telnet.cache -i telnet.cap -o out.telnet.pcap --skipbroadcast
tcpreplay -i eth0 -l 100 -t -c telnet.cache out.telnet.pcap | ./common/scripts/netperf2LAVA.py