Name Date Size #Lines LOC

..--

.gitignoreH A D01-Sep-202058 32

MakefileH A D20-Sep-20242.9 KiB132126

READMEH A D06-Oct-20243.4 KiB9269

bridge_fdb_learning_limit.shH A D20-Sep-20245.8 KiB302216

bridge_igmp.shH A D20-Sep-202414.7 KiB565404

bridge_locked_port.shH A D15-Jul-20249.2 KiB366249

bridge_mdb.shH A D15-Jul-202445.1 KiB1,372926

bridge_mdb_host.shH A D21-Feb-20231.7 KiB10470

bridge_mdb_max.shH A D24-Oct-202330 KiB1,3481,013

bridge_mdb_port_down.shH A D14-Dec-20222.2 KiB11980

bridge_mld.shH A D20-Sep-202416.2 KiB565412

bridge_port_isolation.shH A D15-Jan-20192.3 KiB152112

bridge_sticky_fdb.shH A D15-Jan-20191.1 KiB7052

bridge_vlan_aware.shH A D02-Oct-20244.2 KiB205139

bridge_vlan_mcast.shH A D21-Feb-202316.7 KiB547442

bridge_vlan_unaware.shH A D14-Dec-20221.2 KiB10676

configH A D15-Jul-20241.2 KiB5554

custom_multipath_hash.shH A D06-Oct-20249.8 KiB373245

devlink_lib.shH A D20-Sep-202412.8 KiB599448

dual_vxlan_bridge.shH A D07-Nov-202311.2 KiB368223

fib_offload_lib.shH A D14-Dec-202224.6 KiB874600

forwarding.config.sampleH A D20-Sep-2024706 3116

gre_custom_multipath_hash.shH A D06-Oct-202412.5 KiB465295

gre_inner_v4_multipath.shH A D15-Jul-20247.6 KiB306182

gre_inner_v6_multipath.shH A D15-Jul-20247.7 KiB307183

gre_multipath.shH A D15-Jul-20246.3 KiB258157

gre_multipath_nh.shH A D15-Jul-20248.1 KiB320202

gre_multipath_nh_res.shH A D15-Jul-20248.3 KiB324206

ip6_forward_instats_vrf.shH A D24-Oct-20233 KiB175129

ip6gre_custom_multipath_hash.shH A D06-Oct-202412.8 KiB467297

ip6gre_flat.shH A D31-Oct-20241.2 KiB8056

ip6gre_flat_key.shH A D31-Oct-20241.2 KiB8056

ip6gre_flat_keys.shH A D31-Oct-20241.3 KiB8056

ip6gre_hier.shH A D31-Oct-20241.3 KiB8056

ip6gre_hier_key.shH A D31-Oct-20241.3 KiB8056

ip6gre_hier_keys.shH A D31-Oct-20241.4 KiB8056

ip6gre_inner_v4_multipath.shH A D15-Jul-20247.8 KiB305182

ip6gre_inner_v6_multipath.shH A D15-Jul-20247.9 KiB306183

ip6gre_lib.shH A D31-Oct-202415.7 KiB519283

ipip_flat_gre.shH A D11-Jul-2019838 6443

ipip_flat_gre_key.shH A D11-Jul-2019860 6443

ipip_flat_gre_keys.shH A D11-Jul-2019886 6443

ipip_hier_gre.shH A D11-Jul-2019887 6443

ipip_hier_gre_key.shH A D11-Jul-2019910 6443

ipip_hier_gre_keys.shH A D11-Jul-2019938 6443

ipip_lib.shH A D20-Sep-20248.3 KiB349157

lib.shH A D06-Oct-202444.6 KiB2,2961,760

lib_sh_test.shH A D20-Sep-20243.6 KiB209149

local_termination.shH A D02-Oct-202414.4 KiB597472

min_max_mtu.shH A D20-Sep-20244.7 KiB284192

mirror_gre.shH A D20-Sep-20242.9 KiB14298

mirror_gre_bound.shH A D20-Sep-20245.5 KiB207115

mirror_gre_bridge_1d.shH A D20-Sep-20244.1 KiB11958

mirror_gre_bridge_1d_vlan.shH A D20-Sep-20242.4 KiB11576

mirror_gre_bridge_1q.shH A D20-Sep-20244 KiB11557

mirror_gre_bridge_1q_lag.shH A D20-Sep-20247 KiB276177

mirror_gre_changes.shH A D20-Sep-20245.2 KiB255179

mirror_gre_flower.shH A D20-Sep-20242.6 KiB12583

mirror_gre_lag_lacp.shH A D20-Sep-20247.5 KiB271166

mirror_gre_lib.shH A D20-Sep-20243.6 KiB173136

mirror_gre_neigh.shH A D20-Sep-20242.1 KiB9966

mirror_gre_nh.shH A D20-Sep-20242.5 KiB11370

mirror_gre_topo_lib.shH A D15-Jul-20243.4 KiB9545

