Blame tests/p_vconfig/10_test_vconfig.sh

Christoph Galuschka 7d92e8
#!/bin/sh
Christoph Galuschka ff12d7
# Author: Christoph Galuschka <tigalch@tigalch.org>
Christoph Galuschka 7d92e8
#         Athmane Madjoudj <athmanem@gmail.com>
Christoph Galuschka 7d92e8
Christoph Galuschka 7d92e8
t_Log "Running $0 - create VLAN IF, assign IP on VLAN IF and tear down VLAN IF test"
Christoph Galuschka 7d92e8
ret_val=0
Christoph Galuschka 7d92e8
Christoph Galuschka 1723ad
if [ $centos_ver -gt 6 ]
Christoph Galuschka ff12d7
then
Christoph Galuschka 1723ad
  t_Log 'vconfig is only supported on C5 and C6, skipping'
Christoph Galuschka 1723ad
  t_CheckExitStatus $ret_val
Christoph Galuschka 1723ad
  exit 0
Christoph Galuschka 1723ad
fi
Christoph Galuschka 1723ad
Christoph Galuschka 1723ad
# create VLAN-IF 10 on eth0
Christoph Galuschka 1723ad
vconfig add eth0 10
Christoph Galuschka 1723ad
ip addr list | grep -q eth0.10
a78f80
if [ $? == 1 ]
a78f80
  then
a78f80
  t_Log "VLAN-IF creation failed"
a78f80
  ret_val=1
a78f80
else
a78f80
  t_Log "VLAN-IF successfully created"
a78f80
fi
Christoph Galuschka 7d92e8
Christoph Galuschka 1723ad
#assign IP address on VLAN-IF
Christoph Galuschka 1723ad
ifconfig eth0.10 172.16.30.1 netmask 255.255.255.255
Christoph Galuschka 1723ad
ip addr list | grep -q 172.16.30.1
a78f80
if [ $? == 1 ]
a78f80
  then
a78f80
  t_Log "IP address assignment on eth0.10 failed"
a78f80
  ret_val=1
a78f80
else
a78f80
  t_Log "IP address successfully assigned on eth0.10"
a78f80
fi
Christoph Galuschka 7d92e8
Christoph Galuschka 1723ad
#testing address with ping
Christoph Galuschka 1723ad
ping -c 4 -q 172.16.30.1 | grep -q '4 received'
a78f80
if [ $? == 1 ]
a78f80
  then
a78f80
  t_Log "pinging on eth0.10 failed"
a78f80
  ret_val=1
a78f80
else
a78f80
  t_Log "local ping on VLAN IF worked"
a78f80
fi
Christoph Galuschka 7d92e8
Christoph Galuschka 1723ad
# delete VLAN-IF 10 on eth0
Christoph Galuschka 1723ad
vconfig rem eth0.10
Christoph Galuschka 1723ad
ip addr list | grep -q eth0.10
a78f80
if [ $? == 0 ]
a78f80
  then
a78f80
  t_Log "Removing VLAN IF failed"
a78f80
  ret_val=1
a78f80
else
a78f80
  t_Log "Removing of VLAN IF worked"
a78f80
fi
a78f80
a78f80
t_CheckExitStatus $ret_val