Home | History | Annotate | Download | only in virt
      1 #!/bin/sh
      2 # Copyright (c) 2014-2016 Oracle and/or its affiliates. All Rights Reserved.
      3 #
      4 # This program is free software; you can redistribute it and/or
      5 # modify it under the terms of the GNU General Public License as
      6 # published by the Free Software Foundation; either version 2 of
      7 # the License, or (at your option) any later version.
      8 #
      9 # This program is distributed in the hope that it would be useful,
     10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 # GNU General Public License for more details.
     13 #
     14 # You should have received a copy of the GNU General Public License
     15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
     16 #
     17 # Author: Alexey Kodanev <alexey.kodanev (at] oracle.com>
     18 #
     19 # Test-case 1: It requires remote host. Test will setup IPv4 and IPv6 virtual
     20 #              sub-nets between two hosts, then will compare TCP performance
     21 #              with and without VxLAN using ping or netstress test.
     22 #
     23 # Test-case 2: The same as above but must fail, because VXLAN allows
     24 #              to communicate only within the same VXLAN segment.
     25 
     26 TCID=vxlan03
     27 TST_TOTAL=4
     28 
     29 virt_type="vxlan"
     30 start_id=16700000
     31 
     32 # Destination address, can be unicast or multicast address
     33 vxlan_dst_addr="uni"
     34 
     35 . test_net.sh
     36 . virt_lib.sh
     37 
     38 # In average cases (with small packets less then 150 bytes) VxLAN slower
     39 # by 10-30%. If hosts are too close to each other, e.g. connected to the same
     40 # switch, VxLAN can be much slower when comparing to the performance without
     41 # any encapsulation.
     42 VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-160}
     43 [ "$VIRT_PERF_THRESHOLD" -lt 160 ] && VIRT_PERF_THRESHOLD=160
     44 
     45 cleanup()
     46 {
     47 	cleanup_vifaces
     48 	tst_rhost_run -c "ip link delete ltp_v0 2>/dev/null"
     49 }
     50 TST_CLEANUP="cleanup"
     51 
     52 if [ -z $ip_local -o -z $ip_remote ]; then
     53 	tst_brkm TBROK "you must specify IP address"
     54 fi
     55 
     56 opts=" ,gbp"
     57 
     58 for n in $(seq 1 2); do
     59 	p="$(echo $opts | cut -d',' -f$n)"
     60 
     61 	virt_check_cmd virt_add ltp_v0 id 0 $p || continue
     62 
     63 	tst_resm TINFO "the same VNI must work"
     64 	# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
     65 	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $p" "id 0xFFFFFE $p"
     66 	virt_compare_netperf
     67 
     68 	tst_resm TINFO "different VNI shall not work together"
     69 	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $p" "id 0xFFFFFD $p"
     70 	virt_compare_netperf "fail"
     71 done
     72 
     73 tst_exit
     74