Commit graph

734 commits

Author SHA1 Message Date
Andries Kruithof
f9cea63608 Bluetooth: Audio: add babblesim tests for CAP distribute broadcastcode
Adding a babblesim test for the distribute broadcastcode CAP procedure

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-12-12 16:23:32 +01:00
Emil Gydesen
778a9afae3 tests: Bluetooth: Audio: Remove uses of K_FOREVER in syswg for TX
Several tests were using K_FOREVER when allocating the
buffer for TX in the system workqueue, which is illegal behavior.

The solution chosen was to create a TX thread to handle TX,
similar to the solution used in the audio shell and some
sample applications.

This way we can continue to use K_FOREVER when allocting buffers
and it will always be done in a round-robin fashion while
TXing as much as possible, by always enqueuing all the buffers
with mock data.

Since this works for all streams (both broadcast and unicast),
it was obvious to use the same implementation for all tests,
and thus cleaning up the tests a bit and more them more similar.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-10 16:23:10 +01:00
Emil Gydesen
6a03778309 tests: Bluetooth: CAP: Only advertise for tests that use connections
Move test_start_adv out from init and only call it for the
tests that require a connection.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-10 16:22:34 +01:00
Artur Dobrynin
d11f726942 tests: bsim: bluetooth: using full nrf52bsim board name
Some places kept using partial nrf52bsim board name which led to
inconsistencies.

Signed-off-by: Artur Dobrynin <artur.dobrynin@nordicsemi.no>
2024-12-07 02:03:31 +01:00
Artur Dobrynin
cdec82e103 tests: bsim: bluetooth: host: enable on nrf5340bsim/nrf5340/cpunet
Some bluetooth host tests can be run on nrf5340bsim/nrf5340/cpunet.
This commit enables building and running these tests.

Signed-off-by: Artur Dobrynin <artur.dobrynin@nordicsemi.no>
2024-12-07 02:03:31 +01:00
Artur Dobrynin
9cae99c1d2 tests: bsim: bluetooth: host: streamline conf files
Currently different test cases within the same folder are using largely the
same config files with only subtle variations. It is better instead to have
a base config file with general configuration, aided by overlay files for
specific cases.

Signed-off-by: Artur Dobrynin <artur.dobrynin@nordicsemi.no>
2024-12-07 02:03:31 +01:00
Artur Dobrynin
e0f74cf1b0 tests: bsim: bluetooth: host: use twister to compile tests
Bluetooth host bsim tests are compiled with shell scripts, but it is
possible to use twister, which supports compilation (but not running
at the moment). Compiling with twister requires fewer shell scripts,
provides cleaner interface and more flexible configuration.

Signed-off-by: Artur Dobrynin <artur.dobrynin@nordicsemi.no>
2024-12-07 02:03:31 +01:00
Emil Gydesen
829519dd6f Bluetooth: BAP: Add broadcast sink callback structs
These callbacks are trigger for changes that affect the entire
broadcast sink, such as the BIG synced and terminated events.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:06 +01:00
Emil Gydesen
0ae976166f Bluetooth: CAP: Add broadcast source callback structs
These callbacks are trigger for changes that affect the entire
broadcast source, such as the BIG started and terminated events.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:06 +01:00
Emil Gydesen
ab9ee0817d Bluetooth: BAP: Add broadcast source callback structs
These callbacks are trigger for changes that affect the entire
broadcast source, such as the BIG started and terminated events.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:06 +01:00
Vinayak Kariappa Chettimada
fbbde51853 Revert "test: bsim: bt: fix test scripts"
This reverts commit 18119e8f6e.

Audio tests are enabled back, but change to random number
seed is retained for the multiple identity test.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-12-05 15:18:11 +01:00
Vinayak Kariappa Chettimada
ab478f543c Revert "tests: bsim: comment out some failing AC tests"
This reverts commit 1320b3dd66.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-12-05 15:18:11 +01:00
Emil Gydesen
0851cb2772 tests: Bluetooth: CAP: Acceptor bsim test use ext_adv
Remove a duplicated advertising set in the CAP acceptor babblesim
test. The advertising set is configured in test_start_adv.

The BSIM test for the CAP acceptor used legacy instead
of extended advertising.

