Commit Graph

433 Commits

Author SHA1 Message Date
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
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
James Prestwood 699b83cb1f auto-t: removed ';' from many autotests
At some point a stray ';' got added into an autotest in a section
of code that is heavily copy pasted. So in turn nearly all the autotests
have this stray ';' after list_devices (and a few in other places).
2018-12-14 13:46:23 -06:00
Andrew Zaborowski d558724676 autotests: Update expected error in password length test 2018-12-03 14:21:30 -06:00
Andrew Zaborowski c9d8346d40 autotests: Test bad PSK password lengths 2018-11-30 10:26:33 -06:00
James Prestwood 373d78dacb auto-t: add OWE autotest 2018-11-19 12:10:55 -06:00
Tim Kourt da9b1f785e auto-t: switch MD5 to new property key 2018-10-29 18:46:07 -05:00
James Prestwood ec4cb6beeb auto-t: test connectivity in testWPA
testWPA was not verifying connectivity between the two interfaces. Funny
enough, doing this resulted in the same problems that adhoc had where
we were setting the connection as complete before the gtk/igtk were set.
This is fixed now so we can now use testutil in this test.
2018-10-26 15:29:55 -05:00
James Prestwood da262e7187 auto-t: fix testFT-8021x-roam autoconnect
As with many other test, we need to disable autoconnect for better
reliablility.
2018-10-26 15:29:52 -05:00
Tim Kourt 6661f8c83e auto-t: Change EAP-PWD to a common pwd setting key name 2018-10-25 14:52:41 -05:00
Tim Kourt fc6cebb259 auto-t: rename test
Rename test to avoid confusion with TTLS-MSCHAPV2
2018-10-25 14:15:04 -05:00
Tim Kourt d8905e0666 auto-t: switch GTC to new property key 2018-10-25 14:15:01 -05:00
Tim Kourt 096caf2084 auto-t: test TTLS-MSCHAP 2018-10-25 13:56:13 -05:00
Tim Kourt 10382156b4 auto-t: kill instances of iwd 2018-10-19 14:16:00 -05:00
Denis Kenzior cb50eb6368 Revert "auto-t: Fix EAP-SIM-ofono test"
This reverts commit 7903432e85

The culprit was inside phonesim, not the autotest
2018-10-02 17:56:31 -05:00
Tim Kourt d866ba7557 auto-t: prevent auto connection in pre auth roam test
iwd used to auto connect to AP before it was expected by the test
2018-10-02 16:16:36 -05:00
Tim Kourt 2cb3b7cf2e auto-t: add explicit scan and completion check
The occasional race conditions used to cause the test to fail
due to the empty list of ordered networks
2018-10-02 15:10:17 -05:00
Tim Kourt dc49401fc0 auto-t: test TTLS-CHAP 2018-10-01 17:30:06 -05:00
Tim Kourt fac0131e7c auto-t: test TTLS-PAP 2018-10-01 17:14:05 -05:00
James Prestwood 7903432e85 auto-t: Fix EAP-SIM-ofono test
Curiously this test started failing. The problem was incorrect KC/SRES
values in the sim.db file. I noticed no direct changes to this file,
but changes inside ofono, phonesim, and hostapd could have potentially
caused this.
2018-10-01 14:37:20 -05:00
Denis Kenzior 2527f79670 auto-t: Add WPS tests for StartPin method
This adds two additional test scenarios (using 4 digit and 8 digit
PINs) for testing the StartPin method of the WiFiSimpleConfiguration
interface.
2018-09-24 12:19:27 -05:00
Denis Kenzior 332d4f8e61 auto-t: Add additional utilities for WPS PIN support 2018-09-24 12:19:27 -05:00
James Prestwood 6f833d6cad auto-t: added autotest for FT over SAE
This test was copied from testFT-PSK-roam, but for SAE. The test behaves
as follows:

 - Connect to SAE network (full authentication)
 - Fast transition to another SAE AP
 - Fast transition to a PSK/WPA2 AP