mirror_gre_vlan.shH A D20-Sep-20241.4 KiB7448

mirror_gre_vlan_bridge_1q.shH A D20-Sep-20248.5 KiB330211

mirror_lib.shH A D20-Sep-20243.7 KiB181145

mirror_topo_lib.shH A D07-Nov-20232.7 KiB10360

mirror_vlan.shH A D20-Sep-20241.9 KiB11376

no_forwarding.shH A D17-Oct-20245.5 KiB265190

pedit_dsfield.shH A D07-Nov-20236.7 KiB314236

pedit_ip.shH A D14-Dec-20224.4 KiB202144

pedit_l4port.shH A D15-Jan-20224.5 KiB201144

q_in_vni.shH A D07-Nov-202310.7 KiB349214

q_in_vni_ipv6.shH A D31-May-202210.9 KiB348213

router.shH A D14-Dec-20227.3 KiB341228

router_bridge.shH A D15-Jul-20244 KiB191132

router_bridge_1d.shH A D15-Jul-20245.1 KiB186126

router_bridge_1d_lag.shH A D15-Jul-20249.3 KiB409270

router_bridge_lag.shH A D15-Jul-20246.8 KiB324241

router_bridge_pvid_vlan_upper.shH A D15-Jul-20243.5 KiB156100

router_bridge_vlan.shH A D15-Jul-20245.5 KiB225152

router_bridge_vlan_upper.shH A D15-Jul-20243.9 KiB170111

router_bridge_vlan_upper_pvid.shH A D15-Jul-20243.7 KiB172114

router_broadcast.shH A D23-Aug-20195 KiB238179

router_mpath_nh.shH A D06-Oct-202410.7 KiB465315

router_mpath_nh_lib.shH A D06-Oct-20243.2 KiB133107

router_mpath_nh_res.shH A D06-Oct-202412.7 KiB491334

router_mpath_seed.shH A D20-Sep-20247.4 KiB334247

router_multicast.shH A D14-Dec-202214.6 KiB507324

router_multipath.shH A D06-Oct-20247.1 KiB308222

router_nh.shH A D20-Sep-20243.3 KiB175112

router_vid_1.shH A D14-Dec-20223.5 KiB16198

sch_ets.shH A D01-Sep-2020781 4834

sch_ets_core.shH A D06-Jun-20207.3 KiB301187

sch_ets_tests.shH A D20-Sep-20244.1 KiB227175

sch_red.shH A D20-Sep-202411.2 KiB494342

sch_tbf_core.shH A D20-Sep-20245 KiB234142

sch_tbf_ets.shH A D06-Jun-2020118 73

sch_tbf_etsprio.shH A D31-Aug-20231.4 KiB7250

sch_tbf_prio.shH A D06-Jun-2020118 73

sch_tbf_root.shH A D31-Aug-2023489 3826

settingsH A D24-Oct-202310 21

skbedit_priority.shH A D07-Nov-20233.9 KiB173116

tc_actions.shH A D06-Oct-20249.3 KiB363272

tc_chains.shH A D04-May-20214.8 KiB206148

tc_common.shH A D20-Sep-2024710 3725

tc_flower.shH A D24-Oct-202321.2 KiB718492

tc_flower_cfm.shH A D07-Nov-20234.9 KiB207152

tc_flower_l2_miss.shH A D15-Jul-20249.1 KiB358240

tc_flower_port_range.shH A D15-Jul-20245.9 KiB229174

tc_flower_router.shH A D16-Sep-20193 KiB173123

tc_mpls_l2vpn.shH A D24-Feb-20215 KiB193111

tc_police.shH A D15-Jul-202411.8 KiB442292

tc_shblocks.shH A D16-Sep-20192.7 KiB153108

tc_tunnel_key.shH A D20-Sep-20243.7 KiB163126

tc_vlan_modify.shH A D20-Jul-20193.2 KiB165116

tsn_lib.shH A D14-Dec-20225.5 KiB250190

vxlan_asymmetric.shH A D14-Dec-202217.6 KiB578354

vxlan_asymmetric_ipv6.shH A D31-May-202216 KiB505312

vxlan_bridge_1d.shH A D20-Sep-202420.4 KiB798552

vxlan_bridge_1d_ipv6.shH A D15-Jul-202421.3 KiB805569

vxlan_bridge_1d_port_8472.shH A D11-Jul-2019172 115

vxlan_bridge_1d_port_8472_ipv6.shH A D31-May-2022188 126

vxlan_bridge_1q.shH A D15-Jul-202422.9 KiB841540

vxlan_bridge_1q_ipv6.shH A D15-Jul-202424.3 KiB838547

vxlan_bridge_1q_port_8472.shH A D11-Jul-2019172 115

vxlan_bridge_1q_port_8472_ipv6.shH A D31-May-2022188 126

vxlan_symmetric.shH A D23-Feb-202118.1 KiB562346

vxlan_symmetric_ipv6.shH A D31-May-202218.3 KiB564348

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_local) 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