[PATCH 8/9] tests: remote: monitor allow to pass params

Janusz Dziedzic janusz.dziedzic at gmail.com
Sat Sep 26 07:26:59 EDT 2020


This is mainly for standalone monitor in
case we know and would like to setup specyfic
monitor configuration.

-m  monitor:<chan>,<bw>, <cf1>, <cf2>:...

eg:
-m monitor:1,40,3,0
-m e4300:1,40,3,0:11,40,9,0

This also support monitor with multiple
interfaces (one pcap).

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at gmail.com>
---
 tests/hwsim/remotehost.py |  1 +
 tests/remote/monitor.py   | 18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py
index a1ef1f34b..dec1ad5a8 100644
--- a/tests/hwsim/remotehost.py
+++ b/tests/hwsim/remotehost.py
@@ -57,6 +57,7 @@ class Host():
         self.ifname = ifname
         self.port = port
         self.dev = None
+        self.monitor_params = []
         if self.name == "" and host != None:
             self.name = host
 
diff --git a/tests/remote/monitor.py b/tests/remote/monitor.py
index a97eaf928..937b10005 100644
--- a/tests/remote/monitor.py
+++ b/tests/remote/monitor.py
@@ -26,7 +26,8 @@ def create(devices, setup_params, refs, duts, monitors):
             mons.append(monitor)
 
     for mon in mons:
-        dev = config.get_device(devices, mon)
+        word = mon.split(":")
+        dev = config.get_device(devices, word[0])
         if dev is None:
             continue
 
@@ -35,6 +36,15 @@ def create(devices, setup_params, refs, duts, monitors):
                     port=dev['port'],
                     name=dev['name'])
 
+        for iface_param in word[1:]:
+            params = iface_param.split(",")
+            if len(params) > 3:
+                monitor_param = { "freq" : rutils.c2f(params[0]),
+                                  "bw" : params[1],
+                                  "center_freq1" : rutils.c2f(params[2]),
+                                  "center_freq2" : rutils.c2f(params[3]) }
+                host.monitor_params.append(monitor_param)
+
         try:
             host.execute(["iw", "reg", "set", setup_params['country']])
             rutils.setup_hw_host(host, setup_params, True)
@@ -49,11 +59,15 @@ def destroy(devices, hosts):
         stop(host)
         for monitor in host.monitors:
             host.execute(["ifconfig", monitor, "down"])
+        host.monitor_params = []
 
-def setup(host, monitor_params):
+def setup(host, monitor_params = None):
     if host is None:
         return
 
+    if monitor_params == None:
+        monitor_params = host.monitor_params
+
     ifaces = re.split('; | |, ', host.ifname)
     count = 0
     for param in monitor_params:
-- 
2.17.1




More information about the Hostap mailing list