2.110. test_srv6_ad module

class test_srv6_ad.TestSRv6(methodName='runTest')

Bases: framework.VppTestCase

SRv6 Dynamic Proxy plugin Test Case

compare_rx_tx_packet_End_AD_IPv4_in(tx_pkt, rx_pkt)

Compare input and output packet after passing End.AD

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_End_AD_IPv4_out(tx_pkt, rx_pkt)

Compare input and output packet after passing End.AD with IPv4

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_End_AD_IPv6_in(tx_pkt, rx_pkt)

Compare input and output packet after passing End.AD

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_End_AD_IPv6_out(tx_pkt, rx_pkt)

Compare input and output packet after passing End.AD with IPv6

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_End_AD_L2_in(tx_pkt, rx_pkt)

Compare input and output packet after passing End.AD

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_End_AD_L2_out(tx_pkt, rx_pkt)

Compare input and output packet after passing End.AD with L2

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

configure_interface(interface, ipv6=False, ipv4=False, ipv6_table_id=0, ipv4_table_id=0)

Configure interface. :param ipv6: configure IPv6 on interface :param ipv4: configure IPv4 on interface :param ipv6_table_id: FIB table_id for IPv6 :param ipv4_table_id: FIB table_id for IPv4

create_packet_header_IPv4()

Create packet header: IPv4 header, UDP header

Parameters

dst – IPv4 destination address

IPv4 source address is 123.1.1.1 IPv4 destination address is 124.1.1.1 UDP source port and destination port are 1234

create_packet_header_IPv6()

Create packet header: IPv6 header, UDP header

Parameters

dst – IPv6 destination address

IPv6 source address is 1234::1 IPv6 destination address is 4321::1 UDP source port and destination port are 1234

create_packet_header_IPv6_SRH_IPv4(srcaddr, sidlist, segleft)

Create packet header: IPv4 encapsulated in SRv6: IPv6 header with SRH, IPv4 header, UDP header

Parameters
  • srcaddr (int) – outer source address

  • sidlist (list) – segment list of outer IPv6 SRH

  • segleft (int) – segments-left field of outer IPv6 SRH

Outer IPv6 source address is set to srcaddr Outer IPv6 destination address is set to sidlist[segleft] Inner IPv4 source address is 123.1.1.1 Inner IPv4 destination address is 124.1.1.1 UDP source port and destination port are 1234

create_packet_header_IPv6_SRH_IPv6(srcaddr, sidlist, segleft)

Create packet header: IPv6 encapsulated in SRv6: IPv6 header with SRH, IPv6 header, UDP header

Parameters
  • srcaddr (int) – outer source address

  • sidlist (list) – segment list of outer IPv6 SRH

  • segleft (int) – segments-left field of outer IPv6 SRH

Outer IPv6 source address is set to srcaddr Outer IPv6 destination address is set to sidlist[segleft] Inner IPv6 source addresses is 1234::1 Inner IPv6 destination address is 4321::1 UDP source port and destination port are 1234

create_packet_header_IPv6_SRH_L2(srcaddr, sidlist, segleft, vlan=0)

Create packet header: L2 encapsulated in SRv6: IPv6 header with SRH, L2

Parameters
  • srcaddr (int) – IPv6 source address

  • sidlist (list) – segment list of outer IPv6 SRH

  • segleft (int) – segments-left field of outer IPv6 SRH

  • vlan – L2 vlan; if vlan!=0 then add 802.1q header

IPv6 source address is set to srcaddr IPv6 destination address is set to sidlist[segleft]

create_packet_header_L2(vlan=0)

Create packet header: L2 header

Parameters

vlan – if vlan!=0 then add 802.1q header

create_stream(src_if, dst_if, packet_header, packet_sizes, count)

Create SRv6 input packet stream for defined interface.

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

  • dst_if (VppInterface) – destination interface of packet stream

  • packet_header – Layer3 scapy packet headers, L2 is added when not provided, Raw(payload) with packet_info is added

  • packet_sizes (list) – packet stream pckt sizes,sequentially applied to packets in stream have

  • count (int) – number of packets in packet stream

Returns

list of packets

get_payload_info(packet)

Extract the payload_info from the packet

send_and_verify_pkts(input, pkts, output, compare_func)

Send packets and verify received packets using compare_func

Parameters
  • input – ingress interface of DUT

  • pkts – list of packets to transmit

  • output – egress interface of DUT

  • compare_func – function to compare in and out packets

setUp()

Perform test setup before each test case.

classmethod setUpClass()

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

setup_interfaces(ipv6=[], ipv4=[], ipv6_table_id=[], ipv4_table_id=[])

Create and configure interfaces.

Parameters
  • ipv6 – list of interface IPv6 capabilities

  • ipv4 – list of interface IPv4 capabilities

  • ipv6_table_id – list of intf IPv6 FIB table_ids

  • ipv4_table_id – list of intf IPv4 FIB table_ids

Returns

List of created interfaces.

tearDown()

Clean up test setup after each test case.

classmethod tearDownClass()

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

teardown_interfaces()

Unconfigure and bring down interface.

test_SRv6_End_AD_IPv4()

Test SRv6 End.AD behavior with IPv4 traffic.

test_SRv6_End_AD_IPv6()

Test SRv6 End.AD behavior with IPv6 traffic.

test_SRv6_End_AD_L2()

Test SRv6 End.AD behavior with L2 traffic.

verify_captured_pkts(dst_if, capture, compare_func)

Verify captured packet stream for specified interface. Compare ingress with egress packets using the specified compare fn

Parameters
  • dst_if – egress interface of DUT

  • capture – captured packets

  • compare_func – function to compare in and out packet