xref: /aosp_15_r20/external/ltp/testcases/network/virt/vlan03.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) 2015-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 VLAN 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 VLAN allows
12*49cdfc7eSAndroid Build Coastguard Worker#              to communicate only within the same VLAN segment.
13*49cdfc7eSAndroid Build Coastguard Worker
14*49cdfc7eSAndroid Build Coastguard Workerp0="protocol 802.1Q"
15*49cdfc7eSAndroid Build Coastguard Workerp1="protocol 802.1ad"
16*49cdfc7eSAndroid Build Coastguard Workerlb0="loose_binding off"
17*49cdfc7eSAndroid Build Coastguard Workerlb1="loose_binding on"
18*49cdfc7eSAndroid Build Coastguard Workerrh0="reorder_hdr off"
19*49cdfc7eSAndroid Build Coastguard Workerrh1="reorder_hdr on"
20*49cdfc7eSAndroid Build Coastguard Worker
21*49cdfc7eSAndroid Build Coastguard Workervirt_type="vlan"
22*49cdfc7eSAndroid Build Coastguard Worker
23*49cdfc7eSAndroid Build Coastguard WorkerTST_NEEDS_TMPDIR=1
24*49cdfc7eSAndroid Build Coastguard WorkerTST_TEST_DATA=",$p0 $lb0 $rh1,$p1 $lb1 $rh1"
25*49cdfc7eSAndroid Build Coastguard WorkerTST_TEST_DATA_IFS=","
26*49cdfc7eSAndroid Build Coastguard WorkerTST_TESTFUNC=do_test
27*49cdfc7eSAndroid Build Coastguard WorkerTST_SETUP=virt_lib_setup
28*49cdfc7eSAndroid Build Coastguard WorkerTST_CLEANUP=virt_cleanup
29*49cdfc7eSAndroid Build Coastguard Worker
30*49cdfc7eSAndroid Build Coastguard Workerdo_test()
31*49cdfc7eSAndroid Build Coastguard Worker{
32*49cdfc7eSAndroid Build Coastguard Worker	virt_check_cmd virt_add ltp_v0 id 0 $2 || return
33*49cdfc7eSAndroid Build Coastguard Worker
34*49cdfc7eSAndroid Build Coastguard Worker	tst_res TINFO "networks with the same VLAN ID must work"
35*49cdfc7eSAndroid Build Coastguard Worker	virt_setup "id 4094 $2" "id 4094 $2"
36*49cdfc7eSAndroid Build Coastguard Worker	virt_netperf_msg_sizes
37*49cdfc7eSAndroid Build Coastguard Worker	virt_cleanup_rmt
38*49cdfc7eSAndroid Build Coastguard Worker
39*49cdfc7eSAndroid Build Coastguard Worker	tst_res TINFO "different VLAN ID shall not work together"
40*49cdfc7eSAndroid Build Coastguard Worker	virt_setup "id 4093 $2" "id 4094 $2"
41*49cdfc7eSAndroid Build Coastguard Worker	virt_minimize_timeout
42*49cdfc7eSAndroid Build Coastguard Worker	virt_compare_netperf "fail"
43*49cdfc7eSAndroid Build Coastguard Worker	virt_cleanup_rmt
44*49cdfc7eSAndroid Build Coastguard Worker}
45*49cdfc7eSAndroid Build Coastguard Worker
46*49cdfc7eSAndroid Build Coastguard Worker. virt_lib.sh
47*49cdfc7eSAndroid Build Coastguard Workertst_run
48