Name
Date
Size
#Lines
LOC

..--

.gitignoreH A D01-Sep-202058

MakefileH A D08-Apr-20252.9 KiB

READMEH A D08-Apr-20253.5 KiB

bridge_fdb_learning_limit.shH A D05-Feb-20255.8 KiB

bridge_igmp.shH A D05-Feb-202514.7 KiB

bridge_locked_port.shH A D15-Jul-20249.2 KiB

bridge_mdb.shH A D08-Apr-202545.1 KiB

bridge_mdb_host.shH A D21-Feb-20231.7 KiB

bridge_mdb_max.shH A D24-Oct-202330 KiB

bridge_mdb_port_down.shH A D14-Dec-20222.2 KiB

bridge_mld.shH A D05-Feb-202516.2 KiB

bridge_port_isolation.shH A D15-Jan-20192.3 KiB

bridge_sticky_fdb.shH A D15-Jan-20191.1 KiB

bridge_vlan_aware.shH A D05-Feb-20254.2 KiB

bridge_vlan_mcast.shH A D21-Feb-202316.7 KiB

bridge_vlan_unaware.shH A D08-Apr-20251.7 KiB

configH A D15-Jul-20241.2 KiB

custom_multipath_hash.shH A D05-Feb-20259.8 KiB

devlink_lib.shH A D05-Feb-202512.8 KiB

dual_vxlan_bridge.shH A D07-Nov-202311.2 KiB

fib_offload_lib.shH A D14-Dec-202224.6 KiB

forwarding.config.sampleH A D05-Feb-2025706

gre_custom_multipath_hash.shH A D05-Feb-202512.5 KiB

gre_inner_v4_multipath.shH A D15-Jul-20247.6 KiB

gre_inner_v6_multipath.shH A D15-Jul-20247.7 KiB

gre_multipath.shH A D15-Jul-20246.3 KiB

gre_multipath_nh.shH A D15-Jul-20248.1 KiB

gre_multipath_nh_res.shH A D15-Jul-20248.3 KiB

ip6_forward_instats_vrf.shH A D24-Oct-20233 KiB

ip6gre_custom_multipath_hash.shH A D05-Feb-202512.8 KiB

ip6gre_flat.shH A D05-Feb-20251.2 KiB

ip6gre_flat_key.shH A D05-Feb-20251.2 KiB

ip6gre_flat_keys.shH A D05-Feb-20251.3 KiB

ip6gre_hier.shH A D05-Feb-20251.3 KiB

ip6gre_hier_key.shH A D05-Feb-20251.3 KiB

ip6gre_hier_keys.shH A D05-Feb-20251.4 KiB

ip6gre_inner_v4_multipath.shH A D15-Jul-20247.8 KiB

ip6gre_inner_v6_multipath.shH A D15-Jul-20247.9 KiB

ip6gre_lib.shH A D05-Feb-202515.7 KiB

ipip_flat_gre.shH A D11-Jul-2019838

ipip_flat_gre_key.shH A D11-Jul-2019860

ipip_flat_gre_keys.shH A D11-Jul-2019886

ipip_hier_gre.shH A D11-Jul-2019887

ipip_hier_gre_key.shH A D11-Jul-2019910

ipip_hier_gre_keys.shH A D11-Jul-2019938

ipip_lib.shH A D05-Feb-20258.3 KiB

lib.shH A D08-Apr-202541.5 KiB

lib_sh_test.shH A D05-Feb-20253.6 KiB

local_termination.shH A D05-Apr-202514.4 KiB

min_max_mtu.shH A D05-Feb-20254.7 KiB

mirror_gre.shH A D05-Feb-20252.9 KiB

mirror_gre_bound.shH A D05-Feb-20255.5 KiB

mirror_gre_bridge_1d.shH A D05-Feb-20254.1 KiB

mirror_gre_bridge_1d_vlan.shH A D05-Feb-20252.4 KiB

mirror_gre_bridge_1q.shH A D05-Feb-20254 KiB

mirror_gre_bridge_1q_lag.shH A D08-Apr-20257 KiB

mirror_gre_changes.shH A D05-Feb-20255.2 KiB

