Mon, May 21, 2018 at 10:42:57AM CEST, olichtne(a)redhat.com wrote:
From: Ondrej Lichtner <olichtne(a)redhat.com>
Adding the BaseEnrtRecipe module that defines a class with the same
name. The class inherits from both the PingTestAndEvaluate and
PerfTestAndEvaluate classes to implement a shared scheme for our ENRT
recipes. It is expected that this will go through more refactoring as we
port more recipes but the idea is that we will avoid code duplication at
all costs.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Recipes/ENRT/BaseEnrtRecipe.py | 212 ++++++++++++++++++++++++++++
1 file changed, 212 insertions(+)
create mode 100644 lnst/Recipes/ENRT/BaseEnrtRecipe.py
diff --git a/lnst/Recipes/ENRT/BaseEnrtRecipe.py b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
new file mode 100644
index 0000000..64c8677
--- /dev/null
+++ b/lnst/Recipes/ENRT/BaseEnrtRecipe.py
@@ -0,0 +1,212 @@
+class BaseEnrtRecipe(PingTestAndEvaluate, PerfTestAndEvaluate):
+ ip_versions = Param(default=("ipv4", "ipv6"))
+ perf_tests = Param(default=("tcp_stream", "udp_stream",
"sctp_stream"))
+
+ offload_combinations = Param(default=(
+ dict(gro="on", gso="on", tso="on",
tx="on", rx="on")))
+
+ adaptive_coalescing = BoolParam(default=True)
+
+ mtu = IntParam(mandatory=False)
+
+ dev_intr_cpu = IntParam(default=0)
+
+ perf_duration = IntParam(default=60)
+ perf_iterations = IntParam(default=5)
+ perf_streams = IntParam(default=1)
+ perf_msg_size = IntParam(default=123)
+
+ perf_usr_comment = StrParam(default="")
+
+ perf_max_deviation = IntParam(default=10) #TODO required?
+
+ perf_tool = Param(default=IperfMeasurementTool)
+
+ def test(self):
+ main_config = self.test_wide_configuration()
The self.test_wide_configuration() and self.test_wide_deconfiguration()
should be abstract methods here. I see them defined in the next patch
only where you inherit from this base class.
>+
>+ for sub_config in self.generate_sub_configurations(main_config):
>+ self.apply_sub_configuration(main_config, sub_config)
>+
>+ for ping_config in self.generate_ping_configurations(main_config,
>+ sub_config):
>+ result = self.ping_test(ping_config)
>+ self.ping_evaluate_and_report(ping_config, result)
>+
>+ for perf_config in self.generate_perf_configurations(main_config,
>+ sub_config):
>+ result = self.perf_test(perf_config)
>+ self.perf_evaluate_and_report(perf_config, result, baseline=None)
>+
>+ self.remove_sub_configuration(main_config, sub_config)
>+
>+ self.test_wide_deconfiguration(main_config)
>+