2018-09-21 11:29:19 -05:00
Tim Kourt 3d43d633d1 auto-t: address Dbus API changes
This is a temporary fix to address the recent split of
the Device interface. This patch contains a workaround that
re-enables the auto-tests while the test framework is being
reworked to satisfy the need of the new API and should not
be considered as a permanent solution.
2018-09-19 11:59:28 -05:00
Tim Kourt dcdfdde5dc auto-t: use device waiting feature in all tests 2018-09-19 11:54:36 -05:00
James Prestwood 96330fd75a auto-t: fix OrderedNetwork to work with station API 2018-09-14 21:45:59 -05:00
James Prestwood dd51434560 auto-t: Fix testAP
Fixed two issues:

1. There is no longer a dbus exception when switching to AP mode when
   connected in station mode so that assert was removed.

2. After the device/station change the timing must have changed, causing
   autoconnect to take over before an explicit connect call. Added a
   psk provisioning file that disables autoconnect.
2018-09-14 01:38:45 -05:00
Marcel Holtmann ea20559599 tools: Change net.connman.iwd.hwsim to net.connman.hwsim 2018-09-14 15:27:57 +02:00
Denis Kenzior 9ac46e900e auto-t: Use Station interface for methods 2018-09-05 11:09:35 -05:00
Denis Kenzior 0912a6afb8 auto-t: Convert RSSI agent test to the new API 2018-09-04 23:57:14 -05:00
Andrew Zaborowski 1024562e1d autotests: Always clean up in testAP
Make sure stop_ap is called on success and on failure in both tests so
that one can succeed after the other has failed.  Also make sure to move
both interfaces out of autoconnect state.
2018-08-23 21:43:27 -05:00
Denis Kenzior d8882a75e5 auto-t: Make sure to disable autoconnect 2018-08-14 13:11:44 -05:00
James Prestwood 57fedfba46 auto-t: added test for SAE 2018-08-14 10:37:56 -05:00
Denis Kenzior fac55f6891 auto-t: Rename SignalLevelChanged to Changed 2018-08-13 20:40:59 -05:00
James Prestwood 9ff0e8f6ef auto-t: fixed typo in autoconnect test 2018-08-13 11:09:27 -05:00
James Prestwood a1a85b0135 auto-t: fixed TLS/TTLS autotests
These test were failing due to autoconnect taking over before
the explicit connect call. This adds Autoconnect=False to all
TLS/TTLS tests.
2018-08-10 15:43:45 -05:00
James Prestwood 4ddb95e147 auto-t: made waiting for network connection optional
The default behavior of NetworkObject.connect() is to wait for the
Connect dbus method to reply before returning back to the test. This
change makes it possible to connect, but not wait for a reply and
continue on with the test (by specifying wait=False). This is
specifically required to test SAE anti-clogging, where the AP needs
to have several simultaneous connections at once for the anti-clogging
logic to trigger. This change also adds Device.wait_for_connected()
which waits for the device interface State variable to be "connected".
2018-08-09 15:22:18 -05:00
Andrew Zaborowski 127c37ba66 autotests: Test filesystem watch in testKnownNetworks 2018-08-09 10:35:48 -05:00
James Prestwood f00c228665 auto-t: added test for EAP-GTC w/ agent 2018-07-31 14:35:39 -05:00
Andrew Zaborowski 5dd7bd0201 autotests: Update testKnownNetworks with DBus API changes 2018-07-31 11:53:02 -05:00
James Prestwood fc9cfdc0fe auto-t: Removed unused PSKAgent in EAP-AKA test 2018-07-24 11:53:42 -05:00
Andrew Zaborowski e084b11d39 autotests: Wait for ConnectHiddenNetwork to finish
This lets the testHiddenNetworks tests check if exceptions have been
raised, makes exceptions_test.py pass.
2018-07-23 11:46:03 -05:00
James Prestwood bea6a9f522 auto-t: Adhoc autotests 2018-07-17 17:03:08 -05:00
James Prestwood 12b3ac47fd auto-t: Added adhoc util functions to IWD class 2018-07-17 17:02:59 -05:00
Tim Kourt e64c1e5dc7 auto-t: modify scan test to include hidden networks 2018-07-11 17:23:44 -05:00
Tim Kourt 4f953586e6 auto-t: add test for the hidden networks 2018-07-11 17:23:31 -05:00
Tim Kourt 63232dd7fe auto-t: known networks
1) wait for a device to become available
2) add try, except block for the clean termination of iwd in
   the case of a failure
