Name Date Size #Lines LOC

..11-Dec-2024-

.gitignoreH A D07-Mar-202158 32

MakefileH A D05-Apr-20242.9 KiB131126

READMEH A D07-Mar-20212.3 KiB5946

bridge_igmp.shH A D13-Jun-202414.7 KiB565404

bridge_locked_port.shH A D05-Apr-20249.2 KiB366249

bridge_mdb.shH A D05-Apr-202438.7 KiB1,185825

bridge_mdb_host.shH A D05-Apr-20241.7 KiB10470

bridge_mdb_max.shH A D05-Apr-202430 KiB1,3481,013

bridge_mdb_port_down.shH A D05-Apr-20242.2 KiB11980

bridge_mld.shH A D13-Jun-202416.2 KiB565412

bridge_port_isolation.shH A D07-Mar-20212.3 KiB152112

bridge_sticky_fdb.shH A D07-Mar-20211.1 KiB7052

bridge_vlan_aware.shH A D05-Apr-20242.5 KiB153105

bridge_vlan_mcast.shH A D05-Apr-202416.7 KiB547442

bridge_vlan_unaware.shH A D05-Apr-20241.2 KiB10676

configH A D05-Apr-20241.2 KiB5554

custom_multipath_hash.shH A D13-Sep-20229.8 KiB373245

devlink_lib.shH A D05-Aug-202412.8 KiB599448

dual_vxlan_bridge.shH A D05-Apr-202411.2 KiB368223

ethtool.shH A D05-Apr-20246.6 KiB302213

ethtool_extended_state.shH A D05-Apr-20242.1 KiB11882

ethtool_lib.shH A D24-May-20222.7 KiB12192

ethtool_mm.shH A D05-Apr-20246.3 KiB297202

fib_offload_lib.shH A D05-Apr-202424.6 KiB874600

forwarding.config.sampleH A D05-Apr-20241.4 KiB5224

gre_custom_multipath_hash.shH A D13-Sep-202212.5 KiB465295

gre_inner_v4_multipath.shH A D07-Mar-20217.5 KiB306182

gre_inner_v6_multipath.shH A D07-Mar-20217.7 KiB307183

gre_multipath.shH A D07-Mar-20216.3 KiB258157

gre_multipath_nh.shH A D24-May-20229.1 KiB357230

gre_multipath_nh_res.shH A D24-May-20229.3 KiB362235

hw_stats_l3.shH A D05-Apr-20247.5 KiB341252

hw_stats_l3_gre.shH A D05-Apr-20241.7 KiB11277

ip6_forward_instats_vrf.shH A D05-Apr-20243 KiB175129

ip6gre_custom_multipath_hash.shH A D13-Sep-202212.7 KiB467297

ip6gre_flat.shH A D05-Apr-2024876 6646

ip6gre_flat_key.shH A D05-Apr-2024907 6646

ip6gre_flat_keys.shH A D05-Apr-2024944 6646

ip6gre_hier.shH A D05-Apr-2024937 6646

ip6gre_hier_key.shH A D05-Apr-2024969 6646

ip6gre_hier_keys.shH A D05-Apr-20241,003 6646

ip6gre_inner_v4_multipath.shH A D07-Mar-20217.8 KiB305182

ip6gre_inner_v6_multipath.shH A D07-Mar-20217.9 KiB306183

ip6gre_lib.shH A D05-Apr-202413.9 KiB439217

ipip_flat_gre.shH A D07-Mar-2021838 6443

ipip_flat_gre_key.shH A D07-Mar-2021860 6443

ipip_flat_gre_keys.shH A D07-Mar-2021886 6443

ipip_hier_gre.shH A D07-Mar-2021887 6443

ipip_hier_gre_key.shH A D07-Mar-2021910 6443

ipip_hier_gre_keys.shH A D07-Mar-2021938 6443

ipip_lib.shH A D07-Mar-20218.4 KiB350158

lib.shH A D24-Jun-202438.3 KiB1,9861,541

local_termination.shH A D10-Sep-20246.2 KiB304225

loopback.shH A D07-Mar-20211.6 KiB10369

mirror_gre.shH A D07-Mar-20213.3 KiB161113

mirror_gre_bound.shH A D05-Apr-20245.8 KiB228131

mirror_gre_bridge_1d.shH A D05-Apr-20244.4 KiB13873

mirror_gre_bridge_1d_vlan.shH A D05-Apr-20242.7 KiB13491

mirror_gre_bridge_1q.shH A D05-Apr-20244.3 KiB13472

mirror_gre_bridge_1q_lag.shH A D05-Apr-20247.3 KiB295192

mirror_gre_changes.shH A D05-Apr-20245.7 KiB274194

mirror_gre_flower.shH A D07-Mar-20212.8 KiB13894

mirror_gre_lag_lacp.shH A D07-Mar-20217.3 KiB286183

mirror_gre_lib.shH A D07-Mar-20212.5 KiB13198

mirror_gre_neigh.shH A D07-Mar-20212.3 KiB11679

