On Wed, Aug 22, 2018 at 01:38:05PM +0200, Jan Tluka wrote:
Tue, Aug 21, 2018 at 02:11:10PM CEST, csfakian(a)redhat.com wrote:
>From: Christos Sfakianakis <csfakian(a)redhat.com>
>
>Adding ported recipe PingFloodRecipe, implementing old
>regression_tests/phase1/ping_flood.xml. Its PingFloodRecipe
>class is an immediate subclass of BaseRecipe. It is almost
>identical to examples/python_recipe.py.
>
>Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
>---
> lnst/Recipes/ENRT/PingFloodRecipe.py | 33 ++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
> create mode 100644 lnst/Recipes/ENRT/PingFloodRecipe.py
>
>diff --git a/lnst/Recipes/ENRT/PingFloodRecipe.py
b/lnst/Recipes/ENRT/PingFloodRecipe.py
>new file mode 100644
>index 0000000..05be74d
>--- /dev/null
>+++ b/lnst/Recipes/ENRT/PingFloodRecipe.py
>@@ -0,0 +1,33 @@
>+#!/bin/python2
>+"""
>+Implements scenario similar to regression_tests/phase1/
>+(ping_flood.xml + simple_ping.py)
>+"""
>+
>+from lnst.Common.Parameters import Param
>+from lnst.Common.IpAddress import ipaddress
>+from lnst.Controller import HostReq, DeviceReq, BaseRecipe
>+from lnst.Tests import Ping
>+
>+class PingFloodRecipe(BaseRecipe):
>+ m1 = HostReq()
>+ m1.eth0 = DeviceReq(label="net1")
>+
>+ m2 = HostReq()
>+ m2.eth0 = DeviceReq(label="net1")
>+
>+ def test(self):
>+ #m1, m2 = self.matched.m1, self.matched.m2
^^^^ this should not be commented out, right?
>+
>+ self.matched.m1.eth0.ip_add(ipaddress("192.168.1.1/24"))
>+ self.matched.m2.eth0.ip_add(ipaddress("192.168.1.2/24"))
>+
>+ if "mtu" in self.params:
>+ self.matched.m1.eth0.mtu = self.params.mtu
>+ self.matched.m2.eth0.mtu = self.params.mtu
>+
>+ self.matched.m1.eth0.up()
>+ self.matched.m2.eth0.up()
>+
>+ ping_job = self.matched.m1.run(Ping(dst=self.matched.m2.eth0.ips[0],
interval=0,
>+ interface=self.matched.m1.eth0))
I think we want interval=0.2 as the original test. Also the original test
used count=100 and with the above we would do only count defined by default
value of 10.
Agreed, this recipe should also probably just inherit from the
PingTestAndEvaluate "common recipe template" that BaseEnrtRecipe
inherits from so that we can at least have consistent result reporting.
I want to view Test modules as just "execute and return data about what
was executed" and the PASS/FAIL should be an evaluation done outside of
the Test module - currently in the *TestAndEvaluate classes...
The PingConf class that the PingTestAndEvaluate class uses doesn't
define the count and interval properties yet, but that's also a part of
my own patch set so if this patch set gets applied on top of that then
we can work that in.
-Ondrej