From: Ondrej Lichtner <olichtne(a)redhat.com>
The refactoring of this python task is just using the new update_options
method of a ModuleAPI object and reusing the same object for multiple
command runs.
The task will also attempt to store Netperf results in the PerfRepo
database, based on the test id mapping present in the 3_vlans.mapping
file that you need to create locally, since this file can contain
different information based on who's running the test it's not included
in this commit. Instead here's an example that I currently use:
tcp_ipv4 = tcp_ipv4
tcp_ipv6 = tcp_ipv6
udp_ipv4 = udp_ipv4
udp_ipv6 = udp_ipv6
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/regression_tests/phase1/3_vlans.py | 212 ++++++++++++++++++-----------
1 file changed, 136 insertions(+), 76 deletions(-)
diff --git a/recipes/regression_tests/phase1/3_vlans.py
b/recipes/regression_tests/phase1/3_vlans.py
index 7e79a9f..c2b3a74 100644
--- a/recipes/regression_tests/phase1/3_vlans.py
+++ b/recipes/regression_tests/phase1/3_vlans.py
@@ -1,9 +1,13 @@
from lnst.Controller.Task import ctl
+from lnst.Controller.PerfRepoUtils import parse_id_mapping
# ------
# SETUP
# ------
+perf_api = ctl.connect_PerfRepo()
+mapping = parse_id_mapping('3_vlans.mapping')
+
m1 = ctl.get_host("testmachine1")
m2 = ctl.get_host("testmachine2")
@@ -33,80 +37,76 @@ for vlan in vlans:
ctl.wait(15)
+ping_mod = ctl.get_module("IcmpPing",
+ options={
+ "count" : 100,
+ "interval" : 0.1
+ })
+ping_mod6 = ctl.get_module("Icmp6Ping",
+ options={
+ "count" : 100,
+ "interval" : 0.1
+ })
+netperf_srv = ctl.get_module("Netperf",
+ options={
+ "role" : "server"
+ })
+netperf_srv6 = ctl.get_module("Netperf",
+ options={
+ "role" : "server",
+ "netperf_opts" : " -6"
+ })
+netperf_cli_tcp = ctl.get_module("Netperf",
+ options={
+ "role" : "client",
+ "runs": 3,
+ "duration" : 20,
+ "testname" : "TCP_STREAM"
+ })
+netperf_cli_udp = ctl.get_module("Netperf",
+ options={
+ "role" : "client",
+ "runs": 3,
+ "duration" : 20,
+ "testname" : "UDP_STREAM"
+ })
+netperf_cli_tcp6 = ctl.get_module("Netperf",
+ options={
+ "role" : "client",
+ "runs": 3,
+ "duration" : 20,
+ "testname" : "TCP_STREAM"
+ })
+netperf_cli_udp6 = ctl.get_module("Netperf",
+ options={
+ "role" : "client",
+ "runs": 3,
+ "duration" : 20,
+ "testname" : "UDP_STREAM"
+ })
for vlan1 in vlans:
for vlan2 in vlans:
- ping_mod = ctl.get_module("IcmpPing",
- options={
- "addr" : m2.get_ip(vlan2, 0),
- "count" : 100,
- "iface" : m1.get_devname(vlan1),
- "interval" : 0.1
- })
-
- ping_mod6 = ctl.get_module("Icmp6Ping",
- options={
- "addr" : m2.get_ip(vlan2, 1),
- "count" : 100,
- "iface" : m1.get_ip(vlan1, 1),
- "interval" : 0.1
- })
-
- netperf_srv = ctl.get_module("Netperf",
- options={
- "role" : "server",
- "bind" : m1.get_ip(vlan1, 0),
- })
-
- netperf_srv6 = ctl.get_module("Netperf",
- options={
- "role" : "server",
- "bind" : m1.get_ip(vlan1, 1),
- "netperf_opts" : " -6",
- })
-
- netperf_cli_tcp = ctl.get_module("Netperf",
- options={
- "role" : "client",
- "netperf_server" :
- m1.get_ip(vlan1, 0),
- "duration" : 60,
- "testname" :
"TCP_STREAM",
- "netperf_opts" :
- "-L %s" % m2.get_ip(vlan1)
- })
-
- netperf_cli_udp = ctl.get_module("Netperf",
- options={
- "role" : "client",
- "netperf_server" :
- m1.get_ip(vlan1, 0),
- "duration" : 60,
- "testname" :
"UDP_STREAM",
- "netperf_opts" :
- "-L %s" % m2.get_ip(vlan1)
- })
-
- netperf_cli_tcp6 = ctl.get_module("Netperf",
- options={
- "role" : "client",
- "netperf_server" :
- m1.get_ip(vlan1, 1),
- "duration" : 60,
- "testname" :
"TCP_STREAM",
- "netperf_opts" :
- "-L %s -6" % m2.get_ip(vlan1,
1)
- })
-
- netperf_cli_udp6 = ctl.get_module("Netperf",
- options={
- "role" : "client",
- "netperf_server" :
- m1.get_ip(vlan1, 1),
- "duration" : 60,
- "testname" :
"UDP_STREAM",
- "netperf_opts" :
- "-L %s -6" % m2.get_ip(vlan1,
1)
- })
+ ping_mod.update_options({"addr": m2.get_ip(vlan2, 0),
+ "iface": m1.get_devname(vlan1)})
+
+ ping_mod6.update_options({"addr": m2.get_ip(vlan2, 1),
+ "iface": m1.get_ip(vlan1, 1)})
+
+ netperf_srv.update_options({"bind": m1.get_ip(vlan1, 0)})
+
+ netperf_srv6.update_options({"bind": m1.get_ip(vlan1, 1)})
+
+ netperf_cli_tcp.update_options({"netperf_server": m1.get_ip(vlan1, 0),
+ "netperf_opts": "-L %s" %
m2.get_ip(vlan1)})
+
+ netperf_cli_udp.update_options({"netperf_server": m1.get_ip(vlan1, 0),
+ "netperf_opts": "-L %s" %
m2.get_ip(vlan1)})
+
+ netperf_cli_tcp6.update_options({"netperf_server": m1.get_ip(vlan1,
1),
+ "netperf_opts": "-L %s -6" %
m2.get_ip(vlan1, 1)})
+
+ netperf_cli_udp6.update_options({"netperf_server": m1.get_ip(vlan1,
1),
+ "netperf_opts": "-L %s -6" %
m2.get_ip(vlan1, 1)})
if vlan1 == vlan2:
# These tests should pass
@@ -125,10 +125,40 @@ for vlan1 in vlans:
# Netperf test (both TCP and UDP)
srv_proc = m1.run(netperf_srv, bg=True)
ctl.wait(2)
- m2.run(netperf_cli_tcp, timeout=70)
- m2.run(netperf_cli_udp, timeout=70)
+ result_tcp = m2.run(netperf_cli_tcp, timeout=80)
+ result_udp = m2.run(netperf_cli_udp, timeout=80)
srv_proc.intr()
+ if result_tcp.get_result() is not None and\
+ result_tcp.get_result()['res_data'] is not None:
+ rate =
result_tcp.get_result()['res_data']['rate']
+ deviation =
result_tcp.get_result()['res_data']['rate_std_deviation']
+ result = perf_api.new_result(mapping["tcp_ipv4"],
'result')
+ result.add_value('throughput', rate)
+ result.add_value('throughput_min', rate - deviation)
+ result.add_value('throughput_max', rate + deviation)
+ result.add_value('throughput_std_deviation',
deviation)
+ result.set_parameter(offload, state)
+ result.set_parameter('netperf_server_on_vlan',
vlan1)
+ result.set_parameter('netperf_client_on_vlan',
vlan2)
+ result.set_tag(result.generate_hash())
+ perf_api.save_result(result)
+
+ if result_udp.get_result() is not None and\
+ result_udp.get_result()['res_data'] is not None:
+ rate =
result_udp.get_result()['res_data']['rate']
+ deviation =
result_udp.get_result()['res_data']['rate_std_deviation']
+ result = perf_api.new_result(mapping["udp_ipv4"],
'result')
+ result.add_value('throughput', rate)
+ result.add_value('throughput_min', rate - deviation)
+ result.add_value('throughput_max', rate + deviation)
+ result.add_value('throughput_std_deviation',
deviation)
+ result.set_parameter(offload, state)
+ result.set_parameter('netperf_server_on_vlan',
vlan1)
+ result.set_parameter('netperf_client_on_vlan',
vlan2)
+ result.set_tag(result.generate_hash())
+ perf_api.save_result(result)
+
if ipv in [ 'ipv6', 'both' ]:
# Ping test
m1.run(ping_mod6)
@@ -136,10 +166,40 @@ for vlan1 in vlans:
# Netperf test (both TCP and UDP)
srv_proc = m1.run(netperf_srv6, bg=True)
ctl.wait(2)
- m2.run(netperf_cli_tcp6, timeout=70)
- m2.run(netperf_cli_udp6, timeout=70)
+ result_tcp = m2.run(netperf_cli_tcp6, timeout=80)
+ result_udp = m2.run(netperf_cli_udp6, timeout=80)
srv_proc.intr()
+ if result_tcp.get_result() is not None and\
+ result_tcp.get_result()['res_data'] is not None:
+ rate =
result_tcp.get_result()['res_data']['rate']
+ deviation =
result_tcp.get_result()['res_data']['rate_std_deviation']
+ result = perf_api.new_result(mapping["tcp_ipv6"],
'result')
+ result.add_value('throughput', rate)
+ result.add_value('throughput_min', rate - deviation)
+ result.add_value('throughput_max', rate + deviation)
+ result.add_value('throughput_std_deviation',
deviation)
+ result.set_parameter(offload, state)
+ result.set_parameter('netperf_server_on_vlan',
vlan1)
+ result.set_parameter('netperf_client_on_vlan',
vlan2)
+ result.set_tag(result.generate_hash())
+ perf_api.save_result(result)
+
+ if result_udp.get_result() is not None and\
+ result_udp.get_result()['res_data'] is not None:
+ rate =
result_udp.get_result()['res_data']['rate']
+ deviation =
result_udp.get_result()['res_data']['rate_std_deviation']
+ result = perf_api.new_result(mapping["udp_ipv6"],
'result')
+ result.add_value('throughput', rate)
+ result.add_value('throughput_min', rate - deviation)
+ result.add_value('throughput_max', rate + deviation)
+ result.add_value('throughput_std_deviation',
deviation)
+ result.set_parameter(offload, state)
+ result.set_parameter('netperf_server_on_vlan',
vlan1)
+ result.set_parameter('netperf_client_on_vlan',
vlan2)
+ result.set_tag(result.generate_hash())
+ perf_api.save_result(result)
+
# These tests should fail
# Ping across different VLAN
else:
--
2.1.0