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

111 Commits

Author SHA1 Message Date
James Prestwood
5c7f34d66b auto-t: iwd.py: use IO watch for station debug events
Similarly to hostapd.wait_for_event, IWD's variant needed to act on
an IO watch because events were being received prior to even calling
wait_for_event.
2022-03-31 18:13:02 -05:00
James Prestwood
6e608b14f5 auto-t: iwd.py: fix full_scan argument
This was not being properly honored when existing networks were
already populated. This poses an issue for any test which uses
full_scan after setting radio values such as signal strength.
2022-03-28 12:38:15 -05:00
James Prestwood
50a546705e auto-t: iwd.py: allow passing uri to start_configurator
If a URI is passed this will envoke ConfigureEnrollee()
2022-02-22 16:25:50 -06:00
James Prestwood
94cc957c5e auto-t: iwd.py: add wait argument to scan()
Lets the test continue without waiting for the method return
2022-02-14 16:02:23 -06:00
James Prestwood
994c18c44e auto-t: iwd.py: use spaces instead of tabs 2022-01-04 12:34:22 -06:00
James Prestwood
7ef165035e auto-t: iwd.py: add DPP utilities 2022-01-04 12:02:42 -06:00
James Prestwood
8178ea17fd auto-t: iwd.py: remove unused members 2022-01-04 12:02:42 -06:00
James Prestwood
4ee44ee0ea auto-t: iwd.py: remove StationDebug out of Device init
Since a Device class can represent multiple modes (AP, AdHoc, station)
move StationDebug out of the init and only create this class when it
is used (presumably only when the device is in station mode).

The StationDebug class is now created in a property method consistent
with 'station_if'. If Device is not in station mode it is automatically
switched if the test tries any StationDebug methods.

If the Device mode is changed from 'station' the StationDebug class
instance is destroyed.
2022-01-04 11:40:52 -06:00
James Prestwood
1825fd7ab7 auto-t: iwd.py: fix namespaces on StationDebug
Passing the full argument list to StationDebug was removed
because any existing properties (for Device) were being
included and causing incorrect behavior.

This neglected to handle namespaces which should also be
passed to StationDebug. Unfortunately the arguments are not
named when Device() is initialized so they cannot easily be
sorted. Instead just define Device() arguments to match the
DBus abstraction and pass only the path and namespace to
StationDebug
2021-12-22 19:10:43 -06:00
James Prestwood
44faa81a06 auto-t: iwd.py: use args[0] for station debug interface
Passing *args, **kwargs into StationDebug ended up initializing the
class with Station properties since devices can be initialized from
existing property dictionaries. Since the object path is all
StationDebug needs, pass args[0] instead.
2021-11-22 15:29:42 -06:00
James Prestwood
392eebc0a9 auto-t: iwd.py: fix re-scanning bug on get_ordered_networks
Certain scenarios coupled with lost beacons could result in OrderedNetwork
being initialized many times until the dbus library reached its maximum
signal registrations. This could happen where there are two networks,
IWD finds one in a scan but continues to scan for the other and the beacons
are lost. The way get_ordered_networks was written it returns early if any
networks are found. Since get_ordered_network (not plural) uses
get_ordered_networks() in a loop this caused OrderedNetwork's to be created
rapidly until python raises an exception.

To fix this, pass an optional list of networks being looked for to
get_ordered_networks. Only if all the networks in the list are found will
it return early, otherwise it will continue to scan.
2021-11-02 16:14:28 -05:00
James Prestwood
2e882946f8 auto-t: iwd.py: make wait() a static method
This allows it to be used without initializing an IWD class:

