2.29. test_ip4 module

class test_ip4.TestIPDeag(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Deaggregate Routes

setUp()
tearDown()
test_ip_deag()

IP Deag Routes

class test_ip4.TestIPDisabled(methodName='runTest')

Bases: framework.VppTestCase

IPv4 disabled

setUp()
tearDown()
test_ip_disabled()

IP Disabled

class test_ip4.TestIPInput(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Input Exceptions

setUp()
tearDown()
test_ip_input()

IP Input Exceptions

class test_ip4.TestIPLoadBalance(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Load-Balancing

send_and_expect_load_balancing(input, pkts, outputs)
send_and_expect_one_itf(input, pkts, itf)
setUp()
tearDown()
test_ip_load_balance()

IP Load-Balancing

class test_ip4.TestIPNull(methodName='runTest')

Bases: framework.VppTestCase

IPv4 routes via NULL

setUp()
tearDown()
test_ip_null()

IP NULL route

class test_ip4.TestIPPunt(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Punt Police/Redirect

setUp()
tearDown()
test_ip_punt()

IP punt police and redirect

class test_ip4.TestIPSubNets(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Subnets

setUp()
tearDown()
test_ip_sub_nets()

IP Sub Nets

class test_ip4.TestIPVlan0(methodName='runTest')

Bases: framework.VppTestCase

IPv4 VLAN-0

setUp()
tearDown()
test_ip_vlan_0()

IP VLAN-0

class test_ip4.TestIPv4(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Test Case

config_fib_entries(count)

For each interface add to the FIB table count routes to “10.0.0.1/32” 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.

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

Perform test setup before test case.

Config:
  • 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
Variables:
  • interfaces (list) – pg interfaces and subinterfaces.
  • flows (dict) – IPv4 packet flows in test.
  • pg_if_packet_sizes (list) – packet sizes in test.
tearDown()

Run standard test teardown and log show ip arp.

test_fib()

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.

Parameters:
  • 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 too slow to add many routes, needs replacement.

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

added ips with 32 prefix

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

Add 1k routes

  • add 100 routes check with traffic script.
test_2_del_routes()

Delete 100 routes

  • delete 10 routes check with traffic script.
test_3_add_new_routes()

Add 1k routes

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

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)