From 3541ec5c2b067edaf3e4077bcace447275dc799b Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Tue, 19 Sep 2023 16:03:39 -0400 Subject: [PATCH] tests: add --tracing and --duration flags --- tests/common/config.py | 21 +++++++++++++++++---- tests/conftest.py | 7 +++++++ tests/iperf/iperf.py | 8 ++++++-- tests/iperf/munet_phy.yaml | 16 ++++++++-------- tests/iperf/test_iperf.py | 11 +++++++++++ tests/iperf/test_iperf_phy.py | 15 ++++++++++++++- 6 files changed, 63 insertions(+), 15 deletions(-) diff --git a/tests/common/config.py b/tests/common/config.py index 9bb052d..fbec27d 100644 --- a/tests/common/config.py +++ b/tests/common/config.py @@ -29,8 +29,8 @@ g_offloads = [ # These are both required on my machine to get rid of GSO - # "generic-receive-offload", - # "rx-gro-hw", + "generic-receive-offload", + "rx-gro-hw", # # These are not required to get rid of GSO in iptfs path # # "generic-segmentation-offload", # # "tcp-segmentation-offload", @@ -64,11 +64,10 @@ async def _network_up( await ethtool_disable_offloads(r2, g_offloads) await toggle_ipv6(unet, enable=ipv6) + await toggle_ecn(unet, enable=True) await toggle_forward_pmtu(unet, enable=False) await toggle_forwarding(unet, enable=True) - await toggle_ipv6(unet, enable=ipv6) - if ipv4: if h1: h1.cmd_raises("ip route add 10.0.2.0/24 via 10.0.0.2") @@ -205,6 +204,7 @@ async def _network_up3(unet, ipv4=True, ipv6=False, trex=False, minimal=False): await ethtool_disable_offloads(r2, g_offloads) await toggle_ipv6(unet, enable=ipv6) + await toggle_ecn(unet, enable=True) await toggle_forward_pmtu(unet, enable=False) await toggle_forwarding(unet, enable=True) @@ -366,6 +366,19 @@ async def cleanup_config3(unet, ipv4=True, ipv6=False): r2con.cmd_nostatus("ip x p deleteall") +async def toggle_ecn(unet, enable=False): + nodes = list(unet.hosts.values()) + if unet.isolated: + nodes.append(unet) + for node in nodes: + if enable: + node.cmd_raises("sysctl -w net.ipv4.tcp_ecn=1") + node.cmd_raises("sysctl -w net.ipv4.tcp_ecn_fallback=0") + else: + node.cmd_raises("sysctl -w net.ipv4.tcp_ecn=0") + node.cmd_raises("sysctl -w net.ipv4.tcp_ecn_fallback=1") + + async def toggle_forward_pmtu(unet, enable=False): nodes = list(unet.hosts.values()) if unet.isolated: diff --git a/tests/conftest.py b/tests/conftest.py index 15456cd..64a3d4a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -33,6 +33,13 @@ def pytest_addoption(parser): # pylint: disable=E0102 + parser.addoption( + "--duration", + default=10.0, + type=float, + help="Enable tracing if supported by test", + ) + parser.addoption( "--enable-ipv6", action="store_true", diff --git a/tests/iperf/iperf.py b/tests/iperf/iperf.py index da1f865..19b46f3 100644 --- a/tests/iperf/iperf.py +++ b/tests/iperf/iperf.py @@ -86,6 +86,7 @@ async def _test_iperf( profile=False, profcount=0, tracing=False, + duration=10, ): h1 = unet.hosts["h1"] h2 = unet.hosts["h2"] @@ -187,7 +188,7 @@ async def _test_iperf( if ipv6: cargs.append("-V") - tval = 3 + tval = duration if use_iperf3: args = [ @@ -249,7 +250,10 @@ async def _test_iperf( # timeout = True # o, e = await iperfc.communicate() try: - rc = iperfc.wait(timeout=tval + 5) + if tval > 60: + rc = iperfc.wait(timeout=tval + 20) + else: + rc = iperfc.wait(timeout=tval + 5) timeout = False except subprocess.TimeoutExpired: logging.error("Timeout expired!") diff --git a/tests/iperf/munet_phy.yaml b/tests/iperf/munet_phy.yaml index 6b46563..e9658f1 100644 --- a/tests/iperf/munet_phy.yaml +++ b/tests/iperf/munet_phy.yaml @@ -15,8 +15,8 @@ topology: hostintf: "enp27s0f0v0" ip: 10.0.0.1/24 ipv6: "fc00:0:0:0::1/64" - # mtu: 9000 - mtu: 1400 + mtu: 9000 + # mtu: 1400 - name: r1 kind: linux connections: @@ -30,8 +30,8 @@ topology: physical: "0000:d8:02.0" ip: 10.0.0.2/24 ipv6: "fc00:0:0:0::2/64" - # mtu: 9000 - mtu: 1400 + mtu: 9000 + # mtu: 1400 - name: r2 kind: linux connections: @@ -45,8 +45,8 @@ topology: physical: "0000:d8:0a.0" ip: 10.0.2.3/24 ipv6: "fc00:0:0:2::3/64" - # mtu: 9000 - mtu: 1400 + mtu: 9000 + # mtu: 1400 - name: h2 connections: - to: mgmt0 @@ -54,8 +54,8 @@ topology: hostintf: "enp27s0f1v0" ip: 10.0.2.4/24 ipv6: "fc00:0:0:2::4/64" - # mtu: 9000 - mtu: 1400 + mtu: 9000 + # mtu: 1400 kinds: - name: linux diff --git a/tests/iperf/test_iperf.py b/tests/iperf/test_iperf.py index 4e3e772..0b5c303 100644 --- a/tests/iperf/test_iperf.py +++ b/tests/iperf/test_iperf.py @@ -127,6 +127,16 @@ async def _unet(rundir_module, pytestconfig): # @pytest.mark.parametrize("iptfs_opts", ["init-delay 500"], scope="function") +# @pytest.mark.parametrize("pktsize", [None, 88, 536, 8000]) +# @pytest.mark.parametrize("ipv6", [False, True]) +# @pytest.mark.parametrize("tun_ipv6", [False, True]) +# @pytest.mark.parametrize("routed", [False, True]) + +# @pytest.mark.parametrize( +# "iptfs_opts", ["pkt-size 256 max-queue-size 100000"], scope="function" +# ) + + @pytest.mark.parametrize("iptfs_opts", [""], scope="function") @pytest.mark.parametrize("pktsize", [None, 88, 536, 1442]) @pytest.mark.parametrize("ipv6", [False, True]) @@ -179,6 +189,7 @@ async def test_iperf( profile=pytestconfig.getoption("--profile", False), profcount=test_iperf.count, tracing=pytestconfig.getoption("--tracing", False), + duration=pytestconfig.getoption("--duration", 10.0), ) assert result, "No result from test!" diff --git a/tests/iperf/test_iperf_phy.py b/tests/iperf/test_iperf_phy.py index a489db6..af9305b 100644 --- a/tests/iperf/test_iperf_phy.py +++ b/tests/iperf/test_iperf_phy.py @@ -103,7 +103,19 @@ async def test_tun_up(lcl_unet, astepf): check_logs(unet) +# overrun the queue setup +# @pytest.mark.parametrize( +# "iptfs_opts", ["pkt-size 256 max-queue-size 100000"], scope="function" +# ) +# @pytest.mark.parametrize("pktsize", [8000]) +# @pytest.mark.parametrize("ipv6", [False]) +# @pytest.mark.parametrize("tun_ipv6", [False]) +# @pytest.mark.parametrize("routed", [False]) + # @pytest.mark.parametrize("iptfs_opts", ["", "dont-frag"], scope="function") +# @pytest.mark.parametrize("iptfs_opts", ["init-delay 1000"], scope="function") + +# @pytest.mark.parametrize("iptfs_opts", [""], scope="function") # @pytest.mark.parametrize("pktsize", [None, 88, 536, 1442], scope="function") # @pytest.mark.parametrize("ipv6", [False, True], scope="function") # @pytest.mark.parametrize("tun_ipv6", [False, True], scope="function") @@ -127,7 +139,7 @@ async def test_iperf( if not unet.ipv6_enable and tun_ipv6: pytest.skip("skipping ipv6 as --enable-ipv6 not specified") - if tun_ipv6 and pktsize and pktsize < 536: + if ipv6 and pktsize and pktsize < 536: pytest.skip("Can't run IPv6 iperf with MSS < 536") return @@ -154,6 +166,7 @@ async def test_iperf( profile=pytestconfig.getoption("--profile", False), profcount=test_iperf.count, tracing=pytestconfig.getoption("--tracing", False), + duration=pytestconfig.getoption("--duration", 10.0), ) assert result, "No result from test!"