3 function multihoming_topo_clean
5 echo "Clearing all VPP instances.."
9 echo "Cleaning topology.."
10 ip netns exec intervppns1 ifconfig vppbr down
11 ip netns exec intervppns1 brctl delbr vppbr
12 ip link del dev veth_vpp1 &> /dev/null
13 ip link del dev veth_vpp2 &> /dev/null
14 ip link del dev veth_intervpp11 &> /dev/null
15 ip link del dev veth_intervpp12 &> /dev/null
16 ip link del dev veth_odl &> /dev/null
17 ip netns del vppns1 &> /dev/null
18 ip netns del vppns2 &> /dev/null
19 ip netns del intervppns1 &> /dev/null
21 ip netns exec intervppns2 ifconfig vppbr down
22 ip netns exec intervppns2 brctl delbr vppbr
23 ip link del dev veth_intervpp21 &> /dev/null
24 ip link del dev veth_intervpp22 &> /dev/null
25 ip netns del intervppns2 &> /dev/null
27 if [ "$1" != "no_odl" ] ; then
32 function multihoming_topo_setup
35 # create vpp to clients and inter-vpp namespaces
38 ip netns add intervppns1
39 ip netns add intervppns2
41 # create vpp and odl interfaces and set them in intervppns1
42 ip link add veth_intervpp11 type veth peer name intervpp11
43 ip link add veth_intervpp12 type veth peer name intervpp12
44 ip link add veth_odl type veth peer name odl
45 ip link set dev intervpp11 up
46 ip link set dev intervpp12 up
47 ip link set dev odl up
48 ip link set dev veth_intervpp11 up netns intervppns1
49 ip link set dev veth_intervpp12 up netns intervppns1
50 ip link set dev veth_odl up netns intervppns1
52 ip link add veth_intervpp21 type veth peer name intervpp21
53 ip link add veth_intervpp22 type veth peer name intervpp22
54 ip link set dev intervpp21 up
55 ip link set dev intervpp22 up
56 ip link set dev veth_intervpp21 up netns intervppns2
57 ip link set dev veth_intervpp22 up netns intervppns2
59 # create bridge in intervppns1 and add vpp and odl interfaces
60 ip netns exec intervppns1 brctl addbr vppbr
61 ip netns exec intervppns1 brctl addif vppbr veth_intervpp11
62 ip netns exec intervppns1 brctl addif vppbr veth_intervpp12
63 ip netns exec intervppns1 brctl addif vppbr veth_odl
64 ip netns exec intervppns1 ifconfig vppbr up
66 # create bridge in intervppns2 and add vpp and odl interfaces
67 ip netns exec intervppns2 brctl addbr vppbr
68 ip netns exec intervppns2 brctl addif vppbr veth_intervpp21
69 ip netns exec intervppns2 brctl addif vppbr veth_intervpp22
70 ip netns exec intervppns2 brctl addif vppbr veth_odl
71 ip netns exec intervppns2 ifconfig vppbr up
73 # create and configure 1st veth client to vpp pair
74 ip link add veth_vpp1 type veth peer name vpp1
75 ip link set dev vpp1 up
76 ip link set dev veth_vpp1 up netns vppns1
78 # create and configure 2nd veth client to vpp pair
79 ip link add veth_vpp2 type veth peer name vpp2
80 ip link set dev vpp2 up
81 ip link set dev veth_vpp2 up netns vppns2
83 ip netns exec vppns1 \
86 ip addr add 6.0.1.2/24 dev veth_vpp1
87 ip route add 6.0.2.0/24 via 6.0.1.1
88 ip addr add 6:0:1::2/64 dev veth_vpp1
89 ip route add 6:0:2::0/64 via 6:0:1::1
92 ip netns exec vppns2 \
95 ip addr add 6.0.2.2/24 dev veth_vpp2
96 ip route add 6.0.1.0/24 via 6.0.2.1
97 ip addr add 6:0:2::2/64 dev veth_vpp2
98 ip route add 6:0:1::0/64 via 6:0:2::1
101 # set odl iface ip and disable checksum offloading
102 ip addr add 6.0.3.100/24 dev odl
103 ip addr add 6:0:3::100/64 dev odl
104 ethtool --offload odl rx off tx off
106 # start vpp1 and vpp2 in separate chroot
108 unix { log /tmp/vpp1.log cli-listen \
109 localhost:5002 full-coredump \
110 exec ${VPP_LITE_CONF}/vpp1.config } \
111 api-trace { on } api-segment {prefix xtr1}
114 unix { log /tmp/vpp2.log cli-listen \
115 localhost:5003 full-coredump \
116 exec ${VPP_LITE_CONF}/vpp2.config } \
117 api-trace { on } api-segment {prefix xtr2}
119 if [ "$1" != "no_odl" ] ; then
120 post_curl "add-mapping" ${ODL_CONFIG_FILE1}
121 post_curl "add-mapping" ${ODL_CONFIG_FILE2}