3) increase the max execution time to help with valgrind
2018-07-02 18:51:06 -05:00
Tim Kourt 6bffa395d9 auto-t: ConnectAutoconnect
1) wait for a device to become available
2) add try, except block for the clean termination of iwd in
       the case of a failure
3) remove waits
4) eliminate a race condition on get_ordered_networks()
2018-07-02 18:51:06 -05:00
James Prestwood 8a91d88629 auto-t: failure test for WPA2
The AP code merge resulted in changes to handshake failure
code paths. This just adds a failure test to WPA2 to test
these failure code paths.
2018-07-02 13:05:42 -05:00
James Prestwood c9b4e41604 auto-t: updated tests to use new list_devices
list_devices() was updated to take an integer rather than a bool
for the wait_to_appear argument. This updates any tests that
explicily passed True/False as the argument to list_devices.
2018-07-02 13:05:38 -05:00
James Prestwood 003c1dbc97 auto-t: Changed list_devices() wait_to_appear to int
The list_devices API has a race condition where sometimes it will
return zero or less than the expected number of devices and fail
the test. A fix is in place for when only a single devices is
expected, but some tests expect more than one device. This changes
wait_to_appear to an integer, and the caller can specify the number
of devices they expect to get back. The default stays as it was,
zero or "return cached devices".
2018-07-02 13:05:34 -05:00
James Prestwood 69fe274c7d auto-t: Fixed AP test to work with multiple sub-tests
The single AP test worked fine, but adding a failure test caused some
problems. Since the kernel is never restarted between tests it maintains
old stale scan results from the previous test. This was causing an
assert to sometimes fail in the second test being run because it was
returning > 1 ordered networks. This change iterates through the ordered
network list and chooses the appropriate network rather than assuming
get_ordered_networks() will always return only one network object
2018-06-29 18:30:28 -05:00
James Prestwood 7fedc2bf66 auto-t: Updated start/stop_ap to use new interface 2018-06-29 18:28:41 -05:00
Tim Kourt 5eb043e501 autotests: support new errors 2018-06-29 13:46:36 -05:00
Tim Kourt e9fef6ba52 auto-t: add connect API for the hidden networks
In addition, add dbus exception for the service set overlap
2018-06-28 15:59:18 -05:00
Tim Kourt 395a70d652 auto-t: fix wait logic for the devices
In addition, it makes InterfacesAdded\Removed handlers
a little more generic.
2018-06-28 15:57:49 -05:00
James Prestwood 28c400499d auto-t: added failure test case to AP
Tests an invalid PSK.
2018-06-27 14:41:25 -05:00
Denis Kenzior 025f9a3760 autotests: Fix EAP-PEAP-MSCHAPv2 test
The Identity field needed to be escaped
2018-06-14 19:25:29 -05:00
Andrew Zaborowski 91456b8d98 autotests: Test 4 ways MsCHAPv2 can be configured 2018-06-13 12:18:08 -05:00
James Prestwood e2ac29b492 auto-t: added reauth to connection test
Both EAP-SIM and EAP-AKA will now attempt a reauth after the
connection to exercise reset_state.
2018-06-12 11:09:10 -05:00
Tim Kourt d402b6034a auto-t: enable debug output for iwd
This enables debug output for iwd when started from python
2018-05-31 19:28:16 -05:00
Denis Kenzior 6c2ecc6ca5 autotests: Bump iwd startup timeout
iwd now performs a lot of crypto checks at startup, so the timeout was
sometimes being triggered.
2018-05-30 22:36:41 -05:00
Denis Kenzior 0c701d974a autotests: Bump timeout value
Since EAP-PWD now tests EAP Re-Authentication and waits, bump up the
test timeout time.
2018-05-30 22:36:41 -05:00
Tim Kourt ca0f993358 auto-t: change EAP-PWD to trigger eapol reauth 2018-05-30 22:36:34 -05:00
Tim Kourt 7f437c30e3 auto-t: add eapol reauth cmd into hostapd mngr 2018-05-30 18:59:02 -05:00
Tim Kourt 342ffc5652 auto-t EAP-PEAP
1) Refactored to start catching the exceptions and properly
   dispose an instance of iwd