This also adds the required advertising data and validation
on the CAP initiator and CAP commander.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-05 15:18:11 +01:00
Alberto Escolar Piedras
9a66eb5cbe tests/bsim: For nrf52bsim use full board name with qualifiers
So when building with twister we get the same executable name
as with compile.sh

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-12-04 16:12:18 +01:00
Alberto Escolar Piedras
77fd5f4ecc tests/bsim conn_stress/scripts/_conn_stress.sh: Fix
This custom test script had rotten and was not working.
Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-12-04 16:12:06 +01:00
Alberto Escolar Piedras
8310017dd3 tests/bsim/bluetooth/ll/_compile_permutate_kconfigs: Update
This test was starting to rot: BOARD should have been replaced
with BOARD_TS. Let's also remove a few duplicate checks
and definitions.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-12-04 16:12:06 +01:00
Alberto Escolar Piedras
7cd64a33a4 tests/bsim: Fix host/gatt/notify_multiple _notify-debug
This custom debug script had rotten, let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-12-04 16:12:06 +01:00
Sergey Korotkov
2ee0e38929 Bluetooth: Host: more secure defaults for key size and legacy pairing
Default the Minimum encryption key size to 16.
Key with reduced size is easier to brut force.
Disable LE legacy pairing by default since it's not secure.

These defaults should suite majority of newly developed applications.
It's better to use sensible more secure defaults,
so applications that really need less secure option consciously change it,
not the other way around.
This may help to prevent downgrade attacks.

Signed-off-by: Sergey Korotkov <sergey.korotkov@nordicsemi.no>
2024-12-04 12:10:54 +01:00
Johan Hedberg
8b02141ca7 Bluetooth: Controller: Replace BT_CTLR with HAS_BT_CTLR
Deprecate BT_CTLR, and add a new HAS_BT_CTLR as a virtual option which
specific users (like BT_LL_SW_SPLIT) select. This also means that we can
remove all places that were forcefully enabling the BT_CTLR option, and
instead we now depend on devicetree to get some local LL HCI driver
enabled which in turn also enables the HAS_BT_CTLR option.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-12-03 10:16:44 +01:00
Arkadiusz Balys
6464ea88fe net: openthread: Allow a platform to select a Settings backend.
Removed implying of NVS by the NET_L2_OPENTHREAD, and from now a
platform can choose between ZMS and NVS as a settings backend.
NET_L2_OPENTHREAD still requires NVS or ZMS backend so the config
depends on one of those.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
2024-12-02 18:18:20 +01:00
Ludvig Jordet
dac8d7c397 Tests: Bluetooth: Mesh: Add Subnet Bridge KRP tests
This adds a test that checks that the Subnet Bridge behaves correctly
when one or more of the involved subnets are undergoing the Key Refresh
Procedure.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2024-11-29 14:49:34 +01:00
Ludvig Jordet
1453f6e4ea Tests: Bluetooth: Mesh: Refactor and cleanup of test_brg
This introduces a global variable controlling the number of remote nodes
used in a given test case. This allows removal of the `TEST_TYPE_...`
enums and further tests in the future that can use different remote node
counts.

This also cleans up the test source by extracting common tester
initialization to separate functions, avoiding repetition.

Signed-off-by: Ludvig Jordet <ludvig.jordet@nordicsemi.no>
2024-11-29 14:49:34 +01:00
Valerio Setti
1320b3dd66 tests: bsim: comment out some failing AC tests
This commit comments out some test AC cases that are failing in bsim.
These will be investigated in PR #82199.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-28 15:38:57 +00:00
Valerio Setti
18119e8f6e test: bsim: bt: fix test scripts
This commit fixes
tests/bsim/bluetooth/ll/multiple_id/tests_scripts/multiple.sh.
The reason is that this test seems to depend on random number
sequence in order to have the proper scheduling.

