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
34 mac1=`ip netns exec vppns1 ip a show dev veth_vpp1 | grep "link/ether" | awk '{print $2}'`
35 ip netns exec vppns2 arp -s 6.0.1.11 $mac1
37 mac2=`ip netns exec vppns2 ip a show dev veth_vpp2 | grep "link/ether" | awk '{print $2}'`
38 ip netns exec vppns1 arp -s 6.0.1.12 $mac2
41 function multihoming_topo_setup
44 # create vpp to clients and inter-vpp namespaces
47 ip netns add intervppns1
48 ip netns add intervppns2
50 # create vpp and odl interfaces and set them in intervppns1
51 ip link add veth_intervpp11 type veth peer name intervpp11
52 ip link add veth_intervpp12 type veth peer name intervpp12
53 ip link add veth_odl type veth peer name odl
54 ip link set dev intervpp11 up
55 ip link set dev intervpp12 up
56 ip link set dev odl up
57 ip link set dev veth_intervpp11 up netns intervppns1
58 ip link set dev veth_intervpp12 up netns intervppns1
59 ip link set dev veth_odl up netns intervppns1
61 ip link add veth_intervpp21 type veth peer name intervpp21
62 ip link add veth_intervpp22 type veth peer name intervpp22
63 ip link set dev intervpp21 up
64 ip link set dev intervpp22 up
65 ip link set dev veth_intervpp21 up netns intervppns2
66 ip link set dev veth_intervpp22 up netns intervppns2
68 # create bridge in intervppns1 and add vpp and odl interfaces
69 ip netns exec intervppns1 brctl addbr vppbr
70 ip netns exec intervppns1 brctl addif vppbr veth_intervpp11
71 ip netns exec intervppns1 brctl addif vppbr veth_intervpp12
72 ip netns exec intervppns1 brctl addif vppbr veth_odl
73 ip netns exec intervppns1 ifconfig vppbr up
75 # create bridge in intervppns2 and add vpp and odl interfaces
76 ip netns exec intervppns2 brctl addbr vppbr
77 ip netns exec intervppns2 brctl addif vppbr veth_intervpp21
78 ip netns exec intervppns2 brctl addif vppbr veth_intervpp22
79 ip netns exec intervppns2 brctl addif vppbr veth_odl
80 ip netns exec intervppns2 ifconfig vppbr up
82 # create and configure 1st veth client to vpp pair
83 ip link add veth_vpp1 type veth peer name vpp1
84 ip link set dev vpp1 up
85 ip link set dev veth_vpp1 address 08:11:11:11:11:11
86 ip link set dev veth_vpp1 up netns vppns1
88 # create and configure 2nd veth client to vpp pair
89 ip link add veth_vpp2 type veth peer name vpp2
90 ip link set dev vpp2 up
91 ip link set dev veth_vpp2 address 08:22:22:22:22:22
92 ip link set dev veth_vpp2 up netns vppns2
94 ip netns exec vppns1 \
97 ip addr add 6.0.1.11/24 dev veth_vpp1
98 ip addr add 6:0:1::11/64 dev veth_vpp1
101 ip netns exec vppns2 \
103 ip link set dev lo up
104 ip addr add 6.0.1.12/24 dev veth_vpp2
105 ip addr add 6:0:1::12/64 dev veth_vpp2
108 # set odl iface ip and disable checksum offloading
109 ip addr add 6.0.3.100/24 dev odl
110 ip addr add 6:0:3::100/64 dev odl
111 ethtool --offload odl rx off tx off
113 # generate config files
114 ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD}
119 echo "* Selected configuration method: $CFG_METHOD"
120 if [ "$CFG_METHOD" == "cli" ] ; then
121 echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002
122 echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003
123 elif [ "$CFG_METHOD" == "vat" ] ; then
125 ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat
126 ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat
129 echo "=== Invalid configuration method selected!"
130 echo "=== To resolve this set env variable CFG_METHOD to vat or cli."
134 if [ "$1" != "no_odl" ] ; then
135 post_curl "add-mapping" ${ODL_CONFIG_FILE1}
136 post_curl "add-mapping" ${ODL_CONFIG_FILE2}