2) Switched to list_devices with wait option
2018-05-21 17:46:07 -05:00
Tim Kourt b3b0c3dea5 auto-t: fix configuration for MFP usage 2018-05-21 17:45:59 -05:00
Tim Kourt 6ccb99d98b auto-t: fix python interface handler for devices 2018-05-21 17:44:44 -05:00
Tim Kourt ef610e0f47 auto-t: testAP increased the max execution interval 2018-05-21 17:44:21 -05:00
Tim Kourt 5bc6e986e4 auto-t: GTC
1) Renamed the test to reflect the usage of PEAP
2) Prevented the creation of an extra instance of iwd
3) Refactored to start catching the exceptions and properly
   dispose an instance of iwd
4) Switched to list_devices with wait option
2018-05-21 17:44:16 -05:00
Tim Kourt 68bc64c8cd auto-t: EAP-PWD
1) Removed duplicated entries form .conf
2) Refactored to start catching the exceptions and properly
   dispose an instance of iwd
3) Switched to list_devices with wait option
2018-05-21 17:43:11 -05:00
Tim Kourt d111e03035 auto-t: MFP test
1) Switch to new Agent API
2) Refactored to start catching the exceptions and properly
   dispose an instance of iwd
2018-05-21 17:43:09 -05:00
Tim Kourt 2608dcae6f auto-t: Add testEAP-PEAP-SIM 2018-05-15 14:32:51 -05:00
Tim Kourt 541c207470 auto-t: Add testEAP-PEAP-MSCHAPv2 2018-05-15 14:32:51 -05:00
Tim Kourt 102a455e00 auto-t: Enable test frwk to wait for the radios
Previously, we had to wait for an arbitrary amount of time after
iwd was started form the python scripts to make sure that the
radio objects are available on the D-bus. This patch allows to
wait inside of list_devices() method and get back a list of the
devices once they are available.
2018-05-15 14:32:51 -05:00
James Prestwood b774695a7e autotests: Fix autoconnect autotest issue
These tests were failing (both with/without ofono) because iwd
was trying to autoconnect before the autotest had issued a
connect request (causing iwd to return a busy response). To fix
this, autoconnect was explicitly disabled in the config file.
2018-05-07 16:19:46 -05:00
James Prestwood 1523ce1130 auto-t: added EAP-PWD autotests
One test is for the regular case, the second tests the
fragmentation logic.
2018-05-03 13:03:21 -05:00
James Prestwood a83419011e auto-t: Honor valgrind flag if iwd starts from python
Before starting iwd, we check if IWD_TEST_VALGRIND was set
by test-runner, and if so, start iwd with the appropriate
valgrind options.
2018-04-27 11:21:36 -05:00
Andrew Zaborowski 145711762f autotests: Update excpected exception in testConnectAutoconnect
Update the expected DBus exception in the manual connect case, affected
by recent EAP changes.  Also slightly improve the comment in the file
although it's still not 100% correct.
2018-04-26 11:37:09 -05:00
Andrew Zaborowski baf965ed76 autotests: Add an EAP-TTLS+MsCHAPV2 test
This also tests multiple agent requests for one network connection
because the TTLS client private key is not in the config file and the
MSCHAPV2 password is not in the config file.
2018-04-26 11:29:55 -05:00
Andrew Zaborowski 25a9d2a71f autotests: Test encrypted private keys with EAP-TLS
Make 3 connections in test EAP-TLS, one with an unencrypted private key,
one with the private key passphrase provided in the provisioning file
and one with the passphrase provided through the agent.  Also improve
the scanning logic at the beginning.
2018-04-26 11:28:42 -05:00
Andrew Zaborowski 099f2ecc12 autotests: Add new DBus methods to PSKAgent 2018-04-19 14:09:57 -05:00
Andrew Zaborowski a8c30cd25e autotests: Accept a list of passphrases in PSKAgent
Allow passing a list of passphrases for subsequent agent requests to the
PSKAgent constructor.  This also makes existing tests stricter because
a spurious agent request will not receive the same passphrase.
2018-04-19 14:09:52 -05:00
James Prestwood 7c77bf33c7 auto-t: add EAP-GTC autotest 2018-04-04 09:42:31 -05:00
James Prestwood e889452dde auto-t: disable timeouts in IWD class when debugging
If --gdb is used with test-runner, all the timeouts in the
IWD class must be turned off otherwise the test will fail.
Inside test-runner, a environment variable (IWD_TEST_TIMEOUTS)
is set to either 'on' or 'off'. Then the IWD class (and any
others) can handle the timeouts accordingly. Note that this
does not turn off dbus timeouts, rather it ignores timeout
failures. This does mean that ultimately the test will most
likely fail due to a dbus timeout, but it at least gives you
unlimited debugging time.
2018-04-02 12:49:52 -05:00
Andrew Zaborowski 9e1578d6a9 autotests: Add a FT + 8021x roaming test 2018-03-21 14:25:34 -05:00
Andrew Zaborowski b5c2cd0298 autotests: Check connectivity in TTLS test similar to TLS test 2018-03-15 11:40:34 -05:00
Tim Kourt 2dd84f0114 auto-t: add tests for Protected EAP - type 25 2018-02-26 09:59:48 -06:00
Tim Kourt e348c8e0ce auto-t: reflect config name change in MFP tests 2018-02-13 11:50:35 -06:00
Tim Kourt d450b25b07 auto-t: reflect name change of the config file in autotests 2018-02-07 11:32:11 -06:00
James Prestwood 1491ebe877 auto-t: add SA Query tests
Two autotests:

1. Tests SA Query procedure when the AP goes down. In this case the AP
   goes down ungracefully, now allowing it to send out any deauth
   frames. When the AP comes back up, IWD still thinks its connected.
   The AP will then send unprotected disassociate frames so the client
   can re-connect. This kicks off the SA Query procedure, which the AP
   will not respond to. At this point we can deauth and reconnect to
   the AP.

2. Test SA Query procedure when a disassociate frame has been spoofed.
   In this case we receive an unprotected disassociate frame and start
   SA Query. The AP should then respond to the SA query within the
   timeout. We then know the frame was spoofed and can remain
   connected.
2018-02-01 10:29:44 -06:00
James Prestwood 62bdf6c482 auto-t: hwsim fixup
Changed disassociate reason to 0x07 when spoofing a disassociate
frame. This along with 0x06 are the only two reason codes that
should be accepted in an unprotected disassociate frame.
2018-02-01 10:12:09 -06:00
James Prestwood 13429f8f2d auto-t: add spoofing frame support to hwsim util
Using the hwsim dbus interface ".Interface" under the radios
object you can now send an arbitrary frame out from that radio.
Two methods have been added, spoof_frame and spoof_disassociate.
2018-01-30 23:03:55 -06:00
James Prestwood fe616fbfa5 auto-t: hostapd util get_config_value and get_freq
The hwsim SendFrame method requires the radio frequency which
is obtained from the hostapd config file. This adds a generic
API to get any config value from the hostapd config, as well
as a get_freq API that converts the channel number to a
frequency.
2018-01-30 23:03:51 -06:00
James Prestwood 0db0ce43b8 auto-t: add ungraceful restart to hostapd util
For testing SA Query, the autotest needs the ablility to force
kill (and restart) hostapd without giving it time to deauth its
stations gracefully. A method was added to the HostapdCLI class
which does a killall -9 hostapd, resets the wlnX interface,
and restarts hostapd with the same arguments as it had before.
2018-01-29 14:05:57 -06:00
Marcel Holtmann 980f6f3645 main: Rename iwd/iwd.conf into iwd/main.conf 2018-01-29 02:13:41 -08:00
James Prestwood 5c11c2f351 autotest: test AP Roam 2018-01-18 15:35:38 -06:00
James Prestwood 27a35da0ba autotests: add AP roam support to hostapd.py 2018-01-18 15:35:38 -06:00
James Prestwood 6a9de526a8 autotest: fix possible hlrauc race condition
The AuthCenter will now wait for the RX thread to start before
continuing with the test.