mirror_gre_nh.shH A D07-Mar-20212.9 KiB13285

mirror_gre_topo_lib.shH A D07-Mar-20213.4 KiB9545

mirror_gre_vlan.shH A D07-Mar-20211.7 KiB9363

mirror_gre_vlan_bridge_1q.shH A D05-Apr-20249 KiB349226

mirror_lib.shH A D05-Apr-20242.9 KiB150119

mirror_topo_lib.shH A D05-Apr-20242.7 KiB10360

mirror_vlan.shH A D05-Apr-20242.3 KiB13293

no_forwarding.shH A D18-Oct-20245.5 KiB265190

pedit_dsfield.shH A D05-Apr-20246.7 KiB314236

pedit_ip.shH A D05-Apr-20244.4 KiB202144

pedit_l4port.shH A D26-Jul-20214.5 KiB201144

q_in_vni.shH A D05-Apr-202410.7 KiB349214

q_in_vni_ipv6.shH A D05-Apr-202410.9 KiB348213

router.shH A D05-Apr-20247.3 KiB341228

router_bridge.shH A D05-Apr-20244 KiB191132

router_bridge_1d.shH A D05-Apr-20245.1 KiB186126

router_bridge_1d_lag.shH A D05-Apr-20249.3 KiB409270

router_bridge_lag.shH A D05-Apr-20246.8 KiB324241

router_bridge_pvid_vlan_upper.shH A D05-Apr-20243.5 KiB156100

router_bridge_vlan.shH A D05-Apr-20245.5 KiB225152

router_bridge_vlan_upper.shH A D05-Apr-20243.9 KiB170111

router_bridge_vlan_upper_pvid.shH A D05-Apr-20243.7 KiB172114

router_broadcast.shH A D07-Mar-20215 KiB238179

router_mpath_nh.shH A D24-May-20229.6 KiB426309

router_mpath_nh_res.shH A D24-May-202210 KiB401294

router_multicast.shH A D05-Apr-202414.6 KiB507324

router_multipath.shH A D08-Mar-20218.3 KiB343248

router_nh.shH A D24-May-20222.6 KiB161112

router_vid_1.shH A D05-Apr-20243.5 KiB16198

sch_ets.shH A D07-Mar-2021781 4834

sch_ets_core.shH A D07-Mar-20217.3 KiB301187

sch_ets_tests.shH A D07-Mar-20213.9 KiB224175

sch_red.shH A D01-Nov-202211.1 KiB494342

sch_tbf_core.shH A D07-Mar-20215 KiB234142

sch_tbf_ets.shH A D07-Mar-2021118 73

sch_tbf_etsprio.shH A D05-Apr-20241.4 KiB7250

sch_tbf_prio.shH A D07-Mar-2021118 73

sch_tbf_root.shH A D05-Apr-2024489 3826

settingsH A D05-Apr-202410 21

skbedit_priority.shH A D05-Apr-20243.9 KiB173116

tc_actions.shH A D05-Apr-20247.9 KiB319238

tc_chains.shH A D24-May-20224.8 KiB206148

tc_common.shH A D05-Apr-2024721 3725

tc_flower.shH A D05-Apr-202421.2 KiB718492

tc_flower_cfm.shH A D05-Apr-20244.9 KiB207152

tc_flower_l2_miss.shH A D05-Apr-20249.1 KiB358240

tc_flower_port_range.shH A D05-Apr-20245.9 KiB229174

tc_flower_router.shH A D07-Mar-20213 KiB173123

tc_mpls_l2vpn.shH A D24-May-20225 KiB193111

tc_police.shH A D27-Jun-202211.8 KiB442292

tc_shblocks.shH A D07-Mar-20212.7 KiB153108

tc_tunnel_key.shH A D05-Apr-20243.8 KiB165127

tc_vlan_modify.shH A D07-Mar-20213.2 KiB165116

tsn_lib.shH A D05-Apr-20245.5 KiB250190

vxlan_asymmetric.shH A D05-Apr-202417.6 KiB578354

vxlan_asymmetric_ipv6.shH A D05-Apr-202416 KiB505312

vxlan_bridge_1d.shH A D24-May-202220.4 KiB798552

vxlan_bridge_1d_ipv6.shH A D05-Apr-202421.3 KiB805569

vxlan_bridge_1d_port_8472.shH A D07-Mar-2021172 115

vxlan_bridge_1d_port_8472_ipv6.shH A D05-Apr-2024188 126

vxlan_bridge_1q.shH A D05-Apr-202422.9 KiB841540

vxlan_bridge_1q_ipv6.shH A D05-Apr-202424.3 KiB838547

vxlan_bridge_1q_port_8472.shH A D07-Mar-2021172 115

vxlan_bridge_1q_port_8472_ipv6.shH A D05-Apr-2024188 126

vxlan_symmetric.shH A D07-Mar-202118.1 KiB562346

vxlan_symmetric_ipv6.shH A D05-Apr-202418.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(NETIF_F_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