[lnst] TaskAPI: Delayed evaluation of config values
by Jiří Pírko
commit 54daacddd09db05ad4b2e7a76cfed038ec75575f
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Fri Sep 6 12:40:50 2013 +0200
TaskAPI: Delayed evaluation of config values
This commit adds three new classes (IpAddr, Hwaddr, and Devname) to the
Task API that represent these values in the task. This is necessary so
we can take the full advantage of the asynchronous updates that are
distributed from the slaves to the controller during recipe execution.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/Task.py | 42 ++++++++++++++++++++++++++++++++++--------
1 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index d026e7d..7a8ff63 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -135,7 +135,7 @@ class MachineAPI(object):
self._bg_id_seq += 1
cmd["bg_id"] = bg_id = self._bg_id_seq
elif arg == "expect":
- if argval not in ["pass", "fail"]:
+ if str(argval) not in ["pass", "fail"]:
msg = "Unrecognised value of the expect attribute (%s)." \
% argval
raise TaskError(msg)
@@ -149,7 +149,7 @@ class MachineAPI(object):
raise TaskError(msg)
elif arg == "tool":
if type(what) == str:
- cmd["from"] = argval
+ cmd["from"] = str(argval)
else:
msg = "Argument 'tool' not valid when running modules."
raise TaskError(msg)
@@ -163,7 +163,7 @@ class MachineAPI(object):
cmd["options"] = what._opts
elif type(what) == str:
cmd["type"] = "exec"
- cmd["command"] = what
+ cmd["command"] = str(what)
else:
raise TaskError("Unable to run '%s'." % str(what))
@@ -181,7 +181,7 @@ class MachineAPI(object):
:rtype: str
"""
iface = self._m.get_interface(interface_id)
- return iface.get_devname()
+ return Devname(iface)
def get_hwaddr(self, interface_id):
"""
@@ -194,7 +194,7 @@ class MachineAPI(object):
:rtype: str
"""
iface = self._m.get_interface(interface_id)
- return iface.get_hwaddr()
+ return Hwaddr(iface)
def get_ip(self, interface_id, addr_number=0):
"""
@@ -210,7 +210,7 @@ class MachineAPI(object):
:rtype: str
"""
iface = self._m.get_interface(interface_id)
- return iface.get_address(addr_number)
+ return IpAddr(iface, addr_number)
class ModuleAPI(object):
""" An API class representing a module. """
@@ -223,9 +223,9 @@ class ModuleAPI(object):
self._opts[opt] = []
if type(val) == list:
for v in val:
- self._opts[opt].append({"value": v})
+ self._opts[opt].append({"value": str(v)})
else:
- self._opts[opt].append({"value": val})
+ self._opts[opt].append({"value": str(val)})
class ProcessAPI(object):
""" An API class representing either a running or finished process. """
@@ -283,3 +283,29 @@ class ProcessAPI(object):
"type": "kill",
"proc_id": self._bg_id}
self._res = self._ctl._run_command(cmd)
+
+class ValueAPI(object):
+ def __init__(self, iface):
+ self._iface = iface
+
+ def _resolve(self):
+ pass
+
+ def __str__(self):
+ return str(self._resolve())
+
+class IpAddr(ValueAPI):
+ def __init__(self, iface, addr=0):
+ self._iface = iface
+ self._addr = addr
+
+ def _resolve(self):
+ return self._iface.get_address(self._addr)
+
+class Hwaddr(ValueAPI):
+ def _resolve(self):
+ return self._iface.get_hwaddr()
+
+class Devname(ValueAPI):
+ def _resolve(self):
+ return self._iface.get_devname()
10 years, 7 months
[lnst] NetTestController: Delayed Task Processing
by Jiří Pírko
commit 5391abd605a45823717a54023fb1632f717a2abd
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Fri Sep 6 12:40:49 2013 +0200
NetTestController: Delayed Task Processing
The way the controller task processing was implemented was blocking the
updates of configuration data, that are distributed from the slaves to
the controller.
This patch delays the processing of individual commands so we can take
the full advantage from the updates.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/NetTestController.py | 161 +++++++++++++++++++---------------
1 files changed, 90 insertions(+), 71 deletions(-)
---
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 8045aa7..30f5599 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -240,10 +240,9 @@ class NetTestController:
iface.configure()
def _prepare_tasks(self):
- recipe = self._recipe
+ self._tasks = []
for task_data in self._recipe["tasks"]:
task = {}
-
task["quit_on_fail"] = False
if "quit_on_fail" in task_data:
task["quit_on_fail"] = bool_it(task_data["quit_on_fail"])
@@ -256,10 +255,13 @@ class NetTestController:
if not os.path.isfile(path):
msg = "Task file '%s' not found." % path
raise RecipeError(msg, task_data)
+
+ self._tasks.append(task)
continue
- task["commands"] = []
- for cmd_data in task_data["commands"]:
+ task["commands"] = task_data["commands"]
+ task["skeleton"] = []
+ for cmd_data in task["commands"]:
cmd = {"type": cmd_data["type"]}
if "machine" in cmd_data:
@@ -268,79 +270,96 @@ class NetTestController:
msg = "Invalid machine id '%s'." % cmd["machine"]
raise RecipeError(msg, cmd_data)
- if "expect" in cmd_data:
- expect = cmd_data["expect"]
- if expect not in ["pass", "fail"]:
- msg = "Illegal expect attribute value."
- raise RecipeError(msg, cmd_data)
- cmd["expect"] = expect == "pass"
+ if cmd["type"] in ["test", "exec"]:
+ if "bg_id" in cmd_data:
+ cmd["bg_id"] = cmd_data["bg_id"]
+ elif cmd["type"] in ["wait", "intr", "kill"]:
+ cmd["proc_id"] = cmd_data["bg_id"]
- if cmd["type"] == "test":
- cmd["module"] = cmd_data["module"]
+ task["skeleton"].append(cmd)
- cmd_opts = {}
- if "options" in cmd_data:
- for opt in cmd_data["options"]:
- name = opt["name"]
- val = opt["value"]
+ if self._check_task(task):
+ raise RecipeError("Incorrect command sequence.", task_data)
- if name not in cmd_opts:
- cmd_opts[name] = []
+ self._tasks.append(task)
- cmd_opts[name].append({"value": val})
- cmd["options"] = cmd_opts
- elif cmd["type"] == "exec":
+ def _prepare_command(self, cmd_data):
+ cmd = {"type": cmd_data["type"]}
+ if "machine" in cmd_data:
+ cmd["machine"] = cmd_data["machine"]
+ if cmd["machine"] not in self._machines:
+ msg = "Invalid machine id '%s'." % cmd["machine"]
+ raise RecipeError(msg, cmd_data)
+
+ if "expect" in cmd_data:
+ expect = cmd_data["expect"]
+ if expect not in ["pass", "fail"]:
+ msg = "Illegal expect attribute value."
+ raise RecipeError(msg, cmd_data)
+ cmd["expect"] = expect == "pass"
+
+ if cmd["type"] == "test":
+ cmd["module"] = cmd_data["module"]
+
+ cmd_opts = {}
+ if "options" in cmd_data:
+ for opt in cmd_data["options"]:
+ name = opt["name"]
+ val = opt["value"]
+
+ if name not in cmd_opts:
+ cmd_opts[name] = []
+
+ cmd_opts[name].append({"value": val})
+ cmd["options"] = cmd_opts
+ elif cmd["type"] == "exec":
+ cmd["command"] = cmd_data["command"]
+
+ if "from" in cmd_data:
+ tool = cmd_data["from"]
+ if tool in self._resource_table["tools"]:
cmd["command"] = cmd_data["command"]
-
- if "from" in cmd_data:
- tool = cmd_data["from"]
- if tool in self._resource_table["tools"]:
- cmd["command"] = cmd_data["command"]
- else:
- msg = "Tool '%s' not found on the controller" % tool
- raise RecipeError(msg, cmd_data)
- elif cmd["type"] in ["wait", "intr", "kill"]:
- # XXX The internal name (proc_id) is different, because
- # bg_id is already used by LNST in a different context
- cmd["proc_id"] = cmd_data["bg_id"]
- elif cmd["type"] == "config":
- cmd["persistent"] = False
- if "persistent" in cmd_data:
- cmd["persistent"] = bool_it(cmd_data["persistent"])
-
- cmd["options"] = []
- for opt in cmd_data["options"]:
- name = opt["name"]
- value = opt["value"]
- cmd["options"].append({"name": name, "value": value})
- elif cmd["type"] == "ctl_wait":
- cmd["seconds"] = int(cmd_data["seconds"])
else:
- msg = "Unknown command type '%s'" % cmd["type"]
+ msg = "Tool '%s' not found on the controller" % tool
raise RecipeError(msg, cmd_data)
+ elif cmd["type"] in ["wait", "intr", "kill"]:
+ # XXX The internal name (proc_id) is different, because
+ # bg_id is already used by LNST in a different context
+ cmd["proc_id"] = cmd_data["bg_id"]
+ elif cmd["type"] == "config":
+ cmd["persistent"] = False
+ if "persistent" in cmd_data:
+ cmd["persistent"] = bool_it(cmd_data["persistent"])
+
+ cmd["options"] = []
+ for opt in cmd_data["options"]:
+ name = opt["name"]
+ value = opt["value"]
+ cmd["options"].append({"name": name, "value": value})
+ elif cmd["type"] == "ctl_wait":
+ cmd["seconds"] = int(cmd_data["seconds"])
+ else:
+ msg = "Unknown command type '%s'" % cmd["type"]
+ raise RecipeError(msg, cmd_data)
- if cmd["type"] in ["test", "exec"]:
- if "bg_id" in cmd_data:
- cmd["bg_id"] = cmd_data["bg_id"]
-
- if "timeout" in cmd_data:
- try:
- cmd["timeout"] = int(cmd_data["timeout"])
- except ValueError:
- msg = "Timeout value must be an integer."
- raise RecipeError(msg, cmd_data)
+ if cmd["type"] in ["test", "exec"]:
+ if "bg_id" in cmd_data:
+ cmd["bg_id"] = cmd_data["bg_id"]
- task["commands"].append(cmd)
+ if "timeout" in cmd_data:
+ try:
+ cmd["timeout"] = int(cmd_data["timeout"])
+ except ValueError:
+ msg = "Timeout value must be an integer."
+ raise RecipeError(msg, cmd_data)
- if self._check_task(task):
- raise RecipeError("Incorrect command sequence.", task_data)
- self._tasks.append(task)
+ return cmd
def _check_task(self, task):
err = False
bg_ids = {}
- for i, command in enumerate(task["commands"]):
+ for i, command in enumerate(task["skeleton"]):
if command["type"] == "ctl_wait":
continue
@@ -440,13 +459,9 @@ class NetTestController:
overall_res = {"passed": True}
for task in self._tasks:
+ self._res_serializer.add_task()
try:
- self._res_serializer.add_task()
- if "python" in task:
- res = self._run_python_task(task)
- else:
- res = self._run_task(task)
-
+ res = self._run_task(task)
except CommandException as exc:
logging.debug(exc)
overall_res["passed"] = False
@@ -474,9 +489,13 @@ class NetTestController:
return module.ctl._result
def _run_task(self, task):
+ if "python" in task:
+ return self._run_python_task(task)
+
seq_passed = True
- for command in task["commands"]:
- cmd_res = self._run_command(command)
+ for cmd_data in task["commands"]:
+ cmd = self._prepare_command(cmd_data)
+ cmd_res = self._run_command(cmd)
if not cmd_res["passed"]:
seq_passed = False
@@ -506,7 +525,7 @@ class NetTestController:
cmd_res = machine.run_command(command)
except Exception as exc:
cmd_res = {"passed": False, "err_msg": "Exception raised."}
- raise exc
+ raise
finally:
if self._res_serializer:
self._res_serializer.add_cmd_result(command, cmd_res)
10 years, 7 months
[PATCH] Fix template indexing bug
by Jan Tluka
I found a bug causing template functions to strip one character
immediately following the template function string, e.g.
"{ip(load-balancer,pub1)}:80"
will result in stripping the colon:
192.168.210.580
instead of
192.168.210.5:80
This patch fixes that.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Common/XmlTemplates.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Common/XmlTemplates.py b/lnst/Common/XmlTemplates.py
index daa1254..57acf00 100644
--- a/lnst/Common/XmlTemplates.py
+++ b/lnst/Common/XmlTemplates.py
@@ -320,7 +320,7 @@ class XmlTemplates:
func_match = re.search(self._func_re, string)
if func_match:
prefix = string[0:func_match.start(0)]
- suffix = string[func_match.end(0)+1:]
+ suffix = string[func_match.end(0):]
template = func_match.group(0)
func = self._process_func_template(template)
--
1.8.1.4
10 years, 7 months
[lnst] Fix template indexing bug
by Jiří Pírko
commit 9a05e53a396761f4a0505b1ac2c7408f5af5bba5
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Fri Sep 6 11:24:21 2013 +0200
Fix template indexing bug
I found a bug causing template functions to strip one character
immediately following the template function string, e.g.
"{ip(load-balancer,pub1)}:80"
will result in stripping the colon:
192.168.210.580
instead of
192.168.210.5:80
This patch fixes that.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/XmlTemplates.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/lnst/Common/XmlTemplates.py b/lnst/Common/XmlTemplates.py
index daa1254..57acf00 100644
--- a/lnst/Common/XmlTemplates.py
+++ b/lnst/Common/XmlTemplates.py
@@ -320,7 +320,7 @@ class XmlTemplates:
func_match = re.search(self._func_re, string)
if func_match:
prefix = string[0:func_match.start(0)]
- suffix = string[func_match.end(0)+1:]
+ suffix = string[func_match.end(0):]
template = func_match.group(0)
func = self._process_func_template(template)
10 years, 7 months
[PATCH] smoke lib: remove timeout from intr command
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
intr commands don't support timeout attribute anymore.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/smoke/lib/task-bg.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/recipes/smoke/lib/task-bg.xml b/recipes/smoke/lib/task-bg.xml
index 27536d8..3f08743 100644
--- a/recipes/smoke/lib/task-bg.xml
+++ b/recipes/smoke/lib/task-bg.xml
@@ -8,5 +8,5 @@
</options>
</run>
<ctl_wait seconds="5"/>
- <intr bg_id="1" machine="1" timeout="30"/>
+ <intr bg_id="1" machine="1"/>
</task>
--
1.8.3.1
10 years, 7 months
[lnst] smoke lib: remove timeout from intr command
by Jiří Pírko
commit 1fe05046eca25503c0d584c04db2d08c248f367e
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Sep 4 13:40:10 2013 +0200
smoke lib: remove timeout from intr command
intr commands don't support timeout attribute anymore.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
recipes/smoke/lib/task-bg.xml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/recipes/smoke/lib/task-bg.xml b/recipes/smoke/lib/task-bg.xml
index 27536d8..3f08743 100644
--- a/recipes/smoke/lib/task-bg.xml
+++ b/recipes/smoke/lib/task-bg.xml
@@ -8,5 +8,5 @@
</options>
</run>
<ctl_wait seconds="5"/>
- <intr bg_id="1" machine="1" timeout="30"/>
+ <intr bg_id="1" machine="1"/>
</task>
10 years, 7 months
[PATCH] TestIcmp6Ping: fix regex
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
The reges for the Icmp6Ping test was broken up into two lines and
contained an error causing it to never properly match. This commit fixes
that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
test_modules/TestIcmp6Ping.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/test_modules/TestIcmp6Ping.py b/test_modules/TestIcmp6Ping.py
index 3d66130..83550c5 100644
--- a/test_modules/TestIcmp6Ping.py
+++ b/test_modules/TestIcmp6Ping.py
@@ -38,8 +38,7 @@ class TestIcmp6Ping(TestGeneric):
data_stdout = exec_cmd(cmd, die_on_err=False)[0]
stat_pttr1 = r'(\d+) packets transmitted, (\d+) received'
- stat_pttr2 = r' rtt min/avg/max/mdev = \
- (\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+) ms'
+ stat_pttr2 = r'rtt min/avg/max/mdev = (\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+) ms'
match = re.search(stat_pttr1, data_stdout)
if not match:
--
1.8.3.1
10 years, 7 months
[lnst] TestIcmp6Ping: fix regex
by Jiří Pírko
commit 370663947a0c88785ffa108e29ca4ecc271c3738
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Sep 4 13:39:57 2013 +0200
TestIcmp6Ping: fix regex
The reges for the Icmp6Ping test was broken up into two lines and
contained an error causing it to never properly match. This commit fixes
that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
test_modules/TestIcmp6Ping.py | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/test_modules/TestIcmp6Ping.py b/test_modules/TestIcmp6Ping.py
index 3d66130..83550c5 100644
--- a/test_modules/TestIcmp6Ping.py
+++ b/test_modules/TestIcmp6Ping.py
@@ -38,8 +38,7 @@ class TestIcmp6Ping(TestGeneric):
data_stdout = exec_cmd(cmd, die_on_err=False)[0]
stat_pttr1 = r'(\d+) packets transmitted, (\d+) received'
- stat_pttr2 = r' rtt min/avg/max/mdev = \
- (\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+) ms'
+ stat_pttr2 = r'rtt min/avg/max/mdev = (\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+) ms'
match = re.search(stat_pttr1, data_stdout)
if not match:
10 years, 7 months
[lnst] NetTestCommand: add method check_res_data
by Jiří Pírko
commit 4af0c307668e2e150a5af3232c4338210e553a89
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Sep 4 13:36:08 2013 +0200
NetTestCommand: add method check_res_data
This method checks validity of result data that will eventually be
serialized into an xml. We have agreed that we will only accept result
data in form of nested dictionaries, lists and stringable objects.
The function checks the structure of the data and uses regexes to check
if valid element names and character data can be created.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/NetTestCommand.py | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py
index 9131597..d6f6f0f 100644
--- a/lnst/Common/NetTestCommand.py
+++ b/lnst/Common/NetTestCommand.py
@@ -17,6 +17,7 @@ import signal
import imp
import pickle, traceback
import multiprocessing
+import re
from lnst.Common.ExecCmd import exec_cmd, ExecCmdFail
from lnst.Common.ConnectionHandler import recv_data, send_data
@@ -297,6 +298,7 @@ class NetTestCommandGeneric:
return result
def format_res_data(self, res_data, level=0):
+ self._check_res_data(res_data)
formatted_data = ""
if res_data:
max_key_len = 0
@@ -314,6 +316,35 @@ class NetTestCommandGeneric:
return formatted_data
+ def _check_res_data(self, res_data):
+ name_start_char = u":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF"\
+ u"\u0370-\u037D\u037F-\u1FFF\u200C-\u200D"\
+ u"\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF"\
+ u"\uF900-\uFDCF\uFDF0-\uFFFD\U00010000-\U000EFFFF"
+ name_char = name_start_char + u"\-\.0-9\xB7\u0300-\u036F\u203F-\u2040"
+ name = u"[%s]([%s])*$" % (name_start_char, name_char)
+ char_data = u"[^<&]*"
+ if isinstance(res_data, dict):
+ for key in res_data:
+ if not re.match(name, key, re.UNICODE):
+ msg = "'%s' can't be used as an xml element name!" % key
+ raise CommandException(msg)
+ else:
+ self._check_res_data(res_data[key])
+ elif isinstance(res_data, list):
+ for i in res_data:
+ self._check_res_data(i)
+ else:
+ try:
+ string = str(res_data)
+ except:
+ msg = "res_data can only contain dictionaries, lists or "\
+ "stringable objects!"
+ raise CommandException(msg)
+ if not re.match(char_data, string, re.UNICODE):
+ msg = "'%s' can't be used as character data in xml!" % string
+ raise CommandException(msg)
+
def _format_cmd_res_header(self):
return "%-14s" % self._command["type"]
10 years, 7 months
[lnst] test_modules: update result reporting
by Jiří Pírko
commit 90a83c25400073d2d3d0eca0e9d10aa55da58d1a
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Sep 4 13:36:07 2013 +0200
test_modules: update result reporting
This commit updates the test modules to correctly use the set_pass and
set_fail functions and supply relevant res_data. Any messages that used
to be reported using the old interface are now a part of the res_data
object.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
test_modules/TestDummyFailing.py | 3 ++-
test_modules/TestIcmp6Ping.py | 14 +++++++++++---
test_modules/TestIcmpPing.py | 14 +++++++++++---
test_modules/TestIperf.py | 5 +++--
test_modules/TestMulticast.py | 3 ++-
test_modules/TestNetCat.py | 6 ++++--
test_modules/TestPacketAssert.py | 3 ++-
test_modules/TestPktgenTx.py | 3 ++-
8 files changed, 37 insertions(+), 14 deletions(-)
---
diff --git a/test_modules/TestDummyFailing.py b/test_modules/TestDummyFailing.py
index c48c90d..4ea342d 100644
--- a/test_modules/TestDummyFailing.py
+++ b/test_modules/TestDummyFailing.py
@@ -15,4 +15,5 @@ from lnst.Common.TestsCommon import TestGeneric
class TestDummyFailing(TestGeneric):
def run(self):
- return self.set_fail("what else did you expect?")
+ res_data = {"msg": "what else did you expect?"}
+ return self.set_fail(res_data)
diff --git a/test_modules/TestIcmp6Ping.py b/test_modules/TestIcmp6Ping.py
index 7bc4e40..3d66130 100644
--- a/test_modules/TestIcmp6Ping.py
+++ b/test_modules/TestIcmp6Ping.py
@@ -43,7 +43,8 @@ class TestIcmp6Ping(TestGeneric):
match = re.search(stat_pttr1, data_stdout)
if not match:
- return self.set_fail("expected pattern not found")
+ res_data = {"msg": "expected pattern not found"}
+ return self.set_fail(res_data)
trans_pkts, recv_pkts = match.groups()
rate = int(round((float(recv_pkts) / float(trans_pkts)) * 100))
@@ -51,13 +52,20 @@ class TestIcmp6Ping(TestGeneric):
"rate \"%d%%\", limit_rate \"%d%%\"" \
% (trans_pkts, recv_pkts, rate, limit_rate ))
+ res_data = {"rate": rate,
+ "limit_rate": limit_rate}
+
match = re.search(stat_pttr2, data_stdout)
if match:
tmin, tavg, tmax, tmdev = [float(x) for x in match.groups()]
logging .debug("rtt min \"%.3f\", avg \"%.3f\", max \"%.3f\", "
"mdev \"%.3f\"" % (tmin, tavg, tmax, tmdev))
+ res_data["rtt_min"] = tmin
+ res_data["rtt_max"] = tmax
+
if rate < limit_rate :
- return self.set_fail("rate is lower that limit")
+ res_data["msg"] = "rate is lower that limit"
+ return self.set_fail(res_data)
- return self.set_pass()
+ return self.set_pass(res_data)
diff --git a/test_modules/TestIcmpPing.py b/test_modules/TestIcmpPing.py
index e2c239a..6920056 100644
--- a/test_modules/TestIcmpPing.py
+++ b/test_modules/TestIcmpPing.py
@@ -40,7 +40,8 @@ class TestIcmpPing(TestGeneric):
match = re.search(stat_pttr1, data_stdout)
if not match:
- return self.set_fail("expected pattern not found")
+ res_data = {"msg": "expected pattern not found"}
+ return self.set_fail(res_data)
trans_pkts, recv_pkts = match.groups()
rate = int(round((float(recv_pkts) / float(trans_pkts)) * 100))
@@ -48,13 +49,20 @@ class TestIcmpPing(TestGeneric):
"rate \"%d%%\", limit_rate \"%d%%\""
% (trans_pkts, recv_pkts, rate, limit_rate))
+ res_data = {"rate": rate,
+ "limit_rate": limit_rate}
+
match = re.search(stat_pttr2, data_stdout)
if match:
tmin, tavg, tmax, tmdev = [float(x) for x in match.groups()]
logging.debug("rtt min \"%.3f\", avg \"%.3f\", max \"%.3f\", "
"mdev \"%.3f\"" % (tmin, tavg, tmax, tmdev))
+ res_data["rtt_min"] = tmin
+ res_data["rtt_max"] = tmax
+
if rate < limit_rate:
- return self.set_fail("rate is lower that limit", res_data={"rate": rate})
+ res_data["msg"] = "rate is lower that limit"
+ return self.set_fail(res_data)
- return self.set_pass(res_data={"rate": rate})
+ return self.set_pass(res_data)
diff --git a/test_modules/TestIperf.py b/test_modules/TestIperf.py
index 462c48c..5aacea1 100644
--- a/test_modules/TestIperf.py
+++ b/test_modules/TestIperf.py
@@ -147,7 +147,8 @@ class TestIperf(TestGeneric):
elif role == "client":
logging.debug("running as client ...")
(rv, message) = self.run_client(cmd)
+ res_data = {"msg": mesage}
if rv == False:
- return self.set_fail(message)
+ return self.set_fail(res_data)
- return self.set_pass(message)
+ return self.set_pass(res_data)
diff --git a/test_modules/TestMulticast.py b/test_modules/TestMulticast.py
index 25422f6..cb5a60e 100644
--- a/test_modules/TestMulticast.py
+++ b/test_modules/TestMulticast.py
@@ -126,6 +126,7 @@ class TestMulticast(TestGeneric):
res[name] = value
logging.info("Test result: {0} = {1}".format(name, value))
if not self._evaluate_result(name, value):
- return self.set_fail("Conditions not met!", res)
+ res["msg"] = "Conditions not met!"
+ return self.set_fail(res)
return self.set_pass(res)
diff --git a/test_modules/TestNetCat.py b/test_modules/TestNetCat.py
index cf5199e..89c7e4b 100644
--- a/test_modules/TestNetCat.py
+++ b/test_modules/TestNetCat.py
@@ -52,9 +52,11 @@ class TestNetCat(TestGeneric):
try:
td.read_until_output_matches("10 packets captured", timeout=5)
except ShellProcess.ProcessTerminatedError:
- return self.set_fail("tcpdump process died unexpectedly!")
+ res_data = {"msg": "tcpdump process died unexpectedly!"}
+ return self.set_fail(res_data)
except ShellProcess.ProcessTimeoutError:
- return self.set_fail("No stream detected!")
+ res_data = {"msg": "No stream detected!"}
+ return self.set_fail(res_data)
td.kill()
diff --git a/test_modules/TestPacketAssert.py b/test_modules/TestPacketAssert.py
index 0466c20..d8a73e3 100644
--- a/test_modules/TestPacketAssert.py
+++ b/test_modules/TestPacketAssert.py
@@ -165,4 +165,5 @@ class TestPacketAssert(TestGeneric):
if self._evaluate_results():
return self.set_pass(res)
- return self.set_fail("PacketAssert failed!", res)
+ res["msg"] = "PacketAssert failed!"
+ return self.set_fail(res)
diff --git a/test_modules/TestPktgenTx.py b/test_modules/TestPktgenTx.py
index c1ca86a..684640f 100644
--- a/test_modules/TestPktgenTx.py
+++ b/test_modules/TestPktgenTx.py
@@ -87,6 +87,7 @@ class TestPktgenTx(TestGeneric):
pg.set(pktgen_option)
pgctl.set("start")
except ExecCmdFail:
- return self.set_fail("pktgen failed")
+ res_data = {"msg": "pktgen failed"}
+ return self.set_fail(res_data)
return self.set_pass()
10 years, 7 months