xref: /aosp_15_r20/external/ltp/testcases/network/virt/vxlan03.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker#!/bin/sh
2*49cdfc7eSAndroid Build Coastguard Worker# SPDX-License-Identifier: GPL-2.0-or-later
3*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) 2018 Petr Vorel <[email protected]>
4*49cdfc7eSAndroid Build Coastguard Worker# Copyright (c) 2014-2017 Oracle and/or its affiliates.
5*49cdfc7eSAndroid Build Coastguard Worker# Author: Alexey Kodanev <[email protected]>
6*49cdfc7eSAndroid Build Coastguard Worker#
7*49cdfc7eSAndroid Build Coastguard Worker# Test-case 1: It requires remote host. Test will setup IPv4 and IPv6 virtual
8*49cdfc7eSAndroid Build Coastguard Worker#              sub-nets between two hosts, then will compare TCP performance
9*49cdfc7eSAndroid Build Coastguard Worker#              with and without VxLAN using ping or netstress test.
10*49cdfc7eSAndroid Build Coastguard Worker#
11*49cdfc7eSAndroid Build Coastguard Worker# Test-case 2: The same as above but must fail, because VXLAN allows
12*49cdfc7eSAndroid Build Coastguard Worker#              to communicate only within the same VXLAN segment.
13*49cdfc7eSAndroid Build Coastguard Worker
14*49cdfc7eSAndroid Build Coastguard WorkerTST_NEEDS_TMPDIR=1
15*49cdfc7eSAndroid Build Coastguard WorkerTST_OPTS="hi:d:"
16*49cdfc7eSAndroid Build Coastguard WorkerTST_PARSE_ARGS=virt_lib_parse_args
17*49cdfc7eSAndroid Build Coastguard WorkerTST_USAGE=virt_lib_usage
18*49cdfc7eSAndroid Build Coastguard Worker
19*49cdfc7eSAndroid Build Coastguard Workervirt_type="vxlan"
20*49cdfc7eSAndroid Build Coastguard Workerstart_id=16700000
21*49cdfc7eSAndroid Build Coastguard Worker
22*49cdfc7eSAndroid Build Coastguard Worker# Destination address, can be unicast or multicast address
23*49cdfc7eSAndroid Build Coastguard Workervxlan_dst_addr="uni"
24*49cdfc7eSAndroid Build Coastguard Worker
25*49cdfc7eSAndroid Build Coastguard WorkerTST_TEST_DATA=",gbp"
26*49cdfc7eSAndroid Build Coastguard WorkerTST_TEST_DATA_IFS=","
27*49cdfc7eSAndroid Build Coastguard WorkerTST_NEEDS_TMPDIR=1
28*49cdfc7eSAndroid Build Coastguard WorkerTST_TESTFUNC=do_test
29*49cdfc7eSAndroid Build Coastguard WorkerTST_CLEANUP=virt_cleanup
30*49cdfc7eSAndroid Build Coastguard Worker# In average cases (with small packets less then 150 bytes) VxLAN slower
31*49cdfc7eSAndroid Build Coastguard Worker# by 10-30%. If hosts are too close to each other, e.g. connected to the same
32*49cdfc7eSAndroid Build Coastguard Worker# switch, VxLAN can be much slower when comparing to the performance without
33*49cdfc7eSAndroid Build Coastguard Worker# any encapsulation.
34*49cdfc7eSAndroid Build Coastguard WorkerVIRT_PERF_THRESHOLD_MIN=160
35*49cdfc7eSAndroid Build Coastguard Worker
36*49cdfc7eSAndroid Build Coastguard Workerdo_test()
37*49cdfc7eSAndroid Build Coastguard Worker{
38*49cdfc7eSAndroid Build Coastguard Worker	virt_check_cmd virt_add ltp_v0 id 0 $2 || return
39*49cdfc7eSAndroid Build Coastguard Worker
40*49cdfc7eSAndroid Build Coastguard Worker	tst_res TINFO "the same VNI must work"
41*49cdfc7eSAndroid Build Coastguard Worker	# VNI is 24 bits long, so max value, which is not reserved, is 0xFFFFFE
42*49cdfc7eSAndroid Build Coastguard Worker	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $2" "id 0xFFFFFE $2"
43*49cdfc7eSAndroid Build Coastguard Worker	virt_netperf_msg_sizes
44*49cdfc7eSAndroid Build Coastguard Worker	virt_cleanup_rmt
45*49cdfc7eSAndroid Build Coastguard Worker
46*49cdfc7eSAndroid Build Coastguard Worker	tst_res TINFO "different VNI shall not work together"
47*49cdfc7eSAndroid Build Coastguard Worker	vxlan_setup_subnet_$vxlan_dst_addr "id 0xFFFFFE $2" "id 0xFFFFFD $2"
48*49cdfc7eSAndroid Build Coastguard Worker	virt_minimize_timeout
49*49cdfc7eSAndroid Build Coastguard Worker	virt_compare_netperf "fail"
50*49cdfc7eSAndroid Build Coastguard Worker	virt_cleanup_rmt
51*49cdfc7eSAndroid Build Coastguard Worker}
52*49cdfc7eSAndroid Build Coastguard Worker
53*49cdfc7eSAndroid Build Coastguard Worker. virt_lib.sh
54*49cdfc7eSAndroid Build Coastguard Workertst_run
55