1f08c3bdfSopenharmony_ci#!/bin/sh
2f08c3bdfSopenharmony_ci# SPDX-License-Identifier: GPL-2.0-or-later
3f08c3bdfSopenharmony_ci# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
4f08c3bdfSopenharmony_ci# Copyright (c) 2014-2017 Oracle and/or its affiliates.
5f08c3bdfSopenharmony_ci# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
6f08c3bdfSopenharmony_ci#
7f08c3bdfSopenharmony_ci# Test-case 1: It requires remote host. Test will setup IPv4 and IPv6 virtual
8f08c3bdfSopenharmony_ci#              sub-nets between two hosts, then will compare TCP performance
9f08c3bdfSopenharmony_ci#              with and without VxLAN using ping or netstress test.
10f08c3bdfSopenharmony_ci#
11f08c3bdfSopenharmony_ci# Test-case 2: The same as above but must fail, because VXLAN allows
12f08c3bdfSopenharmony_ci#              to communicate only within the same VXLAN segment.
13f08c3bdfSopenharmony_ci
14f08c3bdfSopenharmony_ciTST_NEEDS_TMPDIR=1
15f08c3bdfSopenharmony_ciTST_OPTS="hi:d:"
16f08c3bdfSopenharmony_ciTST_PARSE_ARGS=virt_lib_parse_args
17f08c3bdfSopenharmony_ciTST_USAGE=virt_lib_usage
18f08c3bdfSopenharmony_ci
19f08c3bdfSopenharmony_civirt_type="vxlan"
20f08c3bdfSopenharmony_cistart_id=16700000
21f08c3bdfSopenharmony_ci
22f08c3bdfSopenharmony_ci# Destination address, can be unicast or multicast address
23f08c3bdfSopenharmony_civxlan_dst_addr="uni"
24f08c3bdfSopenharmony_ci
25f08c3bdfSopenharmony_ciTST_TEST_DATA=",gbp"
26f08c3bdfSopenharmony_ciTST_TEST_DATA_IFS=","
27f08c3bdfSopenharmony_ciTST_NEEDS_TMPDIR=1
28f08c3bdfSopenharmony_ciTST_TESTFUNC=do_test
29f08c3bdfSopenharmony_ciTST_CLEANUP=virt_cleanup
30f08c3bdfSopenharmony_ci# In average cases (with small packets less then 150 bytes) VxLAN slower
31f08c3bdfSopenharmony_ci# by 10-30%. If hosts are too close to each other, e.g. connected to the same
32f08c3bdfSopenharmony_ci# switch, VxLAN can be much slower when comparing to the performance without
33f08c3bdfSopenharmony_ci# any encapsulation.
34f08c3bdfSopenharmony_ciVIRT_PERF_THRESHOLD_MIN=160
35f08c3bdfSopenharmony_ci
36f08c3bdfSopenharmony_cido_test()
37f08c3bdfSopenharmony_ci{
38f08c3bdfSopenharmony_ci	virt_check_cmd virt_add ltp_v0 id 0 $2 || return
39f08c3bdfSopenharmony_ci
40f08c3bdfSopenharmony_ci	tst_res TINFO "the same VNI must work"
41f08c3bdfSopenharmony_ci	# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
42f08c3bdfSopenharmony_ci	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $2" "id 0xFFFFFE $2"
43f08c3bdfSopenharmony_ci	virt_netperf_msg_sizes
44f08c3bdfSopenharmony_ci	virt_cleanup_rmt
45f08c3bdfSopenharmony_ci
46f08c3bdfSopenharmony_ci	tst_res TINFO "different VNI shall not work together"
47f08c3bdfSopenharmony_ci	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $2" "id 0xFFFFFD $2"
48f08c3bdfSopenharmony_ci	virt_minimize_timeout
49f08c3bdfSopenharmony_ci	virt_compare_netperf "fail"
50f08c3bdfSopenharmony_ci	virt_cleanup_rmt
51f08c3bdfSopenharmony_ci}
52f08c3bdfSopenharmony_ci
53f08c3bdfSopenharmony_ci. virt_lib.sh
54f08c3bdfSopenharmony_citst_run
55