2.26. test_l2_fib module

L2 FIB Test Case HLD:

config 1
  • add 4 pg-l2 interfaces
  • configure them into l2bd
  • configure 100 MAC entries in L2 fib - 25 MACs per interface
  • L2 MAC learning and unknown unicast flooding disabled in l2bd
  • configure 100 MAC entries in L2 fib - 25 MACs per interface
test 1
  • send L2 MAC frames between all 4 pg-l2 interfaces for all of 100 MAC entries in the FIB
verify 1
  • all packets received correctly
config 2
  • delete 12 MAC entries - 3 MACs per interface
test 2a
  • send L2 MAC frames between all 4 pg-l2 interfaces for non-deleted MAC entries
verify 2a
  • all packets received correctly
test 2b
  • send L2 MAC frames between all 4 pg-l2 interfaces for all of 12 deleted MAC entries
verify 2b
  • no packet received on all 4 pg-l2 interfaces
config 3
  • configure new 100 MAC entries in L2 fib - 25 MACs per interface
test 3
  • send L2 MAC frames between all 4 pg-l2 interfaces for all of 188 MAC entries in the FIB
verify 3
  • all packets received correctly
config 4
  • delete 160 MAC entries, 40 MACs per interface
test 4a
  • send L2 MAC frames between all 4 pg-l2 interfaces for all of 28 non-deleted MAC entries
verify 4a
  • all packets received correctly
test 4b
  • try send L2 MAC frames between all 4 pg-l2 interfaces for all of 172 deleted MAC entries
verify 4b
  • no packet received on all 4 pg-l2 interfaces
class test_l2_fib.TestL2fib(methodName='runTest')

Bases: framework.VppTestCase

L2 FIB Test Case

config_l2_fib_entries(count, start=0)

Create required number of L2 FIB entries.

Parameters:
  • count (int) – Number of L2 FIB entries to be created.
  • start (int) – Starting index of the host list. (Default value = 0)
create_hosts(count, start=0)

Create required number of host MAC addresses and distribute them among interfaces. Create host IPv4 address for every host MAC address.

Parameters:
  • count (int) – Number of hosts to create MAC/IPv4 addresses for.
  • start (int) – Number to start numbering from.
create_stream(src_if, packet_sizes, deleted=False)

Create input packet stream for defined interface using hosts or deleted_hosts list.

Parameters:
  • src_if (object) – Interface to create packet stream for.
  • packet_sizes (list) – List of required packet sizes.
  • deleted (boolean) – Set to True if deleted_hosts list required.
Returns:

Stream of packets.

delete_l2_fib_entry(count)

Delete required number of L2 FIB entries.

Parameters:count (int) – Number of L2 FIB entries to be created.
run_verify_negat_test()
run_verify_test()
setUp()
classmethod setUpClass()

Perform standard class setup (defined by class method setUpClass in class VppTestCase) before running the test case, set test case related variables and configure VPP.

Variables:
  • bd_id (int) – Bridge domain ID.
  • mac_entries_count (int) – Number of MAC entries for bridge-domain.
tearDown()

Show various debug prints after each test.

test_l2_fib_01()

L2 FIB test 1 - program 100 MAC addresses

test_l2_fib_02()

L2 FIB test 2 - delete 12 MAC entries

test_l2_fib_03()

L2 FIB test 3 - program new 100 MAC addresses

test_l2_fib_04()

L2 FIB test 4 - delete 160 MAC entries

verify_capture(pg_if, capture)

Verify captured input packet stream for defined interface.

Parameters:
  • pg_if (object) – Interface to verify captured packet stream for.
  • capture (list) – Captured packet stream.