summaryrefslogtreecommitdiff
path: root/validation
diff options
context:
space:
mode:
authorOlivier Dufour2013-03-29 12:58:35 +0100
committerOlivier Dufour2013-04-02 09:05:02 +0200
commit0c965b36cd472bd674725044fe51fe08e436b740 (patch)
tree747b4b1a88ad0783e1b441eae329880e68356023 /validation
parent48fe91475a30acda366861aef5de5c52548ac34a (diff)
validation/test/av_home: add environment discovery, refs #3844
Use MME to get the following information: * Network discovery * Attenuation between the two stations * Default tonemap between the two stations * MME output is only printed for the moment
Diffstat (limited to 'validation')
-rwxr-xr-xvalidation/test/av_home/av_home.py5
-rwxr-xr-xvalidation/test/av_home/av_mme.py60
2 files changed, 65 insertions, 0 deletions
diff --git a/validation/test/av_home/av_home.py b/validation/test/av_home/av_home.py
index 2ec9f0330f..3ccc0757f4 100755
--- a/validation/test/av_home/av_home.py
+++ b/validation/test/av_home/av_home.py
@@ -5,12 +5,14 @@
import re, os, sys
import ConfigParser
import av_home_attr
+import av_mme
def master_script():
print ("Executing master script")
test_init ()
print ("Sending MME for environment discovery to " + av_home_attr.plug_mac +
" through " + av_home_attr.iface + " ...")
+ av_mme.get_network_env()
raw_input ("Press enter when slave script has been launched")
print ("Executing ping on slave PC ("+ av_home_attr.addr +")...")
print ("Executing upload iperf test on " + av_home_attr.addr + " ...")
@@ -20,6 +22,9 @@ def slave_script():
print ("Executing slave script")
test_init ()
print ("Sending MME for environment discovery...")
+ print ("Sending MME for environment discovery to " + av_home_attr.plug_mac +
+ " through " + av_home_attr.iface + " ...")
+ av_mme.get_network_env()
print ("Starting iperf server...")
raw_input ("Press enter when master script has finished upload iperf test")
print ("Executing upload iperf test...")
diff --git a/validation/test/av_home/av_mme.py b/validation/test/av_home/av_mme.py
new file mode 100755
index 0000000000..8ad8798a72
--- /dev/null
+++ b/validation/test/av_home/av_mme.py
@@ -0,0 +1,60 @@
+import os
+import sys
+import av_home_attr
+
+from scapy.all import *
+
+def srmme (src, dst, iface, payload):
+ from scammer import MME
+ mme = Ether (src = src, dst = dst) / MME () / payload
+ return srp1 (mme, iface = iface)
+
+def get_network_env():
+ 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
+ from vs import VS_GET_VERSION_REQ
+ from vs import VS_GET_VERSION_CNF
+ from vs import VS_GET_ATTENUATION_LIST_REQ
+ from vs import VS_GET_ATTENUATION_LIST_CNF
+ 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 ()
+ ]
+
+ for mme in mme_list:
+ ans = srmme (av_home_attr.source_mac,
+ av_home_attr.plug_mac,
+ av_home_attr.iface,
+ mme)
+ if ans:
+ ans.show ()
+
+ ans = srmme (av_home_attr.source_mac,
+ av_home_attr.plug_mac,
+ av_home_attr.iface,
+ VS_GET_TONEMAP_REQ (mac=av_home_attr.peer_mac, tmi=0xff))
+ if ans:
+ ans = srmme (av_home_attr.source_mac,
+ av_home_attr.plug_mac,
+ av_home_attr.iface,
+ VS_GET_TONEMAP_REQ (mac=av_home_attr.peer_mac,
+ int_id = ans.int_id,
+ tmi = ans.tmi_default))
+ if ans:
+ process_tonemap (ans[VS_GET_TONEMAP_CNF])
+
+def process_tonemap (tm):
+ from vs import VS_GET_TONEMAP_CNF
+ ml = tm.modulation_list
+ f = open (os.path.join (av_home_attr.output_dir, "tonemap"), "w")
+ print >> f,"Default tonemap:"
+ for i in range (768):
+ print >> f, ml[2 * i:2 * (i + 1)] + " ",
+ if (i % 16) == 15:
+ print >> f, " "
+ f.close ()