mirror_gre_flower.shH A D05-Feb-20252.6 KiB

mirror_gre_lag_lacp.shH A D08-Apr-20257.5 KiB

mirror_gre_lib.shH A D05-Feb-20253.6 KiB

mirror_gre_neigh.shH A D05-Feb-20252.1 KiB

mirror_gre_nh.shH A D05-Feb-20252.5 KiB

mirror_gre_topo_lib.shH A D15-Jul-20243.4 KiB

mirror_gre_vlan.shH A D05-Feb-20251.4 KiB

mirror_gre_vlan_bridge_1q.shH A D05-Feb-20258.5 KiB

mirror_lib.shH A D05-Feb-20253.7 KiB

mirror_topo_lib.shH A D07-Nov-20232.7 KiB

mirror_vlan.shH A D05-Feb-20251.9 KiB

no_forwarding.shH A D05-Feb-20255.5 KiB

pedit_dsfield.shH A D07-Nov-20236.7 KiB

pedit_ip.shH A D14-Dec-20224.4 KiB

pedit_l4port.shH A D15-Jan-20224.5 KiB

q_in_vni.shH A D07-Nov-202310.7 KiB

q_in_vni_ipv6.shH A D31-May-202210.9 KiB

router.shH A D14-Dec-20227.3 KiB

router_bridge.shH A D15-Jul-20244 KiB

router_bridge_1d.shH A D15-Jul-20245.1 KiB

router_bridge_1d_lag.shH A D08-Apr-20259.3 KiB

router_bridge_lag.shH A D08-Apr-20256.8 KiB

router_bridge_pvid_vlan_upper.shH A D15-Jul-20243.5 KiB

router_bridge_vlan.shH A D15-Jul-20245.5 KiB

router_bridge_vlan_upper.shH A D15-Jul-20243.9 KiB

router_bridge_vlan_upper_pvid.shH A D15-Jul-20243.7 KiB

router_broadcast.shH A D23-Aug-20195 KiB

router_mpath_nh.shH A D05-Feb-202510.7 KiB

router_mpath_nh_lib.shH A D05-Feb-20253.2 KiB

router_mpath_nh_res.shH A D05-Feb-202512.7 KiB

router_mpath_seed.shH A D05-Feb-20257.4 KiB

router_multicast.shH A D14-Dec-202214.6 KiB

router_multipath.shH A D05-Feb-20257.1 KiB

router_nh.shH A D05-Feb-20253.3 KiB

router_vid_1.shH A D14-Dec-20223.5 KiB

sch_ets.shH A D05-Feb-2025745

sch_ets_core.shH A D05-Feb-20257.3 KiB

sch_ets_tests.shH A D05-Feb-20254.1 KiB

sch_red.shH A D05-Feb-202511.1 KiB

sch_tbf_core.shH A D05-Feb-20254.8 KiB

sch_tbf_ets.shH A D06-Jun-2020118

sch_tbf_etsprio.shH A D05-Feb-20251.4 KiB

sch_tbf_prio.shH A D06-Jun-2020118

sch_tbf_root.shH A D05-Feb-2025496

settingsH A D24-Oct-202310

skbedit_priority.shH A D07-Nov-20233.9 KiB

tc_actions.shH A D05-Feb-20259.3 KiB

tc_chains.shH A D04-May-20214.8 KiB

tc_common.shH A D05-Feb-2025710

tc_flower.shH A D24-Oct-202321.2 KiB

tc_flower_cfm.shH A D07-Nov-20234.9 KiB

tc_flower_l2_miss.shH A D15-Jul-20249.1 KiB

tc_flower_port_range.shH A D08-Apr-20257.4 KiB

tc_flower_router.shH A D16-Sep-20193 KiB

tc_mpls_l2vpn.shH A D24-Feb-20215 KiB

tc_police.shH A D05-Feb-202511.7 KiB

tc_shblocks.shH A D16-Sep-20192.7 KiB

tc_tunnel_key.shH A D05-Feb-20253.7 KiB

tc_vlan_modify.shH A D20-Jul-20193.2 KiB

tsn_lib.shH A D14-Dec-20225.5 KiB

vxlan_asymmetric.shH A D14-Dec-202217.6 KiB

