[lnst] TestTCPConnect: option parsing bug fixes
by Jiří Pírko
commit bbb4c0315c239be3ffb70e479dabeaead6c6d70a
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Feb 8 11:09:47 2013 +0100
TestTCPConnect: option parsing bug fixes
This commit fixes two bugs during option parsing:
* option "sleep" is not mandatory but when not specified the module
* crashes
* option "port" needs to be an integer value, and the function extend
* was used on the port list, splitting the port string into individual
* characters
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
test_modules/TestTCPConnect.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/test_modules/TestTCPConnect.py b/test_modules/TestTCPConnect.py
index 4a5dc5c..4da2600 100644
--- a/test_modules/TestTCPConnect.py
+++ b/test_modules/TestTCPConnect.py
@@ -123,7 +123,7 @@ class TestTCPConnect(TestGeneric):
# either port or port_range should be set
port = self.get_opt("port")
if port:
- self._port = port
+ self._port = int(port)
else:
port_range = self.get_opt("port_range")
if port_range:
@@ -132,9 +132,11 @@ class TestTCPConnect(TestGeneric):
e = TestOptionMissing()
raise e
- sleep_time = float(self.get_opt("sleep"))
+ sleep_time = self.get_opt("sleep")
if sleep_time:
- self._sleep_time = sleep_time
+ self._sleep_time = float(sleep_time)
+ else:
+ self._sleep_time = 0
cont = self.get_opt("cont")
if cont:
@@ -177,7 +179,7 @@ class TestTCPConnect(TestGeneric):
ports = []
if self._port:
- ports.extend(self._port)
+ ports.append(self._port)
else:
r = self.parse_port_range()
ports.extend(r)
11 years, 2 months
[lnst] TestPktCounter: fix error when dport option is None
by Jiří Pírko
commit ca5db5e13d27b142c93cbc835a697ed13094145f
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Feb 8 11:09:46 2013 +0100
TestPktCounter: fix error when dport option is None
The dport option is not mandatory, but when not specified the
constructed iptables command would contain the string "None" where the
dport value would be. This commnit fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
test_modules/TestPktCounter.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/test_modules/TestPktCounter.py b/test_modules/TestPktCounter.py
index 727d472..7eec92c 100644
--- a/test_modules/TestPktCounter.py
+++ b/test_modules/TestPktCounter.py
@@ -23,7 +23,10 @@ def get_pkt_count(indev_name, dport, proto):
p_indev_name = "\*"
if proto:
p_proto = proto
- p_protodport = "%s dpt:%s" % (proto, dport)
+ if dport:
+ p_protodport = "%s dpt:%s" % (proto, dport)
+ else:
+ p_protodport = ""
else:
p_proto = "all"
p_protodport = ""
11 years, 2 months
[lnst] TestPacketAssert: minor bug fixes
by Jiří Pírko
commit da05b8c6bcd1910b6277de30b4f006df7a3a99e5
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Feb 8 11:09:45 2013 +0100
TestPacketAssert: minor bug fixes
When the TestPacketAssert module was interrupted it didn't read the
remaining tcpdump output. Because of that the recieved packets count
would be less than what was really recieved.
This patch fixes that by making the variable line an attribute of the
class and adding the code for output handling to the interrupt handler.
There is also a minor change here, the "filter" option of the command is
no longer mandatory as it is not needed for correct execution of the
tcpdump command.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
test_modules/TestPacketAssert.py | 35 +++++++++++++++++++++++++++++------
1 files changed, 29 insertions(+), 6 deletions(-)
---
diff --git a/test_modules/TestPacketAssert.py b/test_modules/TestPacketAssert.py
index 1524800..32884a4 100644
--- a/test_modules/TestPacketAssert.py
+++ b/test_modules/TestPacketAssert.py
@@ -40,6 +40,26 @@ class TestPacketAssert(TestGeneric):
""" Kill tcpdump when interrupted """
self._tcpdump.terminate()
+ tcpdump_output = self._tcpdump.stdout
+ while True:
+ try:
+ next_line = tcpdump_output.readline()
+ except IOError: # Interrupted system call
+ break
+
+ if next_line == "":
+ break
+
+ next_line = next_line.strip("\n")
+
+ if re.match("[0-9]+\:[0-9]+\:[0-9\.]+", next_line) and\
+ self.line != "":
+ self._process_captured_line(self.line)
+ self.line = next_line
+ else:
+ self.line += next_line
+
+
def _prepare_grep_filters(self):
""" Parse `grep_for' test options """
filters = self.get_multi_opt("grep_for")
@@ -64,7 +84,9 @@ class TestPacketAssert(TestGeneric):
cmd = ""
interface = self.get_mopt("interface")
- pcap_filter = self.get_mopt("filter")
+ pcap_filter = self.get_opt("filter")
+ if not pcap_filter:
+ pcap_filter = ""
cmd = "tcpdump -p -nn -i %s \"%s\"" % (interface, pcap_filter)
self._cmd = cmd
@@ -104,7 +126,7 @@ class TestPacketAssert(TestGeneric):
logging.info("Capturing started")
- line = ""
+ self.line = ""
tcpdump_output = self._tcpdump.stdout
while True:
if self._tcpdump.poll() != None:
@@ -123,11 +145,12 @@ class TestPacketAssert(TestGeneric):
next_line = next_line.strip("\n")
- if re.match("[0-9]+\:[0-9]+\:[0-9\.]+", next_line) and line != "":
- self._process_captured_line(line)
- line = next_line
+ if re.match("[0-9]+\:[0-9]+\:[0-9\.]+", next_line) and\
+ self.line != "":
+ self._process_captured_line(self.line)
+ self.line = next_line
else:
- line += next_line
+ self.line += next_line
logging.info("Capturing finished. Received %d packets", self._num_recv)
res = {"received": self._num_recv,
11 years, 2 months
[PATCH 0/5] test_module pathset
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
The following is a patch series fixing bugs in the test_modules that I've
encountered while I was creating the wiki documentation for them.
Ondrej Lichtner (5):
TestPacketAssert: minor bug fixes
TestPktCounter: fix error when dport option is None
TestTCPConnect: option parsing bug fixes
TestTCPListen: option parsing bug fixes
TestIperf: bind option not specified bug
test_modules/TestIperf.py | 5 ++++-
test_modules/TestPacketAssert.py | 35 +++++++++++++++++++++++++++++------
test_modules/TestPktCounter.py | 5 ++++-
test_modules/TestTCPConnect.py | 10 ++++++----
test_modules/TestTCPListen.py | 4 ++--
5 files changed, 45 insertions(+), 14 deletions(-)
--
1.7.11.7
11 years, 2 months
[lnst] adding initscript for lnst-slave service
by Jiří Pírko
commit f901a34b0a5c4063f63c5d9f035c2c6da6710cc1
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Tue Feb 5 14:25:03 2013 +0100
adding initscript for lnst-slave service
We'd like to be able to run LNST framework on older releases, e.g.
RHEL6, and since it's not using systemd the initscript for the
lnst-slave daemon is needed.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
dist/lnst-slave | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 105 insertions(+), 0 deletions(-)
---
diff --git a/dist/lnst-slave b/dist/lnst-slave
new file mode 100755
index 0000000..b18f46a
--- /dev/null
+++ b/dist/lnst-slave
@@ -0,0 +1,105 @@
+#!/bin/bash
+#
+# lnst-slave Starts up the LNST slave daemon
+#
+# chkconfig: - 20 80
+# description: LNST is a framework to automate network configuration and
+# testing. This service starts up the LNST slave daemon.
+#
+# processname: lnst-slave
+# pidfile: /var/run/lnst-slave.pid
+
+### BEGIN INIT INFO
+# Provides: lnst-slave
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs
+# Short-Description: Starts up the LNST slave daemon
+# Description: LNST is a framework to automate network configuration and
+# testing. This service starts up the LNST slave daemon.
+### END INIT INFO
+
+# source function library
+. /etc/rc.d/init.d/functions
+
+RETVAL=0
+prog="lnst-slave"
+lockfile=/var/lock/subsys/$prog
+
+# Some functions to make the below more readable
+LNST=/usr/bin/lnst-slave
+PID_FILE=/var/run/lnst-slave.pid
+OPTIONS="--daemonize"
+
+start()
+{
+ [ -x $LNST ] || exit 5
+
+ echo -n $"Starting $prog: "
+ $LNST $OPTIONS && success || failure
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch $lockfile
+ echo
+ return $RETVAL
+}
+
+stop()
+{
+ echo -n $"Stopping $prog: "
+ killproc lnst-slave
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f $lockfile
+ echo
+}
+
+reload() {
+ restart
+}
+
+restart() {
+ stop
+ start
+}
+
+force_reload() {
+ restart
+}
+
+rh_status() {
+ status lnst-slave
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
+ ;;
+ force-reload)
+ $1
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ status)
+ rh_status
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+ RETVAL=2
+esac
+exit $RETVAL
11 years, 2 months
[lnst] fix crash in xml attribute handling method
by Jiří Pírko
commit 6b1272ec30b13c0e3d4185daa85bc75e584e222f
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Tue Feb 5 14:17:21 2013 +0100
fix crash in xml attribute handling method
If rpcport attribute is set in any machine description file in machine
pool the controller will crash in setAttribute method since it expects
string rather than integer. To avoid this the variable is converted to
string.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
lnst/Controller/MachinePool.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/lnst/Controller/MachinePool.py b/lnst/Controller/MachinePool.py
index 9deb96f..92ddf41 100644
--- a/lnst/Controller/MachinePool.py
+++ b/lnst/Controller/MachinePool.py
@@ -129,7 +129,7 @@ class MachinePool:
supported = ["hostname", "libvirt_domain", "rpcport"]
for attr_name, attr_val in self._pool[pm_id]["info"].iteritems():
if attr_name in supported:
- info.setAttribute(attr_name, attr_val)
+ info.setAttribute(attr_name, str(attr_val))
mcfg.appendChild(info)
netdevices = dom.createElement("netdevices")
11 years, 2 months
[PATCH] adding initscript for lnst-slave service
by Jan Tluka
We'd like to be able to run LNST framework on older releases, e.g.
RHEL6, and since it's not using systemd the initscript for the
lnst-slave daemon is needed.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
dist/lnst-slave | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 105 insertions(+), 0 deletions(-)
create mode 100755 dist/lnst-slave
diff --git a/dist/lnst-slave b/dist/lnst-slave
new file mode 100755
index 0000000..b18f46a
--- /dev/null
+++ b/dist/lnst-slave
@@ -0,0 +1,105 @@
+#!/bin/bash
+#
+# lnst-slave Starts up the LNST slave daemon
+#
+# chkconfig: - 20 80
+# description: LNST is a framework to automate network configuration and
+# testing. This service starts up the LNST slave daemon.
+#
+# processname: lnst-slave
+# pidfile: /var/run/lnst-slave.pid
+
+### BEGIN INIT INFO
+# Provides: lnst-slave
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs
+# Short-Description: Starts up the LNST slave daemon
+# Description: LNST is a framework to automate network configuration and
+# testing. This service starts up the LNST slave daemon.
+### END INIT INFO
+
+# source function library
+. /etc/rc.d/init.d/functions
+
+RETVAL=0
+prog="lnst-slave"
+lockfile=/var/lock/subsys/$prog
+
+# Some functions to make the below more readable
+LNST=/usr/bin/lnst-slave
+PID_FILE=/var/run/lnst-slave.pid
+OPTIONS="--daemonize"
+
+start()
+{
+ [ -x $LNST ] || exit 5
+
+ echo -n $"Starting $prog: "
+ $LNST $OPTIONS && success || failure
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch $lockfile
+ echo
+ return $RETVAL
+}
+
+stop()
+{
+ echo -n $"Stopping $prog: "
+ killproc lnst-slave
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f $lockfile
+ echo
+}
+
+reload() {
+ restart
+}
+
+restart() {
+ stop
+ start
+}
+
+force_reload() {
+ restart
+}
+
+rh_status() {
+ status lnst-slave
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
+ ;;
+ force-reload)
+ $1
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ status)
+ rh_status
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
+ RETVAL=2
+esac
+exit $RETVAL
--
1.7.7.6
11 years, 2 months
[PATCH] fix crash in xml attribute handling method
by Jan Tluka
If rpcport attribute is set in any machine description file in machine
pool the controller will crash in setAttribute method since it expects
string rather than integer. To avoid this the variable is converted to
string.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Controller/MachinePool.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lnst/Controller/MachinePool.py b/lnst/Controller/MachinePool.py
index 9deb96f..92ddf41 100644
--- a/lnst/Controller/MachinePool.py
+++ b/lnst/Controller/MachinePool.py
@@ -129,7 +129,7 @@ class MachinePool:
supported = ["hostname", "libvirt_domain", "rpcport"]
for attr_name, attr_val in self._pool[pm_id]["info"].iteritems():
if attr_name in supported:
- info.setAttribute(attr_name, attr_val)
+ info.setAttribute(attr_name, str(attr_val))
mcfg.appendChild(info)
netdevices = dom.createElement("netdevices")
--
1.7.7.6
11 years, 2 months
RFC: lnst-slave init script
by Jan Tluka
Hello everyone,
since some of the testing we do is targeted at RHEL releases that does not
have systemd I've created an initscript that seems to work with the current
RHEL6 release. See it attached.
Radek, should I put it under dist directory? If so, I'll post a patch.
Any comments welcome!
-Jan
11 years, 2 months
Things to include into a package update
by Radek Pazdera
Hi guys!
Honza found a pretty severe issue in the package for Fedora, just before
the presentation at FOSDEM. With this bug, lnst-ctl will fail
practically every time it is executed.
I already posted the patches to fix it and I plan to create a package
update and submit it later this week, so it is ready before devconf.
Anyway, is there anything else we should include to the package update?
Thanks
-Radek
11 years, 2 months