[lnst] Introducing 'desc' command attribute.
by Jan Tluka
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")
--
1.7.4.4
12 years, 6 months
[lnst] Icmp6Ping test
by Jan Tluka
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
Tests/TestIcmp6Ping.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
create mode 100644 Tests/TestIcmp6Ping.py
diff --git a/Tests/TestIcmp6Ping.py b/Tests/TestIcmp6Ping.py
new file mode 100644
index 0000000..086d3fc
--- /dev/null
+++ b/Tests/TestIcmp6Ping.py
@@ -0,0 +1,63 @@
+__author__ = """
+jpirko(a)redhat.com (Jiri Pirko)
+jmalanik(a)redhat.com (Jan Malanik)
+jtluka(a)redhat.com (Jan Tluka)
+"""
+
+
+import logging
+import re
+from Common.TestsCommon import TestGeneric
+from Common.ExecCmd import exec_cmd
+
+
+class TestIcmp6Ping(TestGeneric):
+ def compose_cmd(self):
+ addr = self.get_mopt("addr", opt_type="addr")
+ cmd = "ping6 %s" % addr
+
+ iface = self.get_opt("iface")
+ if iface:
+ cmd += " -I %s" % iface
+
+ count = self.get_opt("count")
+ if count:
+ cmd += " -c %s" % count
+
+ interval = self.get_opt("interval")
+ if interval:
+ cmd += " -i %s" % interval
+
+ return cmd
+
+ def run(self):
+ cmd = self.compose_cmd()
+ logging.debug("%s" % cmd)
+
+ limit_rate = self.get_opt("limit_rate ", default=80)
+ 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'
+
+ match = re.search(stat_pttr1, data_stdout)
+ if not match:
+ return self.set_fail("expected pattern not found")
+
+ trans_pkts, recv_pkts = match.groups()
+ rate = int(round((float(recv_pkts) / float(trans_pkts)) * 100))
+ logging.debug("Transmitted \"%s\", received \"%s\", " \
+ "rate \"%d%%\", limit_rate \"%d%%\"" \
+ % (trans_pkts, recv_pkts, 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))
+
+ if rate < limit_rate :
+ return self.set_fail("rate is lower that limit")
+
+ return self.set_pass()
--
1.7.4.4
12 years, 6 months
[lnst] Introducing 'desc' command attribute.
by Jiří Pírko
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")
12 years, 6 months
[lnst] Icmp6Ping test
by Jiří Pírko
commit 73b24ec5659f7a9ca58e83b0328387bf6d95b9b7
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Tue Sep 13 14:38:57 2011 +0200
Icmp6Ping test
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
Tests/TestIcmp6Ping.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/Tests/TestIcmp6Ping.py b/Tests/TestIcmp6Ping.py
new file mode 100644
index 0000000..086d3fc
--- /dev/null
+++ b/Tests/TestIcmp6Ping.py
@@ -0,0 +1,63 @@
+__author__ = """
+jpirko(a)redhat.com (Jiri Pirko)
+jmalanik(a)redhat.com (Jan Malanik)
+jtluka(a)redhat.com (Jan Tluka)
+"""
+
+
+import logging
+import re
+from Common.TestsCommon import TestGeneric
+from Common.ExecCmd import exec_cmd
+
+
+class TestIcmp6Ping(TestGeneric):
+ def compose_cmd(self):
+ addr = self.get_mopt("addr", opt_type="addr")
+ cmd = "ping6 %s" % addr
+
+ iface = self.get_opt("iface")
+ if iface:
+ cmd += " -I %s" % iface
+
+ count = self.get_opt("count")
+ if count:
+ cmd += " -c %s" % count
+
+ interval = self.get_opt("interval")
+ if interval:
+ cmd += " -i %s" % interval
+
+ return cmd
+
+ def run(self):
+ cmd = self.compose_cmd()
+ logging.debug("%s" % cmd)
+
+ limit_rate = self.get_opt("limit_rate ", default=80)
+ 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'
+
+ match = re.search(stat_pttr1, data_stdout)
+ if not match:
+ return self.set_fail("expected pattern not found")
+
+ trans_pkts, recv_pkts = match.groups()
+ rate = int(round((float(recv_pkts) / float(trans_pkts)) * 100))
+ logging.debug("Transmitted \"%s\", received \"%s\", " \
+ "rate \"%d%%\", limit_rate \"%d%%\"" \
+ % (trans_pkts, recv_pkts, 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))
+
+ if rate < limit_rate :
+ return self.set_fail("rate is lower that limit")
+
+ return self.set_pass()
12 years, 6 months
[lnst] Switch setting link down and address removal
by Jan Tluka
This patch fixes the ipv6 deconfiguration of devices.
Setting link down on ipv6 configured device results in flushing all ipv6
addresses assigned to the device.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
NetConfig/NetConfigDevice.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/NetConfig/NetConfigDevice.py b/NetConfig/NetConfigDevice.py
index b0366a1..e024db7 100644
--- a/NetConfig/NetConfigDevice.py
+++ b/NetConfig/NetConfigDevice.py
@@ -50,10 +50,10 @@ class NetConfigDeviceGeneric:
def down(self):
netdev = self._netdev
- exec_cmd("ip link set %s down" % netdev["name"])
if "addresses" in netdev:
for address in netdev["addresses"]:
exec_cmd("ip addr del %s dev %s" % (address, netdev["name"]))
+ exec_cmd("ip link set %s down" % netdev["name"])
@classmethod
def type_init(self):
--
1.7.4.4
12 years, 6 months
[lnst] Switch setting link down and address removal
by Jiří Pírko
commit 4df9e7ce771516b9c3133dc053cc27c1e60dcd95
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Mon Sep 12 17:01:45 2011 +0200
Switch setting link down and address removal
This patch fixes the ipv6 deconfiguration of devices.
Setting link down on ipv6 configured device results in flushing all ipv6
addresses assigned to the device.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
NetConfig/NetConfigDevice.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/NetConfig/NetConfigDevice.py b/NetConfig/NetConfigDevice.py
index b0366a1..e024db7 100644
--- a/NetConfig/NetConfigDevice.py
+++ b/NetConfig/NetConfigDevice.py
@@ -50,10 +50,10 @@ class NetConfigDeviceGeneric:
def down(self):
netdev = self._netdev
- exec_cmd("ip link set %s down" % netdev["name"])
if "addresses" in netdev:
for address in netdev["addresses"]:
exec_cmd("ip addr del %s dev %s" % (address, netdev["name"]))
+ exec_cmd("ip link set %s down" % netdev["name"])
@classmethod
def type_init(self):
12 years, 6 months
[lnst] Icmp6Ping test
by Jan Tluka
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
Tests/TestIcmp6Ping.py | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 68 insertions(+), 0 deletions(-)
create mode 100644 Tests/TestIcmp6Ping.py
diff --git a/Tests/TestIcmp6Ping.py b/Tests/TestIcmp6Ping.py
new file mode 100644
index 0000000..e57d275
--- /dev/null
+++ b/Tests/TestIcmp6Ping.py
@@ -0,0 +1,68 @@
+__author__ = """
+jpirko(a)redhat.com (Jiri Pirko)
+jmalanik(a)redhat.com (Jan Malanik)
+jtluka(a)redhat.com (Jan Tluka)
+"""
+
+
+import logging
+import re
+from Common.TestsCommon import TestGeneric
+from Common.ExecCmd import exec_cmd
+
+
+class TestIcmp6Ping(TestGeneric):
+ def compose_cmd(self):
+ addr = self.get_mopt("addr", opt_type="addr")
+ cmd = "ping6 %s" % addr
+
+ iface = self.get_opt("iface")
+ if iface:
+ cmd += " -I %s" % iface
+
+ count = self.get_opt("count")
+ if count:
+ cmd += " -c %s" % count
+
+ interval = self.get_opt("interval")
+ if interval:
+ cmd += " -i %s" % interval
+
+ return cmd
+
+ def run(self):
+ cmd = self.compose_cmd()
+ logging.debug("%s" % cmd)
+
+ limit_rate = self.get_opt("limit_rate ", default=80)
+ data_stdout = exec_cmd(cmd, die_on_err=False)[0]
+
+ """ Provede se parsovani vystupu pomoci regularnich vyrazu.
+ V pripade ze hledane retezce nebubdou nalezeny, test skonci
+ s chybou, znamena to, ze vystup programu ma neocekavanou
+ vystupni syntaxi."""
+
+ 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'
+
+ match = re.search(stat_pttr1, data_stdout)
+ if not match:
+ return self.set_fail("expected pattern not found")
+
+ trans_pkts, recv_pkts = match.groups()
+ rate = int(round((float(recv_pkts) / float(trans_pkts)) * 100))
+ logging.debug("Transmitted \"%s\", received \"%s\", " \
+ "rate \"%d%%\", limit_rate \"%d%%\"" \
+ % (trans_pkts, recv_pkts, 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))
+
+ if rate < limit_rate :
+ return self.set_fail("rate is lower that limit")
+
+ return self.set_pass()
--
1.7.4.4
12 years, 6 months