4 function basic_two_odls_clean
6 echo "Clearing all VPP instances.."
10 echo "Cleaning topology.."
11 ip netns exec intervppns ifconfig vppbr down
12 ip netns exec intervppns brctl delbr vppbr
13 ip link del dev veth_vpp1 &> /dev/null
14 ip link del dev veth_vpp2 &> /dev/null
15 ip link del dev veth_intervpp1 &> /dev/null
16 ip link del dev veth_intervpp2 &> /dev/null
17 ip link del dev veth_odl1 &> /dev/null
18 ip link del dev veth_odl2 &> /dev/null
19 ip netns del vppns1 &> /dev/null
20 ip netns del vppns2 &> /dev/null
21 ip netns del intervppns &> /dev/null
24 function basic_two_odls_setup
27 # create vpp to clients and inter-vpp namespaces
30 ip netns add intervppns
32 # create vpp and odl interfaces and set them in intervppns
33 ip link add veth_intervpp1 type veth peer name intervpp1
34 ip link add veth_intervpp2 type veth peer name intervpp2
35 ip link add veth_odl1 type veth peer name odl1
36 ip link add veth_odl2 type veth peer name odl2
37 ip link set dev intervpp1 up
38 ip link set dev intervpp2 up
39 ip link set dev odl1 up
40 ip link set dev odl2 up
41 ip link set dev veth_intervpp1 up netns intervppns
42 ip link set dev veth_intervpp2 up netns intervppns
43 ip link set dev veth_odl1 up netns intervppns
44 ip link set dev veth_odl2 up netns intervppns
46 # create bridge in intervppns and add vpp and odl interfaces
47 ip netns exec intervppns brctl addbr vppbr
48 ip netns exec intervppns brctl addif vppbr veth_intervpp1
49 ip netns exec intervppns brctl addif vppbr veth_intervpp2
50 ip netns exec intervppns brctl addif vppbr veth_odl1
51 ip netns exec intervppns brctl addif vppbr veth_odl2
52 ip netns exec intervppns ifconfig vppbr up
54 # create and configure 1st veth client to vpp pair
55 ip link add veth_vpp1 type veth peer name vpp1
56 ip link set dev vpp1 up
57 ip link set dev veth_vpp1 up netns vppns1
59 # create and configure 2nd veth client to vpp pair
60 ip link add veth_vpp2 type veth peer name vpp2
61 ip link set dev vpp2 up
62 ip link set dev veth_vpp2 up netns vppns2
64 ip netns exec vppns1 \
67 ip addr add 6.0.1.2/24 dev veth_vpp1
68 ip route add 6.0.2.0/24 via 6.0.1.1
71 ip netns exec vppns2 \
74 ip addr add 6.0.2.2/24 dev veth_vpp2
75 ip route add 6.0.1.0/24 via 6.0.2.1
78 # set odl iface ip and disable checksum offloading
79 ip addr add 6.0.3.100/24 dev odl1
80 ethtool --offload odl1 rx off tx off
82 # generate config files
83 ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD}
88 echo "* Selected configuration method: $CFG_METHOD"
89 if [ "$CFG_METHOD" == "cli" ] ; then
90 echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002
91 echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003
92 elif [ "$CFG_METHOD" == "vat" ] ; then
94 ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat
95 ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat
98 echo "=== Invalid configuration method selected!"
99 echo "=== To resolve this set env variable CFG_METHOD to vat or cli."