It also fixes some AC tests by commenting out failing test
cases. The reason of the failure is still unknown and needs
to be investigated in future work.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Valerio Setti
22faaee268 tests: bt: increase PSA key slots count when necessary
Increase the number of key slots in the PSA Crypto core
for some tests using more keys than the default (16).

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Valerio Setti
0f4875b7d0 bt-mesh: deprecate BT_MESH_USES_TINYCRYPT
Since the TinyCrypt library is being deprecated in Zephyr, this
commit set TinyCrypt usage in BT mesh as deprecated and it sets
Mbed TLS PSA Crypto API as the default option (when TF-M is not
available).
Tests are also updated in this commit.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Valerio Setti
f4592382bb bt: use PSA for HCI ECC and rename BT_TINYCRYPT_ECC
This commit sets PSA Crypto API as the default library to perform
ECC-DH in HCI, replacing TinyCrypt (which is being deprecated).
Therefore the symbol BT_TINYCRYPT_ECC is renamed as BT_SEND_ECC_EMULATION.
References in samples/tests are also fixed.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Valerio Setti
da9ab6f593 bt: crypto/host: remove CONFIG_BT_USE_PSA_API symbol
CONFIG_BT_USE_PSA_API was used in BT crypto/host modules to select
PSA crypto API over TinyCrypt (which was the default until now).
Since TinyCrypt is being deprecated and PSA crypto API is the new
standard library for crypto operations, CONFIG_BT_USE_PSA_API is
no more needed.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Pavel Vasilyev
4b6683cca1 test: bluetooth: bsim: mesh: test_access: Increase timeout between proc
Increase timeout between procedures in access_tx_transmitt test to avoid
packet loss.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-11-27 16:40:47 -05:00
Théo Battrel
66ff97e69b Bluetooth: Host: Deprecate BT_BUF_ACL_RX_COUNT symbol
Because the number of ACL RX buffers must be at least the number of
maximum connections plus one, increasing `CONFIG_BT_MAX_CONN` could
inadvertently lead to a build failure if the number of ACL RX buffers is
not also increased. This dependency may not be obvious to users.

To address this issue, this commit deprecates the
`CONFIG_BT_BUF_RX_COUNT` Kconfig symbol and computes the value in
`buf.h` using the new `BT_BUF_RX_COUNT` define. Note that the default
value and the minimum range value have been changed to 0 to "disable"
the option.

Additionally, to allow users to increase the number of ACL RX buffers,
this commit introduces the new `CONFIG_BT_BUF_RX_COUNT_EXTRA` Kconfig
symbol. The value of this symbol will be added to the computed value of
`BT_BUF_RX_COUNT`.

The configurations of tests and samples have been updated to reflect
these changes.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-11-27 10:30:59 +01:00
Vinayak Kariappa Chettimada
31f37a5c29 tests: bsim: Bluetooth: Enable some high reliability CAP tests
Enable some high reliability CAP tests by increasing ISO Tx
buffer counts in the Controller to sufficiently generate
number of complete when multiple SDUs are transmitted in
single ISO interval with use of pre-transmissions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-27 08:15:32 +01:00
Vinayak Kariappa Chettimada
5787d7340e tests: bsim: Bluetooth: Align audio test Controller Kconfig
Align audio test Controller Kconfig value same as used with
nRF53bsim.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-27 08:15:32 +01:00
Valerio Setti
95aaa97dc3 mbedtls: add Kconfig to select the number of key slot in PSA Crypto core
Adding new CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT to select the number
of key slots in PSA Crypto core. The default value is 16. Be aware
that key slots consume RAM memory even if unused, so the proper value
should be a compromise between the number of slots required by
the application and the available RAM in the system.

This commit also:
- updates tests/crypto/secp256r1/mbedtls.conf to showcase how to
  use this new symbol to reduce RAM footprint.
- tests/bsim/bluetooth/mesh/overlay_psa.conf to support all the
  keys used in the test.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-26 00:12:56 +01:00
Emil Gydesen
322b177549 samples: Bluetooth: Reduce heap for hci_ipc
Reducing the heap requirement for the hci_ipc sample from
8KiB to 4KiB. It has been tested in various configurations to
work with 2300, but 4KiB was used to provide some leeway for
future updates.

The heap requirement is not documented, and it is unclear why
values lower than 2300 (not exact number) won't boot, and should
be investigated further.

Memory has become a very scarce resource for especially the ISO
builds for the nRF5340, which is why this is getting reduced.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-25 21:52:15 +01:00
Jordan Yates
4e7feddd87 tests: bsim: support snippets
Support specifying a snippet when compiling bsim applications.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-11-25 14:41:43 +01:00
Vinayak Kariappa Chettimada
98130afd0a tests: bsim: Bluetooth: Fix simulation length be greater than wait time
Fix some test simulation length be greater than wait time.
These tests completed within 12 seconds, 15 second wait
time is a good value with included margin and a 20 second
simulation time.

These tests failed on this PR CI.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-22 17:43:04 +01:00
Alberto Escolar Piedras
4558056f81 tests/bsim: Also runtime test the UART drivers for the nrf54l15
To increase coverage.

