bstinson / centos / t_functional

Forked from centos/t_functional 3 years ago
Clone

Blame tests/p_arpwatch/arpwatch_test.sh

Christoph Galuschka 7bc035
#!/bin/sh
Christoph Galuschka ca9eca
#         Christoph Galuschka <christoph.galuschka@chello.at>
Christoph Galuschka 7bc035
Christoph Galuschka 7bc035
t_Log "Running $0 - arpwatch on eth0"
Christoph Galuschka 7bc035
Athmane Madjoudj 820d69
# Kill arpwatch instance from previous test
Athmane Madjoudj 820d69
killall arpwatch
Athmane Madjoudj 820d69
Christoph Galuschka 7bc035
# getting IP-address of default gateway
Christoph Galuschka 7bc035
defgw=$(ip route list | grep default | cut -d' ' -f3)
Christoph Galuschka 7bc035
Christoph Galuschka 7bc035
# setting path to arp.dat
Christoph Galuschka 7bc035
if (t_GetPkgRel basesystem | grep -q el5)
Christoph Galuschka 7bc035
  then
Christoph Galuschka 7bc035
  arpdat='/var/arpwatch/arp.dat'
Christoph Galuschka 7bc035
else
Christoph Galuschka 7bc035
  arpdat='/var/lib/arpwatch/arp.dat'
Christoph Galuschka 7bc035
fi
Christoph Galuschka 7bc035
Christoph Galuschka 7bc035
# beginning and running test
Christoph Galuschka a95f5f
if [ $centos_ver == '6' ]
Christoph Galuschka a95f5f
  then
Christoph Galuschka a95f5f
  t_Log "Skipping for the time being on C6 until fixed"
Christoph Galuschka a95f5f
  ret_val=0
Christoph Galuschka a95f5f
else
Christoph Galuschka a95f5f
  arpwatch
Christoph Galuschka a95f5f
  sleep 4
Christoph Galuschka a95f5f
  arp -d $defgw
Christoph Galuschka a95f5f
  sleep 2
Christoph Galuschka a95f5f
  ping -q -i 0.5 -c 5 $defgw
Christoph Galuschka a95f5f
  killall arpwatch
Christoph Galuschka a95f5f
  sleep 2
Christoph Galuschka a95f5f
  grep -q $defgw $arpdat
Christoph Galuschka a95f5f
  ret_val=$?
Christoph Galuschka a95f5f
fi
Christoph Galuschka 7bc035
Christoph Galuschka 7bc035
# cleaning up
Christoph Galuschka 7bc035
cat /dev/null > $arpdat
Christoph Galuschka 7bc035
Christoph Galuschka bd9034
t_CheckExitStatus $ret_val