IWD.wait(1)
2021-10-08 08:48:56 -05:00
James Prestwood
7123f47f84 test-runner: remove special case for "root" namespace
This was a placeholder at one point but modules grew to depend on it
being a string. Fix these dependencies and set the root namespace
name to None so there is no more special case needed to handle both
a named namespace and the original 'root' namespace.
2021-09-07 12:45:26 -05:00
James Prestwood
1e0553250b auto-t: scan as many times as needed to find networks
Certain autotests coupled with slower test machines can result in lost
beacons and "Network not found" errors. In attempt to help with this
the test can just rescan (30 seconds max) until the network is found.
2021-08-18 16:55:47 -05:00
James Prestwood
a2c777ba84 auto-t: iwd.py: clean up StationDebug
Initialize this once and reference that for each method/property
2021-08-13 20:39:13 -05:00
James Prestwood
3adb91fc9e auto-t: iwd.py: allow renaming in copy_to_storage
By providing a 'name' keyword argument the file copied will be
renamed to that.
2021-08-13 14:54:53 -05:00
James Prestwood
36777d1e68 auto-t: iwd.py: add StationDebug.Event support
Adds a new wait_for_event API which waits for a StationDebug.Event.
2021-08-13 14:45:12 -05:00
James Prestwood
732871b601 auto-t: iwd.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood
7a74a825a4 auto-t: iwd.py: scan only on needed frequencies
get_ordered_network() now scans automatically and has been updated
to use the StationDebug.Scan() API rather than doing a full
dbus scan (unless full_scan = True). The frequencies to be scanned
are picked automatically based on the current hostapd status
(hidden behind ctx.hostapd.get_frequency()).
2021-08-13 10:46:16 -05:00
James Prestwood
c7466cd56a auto-t: add python API for StationDebug.Scan 2021-08-13 10:46:10 -05:00
James Prestwood
5519faecba auto-t: iwd.py: make scan_if_needed True by default
There is a common block of code in nearly every test which is incorrect,
most likely a copy-paste from long ago. It goes something like:

wd.wait_for_object_condition(device, 'not obj.scanning')
device.scan()
wd.wait_for_object_condition(device, 'not obj.scanning')

network = device.get_ordered_network("ssid")

The problem here is that sometimes the scanning property does not get
updated fast enough before device.scan() returns, meaning get_ordered_network
comes up with nothing. Some tests pass scan_if_needed=True which 'fixes'
this but ends up re-scanning after the original scan finishes.

To put this to rest scan_if_needed is now defaulted to True, and no
explicit scan should be needed.
2021-08-12 16:58:39 -05:00
James Prestwood
4f5010f69d auto-t: iwd.py: add autoconnect property/StationDebug 2021-08-12 16:58:30 -05:00
James Prestwood
77d5b57e9e auto-t: iwd.py: add roam() method
This will use the Roam() developer method to force a roam to
a certain BSS. This is particularly useful for any test requiring
roams that are not testing IWD's BSS selection logic. Rather than
creating hwsim rules, setting low RSSI values, and waiting for the
roam logic/scan to happen Roam() can be used to force the roam
logic immediately.
2021-08-12 15:14:07 -05:00
James Prestwood
3402f5994b auto-t: iwd.py: add connect_bssid() method
Python API for ConnectBssid() developer method
2021-08-12 15:14:07 -05:00
Andrew Zaborowski
c54ba7158c autotests: Initialise P2PPeer objects with correct namespace 2021-06-04 11:56:32 -05:00
James Prestwood
cb6faed69a auto-t: properly print wait_for_object_change exception 2021-04-22 13:25:23 -05:00
James Prestwood
80ff2fe140 auto-t: iwd.py: release namespace on IWD close 2021-02-26 10:09:36 -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
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
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
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
5a7eb91378 auto-t: update utilities to use namespaces 2020-11-18 11:01:11 -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
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
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
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
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
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
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
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
d78d0d5937 auto-t: remove old AdHoc APIs 2020-09-14 16:45:15 -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
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
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
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
Tim Kourt
7ef7894218 auto-t: Add async API call for connect_hidden_network 2020-06-09 21:58:52 -05:00