3 function two_customers_topo_clean {
4 echo "Clearing all VPP instances.."
8 echo "Cleaning topology.."
9 ip netns exec intervpp-ns ifconfig vppbr1 down
10 ip netns exec intervpp-ns brctl delbr vppbr1
11 ip link del dev vpp1_cus1 &> /dev/null
12 ip link del dev vpp2_cus1 &> /dev/null
13 ip link del dev vpp1_cus2 &> /dev/null
14 ip link del dev vpp2_cus2 &> /dev/null
15 ip link del dev intervpp1 &> /dev/null
16 ip link del dev intervpp2 &> /dev/null
17 ip link del dev odl &> /dev/null
19 ip netns del vpp1-cus1-ns &> /dev/null
20 ip netns del vpp1-cus2-ns &> /dev/null
21 ip netns del vpp2-cus1-ns &> /dev/null
22 ip netns del vpp2-cus2-ns &> /dev/null
23 ip netns del intervpp-ns &> /dev/null
28 function two_customers_topo_setup {
29 echo "Configuring topology..."
30 ip netns add vpp1-cus1-ns
31 ip netns add vpp1-cus2-ns
32 ip netns add vpp2-cus1-ns
33 ip netns add vpp2-cus2-ns
34 ip netns add intervpp-ns
36 ip link add veth_intervpp1 type veth peer name intervpp1
37 ip link add veth_intervpp2 type veth peer name intervpp2
38 ip link add veth_odl type veth peer name odl
39 ip link set dev intervpp1 up
40 ip link set dev intervpp2 up
41 ip link set dev odl up
42 ip link set dev veth_intervpp1 up netns intervpp-ns
43 ip link set dev veth_intervpp2 up netns intervpp-ns
44 ip link set dev veth_odl up netns intervpp-ns
46 ip netns exec intervpp-ns brctl addbr vppbr1
47 ip netns exec intervpp-ns brctl addif vppbr1 veth_intervpp1
48 ip netns exec intervpp-ns brctl addif vppbr1 veth_intervpp2
49 ip netns exec intervpp-ns brctl addif vppbr1 veth_odl
50 ip netns exec intervpp-ns ifconfig vppbr1 up
52 # customer1 configuration on vpp1
53 ip link add veth_vpp1_cus1 type veth peer name vpp1_cus1
54 ip link set dev vpp1_cus1 up
55 ip link set dev veth_vpp1_cus1 up netns vpp1-cus1-ns
57 ip netns exec vpp1-cus1-ns \
60 ip addr add 6.0.2.2/24 dev veth_vpp1_cus1
61 ip addr add 6:0:2::2/64 dev veth_vpp1_cus1
62 ip route add 6.0.4.0/24 via 6.0.2.1
63 ip route add 6:0:4::0/64 via 6:0:2::1
66 # customer2 configuration on vpp1
67 ip link add veth_vpp1_cus2 type veth peer name vpp1_cus2
68 ip link set dev vpp1_cus2 up
69 ip link set dev veth_vpp1_cus2 up netns vpp1-cus2-ns
71 ip netns exec vpp1-cus2-ns \
74 ip addr add 6.0.2.2/24 dev veth_vpp1_cus2
75 ip addr add 6:0:2::2/64 dev veth_vpp1_cus2
76 ip route add 6.0.4.0/24 via 6.0.2.1
77 ip route add 6:0:4::0/64 via 6:0:2::1
80 # customer1 configuration on vpp2
81 ip link add veth_vpp2_cus1 type veth peer name vpp2_cus1
82 ip link set dev vpp2_cus1 up
83 ip link set dev veth_vpp2_cus1 up netns vpp2-cus1-ns
85 ip netns exec vpp2-cus1-ns \
88 ip addr add 6.0.4.4/24 dev veth_vpp2_cus1
89 ip addr add 6:0:4::4/64 dev veth_vpp2_cus1
90 ip route add 6.0.2.0/24 via 6.0.4.1
91 ip route add 6:0:2::0/64 via 6:0:4::1
94 # customer2 configuration on vpp2
95 ip link add veth_vpp2_cus2 type veth peer name vpp2_cus2
96 ip link set dev vpp2_cus2 up
97 ip link set dev veth_vpp2_cus2 up netns vpp2-cus2-ns
99 ip netns exec vpp2-cus2-ns \
101 ip link set dev lo up
102 ip addr add 6.0.4.4/24 dev veth_vpp2_cus2
103 ip addr add 6:0:4::4/64 dev veth_vpp2_cus2
104 ip route add 6.0.2.0/24 via 6.0.4.1
105 ip route add 6:0:2::0/64 via 6:0:4::1
108 ip addr add 6.0.3.100/24 dev odl
109 ip addr add 6:0:3::100/64 dev odl
110 ethtool --offload odl rx off tx off
112 # generate config files
113 ./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 post_curl "add-mapping" ${ODL_CONFIG_FILE1}
135 post_curl "add-mapping" ${ODL_CONFIG_FILE2}
136 post_curl "add-mapping" ${ODL_CONFIG_FILE3}
137 post_curl "add-mapping" ${ODL_CONFIG_FILE4}