2.84. test_srv6 module

class test_srv6.TestSRv6(methodName='runTest')

Bases: framework.VppTestCase

SRv6 Test Case

compare_rx_tx_packet_End(tx_pkt, rx_pkt)

Compare input and output packet after passing End (without PSP)

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_End_DX2(tx_pkt, rx_pkt)

Compare input and output packet after passing End.DX2

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_End_DX4(tx_pkt, rx_pkt)

Compare input and output packet after passing End.DX4

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_End_DX6(tx_pkt, rx_pkt)

Compare input and output packet after passing End.DX6

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_End_PSP(tx_pkt, rx_pkt)

Compare input and output packet after passing End with PSP

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_T_Encaps(tx_pkt, rx_pkt)

Compare input and output packet after passing T.Encaps

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_T_Encaps_IPv4(tx_pkt, rx_pkt)

Compare input and output packet after passing T.Encaps for IPv4

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_T_Encaps_L2(tx_pkt, rx_pkt)

Compare input and output packet after passing T.Encaps for L2

Parameters
  • tx_pkt – transmitted packet

  • rx_pkt – received packet

compare_rx_tx_packet_T_Insert(tx_pkt, rx_pkt)

Compare input and output packet after passing T.Insert

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

Create packet header: IPv4 header, UDP header

Parameters

dst – IPv4 destination address

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

create_packet_header_IPv6(dst)

Create packet header: IPv6 header, UDP header

Parameters

dst – IPv6 destination address

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

create_packet_header_IPv6_IPv4(dst_inner, dst_outer)

Create packet header: IPv4 encapsulated in IPv6: IPv6 header, IPv4 header, UDP header

Parameters
  • dst_inner (ipv4address) – inner IPv4 destination address

  • dst_outer (ipv6address) – outer IPv6 destination address

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

create_packet_header_IPv6_IPv6(dst_inner, dst_outer)

Create packet header: IPv6 encapsulated in IPv6: IPv6 header, IPv6 header, UDP header

Parameters
  • dst_inner (ipv6address) – inner IPv6 destination address

  • dst_outer (ipv6address) – outer IPv6 destination address

IPv6 source addresses are 1234::1 and 4321::1 UDP source port and destination port are 1234

create_packet_header_IPv6_L2(dst_outer, vlan=0)

Create packet header: L2 encapsulated in IPv6: IPv6 header, L2

Parameters
  • dst_outer (ipv6address) – outer IPv6 destination address

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

create_packet_header_IPv6_SRH(sidlist, segleft)

Create packet header: IPv6 header with SRH, UDP header

Parameters
  • sidlist (list) – segment list

  • segleft (int) – segments-left field value

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

create_packet_header_IPv6_SRH_IPv4(dst, sidlist, segleft)

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

Parameters
  • dst (ipv4address) – inner IPv4 destination address

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

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

Outer IPv6 destination address is set to sidlist[segleft] IPv6 source address is 1234::1 IPv4 source address is 123.1.1.1 UDP source port and destination port are 1234

create_packet_header_IPv6_SRH_IPv6(dst, sidlist, segleft)

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

Parameters
  • dst (ipv6address) – inner IPv6 destination address

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

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

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

create_packet_header_IPv6_SRH_L2(sidlist, segleft, vlan=0)

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

Parameters
  • 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

Outer IPv6 destination address is set to sidlist[segleft] IPv6 source address is 1234::1

create_packet_header_IPv6_SRH_SRH_IPv6(dst, sidlist1, segleft1, sidlist2, segleft2)

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

Parameters
  • dst (ipv6address) – inner IPv6 destination address

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

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

  • sidlist2 (list) – segment list of inner IPv6 SRH

  • segleft2 (int) – segments-left field of inner IPv6 SRH

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

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

Test SRv6 End (without PSP) behavior.

test_SRv6_End_DT4()

Test SRv6 End.DT4 behavior.

test_SRv6_End_DT6()

Test SRv6 End.DT6 behavior.

test_SRv6_End_DX2()

Test SRv6 End.DX2 behavior.

test_SRv6_End_DX4()

Test SRv6 End.DX4 behavior.

test_SRv6_End_DX6()

Test SRv6 End.DX6 behavior.

test_SRv6_End_X()

Test SRv6 End.X (without PSP) behavior.

test_SRv6_End_X_with_PSP()

Test SRv6 End.X with PSP behavior.

test_SRv6_End_with_PSP()

Test SRv6 End with PSP behavior.

test_SRv6_T_Encaps()

Test SRv6 Transit.Encaps behavior for IPv6.

test_SRv6_T_Encaps_IPv4()

Test SRv6 Transit.Encaps behavior for IPv4.

test_SRv6_T_Encaps_L2()

Test SRv6 Transit.Encaps behavior for L2.

test_SRv6_T_Insert()

Test SRv6 Transit.Insert behavior (IPv6 only).

test_SRv6_T_Insert_Classifier()

Test SRv6 Transit.Insert behavior (IPv6 only). steer packets using the classifier

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