Also removed the non blocking option and fixed the loop to
handle a blocking recvfrom call.
2018-01-18 14:43:53 -06:00
Tim Kourt ca183343e2 auto-t: Cleanup after a failure 2018-01-17 10:37:15 -06:00
Tim Kourt b1745aca79 auto-t: stop AuthCenter on failures 2018-01-04 10:43:03 -06:00
James Prestwood cf3372235c autotests: EAP-AKA' autotest using ofono 2017-12-14 17:47:39 -06:00
James Prestwood 6d07cac299 autotest: added test for EAP-SIM with ofono 2017-12-14 17:47:34 -06:00
James Prestwood 9d4532fe68 autotest: Added autotest for EAP-AKA with ofono 2017-12-14 17:47:32 -06:00
James Prestwood 6942e9c7b1 autotest: Added ofono.py utility
A new class which can be used to power on a modem and wait
for the Interfaces/Properties EAP-SIM/AKA need for
authentication.
2017-12-14 17:47:29 -06:00
James Prestwood 341fb0613a autotest: Added phonesim.conf file
SIM/AKA/AKA' (ofono) autotests will require phonesim.conf for
ofono to communicate with phonesim
2017-12-14 17:41:41 -06:00
James Prestwood 9474785839 autotest: Updated sim_keys for identity prefix change 2017-12-14 16:23:40 -06:00
James Prestwood 74d991bf8e autotest: update EAP-AKA' autotest after plugin change
A new 'keys' file must be added for hardcoded keys
2017-12-14 13:49:59 -06:00
James Prestwood 59c5e0b149 autotest: update EAP-SIM autotest after plugin change
A new 'keys' file must be added for hardcoded keys
2017-12-14 13:49:59 -06:00
James Prestwood daa215a9c3 autotest: update EAP-AKA autotest after plugin change
A new 'keys' file must be added for hardcoded keys
2017-12-14 13:49:59 -06:00
James Prestwood e9e96604c5 autotests: fix issue with hlrauc reading sim database
hlrauc.py was not stripping out newlines when reading the sim
database files.

Also added a print if an exception occurred.
2017-12-13 17:13:29 -06:00
James Prestwood 263074511d autotests: updated hlrauc.py to support re-sync
If the peer detects a sync error, it sends back AUTS. The
authentication center must then re-synchronize and update
the SQN it has saved for the given ISMI.
2017-12-13 17:13:29 -06:00
Tim Kourt ec0aab7829 auto-t: connect, auto-connect scenarios
Exercise connect, auto connect scenarios for the open,
psk, 8021x networks
2017-10-31 17:46:41 -05:00
Tim Kourt 774cfba1c4 auto-t: add NotConfigured dbus exception 2017-10-26 16:00:42 -05:00
Andrew Zaborowski 828b8b7708 autotests: Add the AP mode test 2017-10-23 11:17:14 -05:00
James Prestwood 32907c10df autotest: make hlrauc.py able to run standalone
For testing purposes, it is useful to run hlrauc.py by itself
not including it from another python script like autotests do.

