Commit Graph

262 Commits

Author SHA1 Message Date
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
James Prestwood 2e5099a716 auto-t: add SAE test for group 20 2019-02-01 16:01:01 -06:00
James Prestwood 3ecf091196 auto-t: clean up SAE autotests
SAE has a clogging test which requires 4 radios to all simultaneously
connect. All the other tests are only using one of these radios, so
in these tests we explicitly disconnect these devices preventing them
from autoconnecting.
2019-02-01 15:57:23 -06:00
James Prestwood ffa943f02f auto-t: Use group 20 in EAP-PWD autotest
Since the EAP-PWD fragmentation test uses group 19 there is test
coverage there for that group. This changes connection_test to use
group 20 instead of 19.
2019-01-31 12:42:28 -06:00
James Prestwood 2522216379 auto-t: Add test for BSS blacklisting 2019-01-30 13:27:34 -06:00
James Prestwood 8956451b26 test-runner: decouple --verbose with --valgrind
When using --valgrind, you must also use --verbose iwd, and, depending
on the tests you may also need to include pytests in the verbose flag.
Since anyone using --valgrind definitely wants to see valgrind info
printed they should not need to enable verbose printing. Also, manually
parsing valgrind prints with IWD prints mixed throughout is a nightmare
even for a single test.

This patch uses valgrind's --log-file flag, which is directed to
/tmp/valgrind.log. After the tests runs we can print out this file.
2019-01-18 08:57:21 -06:00
Tim Kourt 04225757d6 auto-t: Disable MAC rand. for tests with trans. medium 2019-01-16 13:20:04 -06:00
Tim Kourt f8fedb0ec8 auto-t: Disable MAC rand. for tests with hidden networks 2019-01-16 13:19:48 -06:00
Tim Kourt 0b4509d8d2 auto-t: Test Tunneled-MSCHAPv2 over TTLS 2019-01-10 17:26:22 -06:00
James Prestwood ae47d12520 auto-t: use get_ordered_network call in remaining tests
This hopefully wraps up the API migration to get_ordered_network
rather than the plural (get_ordered_networks) version.
2019-01-08 21:24:59 -06:00
James Prestwood edbe38103a auto-t: remove hwsim dependency from testSAQuery
hwsim was imported but never used
2019-01-08 21:24:25 -06:00
James Prestwood 2f4c9d05fe auto-t: use get_ordered_network in testWPA2
Modified 'password_test' in testWPA2 to use the new get_ordered_network
call.
2019-01-07 17:02:53 -06:00
James Prestwood 74599ce33d auto-t: update tests to use get_ordered_network call 2018-12-14 13:47:00 -06:00
James Prestwood 9d3d65a282 auto-t: add get_ordered_network(ssid)
This is a helper/shortcut to get_ordered_networks (plural). In nearly
all the autotests we had (roughly) the same block of code:

ordered_network = get_ordered_networks()[0]

self.assertNotEqual(ordered_network, None)
self.assertEqual(ordered_network.name, "someSsid")

Rather than having to do this, we can simplify and just have a single
call to get_ordered_network, which takes the SSID. If the SSID is not
found, we raise an exception. This avoids needing both asserts since
we are guarenteed that the return is valid and the SSID matches.

This also avoids possible issues with multiple networks showing up in
the GetOrderedNetworks call. Eventually test-runner will support running
tests on real wireless hardware, so its possible we could pick up
unexpected networks in the scan.
2018-12-14 13:46:32 -06:00