Home | History | Annotate | Download | only in virt
      1 #!/bin/sh
      2 # SPDX-License-Identifier: GPL-2.0-or-later
      3 # Copyright (c) 2018 Petr Vorel <pvorel (at] suse.cz>
      4 # Copyright (c) 2014-2017 Oracle and/or its affiliates.
      5 # Author: Alexey Kodanev <alexey.kodanev (at] oracle.com>
      6 #
      7 # Test-case 1: It requires remote host. Test will setup IPv4 and IPv6 virtual
      8 #              sub-nets between two hosts, then will compare TCP performance
      9 #              with and without VxLAN using ping or netstress test.
     10 #
     11 # Test-case 2: The same as above but must fail, because VXLAN allows
     12 #              to communicate only within the same VXLAN segment.
     13 
     14 TST_NEEDS_TMPDIR=1
     15 TST_OPTS="hi:d:"
     16 TST_PARSE_ARGS=virt_lib_parse_args
     17 TST_USAGE=virt_lib_usage
     18 
     19 virt_type="vxlan"
     20 start_id=16700000
     21 
     22 # Destination address, can be unicast or multicast address
     23 vxlan_dst_addr="uni"
     24 
     25 TST_TEST_DATA=",gbp"
     26 TST_TEST_DATA_IFS=","
     27 TST_NEEDS_TMPDIR=1
     28 TST_TESTFUNC=do_test
     29 TST_CLEANUP=virt_cleanup
     30 . virt_lib.sh
     31 
     32 # In average cases (with small packets less then 150 bytes) VxLAN slower
     33 # by 10-30%. If hosts are too close to each other, e.g. connected to the same
     34 # switch, VxLAN can be much slower when comparing to the performance without
     35 # any encapsulation.
     36 VIRT_PERF_THRESHOLD=${VIRT_PERF_THRESHOLD:-160}
     37 [ "$VIRT_PERF_THRESHOLD" -lt 160 ] && VIRT_PERF_THRESHOLD=160
     38 
     39 do_test()
     40 {
     41 	if [ -z $ip_local -o -z $ip_remote ]; then
     42 		tst_brk TBROK "you must specify IP address"
     43 	fi
     44 
     45 	virt_check_cmd virt_add ltp_v0 id 0 $2 || continue
     46 
     47 	tst_res TINFO "the same VNI must work"
     48 	# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
     49 	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $2" "id 0xFFFFFE $2"
     50 	virt_netperf_msg_sizes
     51 	virt_cleanup_rmt
     52 
     53 	tst_res TINFO "different VNI shall not work together"
     54 	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $2" "id 0xFFFFFD $2"
     55 	virt_minimize_timeout
     56 	virt_compare_netperf "fail"
     57 	virt_cleanup_rmt
     58 }
     59 
     60 tst_run
     61