3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-02 10:09:23 +01:00
Commit Graph

575 Commits

Author SHA1 Message Date
James Prestwood
904238b6ec auto-t: testEAD: stop ead when test finishes 2021-02-26 10:07:07 -06:00
James Prestwood
3a9c401f63 auto-t: fix blacklist test timing issues
This test fails randomly, and it appears to be due to excessive
scanning. Historically most autotests start a dbus scan right
away. The problem is that most likely a periodic scan is already
ongoing, meaning the dbus scan gets queued. If a Connect() call
comes in (which it always does), the dbus scan gets delayed and will
trigger once connected, at a time the test is not expecting. This
can cause problems with any assumed timing as well as offchannel
frames.

This patch removes the explicit DBus scanning and instead uses
scan_if_needed with get_ordered_networks. The 'all_blacklisted_test'
was also modified to wait for scanning to complete after failing
to connect to all BSS's. This lets all the networks fully come
up (after being blocked by hwsim) and appear in scan results.
2021-02-11 20:32:26 -06:00
James Prestwood
1dc4d6e9ba auto-t: update roaming tests with wait_for_object_change
Every single roaming test had one of two problems with watching the
state change between roaming --> connected. Either the test used
wait_for_object_condition to wait for 'connected' which could allow
other states in between. Or it simply used an assert. The assert
wouldn't allow other state changes, but at the cost of potentially
failing due to IWD not having made it to the 'connected' state yet.

Now we have wait_for_object_change which takes two conditions:
initial (from_str) and expected (to_str). This API will not allow
any other conditions except these, and will wait for the expected
condition before continuing. This allows roaming test to reliably
wait for the roaming --> connected state change.
2021-02-05 14:44:00 -06:00
James Prestwood
c5538f6450 auto-t: add API wait_for_object_change
This is similar to wait_for_object_condition, but will not allow
any intermediate state changes between the initial and expected
conditions. This is useful for roaming tests when the expected
state change is 'connected' --> 'roaming' with no changes in
between.
2021-02-05 14:44:00 -06:00
James Prestwood
5c96e1e81e auto-t: fix SAQuery-spoofing test
This test occationally failed due to a badly timed DBus scan
triggering right when hwsim tried sending out the spoofed frame.
This caused mac80211_hwsim to reject CMD_FRAME when the timing
was just right.

Rather than always starting a DBus scan we can rely on periodic
scans and only DBus scan if there are no networks in IWD's list.
A scanning check was also added prior to sending out the frame
and if true we wait for not scanning. This is more paranoia than
anything.
2021-02-05 14:43:17 -06:00
James Prestwood
e7d941dc3c auto-t: make spoof_frame more robust
Sometimes scan results can come in with a MAC address which
should be in the first index of addrs[] (42:xx:xx:xx:xx:xx).
This causes a failure to lookup the radio path.

There was also a failure path added if the radio cannot be
found rather than rely on DBus to fail with a None path.

The arguments to SendFrame were also changed to use the
ByteArray DBus type rather than python's internal bytearray.
This shouldn't have any effect, but its more consistent with
how DBus arguments should be used.
2021-02-05 14:43:17 -06:00
James Prestwood
4b07280319 auto-t: fix wait_for_object_condition to work with any object
After recent changes fixing wait_for_object_condition it was accidentally
made to only work with classes, not other types of objects. Instead
create a minimal class to hold _wait_timed_out so it doesnt rely on
'obj' holding the boolean.
2021-02-04 20:56:34 -06:00
James Prestwood
ce5e1e1933 auto-t: testFT-PSK-roam wait for connected
Rather than assert its better to wait for a connected
state.
2021-02-03 20:06:12 -06:00
Alvin Šipraga
af93217701 auto-t: add test for stopping periodic roam retries 2021-01-29 17:55:50 -06:00
Alvin Šipraga
fda4734a1b auto-t: throw exception if hostapd can't send BSS transition req
The testAPRoam autotest was silently failing on my machine until I
realized that my distribution hostapd (Arch Linux) is not built with
CONFIG_WNM_AP=y. Indeed, it is also disabled by default in upstream
hostapd. This resulted in the send_bss_transition() function of
hostapd.py silently failing. With this change, throw an exception in
case the BSS_TM_REQ command does not succeed to hopefully save others
the time of debugging this problem.
2021-01-28 13:30:57 -06:00
James Prestwood
d1b3f2d14f auto-t: remove stale hw.conf options
After the test-runner re-write many tests were left with
stale options that are no longer used at all. These were
periodically getting removed as changes were made to
individual tests, but its apparent now that a tree wide
removal was needed.
2021-01-27 13:42:58 -06:00
Alvin Šipraga
d544fb9fa8 auto-t: add test for roaming retry timing
Recent changes make iwd more eager to retry roaming if it has detected a
high RSSI since the last attempt. Add an autotest to verify this
behaviour.
2021-01-27 13:13:43 -06:00
James Prestwood
b0e970ae38 test-runner: fix logging, verbose, and process output
There were some major problems related to logging and process
output. Tests which required output from start_process would
break if used with '--log/--verbose'. This is because we relied
on 'communicate' to retrieve the process output, but Popen does
not store process output when stdout/stderr are anything other
than PIPE.

Intead, in the case of logging or outfiles, we can simply read
from the file we just wrote to.

For an explicit --verbose application we must handle things
slightly different. A keyword argument was added to Process,
'need_out' which will ensure the process output is kept
regardless of --log or --verbose.

Now a user should be able to use --log/--verbose without any
tests failing.
2021-01-26 13:41:23 -06:00
Andrew Zaborowski
6fdae0c4eb autotests: Test loading binary key formats in testEAP-TLS 2021-01-25 14:01:58 -06:00
James Prestwood
5e631b4e38 auto-t: fix wait_for_object_condition
After the re-write this was broken and not noticed until
recently. The issue appeared to be that the GLib timeout
callback retained no context of local variables. Previously
_wait_timed_out was set as a class variable, but this was
removed so multiple IWD instances could work. Without
_wait_timed_out being a class variable the GLib timeout
setting it had no effect on the wait loop.

To fix this we can set _wait_timed_out on the object being
passed in. This is preserved in the GLib timeout callback
and setting it gets honored in the wait loop.
2021-01-25 13:10:52 -06:00
James Prestwood
55e7caa8e0 auto-t: add iftype/cipher disable to hwsim.py 2020-12-17 20:13:41 -06:00
James Prestwood
5525f32cdd auto-t: update hwsim radio create to use dictionary 2020-12-17 20:10:45 -06:00
James Prestwood
eaf176220c auto-t: fix hwsim.py to use Destroy rather than Remove
There is no Remove() method, but since this code never was used it
remained incorrect for quite some time.
2020-12-17 20:10:30 -06:00
James Prestwood
fde1012f5d auto-t: add static netconfig test
Tests netconfig with a static configuration, as well as tests ACD
functionality.

