commit 03609adb5bb8e7ad8d0d65fcab47f3d078344afe
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Wed Sep 14 20:39:13 2011 +0200
Introducing 'desc' command attribute.
This attribute can be used to pass a brief description of what command will do.
For example:
<command type="test" value="Icmp6Ping" desc="ping6 to
loopback address">
If a command has 'desc' attribute defined it's value will be written to
info log.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
NetTest/NetTestCommand.py | 2 ++
NetTest/NetTestController.py | 6 ++++++
NetTest/NetTestParse.py | 3 +++
3 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/NetTest/NetTestCommand.py b/NetTest/NetTestCommand.py
index 32c247f..aefd173 100644
--- a/NetTest/NetTestCommand.py
+++ b/NetTest/NetTestCommand.py
@@ -25,6 +25,8 @@ def str_command(command):
out += ", timeout (%d)" % command["timeout"]
if "bg_id" in command:
out += ", bg_id (%d)" % command["bg_id"]
+ if "desc" in command:
+ out += ", desc (%s)" % command["desc"]
return out
class CommandException(Exception):
diff --git a/NetTest/NetTestController.py b/NetTest/NetTestController.py
index b0480e4..f2efbaa 100644
--- a/NetTest/NetTestController.py
+++ b/NetTest/NetTestController.py
@@ -139,6 +139,12 @@ class NetTestController:
cmd_type = command["type"]
machine_id = command["machine_id"]
+ try:
+ desc = command["desc"]
+ logging.info("Cmd description: %s" % desc)
+ except KeyError:
+ pass
+
if machine_id == 0:
cmd_res = NetTestCommand(command).run()
else:
diff --git a/NetTest/NetTestParse.py b/NetTest/NetTestParse.py
index c042292..c4b553b 100644
--- a/NetTest/NetTestParse.py
+++ b/NetTest/NetTestParse.py
@@ -138,6 +138,9 @@ class NetTestParse:
tmp = dom_command.getAttribute("bg_id")
if tmp:
command["bg_id"] = int(tmp)
+ tmp = dom_command.getAttribute("desc")
+ if tmp:
+ command["desc"] = str(tmp)
logging.debug("Parsed command: [%s]" % str_command(command))
dom_options_grp = dom_command.getElementsByTagName("options")
Show replies by thread