[PATCH] Fixed long parameters parsing in lnst-slave
by Jiri Prochazka
--port and --pidfile didn't have '=' in getopt options.
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst-slave | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst-slave b/lnst-slave
index ce6c390..d4345c3 100755
--- a/lnst-slave
+++ b/lnst-slave
@@ -43,7 +43,7 @@ def main():
opts = getopt.getopt(
sys.argv[1:],
"dhei:p:m",
- ["debug", "help", "daemonize", "pidfile", "port", "no-colours"]
+ ["debug", "help", "daemonize", "pidfile=", "port=", "no-colours"]
)[0]
except getopt.GetoptError as err:
print str(err)
--
2.1.0
8 years, 9 months
[PATCH] Added method to get list of addresses on interface
by Jiri Prochazka
closes #78
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
lnst/Controller/Task.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index 0aa3d1a..27ba801 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -250,6 +250,22 @@ class HostAPI(object):
iface = self._interfaces[interface_id]
return iface.get_ip_addr(addr_number)
+ def get_all_ips(self, interface_id):
+ """
+ Returns list of all IP addresses of the interface.
+
+ :param interface_id: which interface
+ :type interface_id: string
+
+ :return: list of IP addresses (e.g., ['192.168.1.10', '2001::10']).
+ :rtype: list of strings
+ """
+ iface = self._interfaces[interface_id]
+ res = []
+ for ip, prefix in iface.get_ip_addrs().get_val():
+ res.append(ip)
+ return res
+
def get_prefix(self, interface_id, addr_number=0):
"""
Returns an IP address prefix (netmask)
--
2.1.0
8 years, 10 months
[PATCH] Phase2 tests use source IP instead of source device for Icmp6Ping
by Jiri Prochazka
Solution for weird behaviour, when ping6 chooses IP from different device.
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
recipes/regression_tests/phase2/3_vlans_over_team.py | 2 +-
recipes/regression_tests/phase2/team_test.py | 4 ++--
.../phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py | 4 ++--
recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py | 2 +-
recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/recipes/regression_tests/phase2/3_vlans_over_team.py b/recipes/regression_tests/phase2/3_vlans_over_team.py
index 2ede5d4..a6ef2a2 100644
--- a/recipes/regression_tests/phase2/3_vlans_over_team.py
+++ b/recipes/regression_tests/phase2/3_vlans_over_team.py
@@ -33,7 +33,7 @@ for vlan1 in vlans:
options={
"addr" : m2.get_ip(vlan2, 1),
"count" : 100,
- "iface" : m1.get_devname(vlan1),
+ "iface" : m1.get_ip(vlan1, 1),
"interval" : 0.1
})
diff --git a/recipes/regression_tests/phase2/team_test.py b/recipes/regression_tests/phase2/team_test.py
index 78e9efe..d792ea3 100644
--- a/recipes/regression_tests/phase2/team_test.py
+++ b/recipes/regression_tests/phase2/team_test.py
@@ -30,7 +30,7 @@ ping_mod6 = ctl.get_module("Icmp6Ping",
options={
"addr" : m2.get_ip("test_if", 1),
"count" : 100,
- "iface" : m1.get_devname("test_if"),
+ "iface" : m1.get_ip("test_if", 1),
"interval" : 0.1
})
@@ -222,4 +222,4 @@ for offload in offloads:
ctl.wait(2)
m1.run(netperf_cli_tcp6, timeout=65)
m1.run(netperf_cli_udp6, timeout=65)
- server_proc.intr()
\ No newline at end of file
+ server_proc.intr()
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
index a4cfdd8..a4a383f 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_2_vlans_over_active_backup_bond.py
@@ -46,7 +46,7 @@ ping_mod6 = ctl.get_module("Icmp6Ping",
options={
"addr" : g3.get_ip("guestnic", 1),
"count" : 100,
- "iface" : g1.get_devname("guestnic"),
+ "iface" : g1.get_ip("guestnic", 1),
"interval" : 0.1
})
@@ -54,7 +54,7 @@ ping_mod62 = ctl.get_module("Icmp6Ping",
options={
"addr" : g2.get_ip("guestnic", 1),
"count" : 100,
- "iface" : g4.get_devname("guestnic"),
+ "iface" : g4.get_ip("guestnic", 1),
"interval" : 0.1
})
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
index 0d6aba8..eae14db 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_guest.py
@@ -32,7 +32,7 @@ ping_mod6 = ctl.get_module("Icmp6Ping",
options={
"addr" : h2.get_ip("vlan10", 1),
"count" : 100,
- "iface" : g1.get_devname("vlan10"),
+ "iface" : g1.get_ip("vlan10", 1),
"interval" : 0.1
})
diff --git a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
index 3344d81..bc50b18 100644
--- a/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
+++ b/recipes/regression_tests/phase2/virtual_ovs_bridge_vlan_in_host.py
@@ -32,7 +32,7 @@ ping_mod6 = ctl.get_module("Icmp6Ping",
options={
"addr" : h2.get_ip("vlan10", 1),
"count" : 100,
- "iface" : g1.get_devname("guestnic"),
+ "iface" : g1.get_ip("guestnic", 1),
"interval" : 0.1
})
--
2.1.0
8 years, 10 months
[lnst] Added missing ipv alias in phase2 tests
by Jiří Pírko
commit 573dad95c1e0c080e7918fbb51bf53fa0e76d438
Author: Jiri Prochazka <jprochaz(a)redhat.com>
Date: Tue Jan 27 15:20:14 2015 +0100
Added missing ipv alias in phase2 tests
Forgot to add ipv alias in some xml recipes. Fixed now
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
.../phase2/active_backup_double_team.xml | 3 +++
.../regression_tests/phase2/active_backup_team.xml | 3 +++
.../active_backup_team_vs_active_backup_bond.xml | 3 +++
.../active_backup_team_vs_round_robin_bond.xml | 3 +++
.../phase2/round_robin_double_team.xml | 3 +++
.../regression_tests/phase2/round_robin_team.xml | 3 +++
.../round_robin_team_vs_active_backup_bond.xml | 3 +++
.../round_robin_team_vs_round_robin_bond.xml | 3 +++
8 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/recipes/regression_tests/phase2/active_backup_double_team.xml b/recipes/regression_tests/phase2/active_backup_double_team.xml
index 9ecefe2..02c6bf6 100644
--- a/recipes/regression_tests/phase2/active_backup_double_team.xml
+++ b/recipes/regression_tests/phase2/active_backup_double_team.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/active_backup_team.xml b/recipes/regression_tests/phase2/active_backup_team.xml
index 15ad59a..c476c67 100644
--- a/recipes/regression_tests/phase2/active_backup_team.xml
+++ b/recipes/regression_tests/phase2/active_backup_team.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml b/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml
index 445123c..90cf9ef 100644
--- a/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml
+++ b/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/active_backup_team_vs_round_robin_bond.xml b/recipes/regression_tests/phase2/active_backup_team_vs_round_robin_bond.xml
index fc8a6a5..6d3d1b6 100644
--- a/recipes/regression_tests/phase2/active_backup_team_vs_round_robin_bond.xml
+++ b/recipes/regression_tests/phase2/active_backup_team_vs_round_robin_bond.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/round_robin_double_team.xml b/recipes/regression_tests/phase2/round_robin_double_team.xml
index 624d6c9..94eb6b5 100644
--- a/recipes/regression_tests/phase2/round_robin_double_team.xml
+++ b/recipes/regression_tests/phase2/round_robin_double_team.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/round_robin_team.xml b/recipes/regression_tests/phase2/round_robin_team.xml
index 030aaf4..f85a1b0 100644
--- a/recipes/regression_tests/phase2/round_robin_team.xml
+++ b/recipes/regression_tests/phase2/round_robin_team.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/round_robin_team_vs_active_backup_bond.xml b/recipes/regression_tests/phase2/round_robin_team_vs_active_backup_bond.xml
index c33414a..5562006 100644
--- a/recipes/regression_tests/phase2/round_robin_team_vs_active_backup_bond.xml
+++ b/recipes/regression_tests/phase2/round_robin_team_vs_active_backup_bond.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/round_robin_team_vs_round_robin_bond.xml b/recipes/regression_tests/phase2/round_robin_team_vs_round_robin_bond.xml
index 2641b0d..8ac5e69 100644
--- a/recipes/regression_tests/phase2/round_robin_team_vs_round_robin_bond.xml
+++ b/recipes/regression_tests/phase2/round_robin_team_vs_round_robin_bond.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
8 years, 10 months
[lnst] More netperf tests added
by Jiří Pírko
commit f3425c5b342942f6f77a588af110d019b60e2947
Author: Jiri Prochazka <jprochaz(a)redhat.com>
Date: Tue Jan 27 15:02:08 2015 +0100
More netperf tests added
Added netperf test recipes for each test variation.
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
.../{netperf.xml => netperf/netperf_sctp_rr.xml} | 2 ++
.../netperf_sctp_stream.xml} | 2 ++
.../netperf_sctp_stream_many.xml} | 2 ++
.../{netperf.xml => netperf/netperf_tcp_rr.xml} | 2 ++
.../netperf_tcp_stream.xml} | 2 ++
.../{netperf.xml => netperf/netperf_udp_rr.xml} | 2 ++
.../netperf_udp_stream.xml} | 2 ++
7 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/recipes/examples/quick_guides/netperf.xml b/recipes/examples/quick_guides/netperf/netperf_sctp_rr.xml
similarity index 90%
copy from recipes/examples/quick_guides/netperf.xml
copy to recipes/examples/quick_guides/netperf/netperf_sctp_rr.xml
index dd339a5..06c2607 100644
--- a/recipes/examples/quick_guides/netperf.xml
+++ b/recipes/examples/quick_guides/netperf/netperf_sctp_rr.xml
@@ -30,6 +30,8 @@
<options>
<option name="role" value="client"/>
<option name="netperf_server" value="{ip(testmachine2, testifc2)}"/>
+ <option name="testname" value="SCTP_RR" />
+ <option name="threshold" value="0 Trans./sec" />
</options>
</run>
diff --git a/recipes/examples/quick_guides/netperf.xml b/recipes/examples/quick_guides/netperf/netperf_sctp_stream.xml
similarity index 90%
copy from recipes/examples/quick_guides/netperf.xml
copy to recipes/examples/quick_guides/netperf/netperf_sctp_stream.xml
index dd339a5..3e53843 100644
--- a/recipes/examples/quick_guides/netperf.xml
+++ b/recipes/examples/quick_guides/netperf/netperf_sctp_stream.xml
@@ -30,6 +30,8 @@
<options>
<option name="role" value="client"/>
<option name="netperf_server" value="{ip(testmachine2, testifc2)}"/>
+ <option name="testname" value="SCTP_STREAM" />
+ <option name="threshold" value="0 Mbits/sec" />
</options>
</run>
diff --git a/recipes/examples/quick_guides/netperf.xml b/recipes/examples/quick_guides/netperf/netperf_sctp_stream_many.xml
similarity index 90%
copy from recipes/examples/quick_guides/netperf.xml
copy to recipes/examples/quick_guides/netperf/netperf_sctp_stream_many.xml
index dd339a5..175cb36 100644
--- a/recipes/examples/quick_guides/netperf.xml
+++ b/recipes/examples/quick_guides/netperf/netperf_sctp_stream_many.xml
@@ -30,6 +30,8 @@
<options>
<option name="role" value="client"/>
<option name="netperf_server" value="{ip(testmachine2, testifc2)}"/>
+ <option name="testname" value="SCTP_STREAM_MANY" />
+ <option name="threshold" value="0 Mbits/sec" />
</options>
</run>
diff --git a/recipes/examples/quick_guides/netperf.xml b/recipes/examples/quick_guides/netperf/netperf_tcp_rr.xml
similarity index 90%
copy from recipes/examples/quick_guides/netperf.xml
copy to recipes/examples/quick_guides/netperf/netperf_tcp_rr.xml
index dd339a5..98bd279 100644
--- a/recipes/examples/quick_guides/netperf.xml
+++ b/recipes/examples/quick_guides/netperf/netperf_tcp_rr.xml
@@ -30,6 +30,8 @@
<options>
<option name="role" value="client"/>
<option name="netperf_server" value="{ip(testmachine2, testifc2)}"/>
+ <option name="testname" value="TCP_RR" />
+ <option name="threshold" value="0 Trans./sec" />
</options>
</run>
diff --git a/recipes/examples/quick_guides/netperf.xml b/recipes/examples/quick_guides/netperf/netperf_tcp_stream.xml
similarity index 90%
copy from recipes/examples/quick_guides/netperf.xml
copy to recipes/examples/quick_guides/netperf/netperf_tcp_stream.xml
index dd339a5..bcbfdcd 100644
--- a/recipes/examples/quick_guides/netperf.xml
+++ b/recipes/examples/quick_guides/netperf/netperf_tcp_stream.xml
@@ -30,6 +30,8 @@
<options>
<option name="role" value="client"/>
<option name="netperf_server" value="{ip(testmachine2, testifc2)}"/>
+ <option name="testname" value="TCP_STREAM" />
+ <option name="threshold" value="0 Mbits/sec" />
</options>
</run>
diff --git a/recipes/examples/quick_guides/netperf.xml b/recipes/examples/quick_guides/netperf/netperf_udp_rr.xml
similarity index 90%
copy from recipes/examples/quick_guides/netperf.xml
copy to recipes/examples/quick_guides/netperf/netperf_udp_rr.xml
index dd339a5..0c6621d 100644
--- a/recipes/examples/quick_guides/netperf.xml
+++ b/recipes/examples/quick_guides/netperf/netperf_udp_rr.xml
@@ -30,6 +30,8 @@
<options>
<option name="role" value="client"/>
<option name="netperf_server" value="{ip(testmachine2, testifc2)}"/>
+ <option name="testname" value="UDP_RR" />
+ <option name="threshold" value="0 Trans./sec" />
</options>
</run>
diff --git a/recipes/examples/quick_guides/netperf.xml b/recipes/examples/quick_guides/netperf/netperf_udp_stream.xml
similarity index 90%
rename from recipes/examples/quick_guides/netperf.xml
rename to recipes/examples/quick_guides/netperf/netperf_udp_stream.xml
index dd339a5..aa1964c 100644
--- a/recipes/examples/quick_guides/netperf.xml
+++ b/recipes/examples/quick_guides/netperf/netperf_udp_stream.xml
@@ -30,6 +30,8 @@
<options>
<option name="role" value="client"/>
<option name="netperf_server" value="{ip(testmachine2, testifc2)}"/>
+ <option name="testname" value="UDP_STREAM" />
+ <option name="threshold" value="0 Mbits/sec" />
</options>
</run>
8 years, 10 months
[lnst] Extended netperf test support
by Jiří Pírko
commit 77bbc7d8f19984670ebe4113b84048b72f396234
Author: Jiri Prochazka <jprochaz(a)redhat.com>
Date: Tue Jan 27 15:42:50 2015 +0100
Extended netperf test support
Added support for TCP_RR, UDP_RR, SCTP_STREAM, SCTP_STREAM_MANY and SCTP_RR tests.
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
test_modules/Netperf.py | 98 ++++++++++++++++++++++++++++++++---------------
1 files changed, 67 insertions(+), 31 deletions(-)
---
diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
index fba6213..1994412 100644
--- a/test_modules/Netperf.py
+++ b/test_modules/Netperf.py
@@ -14,6 +14,9 @@ from lnst.Common.ShellProcess import ShellProcess
class Netperf(TestGeneric):
+ supported_tests = ["TCP_STREAM", "TCP_RR", "UDP_STREAM", "UDP_RR",
+ "SCTP_STREAM", "SCTP_STREAM_MANY", "SCTP_RR"]
+
def _compose_cmd(self, role):
"""
composes commands for netperf and netserver based on xml recipe
@@ -39,10 +42,11 @@ class Netperf(TestGeneric):
"""
test that will be performed
"""
- if testname != "TCP_STREAM" and testname != "UDP_STREAM":
- logging.warning("Only TCP_STREAM and UDP_STREAM tests are "\
- "now officialy supported by LNST. You can use other tests,"\
- " but test result may not be correct.")
+ if testname not in self.supported_tests:
+ logging.warning("Only TCP_STREAM, TCP_RR, UDP_STREAM, "
+ "UDP_RR, SCTP_STREAM, SCTP_STREAM_MANY and SCTP_RR tests "
+ "are now officialy supported by LNST. You "
+ "can use other tests, but test result may not be correct.")
cmd += " -t %s" % testname
if netperf_opts is not None:
@@ -73,40 +77,68 @@ class Netperf(TestGeneric):
return cmd
def _parse_output(self, threshold, output):
- # pattern for tcp throughput output
- pattern_tcp = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
- # pattern for udp throughput output
- pattern_udp = "\d+\s+\d+\s+\d+\.\d+\s+\d+\s+\d+\s+(\d+(\.\d+){0,1})"
- if self.get_opt("testname") == "UDP_STREAM":
- r2 = re.search(pattern_udp, output.lower())
+ testname = self.get_opt("testname")
+ if testname == "UDP_STREAM":
+ # pattern for UDP_STREAM throughput output
+ # decimal decimal float decimal decimal (float)
+ pattern_udp_stream = "\d+\s+\d+\s+\d+\.\d+\s+\d+\s+\d+\s+(\d+(\.\d+){0,1})"
+ r2 = re.search(pattern_udp_stream, output.lower())
+ elif testname == "TCP_STREAM":
+ # pattern for TCP_STREAM throughput output
+ # decimal decimal decimal float (float)
+ pattern_tcp_stream = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
+ r2 = re.search(pattern_tcp_stream, output.lower())
+ elif testname == "TCP_RR" or testname == "UDP_RR" or testname == "SCTP_RR":
+ # pattern for TCP_RR, UDP_RR and SCTP_RR throughput output
+ # decimal decimal decimal decimal float (float)
+ pattern_tcp_rr = "\d+\s+\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
+ r2 = re.search(pattern_tcp_rr, output.lower())
else:
- r2 = re.search(pattern_tcp, output.lower())
+ # pattern for SCTP streams and other tests
+ # decimal decimal decimal float (float)
+ pattern_sctp = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
+ r2 = re.search(pattern_sctp, output.lower())
if threshold is not None:
# pattern for threshold
# group(1) ... threshold value
# group(3) ... threshold units
# group(4) ... bytes/bits
- pattern1 = "(\d*(\.\d*){0,1})\s*([ kmgt])(bits|bytes)\/sec"
- r1 = re.search(pattern1, threshold.lower())
- threshold_rate = float(r1.group(1))
- threshold_unit_size = r1.group(3)
- threshold_unit_type = r1.group(4)
+ if (testname == "TCP_STREAM" or testname == "UDP_STREAM" or
+ testname == "SCTP_STREAM" or testname == "SCTP_STREAM_MANY"):
+ pattern_stream = "(\d*(\.\d*){0,1})\s*([ kmgt])(bits|bytes)\/sec"
+ r1 = re.search(pattern_stream, threshold.lower())
+ if r1 is None:
+ return (False, "Invalid unit type in the throughput option")
+ threshold_rate = float(r1.group(1))
+ threshold_unit_size = r1.group(3)
+ threshold_unit_type = r1.group(4)
+ elif (testname == "TCP_RR" or testname == "UDP_RR" or
+ testname == "SCTP_RR"):
+ pattern_rr = "(\d*(\.\d*){0,1})\s*trans\.\/sec"
+ r1 = re.search(pattern_rr, threshold.lower())
+ if r1 is None:
+ return (False, "Invalid unit type in the throughput option")
+ threshold_rate = float(r1.group(1))
+ threshold_unit_size = ""
+ threshold_unit_type = "Trans./sec"
throughput_rate = float(r2.group(1))
"""
this part converts threshold and throughput rates to same format
user will get output in format specified in threshold option
if no threshold option is put in, default format is Mbits
"""
- if threshold_unit_size == 'k':
- throughput_rate *= 1000
- elif threshold_unit_size == 'g':
- throughput_rate /= 1000
- elif threshold_unit_size == 't':
- throughput_rate /= 1000 * 1000
- if threshold_unit_type == "bytes":
- throughput_rate /= 8
+ if (testname == "UDP_STREAM" or testname == "TCP_STREAM" or
+ testname == "SCTP_STREAM" or testname == "SCTP_STREAM_MANY"):
+ if threshold_unit_size == 'k':
+ throughput_rate *= 1000
+ elif threshold_unit_size == 'g':
+ throughput_rate /= 1000
+ elif threshold_unit_size == 't':
+ throughput_rate /= 1000 * 1000
+ if threshold_unit_type == "bytes":
+ throughput_rate /= 8
if threshold_rate > throughput_rate:
- return (False, "Measured rate (%s %s%s) is below threshold "\
+ return (False, "Measured rate (%s %s%s) is below threshold "
"(%s %s%s)!" % (throughput_rate,
threshold_unit_size.upper(),
threshold_unit_type,
@@ -114,7 +146,7 @@ class Netperf(TestGeneric):
threshold_unit_size.upper(),
threshold_unit_type))
else:
- return (True, "Measured rate (%s %s%s) is over threshold "\
+ return (True, "Measured rate (%s %s%s) is over threshold "
"(%s %s%s)." % (throughput_rate,
threshold_unit_size.upper(),
threshold_unit_type,
@@ -122,7 +154,11 @@ class Netperf(TestGeneric):
threshold_unit_size.upper(),
threshold_unit_type))
else:
- return (True, "Measured rate: %s Mbits" % r2.group(1))
+ if (testname == "TCP_RR" or testname == "UDP_RR" or
+ testname == "SCTP_RR"):
+ return (True, "Measured rate: %s Trans./sec" % r2.group(1))
+ else:
+ return (True, "Measured rate: %s Mbits/sec" % r2.group(1))
@@ -145,11 +181,11 @@ class Netperf(TestGeneric):
client.kill()
output = client.read_nonblocking()
if rv != 0:
- logging.info("Could not get performance throughput! Are you sure "\
- "netperf is installed on both machines and machines "\
+ logging.info("Could not get performance throughput! Are you sure "
+ "netperf is installed on both machines and machines "
"are mutually accessible?")
- return (False, "Could not get performance throughput! Are you "\
- "sure netperf is installed on both machines and "\
+ return (False, "Could not get performance throughput! Are you "
+ "sure netperf is installed on both machines and "
"machines are mutually accessible?")
return self._parse_output(self.get_opt("threshold"), output)
8 years, 10 months
[lnst] Netperf error detection reworked
by Jiří Pírko
commit 890a2cacd44163c51197ae4eeef86bdb8ec3b079
Author: Jiri Prochazka <jprochaz(a)redhat.com>
Date: Tue Jan 27 15:02:06 2015 +0100
Netperf error detection reworked
Return value of client netperf is checked instead of output parsing and looking for error there.
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
test_modules/Netperf.py | 29 +++++++++++++----------------
1 files changed, 13 insertions(+), 16 deletions(-)
---
diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
index 09bb8f0..fba6213 100644
--- a/test_modules/Netperf.py
+++ b/test_modules/Netperf.py
@@ -73,24 +73,14 @@ class Netperf(TestGeneric):
return cmd
def _parse_output(self, threshold, output):
- # pattern for throughput output
- pattern2 = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
+ # pattern for tcp throughput output
+ pattern_tcp = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
# pattern for udp throughput output
- pattern3 = "\d+\s+\d+\s+\d+\.\d+\s+\d+\s+\d+\s+(\d+(\.\d+){0,1})"
+ pattern_udp = "\d+\s+\d+\s+\d+\.\d+\s+\d+\s+\d+\s+(\d+(\.\d+){0,1})"
if self.get_opt("testname") == "UDP_STREAM":
- r2 = re.search(pattern3, output.lower())
+ r2 = re.search(pattern_udp, output.lower())
else:
- r2 = re.search(pattern2, output.lower())
- if r2 is None:
- """
- throughput was not found, end test with failure
- """
- logging.info("Could not get performance throughput! Are you sure "\
- "netperf is installed on both machines and machines "\
- "are mutually accessible?")
- return (False, "Could not get performance throughput! Are you "\
- "sure netperf is installed on both machines and "\
- "machines are mutually accessible?")
+ r2 = re.search(pattern_tcp, output.lower())
if threshold is not None:
# pattern for threshold
# group(1) ... threshold value
@@ -149,11 +139,18 @@ class Netperf(TestGeneric):
logging.debug("running as client...")
client = ShellProcess(cmd)
try:
- client.wait()
+ rv = client.wait()
except OSError as e:
if e.errno == errno.EINTR:
client.kill()
output = client.read_nonblocking()
+ if rv != 0:
+ logging.info("Could not get performance throughput! Are you sure "\
+ "netperf is installed on both machines and machines "\
+ "are mutually accessible?")
+ return (False, "Could not get performance throughput! Are you "\
+ "sure netperf is installed on both machines and "\
+ "machines are mutually accessible?")
return self._parse_output(self.get_opt("threshold"), output)
def run(self):
8 years, 10 months
[PATCH] Extended netperf test support
by Jiri Prochazka
Added support for TCP_RR, UDP_RR, SCTP_STREAM, SCTP_STREAM_MANY and SCTP_RR tests.
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
test_modules/Netperf.py | 98 +++++++++++++++++++++++++++++++++----------------
1 file changed, 67 insertions(+), 31 deletions(-)
diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
index fba6213..1994412 100644
--- a/test_modules/Netperf.py
+++ b/test_modules/Netperf.py
@@ -14,6 +14,9 @@ from lnst.Common.ShellProcess import ShellProcess
class Netperf(TestGeneric):
+ supported_tests = ["TCP_STREAM", "TCP_RR", "UDP_STREAM", "UDP_RR",
+ "SCTP_STREAM", "SCTP_STREAM_MANY", "SCTP_RR"]
+
def _compose_cmd(self, role):
"""
composes commands for netperf and netserver based on xml recipe
@@ -39,10 +42,11 @@ class Netperf(TestGeneric):
"""
test that will be performed
"""
- if testname != "TCP_STREAM" and testname != "UDP_STREAM":
- logging.warning("Only TCP_STREAM and UDP_STREAM tests are "\
- "now officialy supported by LNST. You can use other tests,"\
- " but test result may not be correct.")
+ if testname not in self.supported_tests:
+ logging.warning("Only TCP_STREAM, TCP_RR, UDP_STREAM, "
+ "UDP_RR, SCTP_STREAM, SCTP_STREAM_MANY and SCTP_RR tests "
+ "are now officialy supported by LNST. You "
+ "can use other tests, but test result may not be correct.")
cmd += " -t %s" % testname
if netperf_opts is not None:
@@ -73,40 +77,68 @@ class Netperf(TestGeneric):
return cmd
def _parse_output(self, threshold, output):
- # pattern for tcp throughput output
- pattern_tcp = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
- # pattern for udp throughput output
- pattern_udp = "\d+\s+\d+\s+\d+\.\d+\s+\d+\s+\d+\s+(\d+(\.\d+){0,1})"
- if self.get_opt("testname") == "UDP_STREAM":
- r2 = re.search(pattern_udp, output.lower())
+ testname = self.get_opt("testname")
+ if testname == "UDP_STREAM":
+ # pattern for UDP_STREAM throughput output
+ # decimal decimal float decimal decimal (float)
+ pattern_udp_stream = "\d+\s+\d+\s+\d+\.\d+\s+\d+\s+\d+\s+(\d+(\.\d+){0,1})"
+ r2 = re.search(pattern_udp_stream, output.lower())
+ elif testname == "TCP_STREAM":
+ # pattern for TCP_STREAM throughput output
+ # decimal decimal decimal float (float)
+ pattern_tcp_stream = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
+ r2 = re.search(pattern_tcp_stream, output.lower())
+ elif testname == "TCP_RR" or testname == "UDP_RR" or testname == "SCTP_RR":
+ # pattern for TCP_RR, UDP_RR and SCTP_RR throughput output
+ # decimal decimal decimal decimal float (float)
+ pattern_tcp_rr = "\d+\s+\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
+ r2 = re.search(pattern_tcp_rr, output.lower())
else:
- r2 = re.search(pattern_tcp, output.lower())
+ # pattern for SCTP streams and other tests
+ # decimal decimal decimal float (float)
+ pattern_sctp = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
+ r2 = re.search(pattern_sctp, output.lower())
if threshold is not None:
# pattern for threshold
# group(1) ... threshold value
# group(3) ... threshold units
# group(4) ... bytes/bits
- pattern1 = "(\d*(\.\d*){0,1})\s*([ kmgt])(bits|bytes)\/sec"
- r1 = re.search(pattern1, threshold.lower())
- threshold_rate = float(r1.group(1))
- threshold_unit_size = r1.group(3)
- threshold_unit_type = r1.group(4)
+ if (testname == "TCP_STREAM" or testname == "UDP_STREAM" or
+ testname == "SCTP_STREAM" or testname == "SCTP_STREAM_MANY"):
+ pattern_stream = "(\d*(\.\d*){0,1})\s*([ kmgt])(bits|bytes)\/sec"
+ r1 = re.search(pattern_stream, threshold.lower())
+ if r1 is None:
+ return (False, "Invalid unit type in the throughput option")
+ threshold_rate = float(r1.group(1))
+ threshold_unit_size = r1.group(3)
+ threshold_unit_type = r1.group(4)
+ elif (testname == "TCP_RR" or testname == "UDP_RR" or
+ testname == "SCTP_RR"):
+ pattern_rr = "(\d*(\.\d*){0,1})\s*trans\.\/sec"
+ r1 = re.search(pattern_rr, threshold.lower())
+ if r1 is None:
+ return (False, "Invalid unit type in the throughput option")
+ threshold_rate = float(r1.group(1))
+ threshold_unit_size = ""
+ threshold_unit_type = "Trans./sec"
throughput_rate = float(r2.group(1))
"""
this part converts threshold and throughput rates to same format
user will get output in format specified in threshold option
if no threshold option is put in, default format is Mbits
"""
- if threshold_unit_size == 'k':
- throughput_rate *= 1000
- elif threshold_unit_size == 'g':
- throughput_rate /= 1000
- elif threshold_unit_size == 't':
- throughput_rate /= 1000 * 1000
- if threshold_unit_type == "bytes":
- throughput_rate /= 8
+ if (testname == "UDP_STREAM" or testname == "TCP_STREAM" or
+ testname == "SCTP_STREAM" or testname == "SCTP_STREAM_MANY"):
+ if threshold_unit_size == 'k':
+ throughput_rate *= 1000
+ elif threshold_unit_size == 'g':
+ throughput_rate /= 1000
+ elif threshold_unit_size == 't':
+ throughput_rate /= 1000 * 1000
+ if threshold_unit_type == "bytes":
+ throughput_rate /= 8
if threshold_rate > throughput_rate:
- return (False, "Measured rate (%s %s%s) is below threshold "\
+ return (False, "Measured rate (%s %s%s) is below threshold "
"(%s %s%s)!" % (throughput_rate,
threshold_unit_size.upper(),
threshold_unit_type,
@@ -114,7 +146,7 @@ class Netperf(TestGeneric):
threshold_unit_size.upper(),
threshold_unit_type))
else:
- return (True, "Measured rate (%s %s%s) is over threshold "\
+ return (True, "Measured rate (%s %s%s) is over threshold "
"(%s %s%s)." % (throughput_rate,
threshold_unit_size.upper(),
threshold_unit_type,
@@ -122,7 +154,11 @@ class Netperf(TestGeneric):
threshold_unit_size.upper(),
threshold_unit_type))
else:
- return (True, "Measured rate: %s Mbits" % r2.group(1))
+ if (testname == "TCP_RR" or testname == "UDP_RR" or
+ testname == "SCTP_RR"):
+ return (True, "Measured rate: %s Trans./sec" % r2.group(1))
+ else:
+ return (True, "Measured rate: %s Mbits/sec" % r2.group(1))
@@ -145,11 +181,11 @@ class Netperf(TestGeneric):
client.kill()
output = client.read_nonblocking()
if rv != 0:
- logging.info("Could not get performance throughput! Are you sure "\
- "netperf is installed on both machines and machines "\
+ logging.info("Could not get performance throughput! Are you sure "
+ "netperf is installed on both machines and machines "
"are mutually accessible?")
- return (False, "Could not get performance throughput! Are you "\
- "sure netperf is installed on both machines and "\
+ return (False, "Could not get performance throughput! Are you "
+ "sure netperf is installed on both machines and "
"machines are mutually accessible?")
return self._parse_output(self.get_opt("threshold"), output)
--
2.1.0
8 years, 10 months
[PATCH] Added missing ipv alias in phase2 tests
by Jiri Prochazka
Forgot to add ipv alias in some xml recipes. Fixed now
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
recipes/regression_tests/phase2/active_backup_double_team.xml | 3 +++
recipes/regression_tests/phase2/active_backup_team.xml | 3 +++
.../phase2/active_backup_team_vs_active_backup_bond.xml | 3 +++
.../regression_tests/phase2/active_backup_team_vs_round_robin_bond.xml | 3 +++
recipes/regression_tests/phase2/round_robin_double_team.xml | 3 +++
recipes/regression_tests/phase2/round_robin_team.xml | 3 +++
.../regression_tests/phase2/round_robin_team_vs_active_backup_bond.xml | 3 +++
.../regression_tests/phase2/round_robin_team_vs_round_robin_bond.xml | 3 +++
8 files changed, 24 insertions(+)
diff --git a/recipes/regression_tests/phase2/active_backup_double_team.xml b/recipes/regression_tests/phase2/active_backup_double_team.xml
index 9ecefe2..02c6bf6 100644
--- a/recipes/regression_tests/phase2/active_backup_double_team.xml
+++ b/recipes/regression_tests/phase2/active_backup_double_team.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/active_backup_team.xml b/recipes/regression_tests/phase2/active_backup_team.xml
index 15ad59a..c476c67 100644
--- a/recipes/regression_tests/phase2/active_backup_team.xml
+++ b/recipes/regression_tests/phase2/active_backup_team.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml b/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml
index 445123c..90cf9ef 100644
--- a/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml
+++ b/recipes/regression_tests/phase2/active_backup_team_vs_active_backup_bond.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/active_backup_team_vs_round_robin_bond.xml b/recipes/regression_tests/phase2/active_backup_team_vs_round_robin_bond.xml
index fc8a6a5..6d3d1b6 100644
--- a/recipes/regression_tests/phase2/active_backup_team_vs_round_robin_bond.xml
+++ b/recipes/regression_tests/phase2/active_backup_team_vs_round_robin_bond.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/round_robin_double_team.xml b/recipes/regression_tests/phase2/round_robin_double_team.xml
index 624d6c9..94eb6b5 100644
--- a/recipes/regression_tests/phase2/round_robin_double_team.xml
+++ b/recipes/regression_tests/phase2/round_robin_double_team.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/round_robin_team.xml b/recipes/regression_tests/phase2/round_robin_team.xml
index 030aaf4..f85a1b0 100644
--- a/recipes/regression_tests/phase2/round_robin_team.xml
+++ b/recipes/regression_tests/phase2/round_robin_team.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/round_robin_team_vs_active_backup_bond.xml b/recipes/regression_tests/phase2/round_robin_team_vs_active_backup_bond.xml
index c33414a..5562006 100644
--- a/recipes/regression_tests/phase2/round_robin_team_vs_active_backup_bond.xml
+++ b/recipes/regression_tests/phase2/round_robin_team_vs_active_backup_bond.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
diff --git a/recipes/regression_tests/phase2/round_robin_team_vs_round_robin_bond.xml b/recipes/regression_tests/phase2/round_robin_team_vs_round_robin_bond.xml
index 2641b0d..8ac5e69 100644
--- a/recipes/regression_tests/phase2/round_robin_team_vs_round_robin_bond.xml
+++ b/recipes/regression_tests/phase2/round_robin_team_vs_round_robin_bond.xml
@@ -1,4 +1,7 @@
<lnstrecipe>
+ <define>
+ <alias name="ipv" value="both" />
+ </define>
<network>
<host id="testmachine1">
<interfaces>
--
2.1.0
8 years, 10 months
[PATCH 1/3] Netperf error detection reworked
by Jiri Prochazka
Return value of client netperf is checked instead of output parsing and looking for error there.
Signed-off-by: Jiri Prochazka <jprochaz(a)redhat.com>
---
test_modules/Netperf.py | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
index 09bb8f0..fba6213 100644
--- a/test_modules/Netperf.py
+++ b/test_modules/Netperf.py
@@ -73,24 +73,14 @@ class Netperf(TestGeneric):
return cmd
def _parse_output(self, threshold, output):
- # pattern for throughput output
- pattern2 = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
+ # pattern for tcp throughput output
+ pattern_tcp = "\d+\s+\d+\s+\d+\s+\d+\.\d+\s+(\d+(\.\d+){0,1})"
# pattern for udp throughput output
- pattern3 = "\d+\s+\d+\s+\d+\.\d+\s+\d+\s+\d+\s+(\d+(\.\d+){0,1})"
+ pattern_udp = "\d+\s+\d+\s+\d+\.\d+\s+\d+\s+\d+\s+(\d+(\.\d+){0,1})"
if self.get_opt("testname") == "UDP_STREAM":
- r2 = re.search(pattern3, output.lower())
+ r2 = re.search(pattern_udp, output.lower())
else:
- r2 = re.search(pattern2, output.lower())
- if r2 is None:
- """
- throughput was not found, end test with failure
- """
- logging.info("Could not get performance throughput! Are you sure "\
- "netperf is installed on both machines and machines "\
- "are mutually accessible?")
- return (False, "Could not get performance throughput! Are you "\
- "sure netperf is installed on both machines and "\
- "machines are mutually accessible?")
+ r2 = re.search(pattern_tcp, output.lower())
if threshold is not None:
# pattern for threshold
# group(1) ... threshold value
@@ -149,11 +139,18 @@ class Netperf(TestGeneric):
logging.debug("running as client...")
client = ShellProcess(cmd)
try:
- client.wait()
+ rv = client.wait()
except OSError as e:
if e.errno == errno.EINTR:
client.kill()
output = client.read_nonblocking()
+ if rv != 0:
+ logging.info("Could not get performance throughput! Are you sure "\
+ "netperf is installed on both machines and machines "\
+ "are mutually accessible?")
+ return (False, "Could not get performance throughput! Are you "\
+ "sure netperf is installed on both machines and "\
+ "machines are mutually accessible?")
return self._parse_output(self.get_opt("threshold"), output)
def run(self):
--
2.1.0
8 years, 10 months