3 function basic_topo_clean
5 echo "Clearing all VPP instances.."
9 echo "Cleaning topology.."
10 ip netns exec intervppns ifconfig vppbr down
11 ip netns exec intervppns 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_intervpp1 &> /dev/null
15 ip link del dev veth_intervpp2 &> /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 intervppns &> /dev/null
21 if [ "$1" != "no_odl" ] ; then
26 function basic_topo_setup
29 # create vpp to clients and inter-vpp namespaces
32 ip netns add intervppns
34 # create vpp and odl interfaces and set them in intervppns
35 ip link add veth_intervpp1 type veth peer name intervpp1
36 ip link add veth_intervpp2 type veth peer name intervpp2
37 ip link add veth_odl type veth peer name odl
38 ip link set dev intervpp1 up
39 ip link set dev intervpp2 up
40 ip link set dev odl 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_odl up netns intervppns
45 # create bridge in intervppns and add vpp and odl interfaces
46 ip netns exec intervppns brctl addbr vppbr
47 ip netns exec intervppns brctl addif vppbr veth_intervpp1
48 ip netns exec intervppns brctl addif vppbr veth_intervpp2
49 ip netns exec intervppns brctl addif vppbr veth_odl
50 ip netns exec intervppns ifconfig vppbr up
52 # create and configure 1st veth client to vpp pair
53 ip link add veth_vpp1 type veth peer name vpp1
54 ip link set dev vpp1 up
55 ip link set dev veth_vpp1 up netns vppns1
57 # create and configure 2nd veth client to vpp pair
58 ip link add veth_vpp2 type veth peer name vpp2
59 ip link set dev vpp2 up
60 ip link set dev veth_vpp2 up netns vppns2
62 ip netns exec vppns1 \
65 ip addr add 6.0.1.2/24 dev veth_vpp1
66 ip route add 6.0.2.0/24 via 6.0.1.1
67 ip addr add 6:0:1::2/64 dev veth_vpp1
68 ip route add 6:0:2::0/64 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
76 ip addr add 6:0:2::2/64 dev veth_vpp2
77 ip route add 6:0:1::0/64 via 6:0:2::1
80 # set odl iface ip and disable checksum offloading
81 ip addr add 6.0.3.100/24 dev odl
82 ip addr add 6:0:3::100/64 dev odl
83 ethtool --offload odl rx off tx off
85 # generate config files
86 ./scripts/generate_config.py ${VPP_LITE_CONF} ${CFG_METHOD}
91 echo "* Selected configuration method: $CFG_METHOD"
92 if [ "$CFG_METHOD" == "cli" ] ; then
93 echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002
94 echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003
95 elif [ "$CFG_METHOD" == "vat" ] ; then
97 ${VPP_API_TEST} chroot prefix vpp1 script in ${VPP_LITE_CONF}/vpp1.vat
98 ${VPP_API_TEST} chroot prefix vpp2 script in ${VPP_LITE_CONF}/vpp2.vat
101 echo "=== Invalid configuration method selected!"
102 echo "=== To resolve this set env variable CFG_METHOD to vat or cli."
106 if [ "$1" != "no_odl" ] ; then
107 post_curl "add-mapping" ${ODL_CONFIG_FILE1}
108 post_curl "add-mapping" ${ODL_CONFIG_FILE2}