Created
May 26, 2016 05:10
-
-
Save T-X/1bea06b7abcf63de143ddcbe0a2aca56 to your computer and use it in GitHub Desktop.
test and memory monitoring script for a setup with many global TT entries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIR=/mnt/dev | |
OUT=/mnt/dev/logs | |
DST="fe80::6670:2ff:feae:72e4%eth1" | |
num=10 | |
wait_for_link() { | |
echo -n "Waiting for link..." | |
while true; do | |
ping6 "$DST" -q -c3 > /dev/null && break | |
sleep 1 | |
echo -n "." | |
done | |
echo " Got link!" | |
} | |
rmmod batman_adv | |
rmmod bridge | |
modprobe bridge | |
brctl addbr br0 | |
brctl addif br0 eth2 | |
echo 0 > /proc/sys/net/ipv6/conf/br0/accept_ra | |
echo 0 > /proc/sys/net/ipv6/conf/eth1/accept_ra | |
echo 0 > /proc/sys/net/ipv6/conf/eth2/accept_ra | |
ip link set up dev br0 | |
ip link set up dev eth1 | |
ip link set up dev eth2 | |
wait_for_link | |
# Clean start | |
echo "Rebooting device, clean start" | |
ssh -i $DIR/testnode42 root@$DST reboot || { | |
echo "Error: Could not reboot device" | |
exit 1 | |
} | |
modprobe crc16 | |
modprobe crc32 | |
modprobe libcrc32c | |
insmod $DIR/batman-adv/net/batman-adv/batman-adv.ko || { | |
echo "Error: Could not load batman-adv.ko" | |
exit 2 | |
} | |
echo "Modules loaded, Wiring things now" | |
for i in `seq 1 $num`; do | |
ip link add dev veth$i-2 type veth peer name veth$i-1 | |
brctl addif br0 veth$i-1 | |
echo bat$i > /sys/class/net/veth$i-2/batman_adv/mesh_iface | |
ip link set up dev veth$i-1 | |
ip link set up dev veth$i-2 | |
ip link set up dev bat$i | |
done | |
# Wait for reboot to settle | |
echo Waiting for device reboot | |
sleep 5 | |
wait_for_link | |
#ssh -i $DIR/testnode42 root@$DST \ | |
# "echo 0 > /sys/class/net/br-client/brif/bat0/learning; \ | |
# echo 1 > /sys/class/net/br-client/brif/bat0/flush; \ | |
# echo 0 > /sys/class/net/br-client/brif/eth1/unicast_flood" || { | |
# | |
# echo "Error: Could not disable FDB on bat0" | |
# exit 3 | |
#} | |
# Wait a little longer for protocol establishment etc. | |
sleep 10 | |
echo "Configuration complete" | |
MYDATE=`date "+%s"` | |
ssh -i $DIR/testnode42 root@$DST \ | |
"date -s @$MYDATE; \ | |
while true; do \ | |
echo =============================; \ | |
echo \"Date: \$(date) // \$(date +%s)\"; \ | |
echo \"TG-size: \$(batctl tg | wc -l)\"; \ | |
echo \"FDB-size: \$(bridge fdb show brport bat0 | wc -l)\"; \ | |
echo \"Load: \$(cat /proc/loadavg)\"; \ | |
cat /proc/meminfo; \ | |
echo -----------------------------; \ | |
sleep 1; \ | |
done" > $OUT/out-$MYDATE.log & | |
MYPID="$!" | |
trap "echo \"Got trap! Killing $MYPID\"; [ -n \"$MYPID\" ] && kill $MYPID" SIGINT SIGTERM EXIT | |
sleep 5 | |
echo "Logging started, firing mz" | |
for i in `seq 1 $num`; do | |
mz bat$i -c 1500 -p 64 -d 10msec -a rand -A -b bcast -t udp || { | |
echo "Error: Could not start mausezahn on interface bat$i" | |
exit 1 | |
} | |
done | |
wait "$MYPID" | |
#echo "Crashed at `date` (`date +%s`)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment