
* TypeError: assertIsNotNone() got an unexpected keyword argument 'msg' * Correct missing calls to setUpClass/tearDownClass. If you want the setUpClass and tearDownClass on base classes called then you must call up to them yourself. The implementations in TestCase are empty. https://docs.python.org/2/library/unittest.html#setupclass-and-teardownclass Cleans up issues in parallel test mode: ------------- FAILURES AND ERRORS IN TESTS: Testcase name: VCL Thru Host Stack Bidir Nsock FAILURE: test_vcl.VCLThruHostStackBidirNsock.test_vcl_thru_host_stack_bi_dir_nsock [test_vcl.VCLThruHostStackBidirNsock.test_vcl_thru_host_stack_bi_dir_nsock] Testcase name: Bidirectional Forwarding Detection (BFD) (changing auth) ERROR: test_bfd.BFDAuthOnOffTestCase.test_auth_change_key_delayed [test_bfd.BFDAuthOnOffTestCase.test_auth_change_key_delayed] ERROR: test_bfd.BFDAuthOnOffTestCase.test_auth_change_key_immediate [test_bfd.BFDAuthOnOffTestCase.test_auth_change_key_immediate] ERROR: test_bfd.BFDAuthOnOffTestCase.test_auth_off_delayed [test_bfd.BFDAuthOnOffTestCase.test_auth_off_delayed] ERROR: test_bfd.BFDAuthOnOffTestCase.test_auth_off_immediate [test_bfd.BFDAuthOnOffTestCase.test_auth_off_immediate] ERROR: test_bfd.BFDAuthOnOffTestCase.test_auth_on_delayed [test_bfd.BFDAuthOnOffTestCase.test_auth_on_delayed] ERROR: test_bfd.BFDAuthOnOffTestCase.test_auth_on_immediate [test_bfd.BFDAuthOnOffTestCase.test_auth_on_immediate] Testcase name: Punt Socket for IPv4 ERROR: test_punt.TestIP4PuntSocket.test_punt_socket_dump [test_punt.TestIP4PuntSocket.test_punt_socket_dump] ERROR: test_punt.TestIP4PuntSocket.test_punt_socket_traffic_multi_port_multi_sockets [test_punt.TestIP4PuntSocket.test_punt_socket_traffic_multi_port_multi_sockets] ERROR: test_punt.TestIP4PuntSocket.test_punt_socket_traffic_multi_ports_single_socket [test_punt.TestIP4PuntSocket.test_punt_socket_traffic_multi_ports_single_socket] ERROR: test_punt.TestIP4PuntSocket.test_punt_socket_traffic_single_port_single_socket [test_punt.TestIP4PuntSocket.test_punt_socket_traffic_single_port_single_socket] Testcase name: Bidirectional Forwarding Detection (BFD) (IPv6) ERROR: test_bfd.BFD6TestCase.test_echo [test_bfd.BFD6TestCase.test_echo] ERROR: test_bfd.BFD6TestCase.test_echo_looped_back [test_bfd.BFD6TestCase.test_echo_looped_back] ERROR: test_bfd.BFD6TestCase.test_intf_deleted [test_bfd.BFD6TestCase.test_intf_deleted] ERROR: test_bfd.BFD6TestCase.test_session_up [test_bfd.BFD6TestCase.test_session_up] ERROR: test_bfd.BFD6TestCase.test_session_up_by_ip [test_bfd.BFD6TestCase.test_session_up_by_ip] Testcase name: Bidirectional Forwarding Detection (BFD) (CLI) ERROR: test_bfd.BFDCLITestCase.test_add_mod_del_bfd_udp [test_bfd.BFDCLITestCase.test_add_mod_del_bfd_udp] ERROR: test_bfd.BFDCLITestCase.test_add_mod_del_bfd_udp6 [test_bfd.BFDCLITestCase.test_add_mod_del_bfd_udp6] ERROR: test_bfd.BFDCLITestCase.test_add_mod_del_bfd_udp6_auth [test_bfd.BFDCLITestCase.test_add_mod_del_bfd_udp6_auth] ERROR: test_bfd.BFDCLITestCase.test_add_mod_del_bfd_udp_auth [test_bfd.BFDCLITestCase.test_add_mod_del_bfd_udp_auth] ERROR: test_bfd.BFDCLITestCase.test_admin_up_down [test_bfd.BFDCLITestCase.test_admin_up_down] ERROR: test_bfd.BFDCLITestCase.test_auth_on_off [test_bfd.BFDCLITestCase.test_auth_on_off] ERROR: test_bfd.BFDCLITestCase.test_auth_on_off_delayed [test_bfd.BFDCLITestCase.test_auth_on_off_delayed] ERROR: test_bfd.BFDCLITestCase.test_set_del_meticulous_sha1_key [test_bfd.BFDCLITestCase.test_set_del_meticulous_sha1_key] ERROR: test_bfd.BFDCLITestCase.test_set_del_sha1_key [test_bfd.BFDCLITestCase.test_set_del_sha1_key] ERROR: test_bfd.BFDCLITestCase.test_set_del_udp_echo_source [test_bfd.BFDCLITestCase.test_set_del_udp_echo_source] ERROR: test_bfd.BFDCLITestCase.test_show [test_bfd.BFDCLITestCase.test_show] Testcase name: VAPI test ERROR: test_vapi.VAPITestCase.test_vapi_c [test_vapi.VAPITestCase.test_vapi_c] Testcase name: Container integration extended testcases ERROR: test_container.ContainerIntegrationTestCase.test_0010_basic_conn_test [test_container.ContainerIntegrationTestCase.test_0010_basic_conn_test] ERROR: test_container.ContainerIntegrationTestCase.test_0011_basic_conn_test [test_container.ContainerIntegrationTestCase.test_0011_basic_conn_test] ERROR: test_container.ContainerIntegrationTestCase.test_0050_loopback_prepare_test [test_container.ContainerIntegrationTestCase.test_0050_loopback_prepare_test] ERROR: test_container.ContainerIntegrationTestCase.test_0110_basic_conn_test [test_container.ContainerIntegrationTestCase.test_0110_basic_conn_test] ERROR: test_container.ContainerIntegrationTestCase.test_0111_basic_conn_test [test_container.ContainerIntegrationTestCase.test_0111_basic_conn_test] ERROR: test_container.ContainerIntegrationTestCase.test_0200_basic_conn_test [test_container.ContainerIntegrationTestCase.test_0200_basic_conn_test] ERROR: test_container.ContainerIntegrationTestCase.test_0210_basic_conn_test [test_container.ContainerIntegrationTestCase.test_0210_basic_conn_test] ERROR: test_container.ContainerIntegrationTestCase.test_0211_basic_conn_test [test_container.ContainerIntegrationTestCase.test_0211_basic_conn_test] ERROR: test_container.ContainerIntegrationTestCase.test_0300_unconfigure_commands [test_container.ContainerIntegrationTestCase.test_0300_unconfigure_commands] ERROR: test_container.ContainerIntegrationTestCase.test_0410_spoof_test [test_container.ContainerIntegrationTestCase.test_0410_spoof_test] ERROR: test_container.ContainerIntegrationTestCase.test_0411_spoof_test [test_container.ContainerIntegrationTestCase.test_0411_spoof_test] Testcase name: Re-enable IPFIX ERROR: test_flowprobe.ReenableIPFIX.test_0011 [test_flowprobe.ReenableIPFIX.test_0011] Testcase name: VXLAN over IPv6 Test Case ERROR: setUpClass [setUpClass (test_vxlan6.TestVxlan6)] Testcase name: JVPP Core Test Case ERROR: test_jvpp.TestJVpp.test_vpp_acl_callback_api [test_jvpp.TestJVpp.test_vpp_acl_callback_api] ERROR: test_jvpp.TestJVpp.test_vpp_acl_future_api [test_jvpp.TestJVpp.test_vpp_acl_future_api] ERROR: test_jvpp.TestJVpp.test_vpp_core_callback_api [test_jvpp.TestJVpp.test_vpp_core_callback_api] ERROR: test_jvpp.TestJVpp.test_vpp_core_future_api [test_jvpp.TestJVpp.test_vpp_core_future_api] ERROR: test_jvpp.TestJVpp.test_vpp_ioamexport_callback_api [test_jvpp.TestJVpp.test_vpp_ioamexport_callback_api] ERROR: test_jvpp.TestJVpp.test_vpp_ioamexport_future_api [test_jvpp.TestJVpp.test_vpp_ioamexport_future_api] ERROR: test_jvpp.TestJVpp.test_vpp_ioampot_callback_api [test_jvpp.TestJVpp.test_vpp_ioampot_callback_api] ERROR: test_jvpp.TestJVpp.test_vpp_ioampot_future_api [test_jvpp.TestJVpp.test_vpp_ioampot_future_api] ERROR: test_jvpp.TestJVpp.test_vpp_ioamtrace_callback_api [test_jvpp.TestJVpp.test_vpp_ioamtrace_callback_api] ERROR: test_jvpp.TestJVpp.test_vpp_ioamtrace_future_api [test_jvpp.TestJVpp.test_vpp_ioamtrace_future_api] ERROR: test_jvpp.TestJVpp.test_vpp_snat_callback_api [test_jvpp.TestJVpp.test_vpp_snat_callback_api] ERROR: test_jvpp.TestJVpp.test_vpp_snat_future_api [test_jvpp.TestJVpp.test_vpp_snat_future_api] Testcase name: LDP Cut Thru Tests FAILURE: test_vcl.LDPCutThruTestCase.test_ldp_cut_thru_iperf3 [test_vcl.LDPCutThruTestCase.test_ldp_cut_thru_iperf3] Testcase name: ACL plugin connection-oriented extended testcases ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_0000_conn_prepare_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_0000_conn_prepare_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_0001_basic_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_0001_basic_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_0002_basic_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_0002_basic_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_0005_clear_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_0005_clear_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_0006_clear_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_0006_clear_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_0011_active_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_0011_active_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_0012_active_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_0012_active_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_1001_basic_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_1001_basic_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_1002_basic_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_1002_basic_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_1005_clear_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_1005_clear_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_1006_clear_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_1006_clear_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_1011_active_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_1011_active_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_1012_active_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_1012_active_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_2000_prepare_for_tcp_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_2000_prepare_for_tcp_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_2001_tcp_transient_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_2001_tcp_transient_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_2002_tcp_transient_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_2002_tcp_transient_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_2003_tcp_transient_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_2003_tcp_transient_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_2004_tcp_transient_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_2004_tcp_transient_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_2005_tcp_transient_teardown_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_2005_tcp_transient_teardown_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_2006_tcp_transient_teardown_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_2006_tcp_transient_teardown_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_3001_tcp_transient_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_3001_tcp_transient_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_3002_tcp_transient_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_3002_tcp_transient_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_3003_tcp_transient_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_3003_tcp_transient_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_3004_tcp_transient_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_3004_tcp_transient_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_3005_tcp_transient_teardown_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_3005_tcp_transient_teardown_conn_test] ERROR: test_acl_plugin_conns.ACLPluginConnTestCase.test_3006_tcp_transient_teardown_conn_test [test_acl_plugin_conns.ACLPluginConnTestCase.test_3006_tcp_transient_teardown_conn_test] Testcase name: LDP Thru Host Stack Echo FAILURE: test_vcl.LDPThruHostStackEcho.test_ldp_thru_host_stack_echo [test_vcl.LDPThruHostStackEcho.test_ldp_thru_host_stack_echo] Testcase name: Bidirectional Forwarding Detection (BFD) - API ERROR: test_bfd.BFDAPITestCase.test_activate_auth [test_bfd.BFDAPITestCase.test_activate_auth] ERROR: test_bfd.BFDAPITestCase.test_add_auth_nonexistent_key [test_bfd.BFDAPITestCase.test_add_auth_nonexistent_key] ERROR: test_bfd.BFDAPITestCase.test_add_bfd [test_bfd.BFDAPITestCase.test_add_bfd] ERROR: test_bfd.BFDAPITestCase.test_add_bfd6 [test_bfd.BFDAPITestCase.test_add_bfd6] ERROR: test_bfd.BFDAPITestCase.test_add_bfd_sha1 [test_bfd.BFDAPITestCase.test_add_bfd_sha1] ERROR: test_bfd.BFDAPITestCase.test_add_sha1_keys [test_bfd.BFDAPITestCase.test_add_sha1_keys] ERROR: test_bfd.BFDAPITestCase.test_change_key [test_bfd.BFDAPITestCase.test_change_key] ERROR: test_bfd.BFDAPITestCase.test_deactivate_auth [test_bfd.BFDAPITestCase.test_deactivate_auth] ERROR: test_bfd.BFDAPITestCase.test_double_add [test_bfd.BFDAPITestCase.test_double_add] ERROR: test_bfd.BFDAPITestCase.test_double_add_sha1 [test_bfd.BFDAPITestCase.test_double_add_sha1] ERROR: test_bfd.BFDAPITestCase.test_mod_bfd [test_bfd.BFDAPITestCase.test_mod_bfd] ERROR: test_bfd.BFDAPITestCase.test_set_del_udp_echo_source [test_bfd.BFDAPITestCase.test_set_del_udp_echo_source] ERROR: test_bfd.BFDAPITestCase.test_shared_sha1_key [test_bfd.BFDAPITestCase.test_shared_sha1_key] Testcase name: LDP Thru Host Stack Iperf FAILURE: test_vcl.LDPThruHostStackIperf.test_ldp_thru_host_stack_iperf3 [test_vcl.LDPThruHostStackIperf.test_ldp_thru_host_stack_iperf3] Testcase name: Bidirectional Forwarding Detection (BFD) (SHA1 auth) ERROR: test_bfd.BFDSHA1TestCase.test_session_up [test_bfd.BFDSHA1TestCase.test_session_up] Testcase name: Punt Socket for IPv6 ERROR: test_punt.TestIP6PuntSocket.test_punt_socket_dump [test_punt.TestIP6PuntSocket.test_punt_socket_dump] ERROR: test_punt.TestIP6PuntSocket.test_punt_socket_traffic_multi_port_multi_sockets [test_punt.TestIP6PuntSocket.test_punt_socket_traffic_multi_port_multi_sockets] ERROR: test_punt.TestIP6PuntSocket.test_punt_socket_traffic_multi_ports_single_socket [test_punt.TestIP6PuntSocket.test_punt_socket_traffic_multi_ports_single_socket] ERROR: test_punt.TestIP6PuntSocket.test_punt_socket_traffic_single_port_single_socket [test_punt.TestIP6PuntSocket.test_punt_socket_traffic_single_port_single_socket] Testcase name: Disable Flowprobe feature ERROR: test_flowprobe.DisableFP.test_0001 [test_flowprobe.DisableFP.test_0001] Testcase name: Disable IPFIX ERROR: test_flowprobe.DisableIPFIX.test_0001 [test_flowprobe.DisableIPFIX.test_0001] Testcase name: VPP Object Model Test ERROR: test_vom.VOMTestCase.test_vom_cpp [test_vom.VOMTestCase.test_vom_cpp] Testcase name: BFD-FIB interactions (IPv6) ERROR: test_bfd.BFDFIBTestCase.test_session_with_fib [test_bfd.BFDFIBTestCase.test_session_with_fib] Testcase name: Bidirectional Forwarding Detection (BFD) ERROR: test_bfd.BFD4TestCase.test_echo [test_bfd.BFD4TestCase.test_echo] ERROR: test_bfd.BFD4TestCase.test_echo_looped_back [test_bfd.BFD4TestCase.test_echo_looped_back] ERROR: test_bfd.BFD4TestCase.test_intf_deleted [test_bfd.BFD4TestCase.test_intf_deleted] ERROR: test_bfd.BFD4TestCase.test_session_down [test_bfd.BFD4TestCase.test_session_down] ERROR: test_bfd.BFD4TestCase.test_session_up [test_bfd.BFD4TestCase.test_session_up] ERROR: test_bfd.BFD4TestCase.test_session_up_by_ip [test_bfd.BFD4TestCase.test_session_up_by_ip] Testcase name: VXLAN-GPE Test Case ERROR: test_vxlan_gpe.TestVxlanGpe.test_decap [test_vxlan_gpe.TestVxlanGpe.test_decap] ERROR: test_vxlan_gpe.TestVxlanGpe.test_encap [test_vxlan_gpe.TestVxlanGpe.test_encap] ERROR: test_vxlan_gpe.TestVxlanGpe.test_ucast_flood [test_vxlan_gpe.TestVxlanGpe.test_ucast_flood] Testcase name: Re-enable Flowprobe feature ERROR: test_flowprobe.ReenableFP.test_0001 [test_flowprobe.ReenableFP.test_0001] Testcase name: LDP IPv6 Cut Thru Tests FAILURE: test_vcl.LDPIpv6CutThruTestCase.test_ldp_ipv6_cut_thru_echo [test_vcl.LDPIpv6CutThruTestCase.test_ldp_ipv6_cut_thru_echo] TESTCASES WHERE NO TESTS WERE SUCCESSFULLY EXECUTED: VXLAN over IPv6 Test Case ============================================================================== 0 attempt(s) left. Change-Id: Id202ed6ee7f57670f34ec87380244c568b509416 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
511 lines
18 KiB
Python
511 lines
18 KiB
Python
#!/usr/bin/env python
|
|
"""IP{4,6} over IP{v,6} tunnel functional tests"""
|
|
|
|
import unittest
|
|
from scapy.layers.inet6 import IPv6, Ether, IP, UDP, IPv6ExtHdrFragment
|
|
from scapy.all import fragment, fragment6, RandShort, defragment6
|
|
from framework import VppTestCase, VppTestRunner
|
|
from vpp_ip import DpoProto
|
|
from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpTable
|
|
from socket import AF_INET, AF_INET6, inet_pton
|
|
from util import reassemble4
|
|
|
|
|
|
""" Testipip is a subclass of VPPTestCase classes.
|
|
|
|
IPIP tests.
|
|
|
|
"""
|
|
|
|
|
|
class TestIPIP(VppTestCase):
|
|
""" IPIP Test Case """
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super(TestIPIP, cls).setUpClass()
|
|
cls.create_pg_interfaces(range(2))
|
|
cls.interfaces = list(cls.pg_interfaces)
|
|
|
|
def setUp(self):
|
|
super(TestIPIP, self).setUp()
|
|
for i in self.interfaces:
|
|
i.admin_up()
|
|
i.config_ip4()
|
|
i.config_ip6()
|
|
i.disable_ipv6_ra()
|
|
i.resolve_arp()
|
|
i.resolve_ndp()
|
|
|
|
def tearDown(self):
|
|
super(TestIPIP, self).tearDown()
|
|
if not self.vpp_dead:
|
|
for i in self.pg_interfaces:
|
|
i.unconfig_ip4()
|
|
i.unconfig_ip6()
|
|
i.admin_down()
|
|
|
|
def validate(self, rx, expected):
|
|
self.assertEqual(rx, expected.__class__(expected))
|
|
|
|
def generate_ip4_frags(self, payload_length, fragment_size):
|
|
p_ether = Ether(src=self.pg1.remote_mac, dst=self.pg1.local_mac)
|
|
p_payload = UDP(sport=1234, dport=1234) / self.payload(payload_length)
|
|
p_ip4 = IP(src="1.2.3.4", dst=self.pg0.remote_ip4)
|
|
outer_ip4 = (p_ether / IP(src=self.pg1.remote_ip4,
|
|
id=RandShort(),
|
|
dst=self.pg0.local_ip4) / p_ip4 / p_payload)
|
|
frags = fragment(outer_ip4, fragment_size)
|
|
p4_reply = (p_ip4 / p_payload)
|
|
p4_reply.ttl -= 1
|
|
return frags, p4_reply
|
|
|
|
def test_ipip4(self):
|
|
""" ip{v4,v6} over ip4 test """
|
|
p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac)
|
|
p_ip6 = IPv6(src="1::1", dst="DEAD::1", nh='UDP', tc=42)
|
|
p_ip4 = IP(src="1.2.3.4", dst="130.67.0.1", tos=42)
|
|
p_payload = UDP(sport=1234, dport=1234)
|
|
|
|
# IPv4 transport
|
|
rv = self.vapi.ipip_add_tunnel(
|
|
src_address=self.pg0.local_ip4n,
|
|
dst_address=self.pg1.remote_ip4n,
|
|
is_ipv6=0, tc_tos=0xFF)
|
|
sw_if_index = rv.sw_if_index
|
|
|
|
# Set interface up and enable IP on it
|
|
self.vapi.sw_interface_set_flags(sw_if_index, 1)
|
|
self.vapi.sw_interface_set_unnumbered(
|
|
ip_sw_if_index=self.pg0.sw_if_index,
|
|
sw_if_index=sw_if_index)
|
|
|
|
# Add IPv4 and IPv6 routes via tunnel interface
|
|
ip4_via_tunnel = VppIpRoute(
|
|
self, "130.67.0.0", 16,
|
|
[VppRoutePath("0.0.0.0",
|
|
sw_if_index,
|
|
proto=DpoProto.DPO_PROTO_IP4)], is_ip6=0)
|
|
ip4_via_tunnel.add_vpp_config()
|
|
|
|
ip6_via_tunnel = VppIpRoute(
|
|
self, "dead::", 16,
|
|
[VppRoutePath("::",
|
|
sw_if_index,
|
|
proto=DpoProto.DPO_PROTO_IP6)], is_ip6=1)
|
|
ip6_via_tunnel.add_vpp_config()
|
|
|
|
# IPv6 in to IPv4 tunnel
|
|
p6 = (p_ether / p_ip6 / p_payload)
|
|
p_inner_ip6 = p_ip6
|
|
p_inner_ip6.hlim -= 1
|
|
p6_reply = (IP(src=self.pg0.local_ip4, dst=self.pg1.remote_ip4,
|
|
proto='ipv6', id=0, tos=42) / p_inner_ip6 / p_payload)
|
|
p6_reply.ttl -= 1
|
|
rx = self.send_and_expect(self.pg0, p6*10, self.pg1)
|
|
for p in rx:
|
|
self.validate(p[1], p6_reply)
|
|
|
|
# IPv4 in to IPv4 tunnel
|
|
p4 = (p_ether / p_ip4 / p_payload)
|
|
p_ip4_inner = p_ip4
|
|
p_ip4_inner.ttl -= 1
|
|
p4_reply = (IP(src=self.pg0.local_ip4, dst=self.pg1.remote_ip4,
|
|
tos=42) /
|
|
p_ip4_inner / p_payload)
|
|
p4_reply.ttl -= 1
|
|
p4_reply.id = 0
|
|
rx = self.send_and_expect(self.pg0, p4*10, self.pg1)
|
|
for p in rx:
|
|
self.validate(p[1], p4_reply)
|
|
|
|
# Decapsulation
|
|
p_ether = Ether(src=self.pg1.remote_mac, dst=self.pg1.local_mac)
|
|
|
|
# IPv4 tunnel to IPv4
|
|
p_ip4 = IP(src="1.2.3.4", dst=self.pg0.remote_ip4)
|
|
p4 = (p_ether / IP(src=self.pg1.remote_ip4,
|
|
dst=self.pg0.local_ip4) / p_ip4 / p_payload)
|
|
p4_reply = (p_ip4 / p_payload)
|
|
p4_reply.ttl -= 1
|
|
rx = self.send_and_expect(self.pg1, p4*10, self.pg0)
|
|
for p in rx:
|
|
self.validate(p[1], p4_reply)
|
|
|
|
err = self.statistics.get_counter(
|
|
'/err/ipip4-input/packets decapsulated')
|
|
self.assertEqual(err, 10)
|
|
|
|
# IPv4 tunnel to IPv6
|
|
p_ip6 = IPv6(src="1:2:3::4", dst=self.pg0.remote_ip6)
|
|
p6 = (p_ether / IP(src=self.pg1.remote_ip4,
|
|
dst=self.pg0.local_ip4) / p_ip6 / p_payload)
|
|
p6_reply = (p_ip6 / p_payload)
|
|
p6_reply.hlim = 63
|
|
rx = self.send_and_expect(self.pg1, p6*10, self.pg0)
|
|
for p in rx:
|
|
self.validate(p[1], p6_reply)
|
|
|
|
err = self.statistics.get_counter(
|
|
'/err/ipip4-input/packets decapsulated')
|
|
self.assertEqual(err, 20)
|
|
|
|
#
|
|
# Fragmentation / Reassembly and Re-fragmentation
|
|
#
|
|
rv = self.vapi.ip_reassembly_enable_disable(
|
|
sw_if_index=self.pg1.sw_if_index,
|
|
enable_ip4=1)
|
|
|
|
# Send lots of fragments, verify reassembled packet
|
|
frags, p4_reply = self.generate_ip4_frags(3131, 1400)
|
|
f = []
|
|
for i in range(0, 1000):
|
|
f.extend(frags)
|
|
self.pg1.add_stream(f)
|
|
self.pg_enable_capture()
|
|
self.pg_start()
|
|
rx = self.pg0.get_capture(1000)
|
|
|
|
for p in rx:
|
|
self.validate(p[1], p4_reply)
|
|
|
|
err = self.statistics.get_counter(
|
|
'/err/ipip4-input/packets decapsulated')
|
|
self.assertEqual(err, 1020)
|
|
|
|
f = []
|
|
r = []
|
|
for i in range(1, 90):
|
|
frags, p4_reply = self.generate_ip4_frags(i * 100, 1000)
|
|
f.extend(frags)
|
|
r.extend(p4_reply)
|
|
self.pg_enable_capture()
|
|
self.pg1.add_stream(f)
|
|
self.pg_start()
|
|
rx = self.pg0.get_capture(89)
|
|
i = 0
|
|
for p in rx:
|
|
self.validate(p[1], r[i])
|
|
i += 1
|
|
|
|
# Now try with re-fragmentation
|
|
#
|
|
# Send fragments to tunnel head-end, for the tunnel head end
|
|
# to reassemble and then refragment
|
|
#
|
|
self.vapi.sw_interface_set_mtu(self.pg0.sw_if_index, [576, 0, 0, 0])
|
|
frags, p4_reply = self.generate_ip4_frags(3123, 1200)
|
|
self.pg_enable_capture()
|
|
self.pg1.add_stream(frags)
|
|
self.pg_start()
|
|
rx = self.pg0.get_capture(6)
|
|
reass_pkt = reassemble4(rx)
|
|
p4_reply.ttl -= 1
|
|
p4_reply.id = 256
|
|
self.validate(reass_pkt, p4_reply)
|
|
|
|
self.vapi.sw_interface_set_mtu(self.pg0.sw_if_index, [1600, 0, 0, 0])
|
|
frags, p4_reply = self.generate_ip4_frags(3123, 1200)
|
|
self.pg_enable_capture()
|
|
self.pg1.add_stream(frags)
|
|
self.pg_start()
|
|
rx = self.pg0.get_capture(2)
|
|
reass_pkt = reassemble4(rx)
|
|
p4_reply.ttl -= 1
|
|
p4_reply.id = 512
|
|
self.validate(reass_pkt, p4_reply)
|
|
|
|
def test_ipip_create(self):
|
|
""" ipip create / delete interface test """
|
|
rv = self.vapi.ipip_add_tunnel(
|
|
src_address=inet_pton(AF_INET, '1.2.3.4'),
|
|
dst_address=inet_pton(AF_INET, '2.3.4.5'), is_ipv6=0)
|
|
sw_if_index = rv.sw_if_index
|
|
self.vapi.ipip_del_tunnel(sw_if_index)
|
|
|
|
def test_ipip_vrf_create(self):
|
|
""" ipip create / delete interface VRF test """
|
|
|
|
t = VppIpTable(self, 20)
|
|
t.add_vpp_config()
|
|
rv = self.vapi.ipip_add_tunnel(
|
|
src_address=inet_pton(AF_INET, '1.2.3.4'),
|
|
dst_address=inet_pton(AF_INET, '2.3.4.5'), is_ipv6=0,
|
|
table_id=20)
|
|
sw_if_index = rv.sw_if_index
|
|
self.vapi.ipip_del_tunnel(sw_if_index)
|
|
|
|
def payload(self, len):
|
|
return 'x' * len
|
|
|
|
|
|
class TestIPIP6(VppTestCase):
|
|
""" IPIP6 Test Case """
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super(TestIPIP6, cls).setUpClass()
|
|
cls.create_pg_interfaces(range(2))
|
|
cls.interfaces = list(cls.pg_interfaces)
|
|
|
|
def setUp(self):
|
|
super(TestIPIP6, self).setUp()
|
|
for i in self.interfaces:
|
|
i.admin_up()
|
|
i.config_ip4()
|
|
i.config_ip6()
|
|
i.disable_ipv6_ra()
|
|
i.resolve_arp()
|
|
i.resolve_ndp()
|
|
self.setup_tunnel()
|
|
|
|
def tearDown(self):
|
|
if not self.vpp_dead:
|
|
self.destroy_tunnel()
|
|
for i in self.pg_interfaces:
|
|
i.unconfig_ip4()
|
|
i.unconfig_ip6()
|
|
i.admin_down()
|
|
super(TestIPIP6, self).tearDown()
|
|
|
|
def setup_tunnel(self):
|
|
# IPv6 transport
|
|
rv = self.vapi.ipip_add_tunnel(
|
|
src_address=self.pg0.local_ip6n,
|
|
dst_address=self.pg1.remote_ip6n, tc_tos=255)
|
|
|
|
sw_if_index = rv.sw_if_index
|
|
self.tunnel_if_index = sw_if_index
|
|
self.vapi.sw_interface_set_flags(sw_if_index, 1)
|
|
self.vapi.sw_interface_set_unnumbered(
|
|
ip_sw_if_index=self.pg0.sw_if_index, sw_if_index=sw_if_index)
|
|
|
|
# Add IPv4 and IPv6 routes via tunnel interface
|
|
ip4_via_tunnel = VppIpRoute(
|
|
self, "130.67.0.0", 16,
|
|
[VppRoutePath("0.0.0.0",
|
|
sw_if_index,
|
|
proto=DpoProto.DPO_PROTO_IP4)], is_ip6=0)
|
|
ip4_via_tunnel.add_vpp_config()
|
|
|
|
ip6_via_tunnel = VppIpRoute(
|
|
self, "dead::", 16,
|
|
[VppRoutePath("::",
|
|
sw_if_index,
|
|
proto=DpoProto.DPO_PROTO_IP6)], is_ip6=1)
|
|
ip6_via_tunnel.add_vpp_config()
|
|
|
|
self.tunnel_ip6_via_tunnel = ip6_via_tunnel
|
|
self.tunnel_ip4_via_tunnel = ip4_via_tunnel
|
|
|
|
def destroy_tunnel(self):
|
|
# IPv6 transport
|
|
self.tunnel_ip4_via_tunnel.remove_vpp_config()
|
|
self.tunnel_ip6_via_tunnel.remove_vpp_config()
|
|
|
|
rv = self.vapi.ipip_del_tunnel(sw_if_index=self.tunnel_if_index)
|
|
|
|
def validate(self, rx, expected):
|
|
self.assertEqual(rx, expected.__class__(expected))
|
|
|
|
def generate_ip6_frags(self, payload_length, fragment_size):
|
|
p_ether = Ether(src=self.pg1.remote_mac, dst=self.pg1.local_mac)
|
|
p_payload = UDP(sport=1234, dport=1234) / self.payload(payload_length)
|
|
p_ip6 = IPv6(src="1::1", dst=self.pg0.remote_ip6)
|
|
outer_ip6 = (p_ether / IPv6(src=self.pg1.remote_ip6,
|
|
dst=self.pg0.local_ip6) /
|
|
IPv6ExtHdrFragment() / p_ip6 / p_payload)
|
|
frags = fragment6(outer_ip6, fragment_size)
|
|
p6_reply = (p_ip6 / p_payload)
|
|
p6_reply.hlim -= 1
|
|
return frags, p6_reply
|
|
|
|
def generate_ip6_hairpin_frags(self, payload_length, fragment_size):
|
|
p_ether = Ether(src=self.pg1.remote_mac, dst=self.pg1.local_mac)
|
|
p_payload = UDP(sport=1234, dport=1234) / self.payload(payload_length)
|
|
p_ip6 = IPv6(src="1::1", dst="dead::1")
|
|
outer_ip6 = (p_ether / IPv6(src=self.pg1.remote_ip6,
|
|
dst=self.pg0.local_ip6) /
|
|
IPv6ExtHdrFragment() / p_ip6 / p_payload)
|
|
frags = fragment6(outer_ip6, fragment_size)
|
|
p_ip6.hlim -= 1
|
|
p6_reply = (IPv6(src=self.pg0.local_ip6, dst=self.pg1.remote_ip6,
|
|
hlim=63) / p_ip6 / p_payload)
|
|
|
|
return frags, p6_reply
|
|
|
|
def test_encap(self):
|
|
""" ip{v4,v6} over ip6 test encap """
|
|
p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac)
|
|
p_ip6 = IPv6(src="1::1", dst="DEAD::1", tc=42, nh='UDP')
|
|
p_ip4 = IP(src="1.2.3.4", dst="130.67.0.1", tos=42)
|
|
p_payload = UDP(sport=1234, dport=1234)
|
|
|
|
# Encapsulation
|
|
# IPv6 in to IPv6 tunnel
|
|
p6 = (p_ether / p_ip6 / p_payload)
|
|
p6_reply = (IPv6(src=self.pg0.local_ip6, dst=self.pg1.remote_ip6,
|
|
hlim=64, tc=42) /
|
|
p_ip6 / p_payload)
|
|
p6_reply[1].hlim -= 1
|
|
rx = self.send_and_expect(self.pg0, p6*11, self.pg1)
|
|
for p in rx:
|
|
self.validate(p[1], p6_reply)
|
|
|
|
# IPv4 in to IPv6 tunnel
|
|
p4 = (p_ether / p_ip4 / p_payload)
|
|
p4_reply = (IPv6(src=self.pg0.local_ip6,
|
|
dst=self.pg1.remote_ip6, hlim=64, tc=42) /
|
|
p_ip4 / p_payload)
|
|
p4_reply[1].ttl -= 1
|
|
rx = self.send_and_expect(self.pg0, p4*11, self.pg1)
|
|
for p in rx:
|
|
self.validate(p[1], p4_reply)
|
|
|
|
def test_decap(self):
|
|
""" ip{v4,v6} over ip6 test decap """
|
|
|
|
p_ether = Ether(src=self.pg1.remote_mac, dst=self.pg1.local_mac)
|
|
p_ip6 = IPv6(src="1::1", dst="DEAD::1", tc=42, nh='UDP')
|
|
p_ip4 = IP(src="1.2.3.4", dst=self.pg0.remote_ip4)
|
|
p_payload = UDP(sport=1234, dport=1234)
|
|
|
|
# Decapsulation
|
|
# IPv6 tunnel to IPv4
|
|
|
|
p4 = (p_ether / IPv6(src=self.pg1.remote_ip6,
|
|
dst=self.pg0.local_ip6) / p_ip4 / p_payload)
|
|
p4_reply = (p_ip4 / p_payload)
|
|
p4_reply.ttl -= 1
|
|
rx = self.send_and_expect(self.pg1, p4*11, self.pg0)
|
|
for p in rx:
|
|
self.validate(p[1], p4_reply)
|
|
|
|
# IPv6 tunnel to IPv6
|
|
p_ip6 = IPv6(src="1:2:3::4", dst=self.pg0.remote_ip6)
|
|
p6 = (p_ether / IPv6(src=self.pg1.remote_ip6,
|
|
dst=self.pg0.local_ip6) / p_ip6 / p_payload)
|
|
p6_reply = (p_ip6 / p_payload)
|
|
p6_reply.hlim = 63
|
|
rx = self.send_and_expect(self.pg1, p6*11, self.pg0)
|
|
for p in rx:
|
|
self.validate(p[1], p6_reply)
|
|
|
|
def test_frag(self):
|
|
""" ip{v4,v6} over ip6 test frag """
|
|
|
|
p_ether = Ether(src=self.pg1.remote_mac, dst=self.pg1.local_mac)
|
|
p_ip6 = IPv6(src="1::1", dst="DEAD::1", tc=42, nh='UDP')
|
|
p_ip4 = IP(src="1.2.3.4", dst=self.pg0.remote_ip4)
|
|
p_payload = UDP(sport=1234, dport=1234)
|
|
|
|
#
|
|
# Fragmentation / Reassembly and Re-fragmentation
|
|
#
|
|
rv = self.vapi.ip_reassembly_enable_disable(
|
|
sw_if_index=self.pg1.sw_if_index,
|
|
enable_ip6=1)
|
|
|
|
# Send lots of fragments, verify reassembled packet
|
|
before_cnt = self.statistics.get_counter(
|
|
'/err/ipip6-input/packets decapsulated')
|
|
frags, p6_reply = self.generate_ip6_frags(3131, 1400)
|
|
f = []
|
|
for i in range(0, 1000):
|
|
f.extend(frags)
|
|
self.pg1.add_stream(f)
|
|
self.pg_enable_capture()
|
|
self.pg_start()
|
|
rx = self.pg0.get_capture(1000)
|
|
|
|
for p in rx:
|
|
self.validate(p[1], p6_reply)
|
|
|
|
cnt = self.statistics.get_counter(
|
|
'/err/ipip6-input/packets decapsulated')
|
|
self.assertEqual(cnt, before_cnt + 1000)
|
|
|
|
f = []
|
|
r = []
|
|
# TODO: Check out why reassembly of atomic fragments don't work
|
|
for i in range(10, 90):
|
|
frags, p6_reply = self.generate_ip6_frags(i * 100, 1000)
|
|
f.extend(frags)
|
|
r.extend(p6_reply)
|
|
self.pg_enable_capture()
|
|
self.pg1.add_stream(f)
|
|
self.pg_start()
|
|
rx = self.pg0.get_capture(80)
|
|
i = 0
|
|
for p in rx:
|
|
self.validate(p[1], r[i])
|
|
i += 1
|
|
|
|
# Simple fragmentation
|
|
p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac)
|
|
self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [1280, 0, 0, 0])
|
|
|
|
# IPv6 in to IPv6 tunnel
|
|
p_payload = UDP(sport=1234, dport=1234) / self.payload(1300)
|
|
|
|
p6 = (p_ether / p_ip6 / p_payload)
|
|
p6_reply = (IPv6(src=self.pg0.local_ip6, dst=self.pg1.remote_ip6,
|
|
hlim=63, tc=42) /
|
|
p_ip6 / p_payload)
|
|
p6_reply[1].hlim -= 1
|
|
self.pg_enable_capture()
|
|
self.pg0.add_stream(p6)
|
|
self.pg_start()
|
|
rx = self.pg1.get_capture(2)
|
|
|
|
# Scapy defragment doesn't deal well with multiple layers
|
|
# of samy type / Ethernet header first
|
|
f = [p[1] for p in rx]
|
|
reass_pkt = defragment6(f)
|
|
self.validate(reass_pkt, p6_reply)
|
|
|
|
# Now try with re-fragmentation
|
|
#
|
|
# Send large fragments to tunnel head-end, for the tunnel head end
|
|
# to reassemble and then refragment out the tunnel again.
|
|
# Hair-pinning
|
|
#
|
|
self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [1280, 0, 0, 0])
|
|
frags, p6_reply = self.generate_ip6_hairpin_frags(8000, 1200)
|
|
self.pg_enable_capture()
|
|
self.pg1.add_stream(frags)
|
|
self.pg_start()
|
|
rx = self.pg1.get_capture(7)
|
|
f = [p[1] for p in rx]
|
|
reass_pkt = defragment6(f)
|
|
p6_reply.id = 256
|
|
self.validate(reass_pkt, p6_reply)
|
|
|
|
def test_ipip_create(self):
|
|
""" ipip create / delete interface test """
|
|
rv = self.vapi.ipip_add_tunnel(
|
|
src_address=inet_pton(AF_INET, '1.2.3.4'),
|
|
dst_address=inet_pton(AF_INET, '2.3.4.5'), is_ipv6=0)
|
|
sw_if_index = rv.sw_if_index
|
|
self.vapi.ipip_del_tunnel(sw_if_index)
|
|
|
|
def test_ipip_vrf_create(self):
|
|
""" ipip create / delete interface VRF test """
|
|
|
|
t = VppIpTable(self, 20)
|
|
t.add_vpp_config()
|
|
rv = self.vapi.ipip_add_tunnel(
|
|
src_address=inet_pton(AF_INET, '1.2.3.4'),
|
|
dst_address=inet_pton(AF_INET, '2.3.4.5'), is_ipv6=0,
|
|
table_id=20)
|
|
sw_if_index = rv.sw_if_index
|
|
self.vapi.ipip_del_tunnel(sw_if_index)
|
|
|
|
def payload(self, len):
|
|
return 'x' * len
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main(testRunner=VppTestRunner)
|