3 if [ "$1" == "-h" ] || [ "$1" == "-help" ] ; then
4 echo "lisp_test.sh [ip4] [ip6] [ip4_ip6] [4o6] [6o4]"
5 echo " ip4 - test ip4 topology"
6 echo " ip6 - test ip6 topology"
7 echo " ip4_ip6 - test ip4 and ip6 topology"
8 echo " 4o6 - test ip4 over ip6"
9 echo " 6o4 - test ip6 over ip4"
15 # path to vpp executable and configurations folder
16 # VPP_LITE_BIN=/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp
17 VPP_LITE_BIN=/home/csit/lisp_vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp
18 VPP_LITE_CONF=`pwd`"/../configs/vpp_lite_config/"
21 ODL_CONFIG_DIR="../configs/odl/"
22 ODL_ADD_CONFIG1="add_ipv4_odl1.txt"
23 ODL_ADD_CONFIG1_4o6="add_ipv4o6_odl1.txt"
24 ODL_ADD_CONFIG1_6="add_ipv6_odl1.txt"
25 ODL_ADD_CONFIG1_6o4="add_ipv6o4_odl1.txt"
26 ODL_ADD_CONFIG2="add_ipv4_odl2.txt"
27 ODL_ADD_CONFIG2_4o6="add_ipv4o6_odl2.txt"
28 ODL_ADD_CONFIG2_6="add_ipv6_odl2.txt"
29 ODL_ADD_CONFIG2_6o4="add_ipv6o4_odl2.txt"
30 ODL_REPLACE_CONFIG2="replace_ipv4_odl2.txt"
31 ODL_REPLACE_CONFIG2_4o6="replace_ipv4o6_odl2.txt"
32 ODL_REPLACE_CONFIG2_6="replace_ipv6_odl2.txt"
33 ODL_REPLACE_CONFIG2_6o4="replace_ipv6o4_odl2.txt"
41 curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:${1} \
42 -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${2}" \
43 -u ${ODL_USER}:${ODL_PASSWD}
46 # make sure there are no vpp instances running
49 # delete previous incarnations if they exist
50 sudo ip netns exec intervppns ifconfig vppbr down
51 sudo ip netns exec intervppns brctl delbr vppbr
52 sudo ip link del dev veth_vpp1 &> /dev/null
53 sudo ip link del dev veth_vpp2 &> /dev/null
54 sudo ip link del dev veth_intervpp1 &> /dev/null
55 sudo ip link del dev veth_intervpp2 &> /dev/null
56 sudo ip link del dev veth_odl &> /dev/null
57 sudo ip netns del vppns1 &> /dev/null
58 sudo ip netns del vppns2 &> /dev/null
59 sudo ip netns del intervppns &> /dev/null
61 curl -X DELETE http://${ODL_IP}:${ODL_PORT}/restconf/config/odl-mappingservice:mapping-database/ \
62 -u ${ODL_USER}:${ODL_PASSWD}
64 if [ "$1" == "clean" ] ; then
68 # create vpp to clients and inter-vpp namespaces
69 sudo ip netns add vppns1
70 sudo ip netns add vppns2
71 sudo ip netns add intervppns
73 # create vpp and odl interfaces and set them in intervppns
74 sudo ip link add veth_intervpp1 type veth peer name intervpp1
75 sudo ip link add veth_intervpp2 type veth peer name intervpp2
76 sudo ip link add veth_odl type veth peer name odl
77 sudo ip link set dev intervpp1 up
78 sudo ip link set dev intervpp2 up
79 sudo ip link set dev odl up
80 sudo ip link set dev veth_intervpp1 up netns intervppns
81 sudo ip link set dev veth_intervpp2 up netns intervppns
82 sudo ip link set dev veth_odl up netns intervppns
84 # create bridge in intervppns and add vpp and odl interfaces
85 sudo ip netns exec intervppns brctl addbr vppbr
86 sudo ip netns exec intervppns brctl addif vppbr veth_intervpp1
87 sudo ip netns exec intervppns brctl addif vppbr veth_intervpp2
88 sudo ip netns exec intervppns brctl addif vppbr veth_odl
89 sudo ip netns exec intervppns ifconfig vppbr up
91 # create and configure 1st veth client to vpp pair
92 sudo ip link add veth_vpp1 type veth peer name vpp1
93 sudo ip link set dev vpp1 up
94 sudo ip link set dev veth_vpp1 up netns vppns1
96 # create and configure 2nd veth client to vpp pair
97 sudo ip link add veth_vpp2 type veth peer name vpp2
98 sudo ip link set dev vpp2 up
99 sudo ip link set dev veth_vpp2 up netns vppns2
101 # set odl iface ip and disable checksum offloading
102 sudo ip addr add 6.0.3.100/24 dev odl
103 sudo ip addr add 6:0:3::100/64 dev odl
104 sudo ethtool --offload odl rx off tx off
106 if [ "$1" == "ip6" ] ; then
107 VPP1_CONF="vpp1_6.conf"
108 VPP2_CONF="vpp2_6.conf"
111 if [ "$1" == "ip4_ip6" ] ; then
112 VPP1_CONF="vpp1_ip4_6.conf"
113 VPP2_CONF="vpp2_ip4_6.conf"
116 if [ "$1" == "4o6" ] ; then
117 VPP1_CONF="vpp1_4o6.conf"
118 VPP2_CONF="vpp2_4o6.conf"
121 if [ "$1" == "6o4" ] ; then
122 VPP1_CONF="vpp1_6o4.conf"
123 VPP2_CONF="vpp2_6o4.conf"
126 # start vpp1 and vpp2 in separate chroot
128 unix { log /tmp/vpp1.log cli-listen \
129 localhost:5002 full-coredump \
130 exec $VPP_LITE_CONF/${VPP1_CONF} } \
131 api-trace { on } chroot {prefix xtr1}
134 unix { log /tmp/vpp2.log cli-listen \
135 localhost:5003 full-coredump \
136 exec $VPP_LITE_CONF/${VPP2_CONF}} \
137 api-trace { on } chroot {prefix xtr2}
140 if [ "$#" == 0 ] || [ "$1" == "ip4" ] ; then
144 if [ "$1" == "ip6" ] ; then
148 if [ "$1" == "ip4_ip6" ] ; then
156 if [ "$1" == "4o6" ] ; then
160 if [ "$1" == "6o4" ] ; then