setup_lisp_topo.sh revision 05767cf1
1# path to vpp executable and configurations folder
2VPP_LITE_BIN=/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp
3VPP_LITE_CONF=/etc/vpp/lite/
4
5# make sure there are no vpp instances running
6pkill vpp
7
8# delete previous incarnations if they exist
9ip netns exec intervppns ifconfig vppbr down
10ip netns exec intervppns brctl delbr vppbr
11ip link del dev veth_vpp1 &> /dev/null
12ip link del dev veth_vpp2 &> /dev/null
13ip link del dev veth_intervpp1 &> /dev/null
14ip link del dev veth_intervpp2 &> /dev/null
15ip link del dev veth_odl &> /dev/null
16ip netns del vppns1 &> /dev/null
17ip netns del vppns2 &> /dev/null
18ip netns del intervppns &> /dev/null
19
20if [ "$1" == "clean" ] ; then
21  exit 0;
22fi
23
24sleep 1
25
26# create vpp to clients and inter-vpp namespaces
27ip netns add vppns1
28ip netns add vppns2
29ip netns add intervppns
30
31# create vpp and odl interfaces and set them in intervppns
32ip link add veth_intervpp1 type veth peer name intervpp1
33ip link add veth_intervpp2 type veth peer name intervpp2
34ip link add veth_odl type veth peer name odl
35ip link set dev intervpp1 up
36ip link set dev intervpp2 up
37ip link set dev odl up
38ip link set dev veth_intervpp1 up netns intervppns
39ip link set dev veth_intervpp2 up netns intervppns
40ip link set dev veth_odl up netns intervppns
41
42# create bridge in intervppns and add vpp and odl interfaces
43ip netns exec intervppns brctl addbr vppbr
44ip netns exec intervppns brctl addif vppbr veth_intervpp1
45ip netns exec intervppns brctl addif vppbr veth_intervpp2
46ip netns exec intervppns brctl addif vppbr veth_odl
47ip netns exec intervppns ifconfig vppbr up
48
49# create and configure 1st veth client to vpp pair
50ip link add veth_vpp1 type veth peer name vpp1
51ip link set dev vpp1 up
52ip link set dev veth_vpp1 up netns vppns1
53
54ip netns exec vppns1 \
55  bash -c "
56    ip link set dev lo up
57    ip addr add 6.0.2.2/24 dev veth_vpp1
58    ip route add 6.0.4.0/24 via 6.0.2.1
59"
60
61# create and configure 2nd veth client to vpp pair
62ip link add veth_vpp2 type veth peer name vpp2
63ip link set dev vpp2 up
64ip link set dev veth_vpp2 up netns vppns2
65
66ip netns exec vppns2 \
67  bash -c "
68    ip link set dev lo up
69    ip addr add 6.0.4.4/24 dev veth_vpp2
70    ip route add 6.0.2.0/24 via 6.0.4.1
71"
72
73# set odl iface ip and disable checksum offloading
74ifconfig odl 6.0.3.100/24
75ethtool --offload  odl rx off tx off
76
77# start vpp1 and vpp2 in separate chroot
78sudo $VPP_LITE_BIN                              \
79  unix { log /tmp/vpp1.log cli-listen           \
80         localhost:5002 full-coredump           \
81         exec $VPP_LITE_CONF/vpp1.conf }        \
82         api-trace { on } chroot {prefix xtr1}
83
84sudo $VPP_LITE_BIN                              \
85  unix { log /tmp/vpp2.log cli-listen           \
86         localhost:5003 full-coredump           \
87         exec $VPP_LITE_CONF/vpp2.conf}         \
88         api-trace { on } chroot {prefix xtr2}
89