3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-06 03:59:22 +01:00
Commit Graph

460 Commits

Author SHA1 Message Date
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