Snake test for L2 switch using Ostinato

Ostinato Team bio photo By Ostinato Team

A snake test is a cost-efficient way to test the performance of an L2 switch (or router) across all its ports and even across the backplane in the case of chassis switches.

Snake Test with 2 Ostinato ports

Only 2 traffic generator ports are required for this test. These traffic generator ports should be capable of generating line rate traffic for the interface speed supported by the switch port e.g. if testing a 48x10G switch, the traffic generator ports should be able to generate a 10G line rate for 64-byte packets or if testing a 32x100G switch, the traffic generator should be rated for 100G.

Ostinato Turbo Transmit add-on is capable of line rate traffic generation at 10/40/100Gbps.

DUT configuration

Our previous post on the Snake Test details the L2 configuration required on the DUT along with the topology and connectivity required.

Ostinato configuration

For the Snake Test, we will create two traffic streams on Ostinato - one on each port.

On traffic generator Port A (connected to port 1 in the diagram above), create a traffic stream with these characteristics -

  • Protocols: Mac | Ethernet | IPv4 | UDP
  • Mac Addresses
    • DstMac: 00:00:5e:00:53:02
    • SrcMac: 00:00:5e:00:53:01
  • IP Addresses
    • SrcIP: 192.168.1.100
    • DstIP: 192.168.1.200
  • Traffic Rate: 0 (magic value for top speed)
  • Goto First (for continuous traffic)

Snake Test Traffic Stream Protocols

Snake Test Traffic Stream Mac addresses

Snake Test Traffic Stream IP addresses

Snake Test Traffic Stream - continuous max speed

🧑‍🏫 Since we are testing an L2 switch, the IP addresses in the packet play no role in L2 forwarding and are purely cosmetic. You can use any IP addresses or even skip them entirely e.g. by configuring an 802.3 raw stream instead (an 802.3 raw packet carries the packet length instead of EtherType in the 2 bytes following the mac header).

On the other traffic generator port B (connected to port 8 in the diagram above), create the same stream with Mac and IP addresses swapped i.e.

  • Protocols: Mac | Ethernet | IPv4 | UDP
  • Mac Addresses
    • SrcMac: 00:00:5e:00:53:02
    • DstMac: 00:00:5e:00:53:01
  • IP Addresses
    • SrcIP: 192.168.1.200
    • DstIP: 192.168.1.100
  • Traffic Rate: 0 (magic value for top speed)
  • Goto First (for continuous traffic)

✂️ You can copy-paste the stream from one port to another! Just use the usual Ctrl/Cmd-C and Ctrl/Cmd-V or the right-click context menus

Layer-2 Switch Snake Tests

L2 Switch Unidirectional forwarding test

To test L2 forwarding of traffic from port A to port B, first, send traffic in the reverse direction from port B to port A for a short duration - start Transmit on port B and stop it after 5 to 10 seconds.

Why? So that the DUT learns the Mac address 00:00:5e:00:53:02 on all the VLANs. If the DstMac is not learnt, the DUT ASIC in the data plane will “flood” instead of “forward” the packet. In the ASIC data plane, these are two different paths with different performance characteristics, so you want to make sure you are selecting the performant forwarding path instead of the flood path.

# Cisco
show mac address-table

# Juniper (non-MX)
show ethernet-switching table

# Juniper (MX)
show bridge mac-table

Now clear the statistics start the actual test traffic from port A and verify that it is received at port B. Also, verify that the Send Frame Rate (fps) on Port A and Receive Frame Rate (fps) on Port B are the same and the expected value as per the DUT spec.

If the receive rate is lower than the send rate that means the traffic is getting dropped on some port within the DUT. Check the interface stats for each port of the DUT and any other error counters that the DUT supports to identify the reason for the drop.

L2 Switch Bidirectional forwarding test

For the bidirectional traffic test, send traffic from both ports A and B for a short duration so that the learning happens in both directions.

Verify on the DUT that both Mac addresses 00:00:5e:00:53:01and 00:00:5e:00:53:02 are learnt on ALL VLANs used in the snake test configuration.

You can now start the bidirectional traffic test by starting to transmit on both ports A and B simultaneously and monitor the Send/Receive Frame Rates.

L2 switch Flood performance test

If you wish to test the performance of the “flood” (unknown unicast) path, clear the MAC address forwarding tables on the DUT first and verify using the show command that it indeed has been cleared.

# Cisco
clear mac address-table

# Juniper (MX)
clear ethernet-switching table

# Juniper (MX)
clear bridge mac-table

Then start a unidirectional traffic test WITHOUT first sending the reverse flow - this is to ensure that the Mac addresses are NOT learnt by the DUT and so packets will use the flood path in the ASIC data plane.