2.49. 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.TestIP4Replace(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Interface Address Replace

get_n_pfxs(intf)
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_replace()

IP interface address replace

class test_ip4.TestIPCover(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Table Cover

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

IP Table Cover

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.TestIPReplace(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Table Replace

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

IP Table Replace

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

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

show_commands_at_teardown()

Allow subclass specific teardown logging additions.

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, start=0)
Parameters
  • start_dest_addr

  • next_hop_addr

  • count

Return list

added ips with 32 prefix

create_stream(src_if, dst_if, routes, 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

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.

unconfig_fib_many_to_one(start_dest_addr, next_hop_addr, count, start=0)
verify_capture(dst_interface, received_pkts, expected_pkts)
verify_not_in_route_dump(routes)
verify_route_dump(routes)
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

class test_ip4.TestIPv4IfAddrRoute(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Interface Addr Route 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_ipv4_ifaddr_del()

Delete an interface address that does not exist

test_ipv4_ifaddr_route()

IPv4 Interface Address Route test

Test scenario:

  • Create loopback

  • Configure IPv4 address on loopback

  • Verify that address is not in the FIB

  • Bring loopback up

  • Verify that address is in the FIB now

  • Bring loopback down

  • Verify that address is not in the FIB anymore

  • Bring loopback up

  • Configure IPv4 address on loopback

  • Verify that address is in the FIB now

test_ipv4_ifaddrs_same_prefix()

IPv4 Interface Addresses Same Prefix test

Test scenario:

  • Verify no route in FIB for prefix 10.10.10.0/24

  • Configure IPv4 address 10.10.10.10/24 on an interface

  • Verify route in FIB for prefix 10.10.10.0/24

  • Configure IPv4 address 10.10.10.20/24 on an interface

  • Delete 10.10.10.10/24 from interface

  • Verify route in FIB for prefix 10.10.10.0/24

  • Delete 10.10.10.20/24 from interface

  • Verify no route in FIB for prefix 10.10.10.0/24

class test_ip4.TestIPv4RouteLookup(methodName='runTest')

Bases: framework.VppTestCase

IPv4 Route Lookup Test Case

route_lookup(prefix, exact)
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_exact_match()
test_longest_prefix_match()