2.59. test_l2bd_multi_instance module

L2BD Multi-instance Test Case HLD:

NOTES:
  • higher number of pg-l2 interfaces causes problems => only 15 pg-l2 interfaces in 5 bridge domains are tested

  • jumbo packets in configuration with 14 l2-pg interfaces leads to problems too

config 1
  • add 15 pg-l2 interfaces

  • configure one host per pg-l2 interface

  • configure 5 bridge domains (BD)

  • add 3 pg-l2 interfaces per BD

test 1
  • send L2 MAC frames between all pg-l2 interfaces of all BDs

verify 1
  • check BD data by parsing output of bridge_domain_dump API command

  • all packets received correctly

config 2
  • update data of 5 BD
    • disable learning, forwarding, flooding and uu_flooding for BD1

    • disable forwarding for BD2

    • disable flooding for BD3

    • disable uu_flooding for BD4

    • disable learning for BD5

verify 2
  • check BD data by parsing output of bridge_domain_dump API command

config 3
  • delete 2 BDs

test 3
  • send L2 MAC frames between all pg-l2 interfaces of all BDs

  • send L2 MAC frames between all pg-l2 interfaces formerly assigned to deleted BDs

verify 3
  • check BD data by parsing output of bridge_domain_dump API command

  • all packets received correctly on all 3 pg-l2 interfaces assigned to BDs

  • no packet received on all 3 pg-l2 interfaces of all deleted BDs

config 4
  • add 2 BDs

  • add 3 pg-l2 interfaces per BD

test 4
  • send L2 MAC frames between all pg-l2 interfaces of all BDs

verify 4
  • check BD data by parsing output of bridge_domain_dump API command

  • all packets received correctly

config 5
  • delete 5 BDs

verify 5
  • check BD data by parsing output of bridge_domain_dump API command

class test_l2bd_multi_instance.TestL2bdMultiInst(methodName='runTest')

Bases: framework.VppTestCase

L2BD Multi-instance Test Case

classmethod bd_if_range(b)
create_bd_and_mac_learn(count, start=1)

Create required number of bridge domains with MAC learning enabled, put 3 l2-pg interfaces to every bridge domain and send MAC learning packets.

Parameters
  • count (int) – Number of bridge domains to be created.

  • start (int) – Starting number of the bridge domain ID. (Default value = 1)

classmethod create_hosts(hosts_per_if)

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

Parameters

hosts_per_if (int) – Number of hosts per if to create MAC/IPv4 addresses for.

create_stream(src_if)

Create input packet stream for defined interface using hosts list.

Parameters
  • src_if (object) – Interface to create packet stream for.

  • packet_sizes (list) – List of required packet sizes.

Returns

Stream of packets.

delete_bd(count, start=1)

Delete required number of bridge domains.

Parameters
  • count (int) – Number of bridge domains to be created.

  • start (int) – Starting number of the bridge domain ID. (Default value = 1)

run_verify_test()
Create packet streams for all configured l2-pg interfaces, send all prepared packet streams and verify that:
  • all packets received correctly on all pg-l2 interfaces assigned to bridge domains

  • no packet received on all pg-l2 interfaces not assigned to bridge domains

Raises

RuntimeError – if no packet captured on l2-pg interface assigned to the bridge domain or if any packet is captured on l2-pg interface not assigned to the bridge domain.

setUp()

Clear trace and packet infos 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.

set_bd_flags(bd_id, **args)

Enable/disable defined feature(s) of the bridge domain.

Parameters
  • bd_id (int) – Bridge domain ID.

  • args (list) – List of feature/status pairs. Allowed features: learn, forward, flood, uu_flood and arp_term. Status False means disable, status True means enable the feature.

Raise

ValueError in case of unknown feature in the input.

tearDown()

Show various debug prints after each test.

classmethod tearDownClass()

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

test_l2bd_inst_01()

L2BD Multi-instance test 1 - create 5 BDs

test_l2bd_inst_02()

L2BD Multi-instance test 2 - update data of 5 BDs

test_l2bd_inst_03()

L2BD Multi-instance test 3 - delete 2 BDs

test_l2bd_inst_04()

L2BD Multi-instance test 4 - add 2 BDs

test_l2bd_inst_05()

L2BD Multi-instance test 5 - delete 5 BDs

verify_bd(bd_id, **args)

Check if the bridge domain is configured and verify expected status of listed features.

Parameters
  • bd_id (int) – Bridge domain ID.

  • args (list) – List of feature/status pairs. Allowed features: learn, forward, flood, uu_flood and arp_term. Status False means disable, status True means enable the feature.

Returns

1 if bridge domain is configured, otherwise return 0.

Raise

ValueError in case of unknown feature in the input.

verify_capture(dst_if)

Verify captured input packet stream for defined interface.

Parameters

dst_if (object) – Interface to verify captured packet stream for.