vxlan_asymmetric_ipv6.shH A D31-May-202216 KiB

vxlan_bridge_1d.shH A D08-Apr-202521 KiB

vxlan_bridge_1d_ipv6.shH A D15-Jul-202421.3 KiB

vxlan_bridge_1d_port_8472.shH A D11-Jul-2019172

vxlan_bridge_1d_port_8472_ipv6.shH A D31-May-2022188

vxlan_bridge_1q.shH A D08-Apr-202523.6 KiB

vxlan_bridge_1q_ipv6.shH A D15-Jul-202424.3 KiB

vxlan_bridge_1q_port_8472.shH A D11-Jul-2019172

vxlan_bridge_1q_port_8472_ipv6.shH A D31-May-2022188

vxlan_reserved.shH A D08-Apr-20257.2 KiB

vxlan_symmetric.shH A D23-Feb-202118.1 KiB

vxlan_symmetric_ipv6.shH A D31-May-202218.3 KiB

README

1Motivation
2==========
3
4One of the nice things about network namespaces is that they allow one
5to easily create and test complex environments.
6
7Unfortunately, these namespaces can not be used with actual switching
8ASICs, as their ports can not be migrated to other network namespaces
9(dev->netns_immutable) and most of them probably do not support the
10L1-separation provided by namespaces.
11
12However, a similar kind of flexibility can be achieved by using VRFs and
13by looping the switch ports together. For example:
14
15                             br0
16                              +
17               vrf-h1         |           vrf-h2
18                 +        +---+----+        +
19                 |        |        |        |
20    192.0.2.1/24 +        +        +        + 192.0.2.2/24
21               swp1     swp2     swp3     swp4
22                 +        +        +        +
23                 |        |        |        |
24                 +--------+        +--------+
25
26The VRFs act as lightweight namespaces representing hosts connected to
27the switch.
28
29This approach for testing switch ASICs has several advantages over the
30traditional method that requires multiple physical machines, to name a
31few:
32
331. Only the device under test (DUT) is being tested without noise from
34other system.
35
362. Ability to easily provision complex topologies. Testing bridging
37between 4-ports LAGs or 8-way ECMP requires many physical links that are
38not always available. With the VRF-based approach one merely needs to
39loopback more ports.
40
41These tests are written with switch ASICs in mind, but they can be run
42on any Linux box using veth pairs to emulate physical loopbacks.
43
44Guidelines for Writing Tests
45============================
46
47o Where possible, reuse an existing topology for different tests instead
48  of recreating the same topology.
49o Tests that use anything but the most trivial topologies should include
50  an ASCII art showing the topology.
51o Where possible, IPv6 and IPv4 addresses shall conform to RFC 3849 and
52  RFC 5737, respectively.
53o Where possible, tests shall be written so that they can be reused by
54  multiple topologies and added to lib.sh.
55o Checks shall be added to lib.sh for any external dependencies.
56o Code shall be checked using ShellCheck [1] prior to submission.
57
581. https://www.shellcheck.net/
59
60Customization
61=============
62
63The forwarding selftests framework uses a number of variables that
64influence its behavior and tools it invokes, and how it invokes them, in
65various ways. A number of these variables can be overridden. The way these
66overridable variables are specified is typically one of the following two
67syntaxes:
68
69	: "${VARIABLE:=default_value}"
70	VARIABLE=${VARIABLE:=default_value}
71
72Any of these variables can be overridden. Notably net/forwarding/lib.sh and
73net/lib.sh contain a number of overridable variables.
74
75One way of overriding these variables is through the environment:
76
77	PAUSE_ON_FAIL=yes ./some_test.sh
78
79The variable NETIFS is special. Since it is an array variable, there is no
80way to pass it through the environment. Its value can instead be given as
81consecutive arguments to the selftest:
82
83	./some_test.sh swp{1..8}
84
85A way to customize variables in a persistent fashion is to create a file
86named forwarding.config in this directory. lib.sh sources the file if
87present, so it can contain any shell code. Typically it will contain
88assignments of variables whose value should be overridden.
89
90forwarding.config.sample is available in the directory as an example of
91how forwarding.config might look.
92