Note that we call twister separatedly for this target, due to the 54l15
overlays using UARTE20 which is indexed in simulation as "2", but as
the nrf52833 does not have 3 instances. So "-uart2_loopback" is not
a valid option for a 52833 executable.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-11-22 11:34:30 +01:00
Emil Gydesen
b4f3763c31 tests: Bluetooth: Audio: Use same recv_cb for all tests
This commit changes the BSIM tests to use the same recv callback
for all tests. The purpose of this is to reduce code duplication
and make it easier to maintain the tests.

This also changes the recv_cb so that in case of any error we log
the most recently received SDU, which should provide more
information about why a test failed in case of RX error.

PBP had to be updated a bit to support the audio_stream
struct.

Also modifies a check and log in bap_stream that was less than
helpful to determine if it was the stream or the endpoint that
was NULL.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 14:47:49 +01:00
Håvard Reierstad
0b35b38ef5 Bsim: Bluetooth: Mesh: Add multicast bridge tests
Adds two new tests for the Subnet Bridge feature, testing group and
virtual addresses as destinations. The tests are based on the existing
`brg_simple.sh` test, with the addition of a new node and a new subnet
to make sure that messages are bridged to multiple subnets, but only
subnets that have a corresponding entry in the bridging table.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-11-21 09:25:11 +01:00
Håvard Reierstad
77e017306e Bsim: Bluetooth: Mesh: Rename/refactor send_ra
Renames `bt_mesh_test_send_ra` to `bt_mesh_test_send_data` and changes
the corresponding callback funciton as it is used outside of the replay
attack tests, and can be used to send custom data. The function is
extended to accept a UUID parameter to allow sending data to virtual
addresses.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-11-21 09:25:11 +01:00
Emil Gydesen
c4fbe38219 Bluetooth: BAP: Depend on BT_PER_ADV_SYNC instead of select
Change the select of BT_PER_ADV_SYNC and BT_EXT_ADV to
depends on. This is an effort to reduce the use of
select for Kconfig options.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
c0f86011cb Bluetooth: BAP: Depend on BT_ISO_SYNC_RECEIVER instead of select
The BAP Kconfigs option now depends on
BT_ISO_BROADCASTER instead of selecting it.

This is an effort to reduce the use of select in LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
d22c7b0cf2 Bluetooth: BAP: Depend on BT_ISO_BROADCASTER instead of select
The BAP_BROADCAST_SOURCE Kconfig option now depends on
BT_ISO_BROADCASTER instead of selecting it.

This is an effort to reduce the use of select in LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
df6b5981bf Bluetooth: Audio: depends on GATT instead of select
Modify the Kconfig options to depend on the GATT
features rather than selecting them.

This is part of an effort to reduce the amount of
selects we use in LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Valerio Setti
08bd9c72bd mbedtls: use CSPRNG whenever possible as PSA random source
The main problem of MBEDTLS_PSA_CRYPTO_LEGACY_RNG is that it
brings in some legacy modules (entropy + ctr_drbg/hmac_drbg)
which means extra ROM/RAM footprint.
MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG instead simply calls to the
CSPRNG which makes it definitely smaller.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-20 15:59:40 -05:00
Emil Gydesen
8e017ebff3 tests: Bluetooth: Audio: Increase RX buf count for bsim
The tests were using the default of 1 which is very low,
especially when we might have multiple RX streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-19 09:52:28 -05:00
Aleksander Wasaznik
3734268f90 Bluetooth: host: Remove useless alloc_buf_cb in test
The alloc_buf callback is not used when `seg_recv` is set, so it is
never called in this test. Remove it.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-11-16 15:55:02 -05:00
Alberto Escolar Piedras
6d53e376cb tests/bsim/bluetooth/ll: Increase EXECUTION_TIMEOUT where needed
Increase the EXECUTION_TIMEOUT (real time timeout at which the test
will be killed), so we have more margin for CI.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-11-16 14:56:43 -05:00
Alberto Escolar Piedras
5da8eb3e9f tests/bsim/bluetooth/host: Increase EXECUTION_TIMEOUT where needed
Increase the EXECUTION_TIMEOUT (real time timeout at which the test
will be killed), so we have more margin for CI.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-11-16 14:56:43 -05:00
Alberto Escolar Piedras
4c8ee78b76 tests/bsim/bluetooth/audio: Increase EXECUTION_TIMEOUT where needed
Increase the EXECUTION_TIMEOUT (real time timeout at which the test
will be killed), so we have more margin for CI.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-11-16 14:56:43 -05:00