test_ip4 module

class test_ip4.TestIPv4(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Test Case


For each interface add to the FIB table count routes to “” destination with interface’s local address as next-hop address.

Parameters:count (int) – Number of FIB entries.
  • TODO: check if the next-hop address shouldn’t be remote address instead of local address.
create_stream(src_if, packet_sizes)

Create input packet stream for defined interface.

  • src_if (VppInterface) – Interface to create packet stream for.
  • packet_sizes (list) – Required packet sizes.

Perform test setup before test case.

  • create 3 pg interfaces
    • untagged pg0 interface
    • Dot1Q subinterface on pg1
    • Dot1AD subinterface on pg2
  • setup interfaces:
    • put it into UP state
    • set IPv4 addresses
    • resolve neighbor address using ARP
  • configure 200 fib entries
  • interfaces (list) – pg interfaces and subinterfaces.
  • flows (dict) – IPv4 packet flows in test.
  • pg_if_packet_sizes (list) – packet sizes in test.

Run standard test teardown and log show ip arp.


IPv4 FIB test

Test scenario:

  • Create IPv4 stream for pg0 interface
  • Create IPv4 tagged streams for pg1’s and pg2’s subinterface.
  • Send and verify received packets on each interface.
verify_capture(dst_if, capture)

Verify captured input packet stream for defined interface.

  • dst_if (VppInterface) – Interface to verify captured packet stream for.
  • capture (list) – Captured packet stream.
class test_ip4.TestIPv4FibCrud(methodName='runTest')

Bases: framework.VppTestCase

FIB - add/update/delete - ip4 routes

Test scenario:
  • add 1k,
  • del 100,
  • add new 1k,
  • del 1.5k

..note:: Python API is to slow to add many routes, needs C code replacement.

config_fib_many_to_one(start_dest_addr, next_hop_addr, count)
  • start_dest_addr
  • next_hop_addr
  • count
Return list:

added ips with 32 prefix

create_stream(src_if, dst_if, dst_ips, count)
classmethod setUpClass()
  1. Create and initialize 3 pg interfaces.
  2. initialize class attributes configured_routes and deleted_routes to store information between tests.

Add 1k routes

  • add 100 routes check with traffic script.

Delete 100 routes

  • delete 10 routes check with traffic script.

Add 1k routes

  • re-add 5 routes check with traffic script.
  • add 100 routes check with traffic script.

Delete 1.5k routes

  • delete 5 routes check with traffic script.
  • add 100 routes check with traffic script.
unconfig_fib_many_to_one(start_dest_addr, next_hop_addr, count)
verify_capture(dst_interface, received_pkts, expected_pkts)
verify_not_in_route_dump(fib_dump, ips)
verify_route_dump(fib_dump, ips)