README 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. Motivation
  2. ==========
  3. One of the nice things about network namespaces is that they allow one
  4. to easily create and test complex environments.
  5. Unfortunately, these namespaces can not be used with actual switching
  6. ASICs, as their ports can not be migrated to other network namespaces
  7. (NETIF_F_NETNS_LOCAL) and most of them probably do not support the
  8. L1-separation provided by namespaces.
  9. However, a similar kind of flexibility can be achieved by using VRFs and
  10. by looping the switch ports together. For example:
  11. br0
  12. +
  13. vrf-h1 | vrf-h2
  14. + +---+----+ +
  15. | | | |
  16. 192.0.2.1/24 + + + + 192.0.2.2/24
  17. swp1 swp2 swp3 swp4
  18. + + + +
  19. | | | |
  20. +--------+ +--------+
  21. The VRFs act as lightweight namespaces representing hosts connected to
  22. the switch.
  23. This approach for testing switch ASICs has several advantages over the
  24. traditional method that requires multiple physical machines, to name a
  25. few:
  26. 1. Only the device under test (DUT) is being tested without noise from
  27. other system.
  28. 2. Ability to easily provision complex topologies. Testing bridging
  29. between 4-ports LAGs or 8-way ECMP requires many physical links that are
  30. not always available. With the VRF-based approach one merely needs to
  31. loopback more ports.
  32. These tests are written with switch ASICs in mind, but they can be run
  33. on any Linux box using veth pairs to emulate physical loopbacks.
  34. Guidelines for Writing Tests
  35. ============================
  36. o Where possible, reuse an existing topology for different tests instead
  37. of recreating the same topology.
  38. o Tests that use anything but the most trivial topologies should include
  39. an ASCII art showing the topology.
  40. o Where possible, IPv6 and IPv4 addresses shall conform to RFC 3849 and
  41. RFC 5737, respectively.
  42. o Where possible, tests shall be written so that they can be reused by
  43. multiple topologies and added to lib.sh.
  44. o Checks shall be added to lib.sh for any external dependencies.
  45. o Code shall be checked using ShellCheck [1] prior to submission.
  46. 1. https://www.shellcheck.net/