2.32. 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, n_hosts_per_if)¶ 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=None, if_dst_hosts=None)¶ 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, n_hosts_per_if)¶ 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)¶ Flush bd_id L2 FIB entries.
Parameters: bd_id (int) – Bridge Domain id.
-
flush_int
(swif)¶ Flush swif L2 FIB entries.
Parameters: swif (int) – sw if index.
-
learn_hosts
(bd_id, n_hosts_per_if)¶ Create L2 MAC packet stream with host MAC addresses per interface to let the bridge domain learn these MAC addresses.
Parameters: - bd_id (int) – BD to teach
- n_hosts_per_if (int) – number of hosts
-
run_verify_negat_test
(bd_id, dst_hosts=None)¶
-
run_verify_test
(bd_id, dst_hosts=None)¶
-
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.
-
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
-
test_l2_fib_05
()¶ L2 FIB test 5 - Program 10 new MAC entries, learn 10
-
test_l2_fib_06
()¶ L2 FIB test 6 - flush first interface
-
test_l2_fib_07
()¶ L2 FIB test 7 - flush bd_id
-
test_l2_fib_08
()¶ L2 FIB test 8 - flush all
-
test_l2_fib_09
()¶ L2 FIB test 9 - mac learning events
-
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.
-
classmethod