tests: remote: Allow passing of parameters with monitor interface

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

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

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

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

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
This commit is contained in:
Janusz Dziedzic 2020-09-26 13:26:59 +02:00 committed by Jouni Malinen
parent 8456b9e7db
commit c203897a88
2 changed files with 17 additions and 2 deletions

View File

@ -57,6 +57,7 @@ class Host():
self.ifname = ifname self.ifname = ifname
self.port = port self.port = port
self.dev = None self.dev = None
self.monitor_params = []
if self.name == "" and host != None: if self.name == "" and host != None:
self.name = host self.name = host

View File

@ -26,7 +26,8 @@ def create(devices, setup_params, refs, duts, monitors):
mons.append(monitor) mons.append(monitor)
for mon in mons: for mon in mons:
dev = config.get_device(devices, mon) word = mon.split(":")
dev = config.get_device(devices, word[0])
if dev is None: if dev is None:
continue continue
@ -35,6 +36,15 @@ def create(devices, setup_params, refs, duts, monitors):
port=dev['port'], port=dev['port'],
name=dev['name']) 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: try:
host.execute(["iw", "reg", "set", setup_params['country']]) host.execute(["iw", "reg", "set", setup_params['country']])
rutils.setup_hw_host(host, setup_params, True) rutils.setup_hw_host(host, setup_params, True)
@ -49,11 +59,15 @@ def destroy(devices, hosts):
stop(host) stop(host)
for monitor in host.monitors: for monitor in host.monitors:
host.execute(["ifconfig", monitor, "down"]) host.execute(["ifconfig", monitor, "down"])
host.monitor_params = []
def setup(host, monitor_params): def setup(host, monitor_params=None):
if host is None: if host is None:
return return
if monitor_params == None:
monitor_params = host.monitor_params
ifaces = re.split('; | |, ', host.ifname) ifaces = re.split('; | |, ', host.ifname)
count = 0 count = 0
for param in monitor_params: for param in monitor_params: