hw-test/scripts/test-bonding

54 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
source scan-netdev
sleep_5 () {
for WAIT in 1 2 3 4 5 ; do
echo -n '.'
sleep 1
done
echo
}
echo "First ping test:"
test-ping | tee $OUTPUT_DIR/test-ping.out \
| grep error
for BOND_N in {0..4} ; do
BOND=bond$BOND_N
if [[ -d /sys/class/net/$BOND ]] ; then
cp /sys/class/net/$BOND/bonding/slaves \
$OUTPUT_DIR/netdev/$BOND.slaves
fi
done
SLAVE_NO=1
#for SLAVE_NO in 1 ; do
echo -n "Removing slave $SLAVE_NO..."
for BOND_N in {0..4} ; do
BOND=bond$BOND_N
[[ -d /sys/class/net/$BOND ]] || continue
SLAVE=`cut -d ' ' -f $SLAVE_NO \
$OUTPUT_DIR/netdev/$BOND.slaves`
ifenslave -d $BOND $SLAVE
done
sleep_5
echo -n "Dummy ping..."
test-ping > /dev/null
sleep_5
echo "Real ping test:"
test-ping | tee $OUTPUT_DIR/slave$SLAVE_NO-ping.out \
| grep error
echo -n "Reinserting slave $SLAVE_NO..."
for BOND_N in {0..4} ; do
[[ -d /sys/class/net/$BOND ]] || continue
BOND=bond$BOND_N
SLAVE=`cut -d ' ' -f $SLAVE_NO \
$OUTPUT_DIR/netdev/$BOND.slaves`
ifenslave $BOND $SLAVE
done
sleep_5
echo -n "Dummy ping..."
test-ping > /dev/null
sleep_5
#done