summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dufour2013-06-27 11:03:27 +0200
committerOlivier Dufour2013-06-27 11:06:46 +0200
commit8356c68b185a14bb468ea07b8d22ce7e75922459 (patch)
tree6f0e20d7215fae36ac1b56fa2bfd5087dd6299a1
parent14f804d318ea50dc4c356f0b2e7057802f6735ce (diff)
parent85dd9997dc38081d08c3e73110d901546c12748f (diff)
Merge branch 'improve-av-home' into eoc-improve-av-home
-rwxr-xr-xvalidation/test/av_home/av_home.py117
-rwxr-xr-xvalidation/test/av_home/av_mme.py46
2 files changed, 120 insertions, 43 deletions
diff --git a/validation/test/av_home/av_home.py b/validation/test/av_home/av_home.py
index 13b15b992a..10e30e3eff 100755
--- a/validation/test/av_home/av_home.py
+++ b/validation/test/av_home/av_home.py
@@ -138,7 +138,10 @@ def iperf_client_run ():
def prepare_points (mode):
# Get min and max value from server logs
- f = open (os.path.join (av_home_attr.output_dir, "server_log"), "r")
+ try:
+ f = open (os.path.join (av_home_attr.output_dir, "server_log"), "r")
+ except IOError:
+ return
lines = f.readlines ()
minimum = 0
maximum = 0
@@ -173,7 +176,10 @@ def prepare_points (mode):
print >> f, s
f.close ()
# Prepare tonemap points
- f = open (os.path.join (av_home_attr.output_dir, "tonemap"), "r")
+ try:
+ f = open (os.path.join (av_home_attr.output_dir, "tonemap"), "r")
+ except IOError:
+ return
lines = f.readlines ()[2:]
s = ""
for l in lines:
@@ -187,7 +193,10 @@ def prepare_points (mode):
def get_general_result (mode):
# Get average up and down throughput
- f = open (os.path.join (av_home_attr.output_dir, "server_log"), "r")
+ try:
+ f = open (os.path.join (av_home_attr.output_dir, "server_log"), "r")
+ except IOError:
+ return
lines = f.readlines ()
result_re = re.compile (r"^.* 0\.0-[0-9]+\.[0-9].* ([0-9]+.*) Mbits/sec")
avg = ""
@@ -201,7 +210,10 @@ def get_general_result (mode):
else:
print "Average download throughput: %s Mbps" % avg
f.close ()
- f = open (os.path.join (av_home_attr.output_dir, "client_log"), "r")
+ try:
+ f = open (os.path.join (av_home_attr.output_dir, "client_log"), "r")
+ except IOError:
+ return
lines = f.readlines ()
server_re = re.compile(r".*Server Report.*")
avg = ""
@@ -226,7 +238,10 @@ def get_general_result (mode):
if c == '0':
available_carrier += 1
f.close ()
- f = open (os.path.join (av_home_attr.output_dir, "tonemap-%s_plot" % mode), "r")
+ try:
+ f = open (os.path.join (av_home_attr.output_dir, "tonemap-%s_plot" % mode), "r")
+ except IOError:
+ return
line = f.readlines ()[0]
f.close ()
mod_list = [0, 0, 0, 0, 0, 0, 0, 0]
@@ -245,8 +260,11 @@ def get_general_result (mode):
7: "1024-QAM" }
print "Using %d carriers on %d (%d%%)" % (nb_carrier, available_carrier, (nb_carrier * 100) / available_carrier)
avg_str = "%f bits per symbol" % (float(bit_value) / float(available_carrier))
- f = open (os.path.join (av_home_attr.output_dir, "tonemap"), "r")
- fec = f.readlines ()[0]
+ try:
+ f = open (os.path.join (av_home_attr.output_dir, "tonemap"), "r")
+ except IOError:
+ return
+ fec = int (f.readlines ()[0])
if fec == 1:
fec_str = "FEC 16/21"
else:
@@ -285,10 +303,19 @@ def prepare_plot ():
def do_plot (direction, directory):
import pylab
- if direction == "rx":
- f = open (os.path.join (av_home_attr.prefix, directory, "master_plot"), "r")
- else:
- f = open (os.path.join (av_home_attr.prefix, directory, "slave_plot"), "r")
+ try:
+ if direction == "rx":
+ f = open (os.path.join (av_home_attr.prefix,
+ directory,
+ "master_plot"),
+ "r")
+ else:
+ f = open (os.path.join (av_home_attr.prefix,
+ directory,
+ "slave_plot"),
+ "r")
+ except IOError:
+ return
lines = f.readlines ()
maximum = 0
minimum = 0
@@ -314,10 +341,19 @@ def do_plot (direction, directory):
pylab.gcf().savefig (os.path.join (av_home_attr.prefix, directory, "master-%s.png" % direction))
pylab.clf()
f.close ()
- if direction == "rx":
- f = open (os.path.join (av_home_attr.prefix, directory, "tonemap-slave_plot"), "r")
- else:
- f = open (os.path.join (av_home_attr.prefix, directory, "tonemap-master_plot"), "r")
+ try:
+ if direction == "rx":
+ f = open (os.path.join (av_home_attr.prefix,
+ directory,
+ "tonemap-slave_plot"),
+ "r")
+ else:
+ f = open (os.path.join (av_home_attr.prefix,
+ directory,
+ "tonemap-master_plot"),
+ "r")
+ except IOError:
+ return
lines = f.readlines ()[0]
x = [ j for j in xrange (1536)]
y = [ lines[j] for j in xrange (1536)]
@@ -406,36 +442,49 @@ def get_name (name):
return result + "\n" + underline
def get_field (d, file):
- f = open (os.path.join (av_home_attr.prefix, d, "%s-master" % file), "r")
- value = f.read ()
- f.close ()
- f = open (os.path.join (av_home_attr.prefix, d, "%s-slave" % file), "r")
- value += f.read ()
- f.close ()
+ try:
+ f = open (os.path.join (av_home_attr.prefix, d, "%s-master" % file), "r")
+ value = f.read ()
+ f.close ()
+ f = open (os.path.join (av_home_attr.prefix, d, "%s-slave" % file), "r")
+ value += f.read ()
+ f.close ()
+ except IOError:
+ return "Data missing ..."
return value
def get_graph (d):
tpl = """
Upload:
-.. image:: {upload}
-.. image:: {tx}
+{upload}
+
+{tx}
Download:
-.. image:: {download}
-.. image:: {rx}
+{download}
+
+{rx}
"""
- upload = "%s/master-tx.png" % d
- download = "%s/master-rx.png" % d
- tx = "%s/tonemap-tx.png" % d
- rx = "%s/tonemap-rx.png" % d
-
- return tpl.format (upload = upload,
- download = download,
- tx = tx,
- rx = rx)
+ images = [ "master-tx.png",
+ "master-rx.png",
+ "tonemap-tx.png",
+ "tonemap-rx.png" ]
+ paths = {}
+ for img in images:
+ try:
+ f = open ("%s/%s" % (d, img), "r")
+ f.close ()
+ paths[img] = ".. image:: %s/%s" % (d, img)
+ except IOError:
+ paths[img] = "Data missing ..."
+
+ return tpl.format (upload = paths["master-tx.png"],
+ download = paths["master-rx.png"],
+ tx = paths["tonemap-tx.png"],
+ rx = paths["tonemap-rx.png"])
def generate_report ():
f = open (os.path.join (av_home_attr.prefix, "template.rst"), "r")
diff --git a/validation/test/av_home/av_mme.py b/validation/test/av_home/av_mme.py
index 97a6b78ebf..9b59b7c428 100755
--- a/validation/test/av_home/av_mme.py
+++ b/validation/test/av_home/av_mme.py
@@ -117,7 +117,7 @@ def process_tonemap (tm):
def process_version (ans, mode):
from vs import VS_GET_VERSION_CNF
- f = open ("soft_version-%s" % mode, "w")
+ f = open (os.path.join (av_home_attr.prefix, "soft_version-%s" % mode), "w")
soft = """
Firmware version of {mac}:
@@ -138,28 +138,40 @@ def process_discovery (ans, mode):
discover = """
List of stations for {plug}:
-+-------------------+------+-----+
-| MAC | SNID | TEI |
-+-------------------+------+-----+
{stations}
List of neighbor networks for {plug}:
-+-------------------+------+
-| NID | SNID |
-+-------------------+------+
{networks}
"""
stations = ""
networks = ""
if ans[CC_DISCOVER_LIST_CNF].num_station != 0:
+ stations = """Total: {n} station(s)
+
++-------------------+------------+------+-----+
+| MAC | Vendor | SNID | TEI |
++-------------------+------------+------+-----+
+"""
for e in ans[CC_DISCOVER_LIST_CNF].stations:
- stations += "| %s | %02d | %03d |\n" % (e.mac, int (e.snid), int (e.tei))
- stations += "+-------------------+------+-----+\n"
+ stations += "| %s | %10s | %02d | %03d |\n" % (e.mac, get_vendor (e.mac), int (e.snid), int (e.tei))
+ stations += "+-------------------+------------+------+-----+\n"
+ stations = stations.format (n = ans[CC_DISCOVER_LIST_CNF].num_station)
+ else:
+ stations = "No neighbor station discovered."
if ans[CC_DISCOVER_LIST_CNF].num_network != 0:
+ networks = """Total: {n} network(s)
+
++-------------------+------+
+| NID | SNID |
++-------------------+------+
+"""
for e in ans[CC_DISCOVER_LIST_CNF].networks:
networks += "| %16s | %02d |\n" % (e.nid, int (e.snid))
networks += "+-------------------+------+\n"
+ networks = networks.format (n = ans[CC_DISCOVER_LIST_CNF].num_network)
+ else:
+ networks = "No neighbor network discovered."
discover = discover.format (plug = av_home_attr.plug_mac,
stations = stations,
networks = networks)
@@ -214,3 +226,19 @@ Attenuation for {plug}:
attenuations = attenuations)
print >>f, attenuation,
f.close ()
+
+def get_vendor (mac):
+ vendor = {
+ "00:13:d7": "Spicdom",
+ "bc:f2:af": "Devolo AG",
+ "00:0b:3b": "Devolo AG",
+ "00:0c:b9": "LEA",
+ "00:22:75": "Belkin",
+ "00:07:cb": "Freebox",
+ "00:24:d4": "Freebox",
+ "14:0c:76": "Freebox"
+ }
+ if mac[:8] in vendor:
+ return vendor[mac[:8]]
+ else:
+ return "Unknown"