Blame tests/p_network/networking_vlan_test.sh

Christoph Galuschka bd5ac8
#!/bin/sh
Christoph Galuschka bd5ac8
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
Christoph Galuschka bd5ac8
Christoph Galuschka 452c77
t_Log "Running $0 - create VLAN IF, assign IP on VLAN IF and tear down VLAN IF using IP command test (C6 only)"
Christoph Galuschka bd5ac8
ret_val=0
Christoph Galuschka bd5ac8
Christoph Galuschka 452c77
if [ $centos_ver == 6 ]
Christoph Galuschka bd5ac8
  then
Christoph Galuschka 452c77
  t_Log 'This is  a C6-system, commencing test'
Christoph Galuschka 452c77
  # create VLAN-IF 10 on eth0
Christoph Galuschka 452c77
  ip link add dev eth0.10 link eth0 type vlan id 10
Christoph Galuschka 452c77
  ip addr list | grep -q eth0.10
Christoph Galuschka 452c77
  if [ $? == 1 ]
Christoph Galuschka 452c77
    then
Christoph Galuschka 452c77
    t_Log "VLAN-IF creation failed"
Christoph Galuschka 452c77
    ret_val=1
Christoph Galuschka 452c77
  else
Christoph Galuschka 452c77
    t_Log "VLAN-IF successfully created"
Christoph Galuschka 452c77
  fi
Christoph Galuschka bd5ac8
Christoph Galuschka 452c77
  #assign IP address on VLAN-IF
Christoph Galuschka 452c77
  ip address add 172.16.30.1/32 dev eth0.10
Christoph Galuschka 452c77
  ip addr list | grep -q 172.16.30.1
Christoph Galuschka 452c77
  if [ $? == 1 ]
Christoph Galuschka 452c77
    then
Christoph Galuschka 452c77
    t_Log "IP address assignment on eth0.10 failed"
Christoph Galuschka 452c77
    ret_val=1
Christoph Galuschka 452c77
  else
Christoph Galuschka 452c77
    t_Log "IP address successfully assigned on eth1.10"
Christoph Galuschka 452c77
  fi
Christoph Galuschka bd5ac8
Christoph Galuschka 452c77
  #testing address with ping
Christoph Galuschka 452c77
  ping -c 4 -q 172.16.30.1 | grep -q '4 received'
Christoph Galuschka 452c77
  if [ $? == 1 ]
Christoph Galuschka 452c77
    then
Christoph Galuschka 452c77
    t_Log "pinging on eth0.10 failed"
Christoph Galuschka 452c77
    ret_val=1
Christoph Galuschka 452c77
  else
Christoph Galuschka 452c77
    t_Log "local ping on VLAN IF worked"
Christoph Galuschka 452c77
  fi
Christoph Galuschka bd5ac8
Christoph Galuschka 452c77
  # delete VLAN-IF 10 on eth0
Christoph Galuschka 452c77
  ip link delete eth0.10
Christoph Galuschka 452c77
  ip addr list | grep -q eth0.10
Christoph Galuschka 452c77
  if [ $? == 0 ]
Christoph Galuschka 452c77
    then
Christoph Galuschka 452c77
    t_Log "Removing VLAN IF failed"
Christoph Galuschka 452c77
    ret_val=1
Christoph Galuschka 452c77
  else
Christoph Galuschka 452c77
    t_Log "Removing of VLAN IF worked"
Christoph Galuschka 452c77
  fi
Christoph Galuschka bd5ac8
else
Christoph Galuschka 452c77
  t_Log ' This is a C5 system, skipping test'
Christoph Galuschka bd5ac8
fi
Christoph Galuschka bd5ac8
Christoph Galuschka bd5ac8
t_CheckExitStatus $ret_val