# Script to test communication
# Usage: "run host1 host2 host3"
# host1 and host2 are on same net (interface)
# host 3 is on different net
#Run netperf between nodes
#make sure netserver is running on host2 and host3
date |tee net-test.out
sleep 3
echo "SENDING NETPERF TO ONE HOST" |tee -a net-test.out
./netperf -t UDP_STREAM -n 2 -l 180 -H $1 - -s 65535 -m 1472 |tee -a net-test.out
./netperf -t TCP_STREAM -n 2 -l 180 -H $1 |tee -a net-test.out
echo "SENDING NETPERF TO TWO HOSTS SAME NET" |tee -a net-test.out
./netperf -t UDP_STREAM -n 2 -l 180 -H $1 - -s 65535 -m 1472 |tee -a net-test.out &
./netperf -t UDP_STREAM -n 2 -l 180 -H $2 - -s 65535 -m 1472 |tee -a net-test.out
./netperf -t TCP_STREAM -n 2 -l 180 -H $2 |tee -a net-test.out &
./netperf -t TCP_STREAM -n 2 -l 180 -H $1 |tee -a net-test.out
echo "SENDING NETPERF TO TWO HOSTS DIFFERENT NET" |tee -a net-test.out
./netperf -t UDP_STREAM -n 2 -l 180 -H $1 - -s 65535 -m 1472 |tee -a net-test.out &
./netperf -t UDP_STREAM -n 2 -l 180 -H $3 - -s 65535 -m 1472 |tee -a net-test.out
./netperf -t TCP_STREAM -n 2 -l 180 -H $3 |tee -a net-test.out &
./netperf -t TCP_STREAM -n 2 -l 180 -H $1 |tee -a net-test.out
#Now run Netpipe
rsh $1 net/NPtcp -r &
sleep 30
echo "SENDING NPtcp TO ONE HOST" |tee -a net-test.out
./NPtcp -t -h $1 -o netpipe.out.single -u 1048576
sleep 3
rsh $1 net/NPtcp -r &
rsh $2 net/NPtcp -r &
sleep 30
echo "SENDING NPtcp TO TWO HOSTS SAME NET" |tee -a net-test.out
./NPtcp -t -h $1 -o netpipe.out.dual1-same -u 1048576 &
./NPtcp -t -h $2 -o netpipe.out.dual2-same -u 1048576
sleep 3
echo "SENDING NPtcp TO TWO HOSTS DIFF NET" |tee -a net-test.out
sleep 3
rsh $1 net/NPtcp -r &
rsh $3 net/NPtcp -r &
sleep 30
./NPtcp -t -h $1 -o netpipe.out.dual1-diff -u 1048576 &
./NPtcp -t -h $3 -o netpipe.out.dual2-diff -u 1048576