The test has two IWD radios which will eventually use the same IP.
One is configured statically, one will receive the IP via DHCP.
The static client sets its IP first and begins using it. Then the
DHCP client is started. Since ACD in a DHCP client is configured
to use its address indefinitely, the static client *should* give
up its address.
2020-12-08 16:29:09 -06:00
James Prestwood
d40cac403f auto-t: support IP match with no IP set
This allows an interface with no IP set to be checked for
by passing None in as the address. This will generate an
exception by ioctl which we catch.
2020-12-08 15:15:42 -06:00
James Prestwood
d2cc033d09 auto-t: pass namespace on to other IWD classes
Certain classes were still using the default namespace. This
didn't matter yet since testAP was the only test using namespaces,
and the AP interface was the only one being used.

For an IWD station on a separate namespace all objects need to
be accessable, so the namespace is passed along to those as needed.
2020-12-08 15:15:39 -06:00
James Prestwood
b18f843532 auto-t: add storage dir to IWD() constructor
Add support for setting a custom storage directory.
2020-12-08 15:15:36 -06:00
James Prestwood
e402a11f06 auto-t: fix FT over DS test to wait for connected
Due to timing this test sometimes does not pass because it was
just asserting on the device state rather than waiting for a
change. This generally worked but not always.
2020-11-24 11:42:00 -06:00
James Prestwood
9e541fe7e8 auto-t: add namespaces to testAP 2020-11-18 11:01:11 -06:00
James Prestwood
4168e20243 auto-t: add test_ip_connected to testutil
Used to check IP connectivity between namespaces. The input
should be two tuples containing the IP and namespace to ping
from/to.
2020-11-18 11:01:11 -06:00
James Prestwood
5a7eb91378 auto-t: update utilities to use namespaces 2020-11-18 11:01:11 -06:00
James Prestwood
b24e201248 auto-t: use hwsim_medium=no (testSAE/HiddenNetworks)
Both these tests create many radios which sometimes causes timing
problems when hwsim is running. Since hwsim is not required for
these tests we can disable it and increase test reliability.
2020-11-17 13:30:29 -06:00
James Prestwood
3c708b0e14 auto-t: update hostapd.list_sta to use Process.out
Instead of list_sta() waiting for the PID itself it can
just use wait=True and grab the output out of the Process
class itself.
2020-11-16 17:05:45 -06:00
James Prestwood
eb92c0a6e5 auto-t: refactor get_instance from iwd.py
When network namespaces are introduced there may be multiple
IWD class instances. This makes IWD.get_instance ambiguous
when namespaces are involved. iwd.py has been refactored to
not use IWD.get_instance, but testutil still needs it since
its purely based off interface names. Rather than remove it
and modify every test to pass the IWD object we can just
maintain the existing behavior for only the root namespace.
2020-11-16 17:05:45 -06:00
James Prestwood
d3a57d47f3 auto-t: remove beacon loss tests 2020-11-04 13:41:01 -06:00
James Prestwood
da6b818a53 auto-t: add profile based DHCP test 2020-11-04 13:36:06 -06:00
James Prestwood
2d45461dfd auto-t: simplify copy_to_hotspot
Since copy_to_storage can take an arbitrary destination path now
we can reuse that instead of duplicating code.
2020-11-04 13:36:03 -06:00
James Prestwood
efe53e28c8 auto-t: add copy_to_ap utility 2020-11-04 13:35:44 -06:00
James Prestwood
a472874890 auto-t: remove more /var/lib/iwd references
The address randomization test was using a /var/lib/iwd which
is no longer specially mounted or used for IWD storage. Instead
use /tmp/iwd.
2020-11-04 13:35:04 -06:00
James Prestwood
2a6690e50d auto-t: fix agent path timing issue
The agent path was generated based on the current time which
sometimes yielded duplicate paths if agents were created quickly
after one another. Instead a simple iterator removes any chance
of a duplicate path.
2020-11-03 13:58:23 -06:00
James Prestwood
957a8aac25 auto-t: remove /var/lib/iwd references in testKnownNetworks 2020-11-03 13:58:23 -06:00
James Prestwood
16698d0c9a auto-t: fix testNetconfig hardcoded interface
If running multiple tests testNetconfig would fail due to the
hardcoded wln0 in the dhcpd.conf file. dhcpd can actually start
by passing in the interface to the run command rather than
inside the config file.
2020-11-03 13:58:23 -06:00
James Prestwood
d03ea531de auto-t: add support for AP StartWithConfig API
If a psk is not provided to start_ap, it is assumed that the
AP is being started with a config file.
2020-11-02 13:58:02 -06:00
James Prestwood
87a29c9ca3 auto-t: fix hotspot autoconnect test
The test was removing files in /var/lib/iwd which is no longer
mounted read/write (nor are config files put there anymore).
2020-10-30 13:16:57 -05:00
James Prestwood
4e9b455a2e auto-t: add AP test with DHCP server
The existing AP tests needed to be modified to start IWD from
python since the DHCP test uses a different main.conf.

Also removed some stale hw.conf options that are no longer used.
2020-10-27 16:19:47 -05:00
James Prestwood
201763ff7f auto-t: testutil: add test_ip_address_match
Checks that the the IP address for a given interface matches
2020-10-27 16:19:47 -05:00
James Prestwood
3e69c33f74 auto-t: only return expected number from list_devices
If the caller specifies the number of devices only return that many.
Some sub-tests may only need a subset of the total number of devices
for the test. If the number of devices expected is less than the total
being returned, python would throw an exception.
2020-10-26 14:27:09 -05:00
James Prestwood
ebd712af4e auto-t: no hostapd instance graceful failure
If a test does not need any hostapd instances but still loads
hostapd.py for some reason we want to gracefully throw an
exception rather than fail in some other manor.
2020-10-20 13:30:43 -05:00
Andrew Zaborowski
e28c211c36 autotests: Add testP2P
Add two P2P client connection scenarios.
2020-10-19 17:20:21 -05:00
Andrew Zaborowski
939a67255a autotests: Move some variables from IWD class to instance
These variables were probably meant as instance members and not class
members.
2020-10-19 17:20:21 -05:00
Andrew Zaborowski
719646df4d autotests: Add basic wpa_supplicant P2P python wrapper
Add the new wpas.Wpas class roughly based on hostapd.HostapdCLI but only
adding methods for the P2P-related stuff.

Adding "wpa_supplicant" to -v will enable output from the wpa_supplicant
process to be printed and "wpa_supplicant-dbg" will make it more verbose
("wpa_supplicant" is not needed because it seems to be automatically
enabled because of the glob matching in ctx.is_verbose)
2020-10-19 17:20:21 -05:00
Andrew Zaborowski
550f8f454c autotests: Basic P2P python API
Add a basic wrapper for the P2P-related DBus interfaces similar to the
existing classes in iwd.py.  WFD is not included.
2020-10-19 17:20:21 -05:00
James Prestwood
313d8dbbed auto-t: remove requirement for /var/lib/{ead,iwd}
The host systems configuration directories for IWD/EAD were
being mounted in the virtual machine. This required that the
host create these directories before hand. Instead we can
just set up the system and IWD/EAD to use directories in /tmp
that we create when we start the VM. This avoids the need for
any host configuration.
2020-10-14 13:03:17 -05:00
James Prestwood
df0b64f8d0 auto-t: add EAD autotest 2020-09-17 16:20:04 -05:00
James Prestwood
c707bee6ac auto-t: add ead.py module
This module is essentially a heavily stripped down version of iwd.py
to work with EAD. Class names were changed to match EAD but basically
the EAD, Adapter, and AdapterList classes map 1:1 to IWD, Device, and
DeviceList.
2020-09-17 16:19:37 -05:00
James Prestwood
ab51228b38 auto-t: allow IWDDBusAbstract to work with any service
This is somewhat of a hack, but the IWDDBusAbstract is a very
convenient abstraction to DBus objects. The only piece that restricts
it to IWD is the hardcoded IWD_SERVICE. Instead we can pass in a
keyword argument which defaults to IWD_SERVICE. That way other modules
(like EAD) can utilize this abstraction with their own service simply
by changing that service argument.
2020-09-17 16:18:31 -05:00
James Prestwood
5cf748e98b auto-t: modify copy_to_storage to take optional dir
This is to prepare for testing EAD, and in this case we need
to copy the 8021x config to /var/lib/ead instead of IWD's
config dir.
2020-09-17 16:18:03 -05:00
James Prestwood
1e8fedce6c auto-t: fix testNetconfig
The interface was hard coded to wln0 which works when running single
tests but not when running multiple. Instead use the actual ifname
that hostapd is using.
2020-09-17 16:17:57 -05:00
James Prestwood
d745fbe24e auto-t: update EAP-PEAP-SIM test to use ofono 2020-09-16 14:31:43 -05:00
James Prestwood
cc44f50d67 auto-t: remove sim_hardcoded tests 2020-09-16 14:31:30 -05:00
James Prestwood
2f51b51152 auto-t: add netconfig autotest
Tests that DHCP using IWD's internal netconfig functions properly.
The actual IP address assignment is not verified, but since IWD does
not signal the connection as successful unless DHCP succeeds we
can assume it was successful by checking that the device is connected.

The process of actually starting dhcpd and configuring the interfaces
is quite simple so it was left in the autotest itself. If (or when)
more tests require IP capabilities (p2p, FILS, etc) this could be
moved into test-runner itself and be made common. The reason I did not
put it in there now is a) because this is the only test and b) more
complex DHCP cases are likely to develop and may require more than this
simplistic setup (like multiple APs/interfaces)
2020-09-15 20:20:40 -05:00
James Prestwood
d78d0d5937 auto-t: remove old AdHoc APIs 2020-09-14 16:45:15 -05:00
James Prestwood
eeca2b3f38 auto-t: update AdHoc tests to use AdHocDevice 2020-09-14 16:45:12 -05:00
James Prestwood
29eb08ead2 auto-t: make AdHoc APIs behave like others
The AdHoc functionality in iwd.py was not consistent at all with
how all the other classes worked (my bad). Instead we can create
a very simple AdHocDevice class which inherits all the DBus magic
in the IWDDBusAbstract class.
2020-09-14 16:45:08 -05:00
James Prestwood
d232edde72 auto-t: replace waiting for network with device
Many tests waited on the network object 'connected' property after
issuing a Connect command. This is not correct as 'connected' is
set quite early in the connection process. The correct way of doing
this is waiting for the device state to change to connected.

This common code was replaced, hopefully putting to rest any random
failures that happen occasionally.
2020-09-14 16:03:04 -05:00
James Prestwood
4676dd7efd auto-t: fix testFT-PSK-roam
Some cleanup code got removed by mistake which cleared out any
hwsim rules before the next subtest. Without this the second test
would end up getting erroneous signal strength numbers in the scan
results causing a failure.
2020-09-14 16:03:04 -05:00
James Prestwood
1b03675002 auto-t: don't clear out rules from hwsim object
This got added in the re-write but a __del__ method was also
added to the Rule class as well. This caused problems if hwsim
cleaned up since it removed the rules, which caused each rule
to call __del__. Since the rule had already been removed there
was no longer a DBus interface which raised an exception.
2020-09-14 16:03:04 -05:00
James Prestwood
5b94c9d243 auto-t: remove hwsim rules on __del__
This prevents previous tests rules from carrying over into
future tests.
2020-09-11 13:42:13 -05:00
James Prestwood
5df28473cb auto-t: fix set_neighbor SSID escaping
Before the re-write there was interesting escapes being used for
set_neighbor. Curiously now hostapd fails to set the neighbor due
to these escapes so they have been removed.
2020-09-11 13:42:13 -05:00
James Prestwood
d43a640d71 auto-t: fix testFT-PSK-roam
Switched around hwsim rules with the IWD initializer to avoid
IWD periodically scanning before hwsim rules are in place. Removed
some unneeded code during teardown.
2020-09-10 17:59:49 -05:00
James Prestwood
20b7540201 auto-t: fix testPreauth-roam
Changed to wait for DeviceState instead of network object as well
as moved hwsim rules ahead of the IWD initializer to avoid IWD
scanning before the rules are fully in place.
2020-09-10 17:59:49 -05:00
James Prestwood
cf3ea5d4df auto-t: fix testWPA2 to wait for device object 2020-09-10 17:59:49 -05:00
James Prestwood
8b41413170 auto-t: harden testHotspot
This test occationally failed, and it uses the old style of waiting
for connected on the network object instead of the device object.

The hwsim rule was also moved ahead of the IWD() initializer which
ensures that IWD doesn't scan before the rule can be set/processed.
2020-09-10 17:59:49 -05:00
James Prestwood
e81b1b77c8 auto-t: fix testAPRoam
This test occationally fails due to no hwsim rules. Basically we
were just expecting iwd to connect to one of 3 access points but
the ranking was equal, so it chose the first in the scan list.

Now a signal strength is assigned to each AP to steer IWD into
connecting to the expected AP.
2020-09-10 17:59:49 -05:00
James Prestwood
b437bfaced auto-t: fix testAP
As with other tests, wait on device state instead of the network
object. The connectivity test was also changed to not check for
group traffic since AP does not negotiate the IGTK at this time.
2020-09-10 17:59:49 -05:00
James Prestwood
7b933db78a auto-t: fix testBSSBlacklist
There were a number of fixes here. The waits were changed to wait
on the device state instead of the network state and hwsim rules
were removed after the test as to not interfere with future tests.
One of the rules was setting the signal to -10000 wich was causing
the ranking to be zero.
2020-09-10 17:59:49 -05:00
James Prestwood
b9cb6134d6 auto-t: update testAgent to use TestContext
This hides iwctl output unless verbose is specified
2020-09-10 17:59:49 -05:00
James Prestwood
03ff410dff auto-t: update testClientNonInteractive to use TestContext
This makes any iwctl output hidden unless enabled via the verbose
option.
2020-09-10 17:59:49 -05:00
James Prestwood
4c6173ee89 auto-t: fix SAE FT test and update
Updated testFT-SAE-roam to use the TestContext APIs as well as
fixed the failure which was introduced after requiring stricter
AKM logic for SAE networks. The new failure was due to the hostapd
config not including the standard SAE AKM which is actually
required by the spec.
2020-09-10 17:59:49 -05:00
James Prestwood
6e2aba3907 auto-t: Increase all test timeouts
Slower systems may not be able to make some timeouts that tests
mandated. All timeouts were increased significantly to allow tests
to pass on slow systems.
2020-09-10 17:59:49 -05:00
James Prestwood
0036cb976f auto-t: hwsim: wait for method return
It is not safe to assume that the python dbus implementation will
wait for a method to return. The documentation says this with
respect to reply_handler/error_handler:

"If both are None, the implementation may request that no reply is sent"

To stay on the safe side we should always include the error/reply
handlers and wait for the operation to complete.
2020-09-10 17:59:49 -05:00
James Prestwood
9bb5ecf27a auto-t: remove device.wait_for_connected
I had added this without realizing wait_for_object_condition
can do this already using the device object.
2020-09-10 17:59:49 -05:00
James Prestwood
2e3ad0f6b3 auto-t: replace hard-coded interfaces
test-runner now supports interface name replacement inside hostapd
config files. Since a given test configuration doesn't know what
interface names there will be $ifaceN can be specified instead e.g.

rsn_preauth_interfaces=$iface0 $iface1

The $ifaceN values will be replace with actual interface names when
the test is started.

This patch also removes ctrl_interface inside the hostapd config
files as this is no longer required.
2020-09-10 17:59:49 -05:00
James Prestwood
0d5409eb04 auto-t: skip ofono tests if ofonod isn't running 2020-09-10 17:59:49 -05:00
James Prestwood
1f404e32a6 auto-t: fix testSAE autoconnect_test.py
This test was unreliable since it was assuming a periodic scan would
happen at just the right time. Instead since we are expecting autoconnect
we can just wait for DeviceState.connected then after we are connected
verify the network was correct.
2020-09-10 17:59:49 -05:00
James Prestwood
2bd2462968 auto-t: fix hidden network test
This test was never 100% reliable, and after the test-runner re-write
it became extremely unreliable. The issue came down to the very common
block of code thats present in many tests where we wait for obj.scanning
then not obj.scanning. This is fine when a dbus scan() is explicitly
done before, otherwise it could lead to problems. Without a dbus scan
explicitly called we are assuming a periodic scan will happen. If it
already happen the initial wait for obj.scanning will never return and
time out.

This probably needs to be changed in several tests, but for this specific
case we can remove the waits completely. Since
check_autoconnect_hidden_network has a 30 second wait on
DeviceState.connected this will ultimately time out if anything goes
wrong. There isn't any great reason to wait for scanning (for this test
specifically).

A minor style change was also made when initializing IWD. The values
passed in this test are now the default, so no arguments need to be
passed.
2020-09-10 17:59:49 -05:00
James Prestwood
3ec3855de9 auto-t: remove wiphy.py
This is no longer needed
2020-09-10 17:59:49 -05:00
James Prestwood
91adbcb7f4 auto-t: iwd.py: update to work with test-runner rewrite
iwd.py was updated to use the TestContext APIs to start/stop
IWD. This makes the process managment consistent between starting
IWD from test-runner or from the IWD() constructor.

The psk agent is now tracked, and destroyed upon __del__. This is
to fix issues where a test throws an exception and never
unregisters the agent, causing future tests to fail.

The configuration directory was also chaged to /tmp by
default. This was done since all tests which used this used /tmp
anyways.

The GLib mainloop was removed, and instead put into test-runner
itself. Now any mainloop operations can use ctx.mainloop instead
2020-09-10 17:59:49 -05:00
James Prestwood
ad97dbee08 auto-t: ofono.py: fix timeout cleanup and wait for service
Ofono.py was not cleaning up the timeout, nor waiting for the ofono.org
service to come up before continuing.
2020-09-10 17:59:49 -05:00
James Prestwood
85259bb519 auto-t: testutil.py: update to work with test-runner rewrite
Similar to the others, testutil.py was converted to use the global
test context to lookup radios/interfaces rather than the wiphy_map
2020-09-10 17:59:49 -05:00
James Prestwood
edac41b1b3 auto-t: hostapd.py: update to work with test-runner rewrite
Before hostapd was initialized using the wiphy_map which has now
gone away. Instead we have a global config module which contains
a single 'ctx'. This is the centeral store for all test information.

This patch converts hostapd.py to lookup instances by already
initialized Hostapd object. The interface parameter was removed
since all tests have been converted to use config= instead.

In addition HostapdCLI was changed to allow no parameters if there
is only a single hostapd instance.
2020-09-10 17:59:49 -05:00
James Prestwood
0772d4b61a auto-t: introduce pure python test-runner re-write
This patch completely re-writes test-runner in Python. This was done
because the existing C test-runner had some clunky work arounds and
maintaining or adding new features was starting to become a huge pain.

There were a few aspects of test-runner which continually had to
be dealt with when adding any new functionality:

 * Argument parsing: Adding new arguments to test-runner wasn't so
   bad, but if you wanted those arguments passed into the VM it
   became a huge pain. Arguments needed to be parsed, then re-formatted
   into the qemu command line, then re-parsed in a special order
   (backwards) once in the VM. The burden for adding new arguments was
   quite high so it was avoided (at least by me) at all costs.
 * The separation between C and Python: The tests are all written in
   python, but the executables, radios, and interfaces were all created
   from C. The way we solved this was by encoding the require info as
   environment variables, then parsing those from Python. It worked,
   but it was, again, a huge pain.
 * Process management: It started with all processes being launched
   from C, but eventually tests required the ability to start IWD, or
   kill hostapd ungracefully in order to test certain functionality.
   Since the processes were tracked in C, Python had no way of
   signalling that it killed a process and when it started one C had
   no idea. This was mitigated (basically by killall), but it was
   no where close to an elegant solution.

Re-writing test-runner in python solves all these problems and will
be much easier to maintain.

 * Argument parsing: Now all arguments are forwarded automatically
   to the VM. The ArgParse library takes care of parsing and each
   argument is stored in a dictionary.
 * Separation between C and Python: No more C, so no more separation.
 * Process management: Python will now manage all processes. This
   allows a test to kill, restart, or start a new process and not
   have to remember the PID or to kill it after the test.

There are a few more important aspects of the python implementation
that should now be considered when writing new tests:

 * The IWD constructor now has different default arugments. IWD
   will always be started unless specified and the configuration
   directory will always be /tmp
 * Any non *.py file in the test directory will be copied to /tmp.
   This avoids the need for 'tmpfs_extra_stuff' completely.
 * ctrl_interface will automatically be appended to every hostapd
   config. There is no need to include this in a config file from
   now on.
 * Test cleanup is extremely important. All tests get run in the
   same interpreter now and the tests themselves are actually loaded
   as python modules. This means e.g. if you somehow kept a reference
   to IWD() any subsequent tests would not start since IWD is still
   running.
 * For debugging, the test context can be printed which shows running
   processes, radios, and interfaces.

Three non-native python modules were used: PrettyTable, colored, and
pyroute2

$ pip3 install prettytable
$ pip3 install termcolor
$ pip3 install pyroute2
2020-09-10 17:59:49 -05:00
James Prestwood
9594b03a35 auto-t: prepare autotests for test-runner re-write
The tests basically remained the same with a few minor changes.
The wiphy_map and in turn hostapd_map are no longer used. This
was already partially converted a long time ago when the 'config'
parameter was added to HostapdCLI. This patch fully converts all
autotests to use 'config' rather than looking up by interface.

Some test scripts were named 'test.py' which was fine before but
the new rewrite actually loads each python test as a module. The
name 'test' is too ambiguous and causes issues due to a native
python module with the same name. All of these files were
renamed to 'connection_test.py'.
2020-09-10 17:59:49 -05:00
James Prestwood
f85fcf2f21 auto-t: make testSAQuery more reliable
First, looking for DeviceState.connected gives a much better indication
if we are actually connected vs the connected property on the network
object. Second, its good practice to also check that hostapd sees that
the station is connected.
2020-07-15 14:43:34 -05:00
James Prestwood
933be89812 auto-t: fix hostapd.ungraceful_restart
Restarting hostapd from python was actually leaking memory and
causing the hostapd object to stay referenced in python. The
GLib timeout in wait_for_event was the ultimate cause, but this
had no come to light because no tests restarted hostapd then
used wait_for_event.

In addition, any use of wait_for_event after a restart would
cause an exception because the event socket was never re-attached
after hostapd restarted.

Now we properly clean up the timeout in wait_for_event and
re-initialize the hostapd object on restart.
2020-07-15 14:43:29 -05:00
James Prestwood
0fdc3b3ed6 auto-t: remove busy wait for eapol reauth
Many tests force a reauth after the initial connection. When the tests
were written there was no way of ensuring the reauth completed except
waiting (IWD.wait()). Now we can wait for hostapd events in the tests,
which is faster and more reliable than busy waiting.
2020-07-08 18:29:01 -05:00
James Prestwood
38c8fe06a4 auto-t: increase wait time for blacklist test
This test was not reliably passing. Busy waiting is not really reliable,
but in this specific case its really the only option as the blacklist
must expire based on time.
2020-07-08 18:28:58 -05:00
James Prestwood
e70b252e19 auto-t: add test for delayed ANQP response 2020-06-12 15:04:43 -05:00
James Prestwood
cb35e9fe65 auto-t: add 'Delay' property to hwsim python module 2020-06-12 15:04:40 -05:00
Tim Kourt
8be7aae079 auto-t: Validate Connect after ConnectHiddenNetwork 2020-06-09 21:58:52 -05:00
Tim Kourt
7ef7894218 auto-t: Add async API call for connect_hidden_network 2020-06-09 21:58:52 -05:00
Tim Kourt
cc66050b90 auto-t: Test Agent ops 2020-05-13 05:50:45 -05:00
Tim Kourt
cbfaef09d6 auto-t: Remove bogus logic
Device object has no property named 'connected'.
client_connect has no member dev2
2020-05-02 07:03:05 -05:00
Tim Kourt
7cc8111817 auto-t: Use changed get_ordered_network API
Rely on internal scan and wait implementation of get_ordered_network
to obtain the known networks
2020-05-02 07:03:05 -05:00
Tim Kourt
ae4b361f79 auto-t: Return None instead of empty known net list
To match the original behavior of get_ordered_networks,
return None for the empty list of known networks after the scan
is complete
2020-05-02 07:03:05 -05:00
Tim Kourt
2e5f7404c0 auto-t: Rename test case to reflect its purpose 2020-05-02 07:03:05 -05:00
Tim Kourt
7f3f5c18dc auto-t: Remove unnecessary disconnect calls
With the introduction of AutoConnect=False network setting the
initial disconnect calls are no longer needed
2020-05-02 07:03:05 -05:00
James Prestwood
b600440ea2 auto-t: use scan_if_needed for testConnectAutoconnect
In certain cases the autoconnect portion of each subtest was connecting
to the network so fast that the check for obj.scanning was never successful
since IWD was already connected (and in turn not scanning). Since the
autoconnect path will wait for the device to be connected there really isn't
a reason to wait for any scanning conditions. The normal connect path does
need to wait for scanning though, and for this we can now use the new
scan_if_needed parameter to get_ordered_networks.
2020-05-02 06:40:23 -05:00
James Prestwood
da3f66ea68 auto-t: add optional scan argument to get_ordered_network(s)
There is a very common block of code inside many autotests
which goes something like:

device.scan()
condition = 'obj.scanning'
wd.wait_for_object_condition(device, condition)
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
network = device.get_ordered_network('an-ssid')

When you see the same pattern in nearly all the tests this shows
we need a helper. Basic autotests which merely check that a
connection succeeded should not need to write the same code again
and again. This code ends up being copy-pasted which can lead to
bugs.

There is also a code pattern which attempts to get ordered
networks, and if this fails it scans and tries again. This, while
not optimal, does prevent unneeded scanning by first checking if
any networks already exist.

This patch solves both the code reuse issue as well as the recovery
if get_ordered_network(s) fails. A new optional parameter was
added to get_ordered_network(s) which is False by default. If True
get_ordered_network(s) will perform a scan if the initial call
yields no networks. Tests will now be able to simply call
get_ordered_network(s) without performing a scan before hand.
2020-05-02 06:40:23 -05:00
James Prestwood
8126899eda auto-t: change blacklist test RSSI values
These values were meant only to force IWD's BSS preference but
since the RSSI's were so low in some cases this caused a roam
immediately after connecting. This patch changes the RSSI values
to prevent a roam from happening.
2020-05-01 23:01:42 -05:00
Tim Kourt
57ce53f1ac auto-t: Fix event order
In addition, use the conditional wait for the expected number
of known networks
2020-04-09 16:46:31 -05:00
Tim Kourt
000b533194 auto-t: Remove unused imports 2020-04-09 16:46:31 -05:00
Tim Kourt
d3339ddb72 auto-t: Use proper connection status indicator
'Connected' property of the network object is set before the connection
attempt is made and does not indicate a connection success. Therefore,
use device status property to identify the connection status of the device.
2020-04-09 16:46:31 -05:00
James Prestwood
83128c797f auto-t: check linkmode/operstate in adhoc test (open)
A previous patch fixed the linkmode/operstate for open AdHoc networks.
2020-04-08 16:35:06 -05:00
James Prestwood
72bf3aa1f5 auto-t: remove iwd_config_dir from autotests
This is no longer needed unless setting a different
directory than /tmp
2020-03-21 00:10:36 -05:00
James Prestwood
9eb0f973f3 auto-t: fix testAddressRandomization
This test was dependent on having a local main.conf in /etc/iwd
2020-03-21 00:10:34 -05:00
James Prestwood
e7a9a43410 auto-t: add test for AddressRandomization option
Tests all cases of AddressRandomization=network

1. Deterministic generation per-network (default)
2. Full randomization per-network
3. Address override per-network
2020-03-18 18:15:16 -05:00
Tim Kourt
40ad8be113 auto-t: Test PEAPv0 cryptobinding 2020-02-03 11:34:29 -06:00
Torstein Husebø
759dbdd37f treewide: fix typos 2020-01-21 16:03:28 -06:00
James Prestwood
38fa76faf5 auto-t: use stand alone radius server for testFT-FILS-SHA384
This fixes the test with recent hostapd versions
2020-01-06 11:18:48 -06:00
James Prestwood
c01751c2b3 auto-t: use stand alone radius server for testFT-FILS-SHA256
This fixes the test with recent hostapd versions
2020-01-06 11:18:48 -06:00
James Prestwood
112f1f2bef auto-t: use stand alone radius server for testFILS
This fixes the test with recent hostapd versions
2020-01-06 11:18:48 -06:00
James Prestwood
40a79dc90b auto-t: add RRM test for scan duration
mac80211_hwsim does not actually support SET_SCAN_DWELL, but since we are
not setting duration mandatory the request should still be accepted.
2019-11-15 14:17:25 -06:00
James Prestwood
c961dafc50 auto-t: let testEAP-TTLS-MSCHAPv2 use HostapdCLI easier
This test made it past the initial refactor to use HostapdCLI with the
'config' parameter. This avoids the need to iterate the hostapd map in
the actual test.
2019-11-14 15:23:03 -06:00
James Prestwood
0c586dc8ca auto-t: give testEAP-TTLS-MSCHAPv2 a longer timeout
When logging is turned on this test consistently fails due to a
timeout. Giving it a bit more time allows it to pass.
2019-11-14 15:23:03 -06:00
James Prestwood
dcbdbac2f8 auto-t: fix intermittent failures in testEAP-MSCHAPV2
Occationally autoconnect would start which was not expected in the
test. This is fixed by disabling autoconnect in the provisioning files.
2019-11-14 12:58:18 -06:00
James Prestwood
a3817ba015 auto-t: add ctrl_interface to testHotspot
This is now required for any test using HostapdCLI
2019-11-13 16:37:17 -06:00
James Prestwood
088ed86f3d auto-t: add ctrl_interface to testHT-VHT
This is now required for any test using HostapdCLI
2019-11-13 16:37:17 -06:00
James Prestwood
5e98a1bbe5 auto-t: add ctrl_interface to testFILS
This is now required for any test using HostapdCLI
2019-11-13 16:37:17 -06:00
James Prestwood
7c2f73148c auto-t: add ctrl_interface to testOWE
This is now required for any test using HostapdCLI
2019-11-13 16:37:17 -06:00
James Prestwood
b45242562b auto-t: add RRM autotest
This test merely verifies hostapd receieved our measurement reports
and verified they were valid. Hostapd does not verify the actual
beacon report body. Really, the only way to test this is on an
actual network which makes these requests.
2019-11-07 12:26:19 -06:00
James Prestwood
87bd9f4c6e auto-t: support hostapd event processing
Hostapd has a feature where you can connect to its control socket and
receive events it generates. Currently we only send commands via this
socket.

First we open the socket (/var/run/hostapd/<iface>) and send the
ATTACH command. This tells hostapd we are ready and after this any
events will be sent over this socket.

A new API, wait_for_event, was added which takes an event string and
waits for some timeout. The glib event loop has been integrated into
this, though its not technically async since we are selecting over a
socket which blocks. To mitigate this a small timeout was chosen for
each select call and then wrapped in a while loop which waits for the
full timeout.
2019-11-04 14:42:17 -06:00
Denis Kenzior
22cba31c8b auto-t: update to the new AgentManager path 2019-10-28 18:08:54 -05:00
James Prestwood
4fcb6c3cc6 auto-t: update testEAP-TLS to use HostapdCLI
This test did not use the updated HostapdCLI where you can specify
a config file rather than iterate hostapd list.
2019-10-28 15:01:36 -05:00
James Prestwood
14df50a0ab auto-t: fix random failures in testEAP-MSCHAPV2
Its difficult to know 100%, but this random test failures appeared
to be caused by two issues. One was that get_ordered_network is being
checked for None, when it was returning a zero length array. Because
of this the scanning block was never executed in any cases. This was
fixed in the previous commit. The other issue was the disconnect at
the start of the tests. The disconnect will cause all pending scans
to cancel, which appeared to cause the scanning block below to be
skipped over quickly if the timing was right. Then, afterwards,
getting a single network failed because scanning was not complete.
2019-10-28 15:01:33 -05:00
James Prestwood
fc9342f751 auto-t: return None with get_ordered_network(s)
If no networks are found, return None rather than an empty
array. This is easier to check by the caller (and was assumed
in some cases). Also add an exception to get_ordered_network
if no network is found.
2019-10-28 14:59:58 -05:00
Denis Kenzior
d12ee292aa treewide: Use CamelCase for disable_anqp setting 2019-10-24 23:18:23 -05:00
Denis Kenzior
e540978633 treewide: Use CamelCase for [Scan] settings 2019-10-24 15:58:08 -05:00
Denis Kenzior
19a85a85e7 treewide: Rename EAP mtu key to MTU 2019-10-24 13:51:20 -05:00
Denis Kenzior
d66139fe34 treewide: Switch to CamelCase for Blacklist settings 2019-10-24 13:38:11 -05:00
Denis Kenzior
aa13f5458d auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
Denis Kenzior
2521830d3e auto-t: Update to use InvalidArguments error 2019-10-24 10:54:45 -05:00
Denis Kenzior
584712dc6d auto-t: Update to the new wsc api naming 2019-10-24 10:49:13 -05:00
James Prestwood
cdc9eb13aa auto-t: hostapd: raise exception upon invalid config
If the config file passed in is not found we would continue and
eventually something else would fail. Instead immediately raise an
exception to be more clear on what is actually failing.
2019-10-22 21:58:30 -05:00
James Prestwood
8885135e63 auto-t: add TLS test with embedded PEMs 2019-10-07 23:09:29 -05:00
Tim Kourt
b3ccabea9e auto-t: Exercise '--dontask' iwctl command-line option 2019-09-19 12:36:12 -05:00
James Prestwood
e3fe7ab18e auto-t: test frequency removal and cleanup
This cleans up the test, but also adds some code to make sure the
frequency file is updated when a known network is forgotten
2019-09-16 13:49:08 -05:00
James Prestwood
c1890c6b06 auto-t: updated testScanKnownFreqs
This autotest was manually creating the .known_network.freq file so
the UUID needed to be manually generated and updated for the test
to function correctly.
2019-09-12 11:36:00 -05:00
James Prestwood
6503a1b482 auto-t: add frequency_test to testKnownNetworks
This tests that the known frequency file works as expected, both
for PSK and hotspot (and 8021x) networks.
2019-09-12 11:35:57 -05:00
Tim Kourt
bab9a4b6f2 auto-t: Remove no longer relevant test
The client prompts user for the missing secrets now, instead of
exiting with an error status code.
2019-09-11 11:48:24 -05:00
James Prestwood
50c947b53c auto-t: set CONFIGURATION_DIRECTORY
The --config option was removed, so any tests which start IWD from
python need to set this option if they need a special configuration
directory.
2019-09-09 15:40:09 -05:00
James Prestwood
c17b0ce04e auto-t: check for known networks in EAP-WSC
Make sure changes to WSC continue to work with known networks
2019-08-28 13:06:40 -05:00
James Prestwood
a0a81c72e1 auto-t: add autoconnect hotspot test 2019-08-28 11:28:53 -05:00
James Prestwood
0766138432 auto-t: update testHotspot with new Name requirements 2019-08-21 14:17:15 -05:00
James Prestwood
0f55b0023d auto-t: add hotspot to testKnownNetworks 2019-08-21 14:17:00 -05:00
James Prestwood
0846f76703 auto-t: add 'hotspot' network type 2019-08-21 14:16:08 -05:00
Tim Kourt
636bf5749f auto-t: Test client's non-interactive connect command 2019-08-15 15:06:59 -05:00
James Prestwood
5af5498aa9 auto-t: add shell test
This is merely an empty test that can act as a sandbox for the new
--shell command. It was not named with 'test' so that autotesting
will skip it.

This test is not very useful for virtual hardware testing
(mac80211_hwsim), but very useful for USB/PCI passthrough. When
setup correctly, you can now pass through a single device and test
against real networks with a minimal kernel.
2019-08-07 16:37:51 -05:00
James Prestwood
e2ec571f06 auto-t: remove dbus scan call in SAE autoconnect test
Doing this scan causes issues in the test. Like with other autoconnect
tests we can just use the fact that IWD will always be doing a periodic
scan during start up, so we only need to wait for that to finish before
querying the network list.
2019-08-02 02:23:45 -05:00
James Prestwood
43e9cce1dc auto-t: fix hotspot tests to remove main.conf
The hotspot tests were not cleaning up /tmp/main.conf, which resulted
in future tests failing.
2019-08-02 02:21:53 -05:00
Tim Kourt
9736bc211c auto-t: Test disconnect on connect while connected 2019-07-23 17:19:12 -05:00
James Prestwood
ce9e61d727 auto-t: hotspot dir not hidden 2019-07-15 11:14:01 -05:00
James Prestwood
c5eba1cc27 auto-t: add test for Hotspot with roaming consortium 2019-07-15 11:11:29 -05:00
James Prestwood
e5dedc3378 auto-t: add HESSID hotspot autotest
This tests the use of ONLY the HESSID configuration option. In
this test we also explicitly disable ANQP.
2019-07-03 13:02:28 -05:00
James Prestwood
7ed51a2d95 auto-t: update testHotspot with copy_to_hotspot 2019-07-03 13:02:28 -05:00
James Prestwood
cdc80cd341 auto-t: add copy_to_hotspot
Initially the solution to copying files to .hotspot was to use the
existing copy_to_storage, but allow full directory copying. Doing it
this way does not allow us to copy single files into .hotspot which
makes it difficult to test single configurations in several consecutive
tests.

This adds a new API, copy_to_hotspot, where a single hotspot config
can be provided. clear_storage was also modified to clear out the
.hotspot directory in addition to the regular storage directory.
2019-07-03 13:02:28 -05:00
James Prestwood
1a2f10dacd auto-t: allow copy_to_storage to copy directories 2019-07-03 11:36:08 -05:00
James Prestwood
f9aeee8707 auto-t: add Hotspot autotest 2019-06-27 13:01:00 -05:00
James Prestwood
65eeab1313 auto-t: updated autotests to use hwsim.get_radio
This removes all the duplicated code where the interfaces are iterated
and the radio/hostapd instances are created. Instead the two new APIs
are used to get each instance, e.g.:

hapd = HostapdCLI(config='ssid.conf')
radio = hwsim.get_radio('radX')
2019-06-11 11:44:00 -05:00
James Prestwood
0c554500e1 auto-t: add simple getter for radios 2019-06-11 11:44:00 -05:00
James Prestwood
1561392614 auto-t: update testOWE to use new HostapdCLI 2019-06-05 16:18:26 -05:00
James Prestwood
5937bfafca auto-t: update testFILS to use new HostapdCLI 2019-06-05 16:18:26 -05:00
James Prestwood
35f06ef87a auto-t: hostapd: allow CLI to lookup by config file
There is a common interface lookup in many tests in order to initialize
the HostapdCLI object e.g.:

for intf in hostapd_map.values():
    if intf.config == 'ssidOWE.conf':
        hapd = HostapdCLI(intf)
        break

Instead of having to do this in every test, HostapdCLI will now
optionally take a config file (config=<file>). The interface object
will still be prefered (i.e. supplying an interface will not even
check the config file) as to not break existing tests. But if only
a config file is supplied the lookup is done internally.

There are some tests that do still need the interface, as they do
an interface lookup to initialize both hostapd and hwsim at the
same time.
2019-06-05 16:18:26 -05:00
James Prestwood
55a077d399 auto-t: testutil: allow skipping of group traffic test
If the network does not support group traffic we can now skip the
broadcast test by specifying group=False in test_ifaces_connected.
2019-06-05 16:18:26 -05:00
James Prestwood
77d66ebc54 auto-t: FILS-FT autotest 2019-05-23 15:28:24 -05:00
James Prestwood
e5d36bbb33 auto-t: add AP test with no AP iftype support
Ensures IWD properly handles an adapter which does not support AP mode.
2019-05-13 16:38:23 -05:00
James Prestwood
f30c4bf578 auto-t: handle exceptions correctly for start_ap
The start_ap method was raising potential dbus errors before converting
them to an IWD error type. This is due to dbus.Set() not taking an error
handler. The only way to address this is to catch the error, convert it
and raise the converted error.
2019-05-13 16:38:23 -05:00
James Prestwood
d6eade2252 auto-t: add test for CCMP with no support
Using the new cipher_disable hwsim option we can disable CCMP support
but require it on the AP. This should result in a Not Supported error.
2019-05-13 16:38:23 -05:00
James Prestwood
02a0a821b4 auto-t: add test for FT-over-DS 2019-05-09 13:38:48 -05:00
James Prestwood
1801262f2a auto-t: update FT tests to disable FT-over-DS 2019-05-09 12:26:33 -05:00
James Prestwood
7f3e47881b auto-t: remove rekey from testFILS
mac80211_hwsim is not quite ready to allow rekeys (will be soon).
2019-05-08 14:42:21 -05:00
James Prestwood
7cbbca23ce auto-t: fix OWE tests, use explicit ifnames 2019-05-02 13:34:04 -05:00
James Prestwood
19bb93a622 auto-t: require "needs_hwsim" on hwsim tests
Running autotests with native hardware will not work on tests which
depend on the hwsim python API (since hwsim will not be running).
For these tests, it will now be required that they specify:

needs_hwsim=1

This allows the test to be skipped when running with native hardware
rather than the test failing with a python exception.
2019-05-01 17:03:37 -05:00
James Prestwood
4209837c0d auto-t: update testFILS to do PTK rekeys 2019-04-26 12:40:13 -05:00
James Prestwood
a6d7907a61 auto-t: fix FILS-384 autotest
This new test was merged during the time when testutil was not working
properly, so it was never verified to work with respect to testutil
(testing for 'connected' has always worked).

Since testFILS has 2 hostapd interfaces test_interface_connected was
defaulting to the incorrect interface for the SHA384 test. Now, the
explicit interfaces are passed in when checking for connectivity.
2019-04-26 12:22:58 -05:00
Andrew Zaborowski
1521b57ec9 autotests: Use device.name instead of a hardcoded interface 2019-04-22 18:20:06 -05:00
Andrew Zaborowski
c73575585b autotests: Remove del wd at the end function pattern
Don't use del wd to dereference the IWD instance at the end of the function
where it has been defined in the first place as at this point wd is about
to have its reference count decreased anyway (the variable's scope is
ending) so it's pointless (but didn't hurt).

Relying on the __del__ destructor to kill the IWD process in those tests
it has been started in the constructor is a bit of a hack in the first
place, because the destructor is called on garbage collection and even
through CPython does this on the refcount reaching 0, this is not
documented and there's no guideline on when it should happen or if it
should happen at all.  So it could be argued that we should keep the del
wd statemenets to be able to easily replace all of them with a call to a
new method.  But most of them are not placed so that they're guaranteed
to happen on test success or failure.  It would probably be easier to do
this and other housekeeping in a base class and make the tests its
subclasses.  Also some of these tests don't really need to launch iwd
themselves, since IWD now tracks changes in the known network files I
think IWD only really needs to be killed between tests when main.conf
changes.
2019-04-22 18:20:01 -05:00
Andrew Zaborowski
f456ac49dc autotests: Use hostapd_map in place of wiphy_map
In the tests that only want to iterate over the hostapd interfaces,
simplify the pattern of walking through the whole wiphy_map tree by
instead using the hostapd_map variable which is already filtered to only
contain hostapd interfaces.
2019-04-22 18:16:14 -05:00
Andrew Zaborowski
576d8ad123 autotests: In testutil obtain interface list dynamically
For the interface connectivity tests obtain the lists of interfaces in
use directly from the IWD class, which has the current list from DBus
properties.
2019-04-22 18:16:11 -05:00
Andrew Zaborowski
0a196025f2 autotests: Remove unneded loops
The hostapd_map dictionary is indexed by the interface name so there's
no point iterating over it to find that entry whose name matches, we can
look up by the name directly.  Simplify code.
2019-04-22 16:34:36 -05:00
Andrew Zaborowski
e13c749d1e autotests: Update the wiphy_map and hostapd_map structs
In the test utilties updated the wiphy_map struct built from the
TEST_WIPHY_LIST variable to parse the new format and to use a new
structure where each wiphy is a namedtuple and each interface under it
also contains a reference to that wiphy.  The 'use' field is now
assigned to the wiphy instead of to the interface.
2019-04-22 16:34:17 -05:00
James Prestwood
00bbc62dfb auto-t: FILS autotest 2019-04-22 16:27:25 -05:00
James Prestwood
0ffc5af09c auto-t: add group renegotiate test to OWE 2019-04-19 13:52:31 -05:00
Tim Kourt
6fd68dae64 auto-t: Test quick scan 2019-04-16 18:20:29 -05:00
Tim Kourt
20ac57783b auto-t: AdHoc - address race condition
The AdHoc methods used to miss the change in properties
on AdHoc interface. To address the race condition, we
subscribe 'PropertiesChanged' signal first and then do
GetAll properties call. This way we are not missing
'PropertiesChanged' signal in between these calls.
2019-03-22 12:40:11 -05:00
James Prestwood
3641cfe30e auto-t: update SAE tests to use MFP/CCMP 2019-03-22 11:38:15 -05:00
James Prestwood
06ee531749 testutil: retry up to 3 times for connectivity 2019-03-19 09:42:53 -05:00
Tim Kourt
55b3a974c6 auto-t: Split EAP-WPS tests
Previously, the WPS tests have shared a single instance of iwd
among themselves. This approach didn’t allow to identify which
tests have passed and which failed. The new solution makes WPS
tests independent from each other by creating a new instance
of iwd for each one of them.
2019-03-19 09:41:39 -05:00
Tim Kourt
664cf5a368 auto-t: TTLS-MSCHAPv2 - remove iwd instance on failure 2019-03-15 17:04:11 -05:00
Tim Kourt
bda956f2b2 auto-t: SAE - remove iwd instance on failure 2019-03-15 17:04:07 -05:00
Tim Kourt
b4485f3e1b auto-t: Ad-Hoc - remove iwd instance on failure 2019-03-15 17:03:34 -05:00
James Prestwood
6de133aee7 auto-t: add timeout test for testOWE
This simulates an authenticate timeout. This test really just proves
that IWD doesn't crash in this case.
2019-03-01 17:15:22 -06:00
James Prestwood
981892470a auto-t: test for temporary blacklist
The simplest way to test this was to create a new AP, where
max_num_sta=1. This only allows a single STA to connect to this AP.
We connect a device to this AP, then try and connect with another.
This results in hostapd failing with DENIED_NO_MORE_STAS, which will
cause a temporary blacklist. We can then disconnect both devices,
and reconnect the device that previously got denied. If it connects
then we know the blacklist only persisted for that earlier connection.
2019-03-01 13:13:19 -06:00
James Prestwood
d47e31954b auto-t: add test for HT/VHT rates
This is a VERY simple test for HT/VHT. Since there are so many potential
options in the IE this really just tests that drops in RSSI will cause
IWD to choose a different BSS, even if that means choosing HT over VHT,
or even basic rates over HT/VHT.
2019-02-25 15:10:31 -06:00
James Prestwood
dc280b83d7 auto-t: add config file for testSAE
This conf file was forgotten after updating SAE to work with group 20
2019-02-07 11:10:14 -06:00