Better error checking was also added as testing can result in
badly formatted data.
2017-10-18 11:17:43 -05:00
Andrew Zaborowski 06b8be902e autotests: Reset _exception after _wait_for_async_op
We need to reset self._exception after _wait_for_async_op raises an
exception, otherwise _wait_for_async_op will report that exception for
every future operation (this wasn't an issue when an exception always
meant that the test was failing and objects were torn down anyway)
2017-10-12 10:55:59 -05:00
Andrew Zaborowski 07d07bb2ca autotests: Fix an assertRaises parameter 2017-10-12 10:55:55 -05:00
James Prestwood a0cde90814 autotest: Added autotest for EAP-AKA' 2017-08-30 21:01:45 -05:00
Andrew Zaborowski d3cf79ed12 autotests: Restore AP beacons after timeout in testFT-PSK-roam
In the beacon loss test try to simulate a periodic communication problem
because we don't support roaming if the AP goes away completely.
2 seconds seems to be enough to consistently trigger the beacon_loss
event without triggering a disconnect by the linux kernel or hiding the AP
from the roam scan.  Also set the RSSI for that AP lower so that it is
not reselected by iwd.
2017-08-23 13:26:58 -05:00
James Prestwood 14dcda4d59 autotest: EAP-AKA autotest
Implemented milenage algorithm in hlrauc.py. Unlike EAP-SIM, the
authentication center must compute several values to give back
to the server (hostapd). This was already done by IWD as the peer
in EAP-AKA, but was also needed on the server side (HLR AuC).
2017-08-21 18:22:28 -05:00
James Prestwood 7c61d0365e autotest: EAP-SIM autotest
Included an HLR AuC python implementation that is required by
hostapd. This is what hostapd uses to retrieve SIM card values
over a UNIX socket.
2017-08-21 18:04:52 -05:00
Andrew Zaborowski 38b5f3fee4 autotests: Add test for roam triggered by beacon loss
The two tests in test.py are similar except for the way that the roaming
is triggered.
2017-08-15 12:43:14 -05:00
Andrew Zaborowski 132d3ac11c autotests: Test operstate is IF_OPER_UP when state == connected
Test that iwd correctly sets the interface's operstate before and after
a roam, in the same autotests which run the connectivity check.
2017-05-30 17:08:36 -05:00
Andrew Zaborowski 71c15306fd autotests: Test communication when iwd reports connected
Test that the AP interface and the station interface managed by iwd
can actually send and receive ethernet traffic when iwd is in the
connected state.  Due to linux routing none of the high level utilities
like ping or arping can be easily used to test communication between
two interfaces of the same machine so use a method based on the
mac80211_hwsim/tools/hwsim_test.c utility in the wpa_supplicant tree
that uses a raw socket to inject unicast and broadcast frames.

Add this check in three tests of different security type connections
that simulate a single AP, and the two roaming tests with two APs.
Check that the station can't communicate with the other AP's interface.
2017-05-30 17:08:31 -05:00
Andrew Zaborowski 49930c6d77 autotests: Add a SignalLevelAgent test
This test takes about 40 seconds.
2017-05-30 11:42:15 -05:00
Andrew Zaborowski ca1ef2d82f autotests: Add a utilities for the SignalLevelAgent API 2017-05-30 11:42:11 -05:00
Andrew Zaborowski 920e79b32c autotests: Add IWD.wait utility for sleeping inside tests 2017-05-16 15:29:53 -05:00
Andrew Zaborowski f0fb1d2c89 autotests: Add a Preauthentication test
Unfortunately this doesn't currently ensure that the preauthentication
has succeeded and that later the PMKSA from the preauthentication was
used in the transition, only that the preauthentication process doesn't
break the transition.  For now this can be confirmed by looking at the
testrunner -v output to see that the line "EAP completed with eapSuccess"
appears before the following line, and not after:

src/device.c:device_enter_state() Old State: connected, new state: roaming
2017-05-01 11:24:17 -05:00
Andrew Zaborowski f5036d7e1f autotests: Always wait for DBus name in IWD.__init__
Sometimes iwd will take a while to register its dbus name.  The python
class already waits for the name to appear on dbus if iwd is being
launched from python, do this also if iwd was already launched by the
test-runner.  My use case was when running iwd under valgrind in which
case it runs slower.
2017-04-26 14:44:47 -05:00
Andrew Zaborowski bb350a3b8e autotests: Avoid periodic polling in the wait methods
Modify AsyncOpAbstract._wait_for_async_op and
IWD.wait_for_object_condition to call context.iteration() in the
blocking mode instead of calling context.pending() every 0.01s.  This
gets rid of busy-waiting and also ensures that the condition is checked
after every single dbus (or other) event.  This way a condition that
potentially occurs for less than 0.01s can be reliably waited for.
2017-03-28 19:57:16 -05:00