2.42. test_ip4 module

class test_ip4.TestICMPEcho(methodName='runTest')

Bases: framework.VppTestCase

ICMP Echo Test Case

setUp()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

test_icmp_echo()

VPP replies to ICMP Echo Request

Test scenario:

  • Receive ICMP Echo Request message on pg0 interface.

  • Check outgoing ICMP Echo Reply message on pg0 interface.

class test_ip4.TestIPDeag(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Deaggregate Routes

setUp()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

test_ip_deag()

IP Deag Routes

class test_ip4.TestIPDirectedBroadcast(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Directed Broadcast

setUp()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

test_ip_input()

IP Directed Broadcast

class test_ip4.TestIPDisabled(methodName='runTest')

Bases: framework.VppTestCase

IPv4 disabled

setUp()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

test_ip_disabled()

IP Disabled

class test_ip4.TestIPInput(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Input Exceptions

setUp()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

test_ip_input()

IP Input Exceptions

class test_ip4.TestIPLPM(methodName='runTest')

Bases: framework.VppTestCase

IPv4 longest Prefix Match

setUp()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

test_ip_lpm()

IP longest Prefix Match

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()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

test_ip_load_balance()

IP Load-Balancing

class test_ip4.TestIPNull(methodName='runTest')

Bases: framework.VppTestCase

IPv4 routes via NULL

setUp()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

test_ip_drop()

IP Drop Routes

test_ip_null()

IP NULL route

class test_ip4.TestIPPunt(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Punt Police/Redirect

setUp()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

test_ip_punt()

IP punt police and redirect

test_ip_punt_dump()

IP4 punt redirect dump

class test_ip4.TestIPSubNets(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Subnets

setUp()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

test_ip_sub_nets()

IP Sub Nets

class test_ip4.TestIPVlan0(methodName='runTest')

Bases: framework.VppTestCase

IPv4 VLAN-0

setUp()

Clear trace before running each test

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Show various debug prints after each test

classmethod tearDownClass()

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

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)

Create input packet stream for defined interface.

Parameters

src_if (VppInterface) – Interface to create packet stream for.

modify_packet(src_if, packet_size, pkt)

Add load, set destination IP and extend packet to required packet size for defined interface.

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

  • packet_size (int) – Required packet size.

  • pkt (Scapy) – Packet to be modified.

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.

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

tearDown()

Run standard test teardown and log show ip arp.

classmethod tearDownClass()

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

test_fib()

IPv4 FIB test

Test scenario:

  • Create IPv4 stream for pg0 interface

  • Create IPv4 tagged streams for pg1’s and pg2’s sub-interface.

  • 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()

Clear trace before running each test

classmethod setUpClass()
  1. Create and initialize 3 pg interfaces.

  2. initialize class attributes configured_routes and deleted_routes to store information between tests.

classmethod tearDownClass()

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

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)
class test_ip4.TestIPv4Frag(methodName='runTest')

Bases: framework.VppTestCase

IPv4 fragmentation

classmethod setUpClass()

Perform class setup before running the testcase Remove shared memory files, start vpp and connect the vpp-api

classmethod tearDownClass()

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

test_frag_large_packets()

Fragmentation of large packets