Create LISP test for csit_topology and for vpp_lite_topology
[one.git] / tests / data_plane / vpp_lite_topo / lisp_test.sh
1 #!/usr/bin/env bash
2
3 set -x
4
5 # path to vpp executable and configurations folder
6 # VPP_LITE_BIN=/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp
7 VPP_LITE_BIN=/home/csit/lisp_vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp
8 VPP_LITE_CONF=`pwd`"/../configs/vpp_lite_config/"
9 VPP1_CONF="vpp1.conf"
10 VPP2_CONF="vpp2.conf"
11 ODL_CONFIG_DIR="../configs/odl/"
12 ODL_ADD_CONFIG1="add_ipv4_odl1.txt"
13 ODL_ADD_CONFIG1_6="add_ipv6_odl1.txt"
14 ODL_ADD_CONFIG2="add_ipv4_odl2.txt"
15 ODL_ADD_CONFIG2_6="add_ipv6_odl2.txt"
16 ODL_REPLACE_CONFIG2="replace_ipv4_odl2.txt"
17 ODL_REPLACE_CONFIG2_6="replace_ipv6_odl2.txt"
18
19 ODL_USER="admin"
20 ODL_PASSWD="admin"
21 ODL_IP="127.0.0.1"
22 ODL_PORT="8181"
23
24 # make sure there are no vpp instances running
25 sudo pkill vpp
26
27 # delete previous incarnations if they exist
28 sudo ip netns exec intervppns ifconfig vppbr down
29 sudo ip netns exec intervppns brctl delbr vppbr
30 sudo ip link del dev veth_vpp1 &> /dev/null
31 sudo ip link del dev veth_vpp2 &> /dev/null
32 sudo ip link del dev veth_intervpp1 &> /dev/null
33 sudo ip link del dev veth_intervpp2 &> /dev/null
34 sudo ip link del dev veth_odl &> /dev/null
35 sudo ip netns del vppns1 &> /dev/null
36 sudo ip netns del vppns2 &> /dev/null
37 sudo ip netns del intervppns &> /dev/null
38
39 if [ "$1" == "clean" ] ; then
40   exit 0;
41 fi
42
43 # create vpp to clients and inter-vpp namespaces
44 sudo ip netns add vppns1
45 sudo ip netns add vppns2
46 sudo ip netns add intervppns
47
48 # create vpp and odl interfaces and set them in intervppns
49 sudo ip link add veth_intervpp1 type veth peer name intervpp1
50 sudo ip link add veth_intervpp2 type veth peer name intervpp2
51 sudo ip link add veth_odl type veth peer name odl
52 sudo ip link set dev intervpp1 up
53 sudo ip link set dev intervpp2 up
54 sudo ip link set dev odl up
55 sudo ip link set dev veth_intervpp1 up netns intervppns
56 sudo ip link set dev veth_intervpp2 up netns intervppns
57 sudo ip link set dev veth_odl up netns intervppns
58
59 # create bridge in intervppns and add vpp and odl interfaces
60 sudo ip netns exec intervppns brctl addbr vppbr
61 sudo ip netns exec intervppns brctl addif vppbr veth_intervpp1
62 sudo ip netns exec intervppns brctl addif vppbr veth_intervpp2
63 sudo ip netns exec intervppns brctl addif vppbr veth_odl
64 sudo ip netns exec intervppns ifconfig vppbr up
65
66 # create and configure 1st veth client to vpp pair
67 sudo ip link add veth_vpp1 type veth peer name vpp1
68 sudo ip link set dev vpp1 up
69 sudo ip link set dev veth_vpp1 up netns vppns1
70
71 # create and configure 2nd veth client to vpp pair
72 sudo ip link add veth_vpp2 type veth peer name vpp2
73 sudo ip link set dev vpp2 up
74 sudo ip link set dev veth_vpp2 up netns vppns2
75
76 # set odl iface ip and disable checksum offloading
77 sudo ip addr add 6.0.3.100/24 dev odl
78 sudo ip addr add 6:0:3::100/64 dev odl
79 sudo ethtool --offload  odl rx off tx off
80
81 if [ "$1" == "ip6" ] ; then
82   VPP1_CONF="vpp1_6.conf"
83   VPP2_CONF="vpp2_6.conf"
84 fi
85
86 if [ "$1" == "all" ] ; then
87   VPP1_CONF="vpp1_ip4_6.conf"
88   VPP2_CONF="vpp2_ip4_6.conf"
89 fi
90
91 # start vpp1 and vpp2 in separate chroot
92 sudo $VPP_LITE_BIN                              \
93   unix { log /tmp/vpp1.log cli-listen           \
94          localhost:5002 full-coredump           \
95          exec $VPP_LITE_CONF/${VPP1_CONF} }     \
96          api-trace { on } chroot {prefix xtr1}
97
98 sudo $VPP_LITE_BIN                              \
99   unix { log /tmp/vpp2.log cli-listen           \
100          localhost:5003 full-coredump           \
101          exec $VPP_LITE_CONF/${VPP2_CONF}}      \
102          api-trace { on } chroot {prefix xtr2}
103
104
105 if [ "$#" == 0 ] || [ "$1" == "ip4" ] ; then
106   source lisp_ip4.sh
107 fi
108
109 if [ "$1" == "ip6" ] ; then
110   source lisp_ip6.sh
111 fi
112
113 if [ "$1" == "all" ] ; then
114   source lisp_ip4.sh
115   source lisp_ip6.sh
116
117   ping_lisp
118   ping_lisp6
119 fi
120
121 echo "Success"
122