From: Ondrej Lichtner olichtne@redhat.com
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py | 2 ++ lnst/Recipes/ENRT/SimpleMacsecRecipe.py | 2 ++ 2 files changed, 4 insertions(+)
diff --git a/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py b/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py index 65e480b..8d7d0c9 100644 --- a/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py +++ b/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py @@ -142,8 +142,10 @@ def generate_flow_combinations(self, config): type = perf_test, generator = ns1, generator_bind = ip1, + generator_nic = config.endpoint1, receiver = ns2, receiver_bind = ip2, + receiver_nic = config.endpoint2, msg_size = size, duration = self.params.perf_duration, parallel_streams = self.params.perf_parallel_streams, diff --git a/lnst/Recipes/ENRT/SimpleMacsecRecipe.py b/lnst/Recipes/ENRT/SimpleMacsecRecipe.py index fded0e6..069263d 100644 --- a/lnst/Recipes/ENRT/SimpleMacsecRecipe.py +++ b/lnst/Recipes/ENRT/SimpleMacsecRecipe.py @@ -223,8 +223,10 @@ def generate_flow_combinations(self, config): type = perf_test, generator = client_netns, generator_bind = client_bind, + generator_nic = client_nic, receiver = server_netns, receiver_bind = server_bind, + receiver_nic = server_nic, msg_size = size, duration = self.params.perf_duration, parallel_streams = pstreams,
From: Ondrej Lichtner olichtne@redhat.com
Before returning any sort of PacketAssert "recipe template" result we need to check the actual PacketAssert test module success or failure, if the remote job returns a failure this means that it failed to measure anything meaningful and that there are no results available.
Because of this we should return an empty object that tells the evaluate_and_report method to skip a normal evaluation and just immediately report a failing result.
This fixes a traceback crashing issue where trying to read "p_recv" was not possible when the PacketAssert test module failed.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/RecipeCommon/PacketAssert.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lnst/RecipeCommon/PacketAssert.py b/lnst/RecipeCommon/PacketAssert.py index 689250e..ae52803 100644 --- a/lnst/RecipeCommon/PacketAssert.py +++ b/lnst/RecipeCommon/PacketAssert.py @@ -59,11 +59,18 @@ def packet_assert_test_stop(self):
self.started_job.kill(signal=signal.SIGINT) self.started_job.wait() - result = self.started_job.result + if not self.started_job.passed: + result = {} + else: + result = self.started_job.result self.started_job = None return result
def packet_assert_evaluate_and_report(self, packet_assert_config, results): + if not results: + self.add_result(False, "Packet assert results unavailable") + return + if results["p_recv"] >= packet_assert_config.p_min and \ (results["p_recv"] <= packet_assert_config.p_max or not packet_assert_config.p_max):
From: Ondrej Lichtner olichtne@redhat.com
This commit implements a new PerfTestTweakMixin called once per perf_test method that handles configuration of ipfragmentation thresholds in case a udp flow is being measured.
The mixin includes detection for which IP version the flow will use and configures the ip fragmentation specifically for that version.
v2: * added udp_fragmentation_time parameter to allow for more control of configuration
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- .../CommonPerfTestTweakMixin.py | 14 +- .../UdpFragmentationPerfTestMixin.py | 149 ++++++++++++++++++ lnst/Recipes/ENRT/PerfTestMixins/__init__.py | 1 + 3 files changed, 160 insertions(+), 4 deletions(-) create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/UdpFragmentationPerfTestMixin.py
diff --git a/lnst/Recipes/ENRT/PerfTestMixins/CommonPerfTestTweakMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/CommonPerfTestTweakMixin.py index ebe5965..7b77234 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/CommonPerfTestTweakMixin.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/CommonPerfTestTweakMixin.py @@ -1,7 +1,13 @@ from lnst.Recipes.ENRT.PerfTestMixins import ( - SctpFirewallPerfTestMixin, - DropCachesPerfTestMixin, - ) + SctpFirewallPerfTestMixin, + UdpFragmentationPerfTestMixin, + DropCachesPerfTestMixin, +)
-class CommonPerfTestTweakMixin(SctpFirewallPerfTestMixin, DropCachesPerfTestMixin): + +class CommonPerfTestTweakMixin( + SctpFirewallPerfTestMixin, + UdpFragmentationPerfTestMixin, + DropCachesPerfTestMixin, +): pass diff --git a/lnst/Recipes/ENRT/PerfTestMixins/UdpFragmentationPerfTestMixin.py b/lnst/Recipes/ENRT/PerfTestMixins/UdpFragmentationPerfTestMixin.py new file mode 100644 index 0000000..0f5c6c7 --- /dev/null +++ b/lnst/Recipes/ENRT/PerfTestMixins/UdpFragmentationPerfTestMixin.py @@ -0,0 +1,149 @@ +from lnst.Common.LnstError import LnstError +from lnst.Common.Parameters import IntParam +from lnst.Common.IpAddress import ipaddress, AF_INET, AF_INET6 +from lnst.Controller.RecipeResults import ResultLevel +from lnst.RecipeCommon.Perf.PerfTestMixins import BasePerfTestTweakMixin +from lnst.Recipes.ENRT.PerfTestMixins.Utils import ( + get_flow_measurements_from_config, +) + + +class UdpFragmentationPerfTestMixin(BasePerfTestTweakMixin): + udp_fragmentation_threshold = IntParam(default=104857600) + udp_fragmentation_time = IntParam(default=1) + + def apply_perf_test_tweak(self, perf_config): + super().apply_perf_test_tweak(perf_config) + + flow_measurements = get_flow_measurements_from_config(perf_config) + flow = flow_measurements[0].conf[0] + tweak_config = perf_config.perf_test_tweak_config + if flow.type == "udp_stream": + tweak_config["udp_fragmentation"] = {} + for host in self.matched: + self._config_ip_fragmentation(tweak_config, host, flow) + + def _config_ip_fragmentation(self, config, host, flow): + ip_version = self._flow_ip_version(flow) + + if ip_version == AF_INET: + orig_thresh_value = host.run( + "cat /proc/sys/net/ipv4/ipfrag_high_thresh", + job_level=ResultLevel.DEBUG, + ) + orig_time_value = host.run( + "cat /proc/sys/net/ipv4/ipfrag_time", + job_level=ResultLevel.DEBUG, + ) + host.run( + "echo {} > /proc/sys/net/ipv4/ipfrag_high_thresh".format( + self.params.udp_fragmentation_threshold + ), + job_level=ResultLevel.NORMAL, + ) + host.run( + "echo {} > /proc/sys/net/ipv4/ipfrag_time".format( + self.params.udp_fragmentation_time + ), + job_level=ResultLevel.NORMAL, + ) + elif ip_version == AF_INET6: + orig_thresh_value = host.run( + "cat /proc/sys/net/ipv6/ip6frag_high_thresh", + job_level=ResultLevel.DEBUG, + ) + orig_time_value = host.run( + "cat /proc/sys/net/ipv6/ip6frag_time", + job_level=ResultLevel.DEBUG, + ) + host.run( + "echo {} > /proc/sys/net/ipv6/ip6frag_high_thresh".format( + self.params.udp_fragmentation_threshold + ), + job_level=ResultLevel.NORMAL, + ) + host.run( + "echo {} > /proc/sys/net/ipv6/ip6frag_time".format( + self.params.udp_fragmentation_time + ), + job_level=ResultLevel.NORMAL, + ) + + config["udp_fragmentation"][host] = { + "ip_version": ip_version, + "original_threshold": orig_thresh_value.stdout.strip(), + "original_time": orig_time_value.stdout.strip(), + "current_threshold": self.params.udp_fragmentation_threshold, + "current_time": self.params.udp_fragmentation_time, + } + + def remove_perf_test_tweak(self, perf_config): + tweak_config = perf_config.perf_test_tweak_config + if "udp_fragmentation" in tweak_config: + for host, host_cfg in tweak_config["udp_fragmentation"].items(): + self._deconfig_ip_fragmentation(host_cfg, host) + + del tweak_config["udp_fragmentation"] + + super().remove_perf_test_tweak(perf_config) + + def _deconfig_ip_fragmentation(self, config, host): + ip_version = config["ip_version"] + + if ip_version == AF_INET: + host.run( + "echo {} > /proc/sys/net/ipv4/ipfrag_high_thresh".format( + config["original_threshold"] + ), + job_level=ResultLevel.NORMAL, + ) + host.run( + "echo {} > /proc/sys/net/ipv4/ipfrag_time".format( + config["original_time"] + ), + job_level=ResultLevel.NORMAL, + ) + elif ip_version == AF_INET6: + host.run( + "echo {} > /proc/sys/net/ipv6/ip6frag_high_thresh".format( + config["original_threshold"] + ), + job_level=ResultLevel.NORMAL, + ) + host.run( + "echo {} > /proc/sys/net/ipv6/ip6frag_time".format( + config["original_time"] + ), + job_level=ResultLevel.NORMAL, + ) + else: + raise LnstError("Unknown ip version: {}".format(ip_version)) + + def generate_perf_test_tweak_description(self, perf_config): + description = super().generate_perf_test_tweak_description(perf_config) + tweak_config = perf_config.perf_test_tweak_config + if "udp_fragmentation" in tweak_config: + for host, host_cfg in tweak_config["udp_fragmentation"].items(): + description.append( + "Host {hid} configured ipfrag_high_thresh={value}, original={orig}".format( + hid=host.hostid, + value=host_cfg["current_threshold"], + orig=host_cfg["original_threshold"], + ) + ) + description.append( + "Host {hid} configured ipfrag_time={value}, original={orig}".format( + hid=host.hostid, + value=host_cfg["current_time"], + orig=host_cfg["original_time"], + ) + ) + else: + description.append( + "skipped configuration of fragmentation thresholds" + ) + + return description + + def _flow_ip_version(self, flow): + return ipaddress(flow.generator_bind).family diff --git a/lnst/Recipes/ENRT/PerfTestMixins/__init__.py b/lnst/Recipes/ENRT/PerfTestMixins/__init__.py index 93709ad..3f012da 100644 --- a/lnst/Recipes/ENRT/PerfTestMixins/__init__.py +++ b/lnst/Recipes/ENRT/PerfTestMixins/__init__.py @@ -1,3 +1,4 @@ from lnst.Recipes.ENRT.PerfTestMixins.SctpFirewallPerfTestMixin import SctpFirewallPerfTestMixin +from lnst.Recipes.ENRT.PerfTestMixins.UdpFragmentationPerfTestMixin import UdpFragmentationPerfTestMixin from lnst.Recipes.ENRT.PerfTestMixins.DropCachesPerfTestMixin import DropCachesPerfTestMixin from lnst.Recipes.ENRT.PerfTestMixins.CommonPerfTestTweakMixin import CommonPerfTestTweakMixin
Mon, Nov 16, 2020 at 01:25:27PM CET, olichtne@redhat.com wrote:
From: Ondrej Lichtner olichtne@redhat.com
Signed-off-by: Ondrej Lichtner olichtne@redhat.com
lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py | 2 ++ lnst/Recipes/ENRT/SimpleMacsecRecipe.py | 2 ++ 2 files changed, 4 insertions(+)
diff --git a/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py b/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py index 65e480b..8d7d0c9 100644 --- a/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py +++ b/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py @@ -142,8 +142,10 @@ def generate_flow_combinations(self, config): type = perf_test, generator = ns1, generator_bind = ip1,
generator_nic = config.endpoint1, receiver = ns2, receiver_bind = ip2,
receiver_nic = config.endpoint2, msg_size = size, duration = self.params.perf_duration, parallel_streams = self.params.perf_parallel_streams,
diff --git a/lnst/Recipes/ENRT/SimpleMacsecRecipe.py b/lnst/Recipes/ENRT/SimpleMacsecRecipe.py index fded0e6..069263d 100644 --- a/lnst/Recipes/ENRT/SimpleMacsecRecipe.py +++ b/lnst/Recipes/ENRT/SimpleMacsecRecipe.py @@ -223,8 +223,10 @@ def generate_flow_combinations(self, config): type = perf_test, generator = client_netns, generator_bind = client_bind,
generator_nic = client_nic, receiver = server_netns, receiver_bind = server_bind,
receiver_nic = server_nic, msg_size = size, duration = self.params.perf_duration, parallel_streams = pstreams,
-- 2.29.2 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
Ack to series.
Acked-by: Jan Tluka jtluka@redhat.com
On Mon, Nov 16, 2020 at 01:55:36PM +0100, Jan Tluka wrote:
Mon, Nov 16, 2020 at 01:25:27PM CET, olichtne@redhat.com wrote:
From: Ondrej Lichtner olichtne@redhat.com
Signed-off-by: Ondrej Lichtner olichtne@redhat.com
lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py | 2 ++ lnst/Recipes/ENRT/SimpleMacsecRecipe.py | 2 ++ 2 files changed, 4 insertions(+)
diff --git a/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py b/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py index 65e480b..8d7d0c9 100644 --- a/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py +++ b/lnst/Recipes/ENRT/IpsecEspAhCompRecipe.py @@ -142,8 +142,10 @@ def generate_flow_combinations(self, config): type = perf_test, generator = ns1, generator_bind = ip1,
generator_nic = config.endpoint1, receiver = ns2, receiver_bind = ip2,
receiver_nic = config.endpoint2, msg_size = size, duration = self.params.perf_duration, parallel_streams = self.params.perf_parallel_streams,
diff --git a/lnst/Recipes/ENRT/SimpleMacsecRecipe.py b/lnst/Recipes/ENRT/SimpleMacsecRecipe.py index fded0e6..069263d 100644 --- a/lnst/Recipes/ENRT/SimpleMacsecRecipe.py +++ b/lnst/Recipes/ENRT/SimpleMacsecRecipe.py @@ -223,8 +223,10 @@ def generate_flow_combinations(self, config): type = perf_test, generator = client_netns, generator_bind = client_bind,
generator_nic = client_nic, receiver = server_netns, receiver_bind = server_bind,
receiver_nic = server_nic, msg_size = size, duration = self.params.perf_duration, parallel_streams = pstreams,
-- 2.29.2 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedorahos...
Ack to series.
Acked-by: Jan Tluka jtluka@redhat.com
pushed, thanks for review.
-Ondrej
lnst-developers@lists.fedorahosted.org