3 if [ "$1" == "-h" ] || [ "$1" == "-help" ] ; then
4 echo "lisp_test.sh [ip4] [ip6] [ip4_ip6] [4o6] [6o4] [remote] [remote6]"
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"
10 echo " remote - test static mapping, without ODL"
11 echo " remote6 - test static mapping for IPv6, without ODL"
17 VPP_LITE_CONF=`pwd`"/../configs/vpp_lite_config/"
20 ODL_CONFIG_DIR="../configs/odl/"
21 ODL_ADD_CONFIG1="add_ipv4_odl1.txt"
22 ODL_ADD_CONFIG1_4o6="add_ipv4o6_odl1.txt"
23 ODL_ADD_CONFIG1_6="add_ipv6_odl1.txt"
24 ODL_ADD_CONFIG1_6o4="add_ipv6o4_odl1.txt"
25 ODL_ADD_CONFIG2="add_ipv4_odl2.txt"
26 ODL_ADD_CONFIG2_4o6="add_ipv4o6_odl2.txt"
27 ODL_ADD_CONFIG2_6="add_ipv6_odl2.txt"
28 ODL_ADD_CONFIG2_6o4="add_ipv6o4_odl2.txt"
29 ODL_REPLACE_CONFIG2="replace_ipv4_odl2.txt"
30 ODL_REPLACE_CONFIG2_4o6="replace_ipv4o6_odl2.txt"
31 ODL_REPLACE_CONFIG2_6="replace_ipv6_odl2.txt"
32 ODL_REPLACE_CONFIG2_6o4="replace_ipv6o4_odl2.txt"
37 # make sure there are no vpp instances running
40 # delete previous incarnations if they exist
41 sudo ip netns exec intervppns ifconfig vppbr down
42 sudo ip netns exec intervppns brctl delbr vppbr
43 sudo ip link del dev veth_vpp1 &> /dev/null
44 sudo ip link del dev veth_vpp2 &> /dev/null
45 sudo ip link del dev veth_intervpp1 &> /dev/null
46 sudo ip link del dev veth_intervpp2 &> /dev/null
47 sudo ip link del dev veth_odl &> /dev/null
48 sudo ip netns del vppns1 &> /dev/null
49 sudo ip netns del vppns2 &> /dev/null
50 sudo ip netns del intervppns &> /dev/null
52 if [ "$1" != "remote" ] && [ "$1" != "remote6" ] ; then
56 if [ "$1" == "clean" ] ; then
62 # create vpp to clients and inter-vpp namespaces
63 sudo ip netns add vppns1
64 sudo ip netns add vppns2
65 sudo ip netns add intervppns
67 # create vpp and odl interfaces and set them in intervppns
68 sudo ip link add veth_intervpp1 type veth peer name intervpp1
69 sudo ip link add veth_intervpp2 type veth peer name intervpp2
70 sudo ip link add veth_odl type veth peer name odl
71 sudo ip link set dev intervpp1 up
72 sudo ip link set dev intervpp2 up
73 sudo ip link set dev odl up
74 sudo ip link set dev veth_intervpp1 up netns intervppns
75 sudo ip link set dev veth_intervpp2 up netns intervppns
76 sudo ip link set dev veth_odl up netns intervppns
78 # create bridge in intervppns and add vpp and odl interfaces
79 sudo ip netns exec intervppns brctl addbr vppbr
80 sudo ip netns exec intervppns brctl addif vppbr veth_intervpp1
81 sudo ip netns exec intervppns brctl addif vppbr veth_intervpp2
82 sudo ip netns exec intervppns brctl addif vppbr veth_odl
83 sudo ip netns exec intervppns ifconfig vppbr up
85 # create and configure 1st veth client to vpp pair
86 sudo ip link add veth_vpp1 type veth peer name vpp1
87 sudo ip link set dev vpp1 up
88 sudo ip link set dev veth_vpp1 up netns vppns1
90 # create and configure 2nd veth client to vpp pair
91 sudo ip link add veth_vpp2 type veth peer name vpp2
92 sudo ip link set dev vpp2 up
93 sudo ip link set dev veth_vpp2 up netns vppns2
95 # set odl iface ip and disable checksum offloading
96 sudo ip addr add 6.0.3.100/24 dev odl
97 sudo ip addr add 6:0:3::100/64 dev odl
98 sudo ethtool --offload odl rx off tx off
100 if [ "$1" == "ip6" ] ; then
101 VPP1_CONF="vpp1_6.conf"
102 VPP2_CONF="vpp2_6.conf"
105 if [ "$1" == "ip4_ip6" ] ; then
106 VPP1_CONF="vpp1_ip4_6.conf"
107 VPP2_CONF="vpp2_ip4_6.conf"
110 if [ "$1" == "4o6" ] ; then
111 VPP1_CONF="vpp1_4o6.conf"
112 VPP2_CONF="vpp2_4o6.conf"
115 if [ "$1" == "6o4" ] ; then
116 VPP1_CONF="vpp1_6o4.conf"
117 VPP2_CONF="vpp2_6o4.conf"
120 if [ "$1" == "remote" ] ; then
121 VPP1_CONF="vpp1_remote.conf"
122 VPP2_CONF="vpp2_remote.conf"
125 if [ "$1" == "remote6" ] ; then
126 VPP1_CONF="vpp1_6_remote.conf"
127 VPP2_CONF="vpp2_6_remote.conf"
130 # start vpp1 and vpp2 in separate chroot
132 unix { log /tmp/vpp1.log cli-listen \
133 localhost:5002 full-coredump \
134 exec $VPP_LITE_CONF/${VPP1_CONF} } \
135 api-trace { on } api-segment {prefix xtr1}
138 unix { log /tmp/vpp2.log cli-listen \
139 localhost:5003 full-coredump \
140 exec $VPP_LITE_CONF/${VPP2_CONF}} \
141 api-trace { on } api-segment {prefix xtr2}
144 if [ "$#" == 0 ] || [ "$1" == "ip4" ] ; then
148 if [ "$1" == "ip6" ] ; then
152 if [ "$1" == "ip4_ip6" ] ; then
160 if [ "$1" == "4o6" ] ; then
164 if [ "$1" == "6o4" ] ; then
168 if [ "$1" == "remote" ] ; then
169 source lisp_remote_mapping.sh
172 if [ "$1" == "remote6" ] ; then
173 source lisp_6_remote_mapping.sh