[PATCH v3 00/26] Add remote tests (based on hwsim)

Janusz Dziedzic janusz.dziedzic at tieto.com
Wed Feb 17 04:14:03 PST 2016


This patches add tests/remote directory and functionality
to run remote tests with hostapd/wpa_supplicant using:
- wpaspy.py - (UDP) for communication with hostapd,
              wpa_supplicant CTRL interface
- hostapd.py - for control hostapd
- wpasupplicant.py - for control wpa_supplicant

This three files were modified (as minimal as possible)
to be used with remote hosts.

Also wpaspy.Host class was added. This is used for run
remote shell commands and base on ssh and authorized_keys
connection.
So, each machine you would like to use in your remote test
system should have configured authorized_keys correctly.
Eg. you should be able to simple execute

ssh root@<your_ip_or_host> id

In case of wpa_supplicant and hostapd configuration you can
simply use examples from tests/hwsim and add such option to
the .config file:

CONFIG_CTRL_IFACE=udp-remote

Added files:
- remote/run-tests.py - run tc script
- remote/utils.py
- remote/test_ap_open.py

This works similar to the hwsim version and will run all
test_* from test_* modules. As a parameters each test get
t(devices, duts, setup_params, ref, dut) where:
- devices - available reference device table
- duts - available duts table
- setup_params - environtment setup params
- ref - reference device name should be used
- dut - dut name should be tested

Devices table is table of RemoteHost. This is simple dictionary
which contais:
- hostname - remote PC IPv4, hostname or IPv4 
- ifname - wifi interface should be used
- port - CTRL UDP port should be used
- name - name
- flags - eg. AP_VHT80, STA_VHT80 ...

DUTs table is almost the same, don't need flags.

Each test case is responsible for run/terminate wpa_supplicant
or hostapd. Because of that I added termiate support to hostapd
and wpaspy.py.

As a example of test cases I added test_ap_open.py file which
tests most of AP open setups and run iperf/iperf3 (IPv4, IPv6, tcp,
udp) tests between STATION and AP. I verify this using:
- AP - Atheros ath10k
- STA - Intel 7260

So, steps you need before setup:
- compile hostapd/wpa_supplicant with CONFIG_CTRL_IFACE=udp-remote
  on your remote PCs/devices
- setup authorized_keys correctly
- fill devices table in run-tests.py
- fill dut table in run-tests.py
- fill setup_params in run-tests.py

After that you can simply run:
./run-tests.py <dut_name> all

Log system (based on hwsim and using logger):
You can find logs in logs directory. logs/current point to
last tests run.
Each failed test case get (using scp) wpa_supplicant and
hostapd logs and put them in logs directory.

In the future I can add more test cases base on this "framework".

This is part of log:
TC - AP with open mode (no security) configuration IPv4 ping (1/91)
TC - PASS (packet_loss: 0%, 0%)
TC - AP with open mode (no security) configuration IPv6 (2/91)
TC - PASS (packet_loss: 0%, 0%)
TC - AP with open mode (no security) configuration 2412 B-only IPv4 udp upload (3/91)
TC - PASS (4.54 Mbits/sec)
TC - AP with open mode (no security) configuration 2412 B-only IPv4 udp download (4/91)
TC - PASS (5.33 Mbits/sec)
TC - AP with open mode (no security) configuration all channels B-only IPv4 ping (11/91)
TC - PASS (PL 1: OK 2: OK 3: OK 4: OK 5: OK 6: OK 7: OK 8: OK 9: OK 10: OK 11: OK 12: FAILED 13: FAILED 14: FAILED )
TC - AP with open mode (no security) configuration 5180 A-only IPv6 udp upload (32/91)
TC - PASS (17.3 Mbits/sec)
TC - AP with open mode (no security) configuration 5180 A-only IPv6 udp download (33/91)
TC - PASS (18.0 Mbits/sec)


Minimal changes in wpaspy.py/hostapd.py/wpasupplicant.py don't
breake any hwsim tests.
I suspect there could be still some problems in implementation,
while I am not a python expert. Still Host class could be better.

Anyway, please review.

Janusz Dziedzic (26):
  wpa_supplicant: ctrl udp allow to set port
  wpa_supplicant: ctrl handle IFNAME for global iface
  wpa_supplicant: change attach/detach/send ctrl UDP functions
  wpa_supplicant: add monitor support for global ctrl UDP iface
  wpa_supplicant: add common ctrl iface files
  wpa_supplicant: ctrl unix use common functions
  hostapd: ctrl unix use common ctrl code
  ctrl unix: use sockaddr_storage
  hostap: add UDP support for ctrl iface
  hostapd: ctrl udp allow to set port
  wpa_supplicant: udp ctrl setup ctrl_interface
  wpa_supplicant: udp ctrl show when ITERFACES cmd
  hostapd: setup real ctrl_interface for UDP
  hostapd: add INTERFACES ctrl command
  hostapd: add global TERMINATE command
  wpaspy: add support for UDP connection
  wpaspy: add debug support for Ctrl UDP class
  tests: wpasupplicant.py allow to use remote host
  tests: hostapd.py allow to use remote host
  wpaspy: add Host class
  tests: hostapd.py/wpasupplicant.py use host when execute
  tests: hostapd.py add get_ctrl_iface_port
  tests: add remote dir and run-tests.py
  wpaspy: add terminate support
  tests: add terminate support for hostapd/wpa_supplicant
  tests: remote, add test_ap_open.py

 hostapd/Makefile                 |  24 +-
 hostapd/ctrl_iface.c             | 517 +++++++++++++++++++++---------
 hostapd/hostapd_cli.c            |   5 +
 hostapd/main.c                   |   7 +-
 src/ap/hostapd.c                 |   1 +
 src/ap/hostapd.h                 |   4 +-
 src/common/ctrl_iface_common.c   | 141 +++++++++
 src/common/ctrl_iface_common.h   |  36 +++
 tests/hwsim/hostapd.py           |  89 +++++-
 tests/hwsim/wpasupplicant.py     |  82 +++--
 tests/remote/run-tests.py        | 161 ++++++++++
 tests/remote/test_ap_open.py     | 663 +++++++++++++++++++++++++++++++++++++++
 tests/remote/utils.py            | 314 ++++++++++++++++++
 wpa_supplicant/Makefile          |   1 +
 wpa_supplicant/ctrl_iface.c      |   8 +
 wpa_supplicant/ctrl_iface_udp.c  | 142 +++++++--
 wpa_supplicant/ctrl_iface_unix.c |  96 +-----
 wpaspy/test.py                   |  23 +-
 wpaspy/wpaspy.py                 | 163 +++++++++-
 19 files changed, 2154 insertions(+), 323 deletions(-)
 create mode 100644 src/common/ctrl_iface_common.c
 create mode 100644 src/common/ctrl_iface_common.h
 create mode 100755 tests/remote/run-tests.py
 create mode 100644 tests/remote/test_ap_open.py
 create mode 100644 tests/remote/utils.py

-- 
1.9.1




More information about the Hostap mailing list