2.62. 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

classmethod bd_ifs(bd_id)
config_l2_fib_entries(bd_id, hosts)

Config required number of L2 FIB entries.

Parameters
  • bd_id (int) – BD’s id

  • count (int) – Number of L2 FIB entries to be created.

  • start (int) – Starting index of the host list. (Default value = 0)

create_hosts(n_hosts_per_if, subnet)

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

Parameters

n_hosts_per_if (int) – Number of per interface hosts to

create MAC/IPv4 addresses for.

create_stream(src_if, packet_sizes, if_src_hosts, if_dst_hosts)

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(bd_id, hosts)

Delete required number of L2 FIB entries.

Parameters

count (int) – Number of L2 FIB entries to be created.

flush_all()

Flush All L2 FIB entries.

flush_bd(bd_id, learned_hosts)

Flush bd_id L2 FIB entries.

Parameters

bd_id (int) – Bridge Domain id.

flush_int(swif, learned_hosts)

Flush swif L2 FIB entries.

Parameters

swif (int) – sw if index.

learn_hosts(bd_id, hosts)

Create and send per interface L2 MAC broadcast packet stream to let the bridge domain learn these MAC addresses.

Parameters
  • bd_id (int) – BD to teach

  • hosts (dict) – dict of hosts per interface

run_verify_negat_test(bd_id, src_hosts, dst_hosts)
run_verify_test(bd_id, src_hosts, dst_hosts)
setUp()

Clear trace before running each test

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.

show_commands_at_teardown()

Allow subclass specific teardown logging additions.

split_hosts(hosts, n)
tearDown()

Show various debug prints after each test.

classmethod tearDownClass()

Perform final cleanup after running all tests in this test-case

test_l2_fib_flush_all()

L2 FIB - flush all

test_l2_fib_flush_bd()

L2 FIB - flush BD

test_l2_fib_flush_int()

L2 FIB - flush interface

test_l2_fib_mac_learn_evs()

L2 FIB - mac learning events

test_l2_fib_macs_learn_max()

L2 FIB - mac learning max macs in event

test_l2_fib_program100()

L2 FIB - program 100 MACs

test_l2_fib_program100_add100()

L2 FIB - program 100, add 100 MACs

test_l2_fib_program100_delete12()

L2 FIB - program 100, delete 12 MACs

test_l2_fib_program10_learn10()

L2 FIB - program 10 MACs, learn 10

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.