config.sh revision 1df1d674
1ODL_USER="admin"
2ODL_PASSWD="admin"
3ODL_IP="127.0.0.1"
4ODL_PORT="8181"
5
6# path to vpp executable
7VPP_LITE_BIN=/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp
8VPP_API_TEST=/vpp/build-root/install-vpp_lite_debug-native/vpp-api-test/bin/vpp_api_test
9
10# read user config file if exists
11if [ -f "${HOME}/.onerc" ] ; then
12  source "${HOME}/.onerc"
13fi
14
15if [ ! -f "${VPP_LITE_BIN}" ] ; then
16  echo "Error: VPP binary not found. You can set VPP_LITE_BIN in config.sh"
17  echo "Current value:"
18  echo "VPP_LITE_BIN=${VPP_LITE_BIN}"
19  exit 1
20fi
21
22if [ ! -f "${VPP_API_TEST}" ] ; then
23  echo "Error: vpp_api_test not found. Either it's not built or environment \
24    variable VPP_API_TEST is not set. You can build vpp_api_test with:"
25  echo "$ make build-vat"
26  echo "VPP_API_TEST can be set in config.sh or in ~/.onerc."
27  echo "Current value:"
28  echo "VPP_LITE_BIN=${VPP_API_TEST}"
29  exit 1
30fi
31
32function clean_all
33{
34  echo "Clearing all VPP instances.."
35  pkill vpp --signal 9
36  rm /dev/shm/* &> /dev/null
37
38  echo "Cleaning topology.."
39  ip netns exec intervppns ifconfig vppbr down &> /dev/null
40  ip netns exec intervppns brctl delbr vppbr &> /dev/null
41  ip netns exec intervppns1 ifconfig vppbr down &> /dev/null
42  ip netns exec intervppns1 brctl delbr vppbr &> /dev/null
43  ip netns exec intervppns2 ifconfig vppbr down &> /dev/null
44  ip netns exec intervppns2 brctl delbr vppbr &> /dev/null
45  ip netns exec intervpp-ns ifconfig vppbr1 down &> /dev/null
46  ip netns exec intervpp-ns brctl delbr vppbr1 &> /dev/null
47  ip netns exec xtr-rtr-ns ifconfig vppbr1 down &> /dev/null
48  ip netns exec xtr-rtr-ns brctl delbr vppbr1 &> /dev/null
49
50  ip link del dev veth_vpp1 &> /dev/null
51  ip link del dev veth_vpp2 &> /dev/null
52  ip link del dev vpp1_cus1 &> /dev/null
53  ip link del dev vpp2_cus1 &> /dev/null
54  ip link del dev vpp1_cus2 &> /dev/null
55  ip link del dev vpp2_cus2 &> /dev/null
56  ip link del dev vpp1 &> /dev/null
57  ip link del dev vpp2 &> /dev/null
58
59  ip link del dev veth_intervpp1 &> /dev/null
60  ip link del dev veth_intervpp2 &> /dev/null
61  ip link del dev veth_intervpp11 &> /dev/null
62  ip link del dev veth_intervpp12 &> /dev/null
63  ip link del dev veth_intervpp21 &> /dev/null
64  ip link del dev veth_intervpp22 &> /dev/null
65  ip link del dev intervpp1 &> /dev/null
66  ip link del dev intervpp2 &> /dev/null
67  ip link del dev xtr_rtr1 &> /dev/null
68  ip link del dev xtr_rtr2 &> /dev/null
69  ip link del dev xtr_rtr3 &> /dev/null
70
71  ip link del dev veth_odl &> /dev/null
72  ip link del dev odl &> /dev/null
73
74  ip netns del vppns1 &> /dev/null
75  ip netns del vppns2 &> /dev/null
76  ip netns del intervppns &> /dev/null
77  ip netns del intervppns1 &> /dev/null
78  ip netns del intervppns2 &> /dev/null
79  ip netns del vpp1-cus1-ns &> /dev/null
80  ip netns del vpp1-cus2-ns &> /dev/null
81  ip netns del vpp2-cus1-ns &> /dev/null
82  ip netns del vpp2-cus2-ns &> /dev/null
83  ip netns del intervpp-ns &> /dev/null
84  ip netns del vpp-ns1 &> /dev/null
85  ip netns del vpp-ns2 &> /dev/null
86  ip netns del xtr-rtr-ns &> /dev/null
87
88  if [ "$1" != "no_odl" ] ; then
89    odl_clear_all
90  fi
91
92
93}
94