summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--validation/test/P2P_throughput/P2P_throughput.py18
-rw-r--r--validation/test/P2P_throughput/config.py9
-rw-r--r--validation/validlib/iperf.py98
3 files changed, 53 insertions, 72 deletions
diff --git a/validation/test/P2P_throughput/P2P_throughput.py b/validation/test/P2P_throughput/P2P_throughput.py
index 8c860b2f8e..e13714f877 100644
--- a/validation/test/P2P_throughput/P2P_throughput.py
+++ b/validation/test/P2P_throughput/P2P_throughput.py
@@ -176,9 +176,11 @@ def check_config_aux(attenuation_offset, attenuation_range_db,
#We check that the attenuation is in the attenuation range
#of the attenuator
assert attenuation_db <= max_attenuation_db, \
- ("Attenuation too high", test_value)
+ ("Attenuation too high", test_value, attenuation_offset, \
+ max_attenuation_db)
assert attenuation_db >= min_attenuation_db, \
- ("Attenuation too low", test_value)
+ ("Attenuation too low", test_value, attenuation_offset, \
+ min_attenuation_db)
if test_type == "SNR":
#We check here that the values of SNR are consistent with the
#output power range of the waveform generator
@@ -186,9 +188,9 @@ def check_config_aux(attenuation_offset, attenuation_range_db,
for test_value in test_values:
power_dbm = snr_offset_db - test_value
assert power_dbm <= max_power_dbm, \
- ("SNR too low", test_value)
+ ("SNR too low", snr_offset_db, test_value, max_power_dbm)
assert power_dbm >= min_power_dbm, \
- ("SNR too high", test_value)
+ ("SNR too high", snr_offset_db, test_value, min_power_dbm)
assert test_params == None
elif test_type == "SJR":
#Because of sjr_attenuator_attenuation_db, the bench is not
@@ -207,9 +209,9 @@ def check_config_aux(attenuation_offset, attenuation_range_db,
power_dbm = sjr_offset_db - test_value
(min_power_dbm, max_power_dbm) = power_range_dbm
assert power_dbm <= max_power_dbm, \
- ("SJR too low", test_value)
+ ("SJR too low", sjr_offset_db, test_value, max_power_dbm)
assert power_dbm >= min_power_dbm, \
- ("SJR too high", test_value)
+ ("SJR too high", sjr_offset_db, test_value, min_power_dbm)
elif test_type == "dynamic_jammer":
assert test_values == ["time"]
(min_attenuation_db, max_attenuation_db) = attenuation_range_db
@@ -224,9 +226,9 @@ def check_config_aux(attenuation_offset, attenuation_range_db,
#output power range of the waveform generator
(min_power_dbm, max_power_dbm) = power_range_dbm
assert power_dbm <= max_power_dbm, \
- ("SJR too low", test_value)
+ ("SJR too low", sjr_offset_db, test_params[0], max_power_dbm)
assert power_dbm >= min_power_dbm, \
- ("SJR too high", test_value)
+ ("SJR too high", sjr_offset_db, test_params[0], min_power_dbm)
else:
assert test_params == None, test_params
diff --git a/validation/test/P2P_throughput/config.py b/validation/test/P2P_throughput/config.py
index fbe65c7757..5a945ed56b 100644
--- a/validation/test/P2P_throughput/config.py
+++ b/validation/test/P2P_throughput/config.py
@@ -30,7 +30,7 @@
#see iperf.measurement_specs() for the meaning of the values
"curves":["a_b_uni", "b_a_uni", "bi"]},
"SNR": {
- "values":numpy.arange(40, -10, -5).tolist(),
+ "values":numpy.arange(35, -10, -5).tolist(),
"duration_s":20,
#["a_b_uni"|"b_a_uni"|"bi"]
#see iperf.measurement_specs() for the meaning of the values
@@ -68,7 +68,6 @@
"dynamic_jammer":{
#Must be ["time"]
"values":["time"],
- #Must be seconds
"duration_s":15,
#["a_b_uni"|"b_a_uni"|"bi"]
#see iperf.measurement_specs() for the meaning of the values
@@ -93,7 +92,7 @@
("UDP", "SJR", (26, ("SINusoid", 1, 80))),
("UDP", "SJR", (27.345, ("SINusoid", 1, 80))),
("UDP", "frame_size", None),
- ("UDP", "dynamic_jammer", (10, 2, 30, 60)),
+ ("UDP", "dynamic_jammer", (5, 2, 30, 60)),
("UDP", "dynamic_jammer", (0, 2, 30, 60)),
("UDP", "dynamic_jammer", (-10, 2, 30, 60)),
("UDP", "dynamic_jammer", (-20, 2, 30, 60)),
@@ -116,8 +115,8 @@
#would not be impacted without noise. This value should be deduced from
#the results obtained in the 'attenuation' test. If the curve starts going
#down at 55 dB and if the minimal attenuation of the bench is 38,
- #sjr_attenuator_attenuation_db must be to a value lower than
- #(55 - 38) dB = 17 dB and greater than 0 dB, as long as these values are in
+ #sjr_attenuator_attenuation_db must be set to a value lower than
+ #(55 - 38) dB = 17 dB and greater than 0 dB, as long as these values are
#compatible with the range of attenuation of the variable attenuator.
"sjr_attenuator_attenuation_db": 29,
#Attenuation of each AMN
diff --git a/validation/validlib/iperf.py b/validation/validlib/iperf.py
index b972d6528d..d078c23bbc 100644
--- a/validation/validlib/iperf.py
+++ b/validation/validlib/iperf.py
@@ -46,8 +46,6 @@ columns_nb_for_parameter_values = 3.0
throughput_suffix_file_name = "Throughput"
#Suffix used for the ce statistics measurement file name
ce_suffix_file_name = "CE_stats"
-#Tokens
-tokens = None
#String displayed for the maximum throughput test
str_max_throughput = "Maximum throughput"
@@ -59,45 +57,29 @@ def update_config(new_config):
has_mstar_plugs()
def check_tokens():
- global tokens
- if tokens is None:
- check_token("host_a")
- check_token("host_b")
- tokens = True
-
-def check_token(host):
- user = config[host]["user"]
- non_plc_ip_address = config[host]["non_plc_ip_address"]
- host_token.check(user, non_plc_ip_address)
+ for host in ["host_a", "host_b"]:
+ user = config[host]["user"]
+ non_plc_ip_address = config[host]["non_plc_ip_address"]
+ host_token.check(user, non_plc_ip_address)
def clear_tokens():
- clear_token("host_a")
- clear_token("host_b")
-
-def clear_token(host):
- user = config[host]["user"]
- non_plc_ip_address = config[host]["non_plc_ip_address"]
- host_token.clear(user, non_plc_ip_address)
+ for host in ["host_a", "host_b"]:
+ user = config[host]["user"]
+ non_plc_ip_address = config[host]["non_plc_ip_address"]
+ host_token.clear(user, non_plc_ip_address)
def set_tokens():
- set_token("host_a")
- set_token("host_b")
-
-def set_token(host):
- user = config[host]["user"]
- non_plc_ip_address = config[host]["non_plc_ip_address"]
- host_token.set(user, non_plc_ip_address)
+ for host in ["host_a", "host_b"]:
+ user = config[host]["user"]
+ non_plc_ip_address = config[host]["non_plc_ip_address"]
+ host_token.set(user, non_plc_ip_address)
def switch_on_plugs():
- """Switch on the plugs connected to the two hosts"""
- switch_on_plug("host_a")
- switch_on_plug("host_b")
-
-def switch_on_plug(host):
- """Switch on the plug connected to a host and erase the traces file"""
- key = config[host]["power_strip_key"]
- plug.switch_on(key)
- clean_trace(host)
+ """Switch on the plugs and erase the traces files"""
+ for host in ["host_a", "host_b"]:
+ key = config[host]["power_strip_key"]
+ plug.switch_on(key)
+ clean_trace(host)
def bench_data():
return dict(non_plc_ip_address_a = non_plc_ip_address("host_a"),
@@ -137,13 +119,10 @@ def clean_trace(host):
def check_traces():
"""Check the files containing the traces on the two hosts"""
- check_trace("host_a")
- check_trace("host_b")
-
-def check_trace(host):
- if has_mstar_plug(host):
- key = config[host]["power_strip_key"]
- assert False == spc300.trace_is_present(key, 0), host
+ for host in ["host_a", "host_b"]:
+ if has_mstar_plug(host):
+ key = config[host]["power_strip_key"]
+ assert False == spc300.trace_is_present(key, 0), host
def has_mstar_plugs():
has_mstar_plug("host_a")
@@ -155,18 +134,15 @@ def has_mstar_plug(host):
def kill_iperfs():
"""Kill iperf on the two hosts"""
- kill_iperf("host_a")
- kill_iperf("host_b")
-
-def kill_iperf(host):
- tries_nb = 5
- iperf_is_dead = False
- while (iperf_is_dead == False and tries_nb > 0):
- check_output(host, "killall iperf 2>/dev/null")
- time.sleep(1)
- iperf_is_dead = (check_output(host, "pgrep iperf") == "")
- tries_nb = tries_nb - 1
- assert tries_nb > 0, ("Failed to kill iperf", host)
+ for host in ["host_a", "host_b"]:
+ tries_nb = 5
+ iperf_is_dead = False
+ while (iperf_is_dead == False and tries_nb > 0):
+ check_output(host, "killall iperf 2>/dev/null")
+ time.sleep(1)
+ iperf_is_dead = (check_output(host, "pgrep iperf") == "")
+ tries_nb = tries_nb - 1
+ assert tries_nb > 0, ("Failed to kill iperf", host)
def update_tone_maps(time_s, ping = False):
"""Update the tone maps on the plugs once the channel has changed.
@@ -177,10 +153,8 @@ def update_tone_maps(time_s, ping = False):
period_s = 0.2
count = float(time_s)/period_s
arguments = " -i" + str(period_s) + " -c" + str(count)+ "-s 1500"
- p_a_b = Popen("host_a", "ping " + plc_address_b + arguments)
- p_b_a = Popen("host_b", "ping " + plc_address_a + arguments)
- p_a_b.communicate()
- p_b_a.communicate()
+ call("host_a", "ping " + plc_address_b + arguments)
+ call("host_b", "ping " + plc_address_a + arguments)
else:
udp_parameters = ((default_frame_size, 103), (default_frame_size, 88))
make_measurement("UDP", udp_parameters, time_s, ["bi"], None, False)
@@ -649,11 +623,17 @@ def check_output(host, command):
return ssh.check_output(user, non_plc_ip_address, command)
def Popen(host, command):
- """Execute a command on a host"""
+ """Returns a process executing a command on a host"""
non_plc_ip_address = config[host]["non_plc_ip_address"]
user = config[host]["user"]
return ssh.Popen(user, non_plc_ip_address, command)
+def call(host, command):
+ """Execute a command on a host and returns"""
+ non_plc_ip_address = config[host]["non_plc_ip_address"]
+ user = config[host]["user"]
+ return ssh.call(user, non_plc_ip_address, command)
+
def overhead():
'''Size of the UDP and Ethernet headers in an Ethernet frame'''
ethernet_header_length = 18.0