setup_lisp_topo.sh revision abfb56e7
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
24# create vpp to clients and inter-vpp namespaces
25ip netns add vppns1
26ip netns add vppns2
27ip netns add intervppns
28
29# create vpp and odl interfaces and set them in intervppns
30ip link add veth_intervpp1 type veth peer name intervpp1
31ip link add veth_intervpp2 type veth peer name intervpp2
32ip link add veth_odl type veth peer name odl
33ip link set dev intervpp1 up
34ip link set dev intervpp2 up
35ip link set dev odl up
36ip link set dev veth_intervpp1 up netns intervppns
37ip link set dev veth_intervpp2 up netns intervppns
38ip link set dev veth_odl up netns intervppns
39
40# create bridge in intervppns and add vpp and odl interfaces
41ip netns exec intervppns brctl addbr vppbr
42ip netns exec intervppns brctl addif vppbr veth_intervpp1
43ip netns exec intervppns brctl addif vppbr veth_intervpp2
44ip netns exec intervppns brctl addif vppbr veth_odl
45ip netns exec intervppns ifconfig vppbr up
46
47# create and configure 1st veth client to vpp pair
48ip link add veth_vpp1 type veth peer name vpp1
49ip link set dev vpp1 up
50ip link set dev veth_vpp1 up netns vppns1
51
52ip netns exec vppns1 \
53  bash -c "
54    ip link set dev lo up
55    ip addr add 6.0.2.2/24 dev veth_vpp1
56    ip route add 6.0.4.0/24 via 6.0.2.1
57"
58
59# create and configure 2nd veth client to vpp pair
60ip link add veth_vpp2 type veth peer name vpp2
61ip link set dev vpp2 up
62ip link set dev veth_vpp2 up netns vppns2
63
64ip netns exec vppns2 \
65  bash -c "
66    ip link set dev lo up
67    ip addr add 6.0.4.4/24 dev veth_vpp2
68    ip route add 6.0.2.0/24 via 6.0.4.1
69"
70
71# set odl iface ip and disable checksum offloading
72ifconfig odl 6.0.3.100/24
73ethtool --offload  odl rx off tx off
74
75# start vpp1 and vpp2 in separate chroot
76sudo $VPP_LITE_BIN                              \
77  unix { log /tmp/vpp1.log cli-listen           \
78         localhost:5002 full-coredump           \
79         exec $VPP_LITE_CONF/vpp1.conf }        \
80         api-trace { on } chroot {prefix xtr1}
81
82sudo $VPP_LITE_BIN                              \
83  unix { log /tmp/vpp2.log cli-listen           \
84         localhost:5003 full-coredump           \
85         exec $VPP_LITE_CONF/vpp2.conf}         \
86         api-trace { on } chroot {prefix xtr2}
87