[DISCUSSION] python version requirement
by Ondrej Lichtner
Hi all,
since we've moved to python3 that is actively developed and versions
move between various long term/short term support cycles, we should also
adapt LNST to this cycle of updating which minimal version of python
LNST requires.
TL;DR: The main questions I'm asking are:
* how do we _implement_ a python version requirement?
* how do we _upgrade_/_migrate_ in the future?
* how do we _document_ a python version requirement?
* which version do we want to use _now_?
More context:
I think at the moment we have a "soft" requirement for python3.6. Soft
because we:
* probably haven't tested on anything older
* it's not explicitly configured/documented anywhere
At the same time, there are now at least two reasons to start thinking
about moving to python3.8:
* I remember Perry asking about the f-string feature introduced in 3.8
* while working with Adrian on the TRex refactoring I started thinking
about a feature for the lnst.Tests package that I've had in mind for a
while, which requires a 3.7 feature
* python3.8 is the current version on Fedora32, is available in RHEL8
(via dnf install python38), and python3.7 was skipped
The lnst.Tests feature I'm thinking of is "lazy" and "dynamic" loading
of BaseTestModule derived modules - for example at the moment, if a
Recipe imports any module from lnst.Tests (e.g. lnst.Tests.Ping), the
entire package is parsed and "loaded", which means that the python
environment will also parse and load lnst.Tests.TRex. This means that a
basic hello world recipe that simply calls Ping, will in some way
require load time dependencies of TRex.
The "lazy" and "dynamic" loading of test modules would ensure that when
a recipe calls:
from lnst.Tests import Ping
Only the Ping module will be parsed, loaded and imported, and nothing
else. And the dynamicity here could mean that we could be able to extend
test modules exported by the lnst.Tests package via the lnst-ctl config
file, for example for user/tester implemented test modules that are not
tracked in the main lnst repository.
I wrote a rough patch to experiment with this:
---
diff --git a/lnst/Tests/__init__.py b/lnst/Tests/__init__.py
index f7c6c90..a39b6f4 100644
--- a/lnst/Tests/__init__.py
+++ b/lnst/Tests/__init__.py
@@ -12,8 +12,26 @@
olichtne(a)redhat.com (Ondrej Lichtner)
"""
-from lnst.Tests.Ping import Ping
-from lnst.Tests.PacketAssert import PacketAssert
-from lnst.Tests.Iperf import IperfClient, IperfServer
+# from lnst.Tests.Ping import Ping
+# from lnst.Tests.PacketAssert import PacketAssert
+# from lnst.Tests.Iperf import IperfClient, IperfServer
+import importlib
+
+lazy_load_modules = {
+ "Ping": "lnst.Tests.Ping",
+ "PacketAssert": "lnst.Tests.PacketAssert",
+ "IperfClient": "lnst.Tests.Iperf",
+ "IperfServer": "lnst.Tests.Iperf",
+}
+
+
+def __getattr__(name):
+ if name not in lazy_load_modules:
+ raise ImportError("Cannot import {}".format(name))
+ mod = importlib.import_module(lazy_load_modules[name])
+ globals()[name] = getattr(mod, name)
+ return globals()[name]
+
+
+# #TODO add support for test classes from lnst-ctl.conf
-#TODO add support for test classes from lnst-ctl.conf
---
However this requires the ability to define __getattr__ for a module,
which is introduced as a python3.7 feature via PEP562 [0].
-Ondrej
[0] https://www.python.org/dev/peps/pep-0562/
2 years, 1 month
[PATCH] Revert "add sleep between start of iperf server and client"
by Jan Tluka
This reverts commit a961862ff4734b609d7b6325bc2555829833f906.
Some issues popped up when this patch was used.
First issue was with the CPUStatMeasurement that is used in ENRT recipes.
The 2 seconds delay caused the measurement to include samples when the CPUs
were idle and reported 1-2% lower utilization.
Second issue was a result of iperf bug [1], when the iperf measures CPU
utilization from the moment the iperf server program is started, again
this includes 2 seconds of idling.
Until both issues are dealt with, the simplest solution is to revert the
patch.
[1] https://github.com/esnet/iperf/issues/1076
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py b/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
index c0ead127..c1939875 100644
--- a/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
+++ b/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
@@ -57,7 +57,6 @@ class IperfFlowMeasurement(BaseFlowMeasurement):
for flow in test_flows:
flow.server_job.start(bg=True)
- time.sleep(2)
for flow in test_flows:
flow.client_job.start(bg=True)
--
2.26.2
2 years, 6 months
[PATCH v2 1/3] Recipes.ENRT: add missing PerfFlow attributes
by olichtne@redhat.com
From: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Ondrej Lichtner <olichtne(a)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
2 years, 6 months
[PATCH 1/3] Recipes.ENRT: add missing PerfFlow attributes
by olichtne@redhat.com
From: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Ondrej Lichtner <olichtne(a)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
2 years, 6 months
[PATCH v3 0/6] add per-iteration perf_test tweaks
by Jan Tluka
This patchset modifies the current implementation of the performance test
tweaks.
Before the patch set the user was unable to add performance test tweaks
on per iteration basis. It was only possible to add/remove tweaks
before/after the whole set of the performance test measurement iterations.
The patchset adds BasePerfTestIterationTweakMixin to RecipeCommon.Perf.Recipe
that provides a common API for that. The actual tasks to be performed
before/after each iteration needs to be defined by a specific mixin
class.
In the same manner the already existing BasePerfTestTweakMixin has been
moved to RecipeCommon.Perf.Recipe to have both APIs at the same place.
Jan Tluka (6):
RecipeCommon.Perf.PerfTestMixins: add BasePerfTestIterationTweakMixin
RecipeCommon.Perf.Recipe: add per-iteration tweaks using
BasePerfTestIterationTweakMixin
lnst.Recipes.ENRT.PerfTestMixins: move BasePerfTestTweakMixin to
RecipeCommon
RecipeCommon.Perf.PerfTestMixins.BasePerfTestTweakMixin: move
get_flow_measurement_from_config to standalone function
lnst.Recipes.ENRT.PerfTestMixins: add DropCachesPerfTestMixin
Recipes.ENRT.PerfTestMixins: extend CommonPerfTestTweakMixin with
DropCachesMixin
.../BasePerfTestIterationTweakMixin.py | 18 +++++++++
.../PerfTestMixins/BasePerfTestTweakMixin.py | 6 ---
.../Perf/PerfTestMixins/__init__.py | 2 +
lnst/RecipeCommon/Perf/Recipe.py | 30 ++++++++++++--
lnst/Recipes/ENRT/BaseEnrtRecipe.py | 9 +----
.../CommonPerfTestTweakMixin.py | 3 +-
.../PerfTestMixins/DropCachesPerfTestMixin.py | 39 +++++++++++++++++++
.../SctpFirewallPerfTestMixin.py | 11 +++---
lnst/Recipes/ENRT/PerfTestMixins/Utils.py | 5 +++
lnst/Recipes/ENRT/PerfTestMixins/__init__.py | 2 +-
10 files changed, 102 insertions(+), 23 deletions(-)
create mode 100644 lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestIterationTweakMixin.py
rename lnst/{Recipes/ENRT => RecipeCommon/Perf}/PerfTestMixins/BasePerfTestTweakMixin.py (63%)
create mode 100644 lnst/RecipeCommon/Perf/PerfTestMixins/__init__.py
create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py
create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/Utils.py
--
2.21.3
2 years, 6 months
[PATCH] add sleep between start of iperf server and client
by Jan Tluka
Add a short delay before starting iperf client connection to server.
This is to reduce probability of the iperf server not being able to start
quick enough to handle the client connection.
Fixes https://github.com/LNST-project/lnst/issues/200
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py b/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
index c1939875..c0ead127 100644
--- a/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
+++ b/lnst/RecipeCommon/Perf/Measurements/IperfFlowMeasurement.py
@@ -57,6 +57,7 @@ class IperfFlowMeasurement(BaseFlowMeasurement):
for flow in test_flows:
flow.server_job.start(bg=True)
+ time.sleep(2)
for flow in test_flows:
flow.client_job.start(bg=True)
--
2.21.3
2 years, 6 months
[PATCH v2 0/6] add per-iteration perf_test tweaks
by Jan Tluka
This patchset modifies the current implementation of the performance test
tweaks.
Before the patch set the user was unable to add performance test tweaks
on per iteration basis. It was only possible to add/remove tweaks
before/after the whole set of the performance test measurement iterations.
The patchset adds BasePerfTestIterationTweakMixin to RecipeCommon.Perf.Recipe
that provides a common API for that. The actual tasks to be performed
before/after each iteration needs to be defined by a specific mixin
class.
In the same manner the already existing BasePerfTestTweakMixin has been
moved to RecipeCommon.Perf.Recipe to have both APIs at the same place.
Jan Tluka (6):
RecipeCommon.Perf.PerfTestMixins: add BasePerfTestIterationTweakMixin
RecipeCommon.Perf.Recipe: add per-iteration tweaks using
BasePerfTestIterationTweakMixin
lnst.Recipes.ENRT.PerfTestMixins: move BasePerfTestTweakMixin to
RecipeCommon
RecipeCommon.Perf.PerfTestMixins.BasePerfTestTweakMixin: move
get_flow_measurement_from_config to standalone function
lnst.Recipes.ENRT.PerfTestMixins: add DropCachesPerfTestMixin
Recipes.ENRT.PerfTestMixins: extend CommonPerfTestTweakMixin with
DropCachesMixin
.../BasePerfTestIterationTweakMixin.py | 18 +++++++++
.../PerfTestMixins/BasePerfTestTweakMixin.py | 6 ---
lnst/RecipeCommon/Perf/Recipe.py | 30 ++++++++++++--
lnst/Recipes/ENRT/BaseEnrtRecipe.py | 9 +----
.../CommonPerfTestTweakMixin.py | 3 +-
.../PerfTestMixins/DropCachesPerfTestMixin.py | 39 +++++++++++++++++++
.../SctpFirewallPerfTestMixin.py | 11 +++---
lnst/Recipes/ENRT/PerfTestMixins/Utils.py | 5 +++
lnst/Recipes/ENRT/PerfTestMixins/__init__.py | 2 +-
9 files changed, 100 insertions(+), 23 deletions(-)
create mode 100644 lnst/RecipeCommon/Perf/PerfTestMixins/BasePerfTestIterationTweakMixin.py
rename lnst/{Recipes/ENRT => RecipeCommon/Perf}/PerfTestMixins/BasePerfTestTweakMixin.py (63%)
create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/DropCachesPerfTestMixin.py
create mode 100644 lnst/Recipes/ENRT/PerfTestMixins/Utils.py
--
2.21.3
2 years, 6 months