Back to home page

OSCL-LXR

 
 

    


0001 Motivation
0002 ==========
0003 
0004 One of the nice things about network namespaces is that they allow one
0005 to easily create and test complex environments.
0006 
0007 Unfortunately, these namespaces can not be used with actual switching
0008 ASICs, as their ports can not be migrated to other network namespaces
0009 (NETIF_F_NETNS_LOCAL) and most of them probably do not support the
0010 L1-separation provided by namespaces.
0011 
0012 However, a similar kind of flexibility can be achieved by using VRFs and
0013 by looping the switch ports together. For example:
0014 
0015                              br0
0016                               +
0017                vrf-h1         |           vrf-h2
0018                  +        +---+----+        +
0019                  |        |        |        |
0020     192.0.2.1/24 +        +        +        + 192.0.2.2/24
0021                swp1     swp2     swp3     swp4
0022                  +        +        +        +
0023                  |        |        |        |
0024                  +--------+        +--------+
0025 
0026 The VRFs act as lightweight namespaces representing hosts connected to
0027 the switch.
0028 
0029 This approach for testing switch ASICs has several advantages over the
0030 traditional method that requires multiple physical machines, to name a
0031 few:
0032 
0033 1. Only the device under test (DUT) is being tested without noise from
0034 other system.
0035 
0036 2. Ability to easily provision complex topologies. Testing bridging
0037 between 4-ports LAGs or 8-way ECMP requires many physical links that are
0038 not always available. With the VRF-based approach one merely needs to
0039 loopback more ports.
0040 
0041 These tests are written with switch ASICs in mind, but they can be run
0042 on any Linux box using veth pairs to emulate physical loopbacks.
0043 
0044 Guidelines for Writing Tests
0045 ============================
0046 
0047 o Where possible, reuse an existing topology for different tests instead
0048   of recreating the same topology.
0049 o Tests that use anything but the most trivial topologies should include
0050   an ASCII art showing the topology.
0051 o Where possible, IPv6 and IPv4 addresses shall conform to RFC 3849 and
0052   RFC 5737, respectively.
0053 o Where possible, tests shall be written so that they can be reused by
0054   multiple topologies and added to lib.sh.
0055 o Checks shall be added to lib.sh for any external dependencies.
0056 o Code shall be checked using ShellCheck [1] prior to submission.
0057 
0058 1. https://www.shellcheck.net/