summaryrefslogtreecommitdiffstats
path: root/tests/data_plane/vpp_lite_topo/config.sh
blob: e4c3283a47151d987c26a17105dbd469508d3f05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
ODL_USER="admin"
ODL_PASSWD="admin"
ODL_IP="127.0.0.1"
ODL_PORT="8181"

# path to vpp executable
VPP_LITE_BIN=/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp
VPP_API_TEST=/vpp/build-root/install-vpp_lite_debug-native/vpp-api-test/bin/vpp_api_test

# read user config file if exists
if [ -f "${HOME}/.onerc" ] ; then
  source "${HOME}/.onerc"
fi

if [ ! -f "${VPP_LITE_BIN}" ] ; then
  echo "Error: VPP binary not found. You can set VPP_LITE_BIN in config.sh"
  echo "Current value:"
  echo "VPP_LITE_BIN=${VPP_LITE_BIN}"
  exit 1
fi

if [ ! -f "${VPP_API_TEST}" ] ; then
  echo "Error: vpp_api_test not found. Either it's not built or environment \
    variable VPP_API_TEST is not set. You can build vpp_api_test with:"
  echo "$ make build-vat"
  echo "VPP_API_TEST can be set in config.sh or in ~/.onerc."
  echo "Current value:"
  echo "VPP_LITE_BIN=${VPP_API_TEST}"
  exit 1
fi

function clean_all
{
  echo "Clearing all VPP instances.."
  pkill vpp --signal 9
  rm /dev/shm/* &> /dev/null

  echo "Cleaning topology.."
  ip netns exec intervppns ifconfig vppbr down &> /dev/null
  ip netns exec intervppns brctl delbr vppbr &> /dev/null
  ip netns exec intervppns1 ifconfig vppbr down &> /dev/null
  ip netns exec intervppns1 brctl delbr vppbr &> /dev/null
  ip netns exec intervppns2 ifconfig vppbr down &> /dev/null
  ip netns exec intervppns2 brctl delbr vppbr &> /dev/null
  ip netns exec intervpp-ns ifconfig vppbr1 down &> /dev/null
  ip netns exec intervpp-ns brctl delbr vppbr1 &> /dev/null
  ip netns exec xtr-rtr-ns ifconfig vppbr1 down &> /dev/null
  ip netns exec xtr-rtr-ns brctl delbr vppbr1 &> /dev/null

  ip link del dev veth_vpp1 &> /dev/null
  ip link del dev veth_vpp2 &> /dev/null
  ip link del dev vpp1_cus1 &> /dev/null
  ip link del dev vpp2_cus1 &> /dev/null
  ip link del dev vpp1_cus2 &> /dev/null
  ip link del dev vpp2_cus2 &> /dev/null
  ip link del dev vpp1 &> /dev/null
  ip link del dev vpp2 &> /dev/null

  ip link del dev veth_intervpp1 &> /dev/null
  ip link del dev veth_intervpp2 &> /dev/null
  ip link del dev veth_intervpp11 &> /dev/null
  ip link del dev veth_intervpp12 &> /dev/null
  ip link del dev veth_intervpp21 &> /dev/null
  ip link del dev veth_intervpp22 &> /dev/null
  ip link del dev intervpp1 &> /dev/null
  ip link del dev intervpp2 &> /dev/null
  ip link del dev xtr_rtr1 &> /dev/null
  ip link del dev xtr_rtr2 &> /dev/null
  ip link del dev xtr_rtr3 &> /dev/null

  ip link del dev veth_odl &> /dev/null
  ip link del dev odl &> /dev/null

  ip netns del vppns1 &> /dev/null
  ip netns del vppns2 &> /dev/null
  ip netns del intervppns &> /dev/null
  ip netns del intervppns1 &> /dev/null
  ip netns del intervppns2 &> /dev/null
  ip netns del vpp1-cus1-ns &> /dev/null
  ip netns del vpp1-cus2-ns &> /dev/null
  ip netns del vpp2-cus1-ns &> /dev/null
  ip netns del vpp2-cus2-ns &> /dev/null
  ip netns del intervpp-ns &> /dev/null
  ip netns del vpp-ns1 &> /dev/null
  ip netns del vpp-ns2 &> /dev/null
  ip netns del xtr-rtr-ns &> /dev/null

  if [ "$1" != "no_odl" ] ; then
    odl_clear_all
  fi


}