summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dufour2013-03-28 14:45:49 +0100
committerOlivier Dufour2013-04-23 15:18:04 +0200
commit231e0f82773ee5a5ce4d722531447025b21be8eb (patch)
treef2dbb463e941f2e7285983b857a23f8da112c778
parent0b364f231888b7d3ed1b60f5f33d89bcc433f3e5 (diff)
validation/test/av_home: store MME data in RST files, refs #3845
-rwxr-xr-xvalidation/test/av_home/av_home.py4
-rwxr-xr-xvalidation/test/av_home/av_mme.py114
2 files changed, 109 insertions, 9 deletions
diff --git a/validation/test/av_home/av_home.py b/validation/test/av_home/av_home.py
index 8148796f14..6768a801d7 100755
--- a/validation/test/av_home/av_home.py
+++ b/validation/test/av_home/av_home.py
@@ -16,7 +16,7 @@ def master_script():
av_mme.ping_peer ()
print ("Sending MME for environment discovery to " + av_home_attr.plug_mac +
" through " + av_home_attr.iface + " ...")
- av_mme.get_network_env()
+ av_mme.get_network_env("master")
raw_input ("Press enter when slave script has been launched")
print ("Executing upload iperf test on " + av_home_attr.addr + " ...")
iperf_client_run ()
@@ -34,7 +34,7 @@ def slave_script():
av_mme.ping_peer ()
print ("Sending MME for environment discovery to " + av_home_attr.plug_mac +
" through " + av_home_attr.iface + " ...")
- av_mme.get_network_env()
+ av_mme.get_network_env("slave")
print ("Starting iperf server...")
server = iperf_server_spawn ()
raw_input ("Press enter when master script has finished upload iperf test")
diff --git a/validation/test/av_home/av_mme.py b/validation/test/av_home/av_mme.py
index 3a1bdf7765..ad80ef42ab 100755
--- a/validation/test/av_home/av_mme.py
+++ b/validation/test/av_home/av_mme.py
@@ -9,7 +9,7 @@ def srmme (src, dst, iface, payload):
mme = Ether (src = src, dst = dst) / MME () / payload
return srp1 (mme, iface = iface)
-def get_network_env():
+def get_network_env(mode):
sys.path.append (av_home_attr.scammer_path)
from cc import CC_DISCOVER_LIST_REQ, CC_DISCOVER_LIST_CNF
from cm import CM_NW_INFO_REQ, CM_NW_INFO_CNF
@@ -20,19 +20,19 @@ def get_network_env():
from vs import VS_GET_TONEMAP_REQ
from vs import VS_GET_TONEMAP_CNF
- mme_list = [ VS_GET_VERSION_REQ (),
- CC_DISCOVER_LIST_REQ (),
- CM_NW_INFO_REQ (),
- VS_GET_ATTENUATION_LIST_REQ ()
+ mme_list = [ [ VS_GET_VERSION_REQ (), process_version ],
+ [ CC_DISCOVER_LIST_REQ (), process_discovery ],
+ [ CM_NW_INFO_REQ (), process_avln ],
+ [ VS_GET_ATTENUATION_LIST_REQ (), process_attenuation ],
]
for mme in mme_list:
ans = srmme (av_home_attr.source_mac,
av_home_attr.plug_mac,
av_home_attr.iface,
- mme)
+ mme[0])
if ans:
- ans.show ()
+ mme[1] (ans, mode)
ans = srmme (av_home_attr.source_mac,
av_home_attr.plug_mac,
@@ -64,3 +64,103 @@ def process_tonemap (tm):
if (i % 16) == 15:
print >> f, " "
f.close ()
+
+def process_version (ans, mode):
+ from vs import VS_GET_VERSION_CNF
+ f = open ("soft_version-%s" % mode, "w")
+ soft = """
+Firmware version of {mac}:
+
+::
+
+ PLC Driver: {linux}
+ PLC Firmware: {driver}
+"""
+ soft = soft.format (mac = ans[Ether].src,
+ linux = ans[VS_GET_VERSION_CNF].applicative_version,
+ driver = ans[VS_GET_VERSION_CNF].av_stack_version.replace ('\0', ''))
+ print >>f, soft,
+ f.close ()
+
+def process_discovery (ans, mode):
+ from cc import CC_DISCOVER_LIST_CNF
+ f = open (os.path.join (av_home_attr.output_dir, "discovery-%s" % mode), "w")
+ 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:
+ for e in ans[CC_DISCOVER_LIST_CNF].stations:
+ stations += "| %s | %02d | %03d |\n" % (e.mac, int (e.snid), int (e.tei))
+ stations += "+-------------------+------+-----+\n"
+ if ans[CC_DISCOVER_LIST_CNF].num_network != 0:
+ for e in ans[CC_DISCOVER_LIST_CNF].networks:
+ networks += "| %s | %02d |\n" % (e.nid, int (e.snid))
+ networks += "+-------------------+------+\n"
+ discover = discover.format (plug = av_home_attr.plug_mac,
+ stations = stations,
+ networks = networks)
+ print >>f, discover,
+ f.close ()
+
+def process_avln (ans, mode):
+ from cm import CM_NW_INFO_CNF
+ role = {
+ 0: "STA",
+ 1: "PROXY_COORDINATOR",
+ 2: "CCO" }
+ f = open (os.path.join (av_home_attr.output_dir, "avln-%s" % mode), "w")
+ avln = """
+AVLN(s) for {plug}:
+
++-------------------+------+-----+------+
+| NID | SNID | TEI | Role |
++-------------------+------+-----+------+
+{avlns}
+"""
+ avlns = ""
+ for e in ans[CM_NW_INFO_CNF].nwinfo:
+ avlns += "| %s | %02d | %03d | %s |\n" % (e.nid, int (e.snid), int (e.tei), role[e.stationrole])
+ avlns += "+-------------------+------+-----+------+\n"
+ avln = avln.format (plug = av_home_attr.plug_mac, avlns = avlns)
+ print >>f, avln,
+ f.close ()
+
+def process_attenuation (ans, mode):
+ from vs import VS_GET_ATTENUATION_LIST_CNF
+ f = open (os.path.join (av_home_attr.output_dir, "attenuation-%s" % mode), "w")
+ attenuation = """
+Attenuation for {plug}:
+
++-------------------+------+
+| MAC | Att |
++-------------------+------+
+{attenuations}
+"""
+ attenuations = ""
+ for e in ans[VS_GET_ATTENUATION_LIST_CNF].entries:
+ if e.valid:
+ # Values above are not valid
+ if e.attenuation_db > 80:
+ e.attenuation_db = 80
+ attenuations += "| %s | %02d |\n" % (e.mac, int(e.attenuation_db))
+ else:
+ attenuations += "| %s | NA |\n" % e.mac
+ attenuations += "+-------------------+------+\n"
+ attenuation = attenuation.format (plug = av_home_attr.plug_mac,
+ attenuations = attenuations)
+ print >>f, attenuation,
+ f.close ()