xref: /linux/tools/testing/selftests/net/forwarding/ip6gre_hier.sh (revision a4eb44a6435d6d8f9e642407a4a06f65eb90ca04)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4# Test IP-in-IP GRE tunnels without key.
5# This test uses hierarchical topology for IP tunneling tests. See
6# ip6gre_lib.sh for more details.
7
8ALL_TESTS="
9	gre_hier
10	gre_mtu_change
11"
12
13NUM_NETIFS=6
14source lib.sh
15source ip6gre_lib.sh
16
17setup_prepare()
18{
19	h1=${NETIFS[p1]}
20	ol1=${NETIFS[p2]}
21
22	ul1=${NETIFS[p3]}
23	ul2=${NETIFS[p4]}
24
25	ol2=${NETIFS[p5]}
26	h2=${NETIFS[p6]}
27
28	forwarding_enable
29	vrf_prepare
30	h1_create
31	h2_create
32	sw1_hierarchical_create $ol1 $ul1
33	sw2_hierarchical_create $ol2 $ul2
34}
35
36gre_hier()
37{
38	test_traffic_ip4ip6 "GRE hierarchical IPv4-in-IPv6"
39	test_traffic_ip6ip6 "GRE hierarchical IPv6-in-IPv6"
40}
41
42gre_mtu_change()
43{
44	test_mtu_change gre
45}
46
47cleanup()
48{
49	pre_cleanup
50
51	sw2_hierarchical_destroy $ol2 $ul2
52	sw1_hierarchical_destroy $ol1 $ul1
53	h2_destroy
54	h1_destroy
55	vrf_cleanup
56	forwarding_restore
57}
58
59trap cleanup EXIT
60
61setup_prepare
62setup_wait
63tests_run
64
65exit $EXIT_STATUS
66