2.101. test_srv6_as module¶
-
class
test_srv6_as.
TestSRv6
(methodName='runTest')¶ Bases:
framework.VppTestCase
SRv6 Static Proxy plugin Test Case
-
compare_rx_tx_packet_End_AS_IPv4_in
(tx_pkt, rx_pkt)¶ Compare input and output packet after passing End.AS
- Parameters
tx_pkt – transmitted packet
rx_pkt – received packet
-
compare_rx_tx_packet_End_AS_IPv4_out
(tx_pkt, rx_pkt)¶ Compare input and output packet after passing End.AS with IPv4
- Parameters
tx_pkt – transmitted packet
rx_pkt – received packet
-
compare_rx_tx_packet_End_AS_IPv6_in
(tx_pkt, rx_pkt)¶ Compare input and output packet after passing End.AS
- Parameters
tx_pkt – transmitted packet
rx_pkt – received packet
-
compare_rx_tx_packet_End_AS_IPv6_out
(tx_pkt, rx_pkt)¶ Compare input and output packet after passing End.AS with IPv6
- Parameters
tx_pkt – transmitted packet
rx_pkt – received packet
-
compare_rx_tx_packet_End_AS_L2_in
(tx_pkt, rx_pkt)¶ Compare input and output packet after passing End.AS
- Parameters
tx_pkt – transmitted packet
rx_pkt – received packet
-
compare_rx_tx_packet_End_AS_L2_out
(tx_pkt, rx_pkt)¶ Compare input and output packet after passing End.AS 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
(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 IPv4 destination address is 124.1.1.1 UDP source port and destination port are 1234
-
create_packet_header_IPv6_SRH_IPv6
(sidlist, segleft)¶ Create packet header: IPv6 encapsulated in SRv6: IPv6 header with SRH, IPv6 header, UDP header
- Parameters
sidlist (list) – segment list of outer IPv6 SRH
segleft (int) – segments-left field of outer IPv6 SRH
Outer IPv6 source address is set to 5678::1 Outer IPv6 destination address is set to sidlist[segleft] IPv6 source addresses is 1234::1 IPv6 destination address is 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_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
-
run_SRv6_End_AS_IPv4
(sid_list, test_sid_index, rewrite_src_addr)¶ Run SRv6 End.AS test with IPv4 traffic.
-
run_SRv6_End_AS_IPv6
(sid_list, test_sid_index, rewrite_src_addr)¶ Run SRv6 End.AS test with IPv6 traffic.
-
run_SRv6_End_AS_L2
(sid_list, test_sid_index, rewrite_src_addr)¶ Run SRv6 End.AS test with L2 traffic.
-
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_AS_IPv4_SRH
()¶ Test SRv6 End.AS behavior with IPv4 traffic and SRH rewrite.
-
test_SRv6_End_AS_IPv4_noSRH
()¶ Test SRv6 End.AS behavior with IPv4 traffic and no SRH rewrite.
-
test_SRv6_End_AS_IPv6_SRH
()¶ Test SRv6 End.AS behavior with IPv6 traffic and SRH rewrite.
-
test_SRv6_End_AS_IPv6_noSRH
()¶ Test SRv6 End.AS behavior with IPv6 traffic and no SRH rewrite.
-
test_SRv6_End_AS_L2_SRH
()¶ Test SRv6 End.AS behavior with L2 traffic and SRH rewrite.
-
test_SRv6_End_AS_L2_noSRH
()¶ Test SRv6 End.AS behavior with L2 traffic and no SRH rewrite.
-
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
-