2.44. test_ip4_vrf_multi_instance module

IP4 VRF Multi-instance Test Case HLD:

NOTES:
  • higher number of pg-ip4 interfaces causes problems => only 15 pg-ip4 interfaces in 5 VRFs are tested

  • jumbo packets in configuration with 15 pg-ip4 interfaces leads to problems too

config 1
  • add 15 pg-ip4 interfaces

  • configure 5 hosts per pg-ip4 interface

  • configure 4 VRFs

  • add 3 pg-ip4 interfaces per VRF

test 1
  • send IP4 packets between all pg-ip4 interfaces in all VRF groups

verify 1
  • check VRF data by parsing output of ip_fib_dump API command

  • all packets received correctly in case of pg-ip4 interfaces in the same

VRF - no packet received in case of pg-ip4 interfaces not in VRF - no packet received in case of pg-ip4 interfaces in different VRFs

config 2
  • reset 2 VRFs

test 2
  • send IP4 packets between all pg-ip4 interfaces in all VRF groups

verify 2
  • all packets received correctly in case of pg-ip4 interfaces in the same

VRF - no packet received in case of pg-ip4 interfaces not in VRF - no packet received in case of pg-ip4 interfaces in different VRFs

config 3
  • add 1 of reset VRFs and 1 new VRF

test 3
  • send IP4 packets between all pg-ip4 interfaces in all VRF groups

verify 3
  • check VRF data by parsing output of ip_fib_dump API command

  • all packets received correctly in case of pg-ip4 interfaces in the same

VRF - no packet received in case of pg-ip4 interfaces not in VRF - no packet received in case of pg-ip4 interfaces in different VRFs

config 4
  • reset all created VRFs

test 4
  • send IP4 packets between all pg-ip4 interfaces in all VRF groups

verify 4
  • check VRF data by parsing output of ip_fib_dump API command

  • all packets received correctly in case of pg-ip4 interfaces in the same

VRF - no packet received in case of pg-ip4 interfaces not in VRF - no packet received in case of pg-ip4 interfaces in different VRFs

class test_ip4_vrf_multi_instance.TestIp4VrfMultiInst(methodName='runTest')

Bases: framework.VppTestCase

IP4 VRF Multi-instance Test Case

create_stream(src_if, packet_sizes)

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.

create_stream_crosswise_vrf(src_if, vrf_id, packet_sizes)

Create input packet stream for negative test for leaking across different VRFs for defined interface using hosts list.

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

  • vrf_id (int) – The FIB table / VRF ID where src_if is assigned.

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

Returns

Stream of packets.

create_vrf_and_assign_interfaces(count, start=1)

Create required number of FIB tables / VRFs, put 3 pg-ip4 interfaces to every FIB table / VRF.

Parameters
  • count (int) – Number of FIB tables / VRFs to be created.

  • start (int) – Starting number of the FIB table / VRF ID. (Default value = 1)

reset_vrf_and_remove_from_vrf_list(vrf_id)

Reset required FIB table / VRF and remove it from VRF list.

Parameters

vrf_id (int) – The FIB table / VRF ID to be reset.

run_crosswise_vrf_test()

Create packet streams for every pg-ip4 interface in VRF towards all pg-ip4 interfaces in other VRFs, send all prepared packet streams and verify that:

  • no packet received on all configured pg-ip4 interfaces

Raises

RuntimeError – If any packet is captured on any pg-ip4 interface.

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

  • no packet received on all pg-ip4 interfaces not assigned to VRFs

Raises

RuntimeError – If no packet captured on pg-ip4 interface assigned to VRF or if any packet is captured on pg-ip4 interface not assigned to VRF.

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.

tearDown()

Show various debug prints after each test.

classmethod tearDownClass()

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

test_ip4_vrf_01()

IP4 VRF Multi-instance test 1 - create 4 VRFs

test_ip4_vrf_02()

IP4 VRF Multi-instance test 2 - reset 2 VRFs

test_ip4_vrf_03()

IP4 VRF Multi-instance 3 - add 2 VRFs

test_ip4_vrf_04()

IP4 VRF Multi-instance test 4 - reset 4 VRFs

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.

verify_vrf(vrf_id)

Check if the FIB table / VRF ID is configured.

Parameters

vrf_id (int) – The FIB table / VRF ID to be verified.

Returns

1 if the FIB table / VRF ID is configured, otherwise return 0.

test_ip4_vrf_multi_instance.is_ipv4_misc(p)

Is packet one of uninteresting IPv4 broadcasts?