Commit graph

1662 commits

Author SHA1 Message Date
Jukka Rissanen 1899c0c5c7 tests: net: ip-addr: Check IPv6 private addresses
Add a test that checks that the private address checker works
as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-26 11:41:55 +00:00
Jukka Rissanen 5723676770 tests: net: ip-addr: Check IPv4 private addresses
Add a test that checks that the private address checker works
as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-26 11:41:55 +00:00
Robert Lubos 3ea05cc958 tests: net: dhcpv4_server: Add tests for declined address expiry/reuse
Verify that declined addresses are not permanently blocked - i. e.
expire after configured timeout and in case of free address shortage,
can be reused.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-26 11:41:35 +00:00
Konrad Derda 28f37e07b6 tests: net: buf: additional verification of fixed buffer pool
This commit introduces two changes:
- veryfing fixed buffer's size and length after allocation to existing
  test case
- new test veryfing appending bytes to a network buffer from a fixed
  size pool

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-02-06 12:56:37 +01:00
Konrad Derda 57cd012476 test: net: net_pkt: use var buffer pool for testing
From change 47eb592c28b9e7dfbdd25fedbf07a528ad240084 net_buf structures
allocated from pools defined with NET_BUF_POOL_FIXED_DEFINE() will keep
their `size` member set to the actual fixed size and not requested
size like before.

For this set of tests NET_BUF_POOL_FIXED_DEFINE() for several test
cases. These tests check the several values based on a fact that the
network buffer's size was set to the requested size.

This commit changes definition of the buffer pool to
NET_BUF_POOL_FIXED_DEFINE() in order to satisfy these expectations.
This change does not impact the tests themselves.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-02-06 12:56:37 +01:00
Robert Lubos c6f2f2cf53 tests: net: ip-addr: Fix compiler warning
Building with Zephyr SDK 0.16.5 revealed a minor bug with the buffer
size provided to snprintk():
  specified bound 38 exceeds destination size 20 [-Wstringop-overflow=]

As we provide the buffer to snprintk() with an offset, the actual
buffer size should be reduced by that offset value.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-02 19:54:52 +01:00
Jukka Rissanen aa546baf44 tests: net: sockets: udp: Add recvmsg test for checking msg_controllen
Make sure that msg_controllen is cleared if there is no
control data received.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-02-02 11:51:53 -06:00
Robert Lubos 6d6d5b438d tests: net: dhcpv4_server: Add test case for ICMP probing
Add test case which verifies that ICMP probing work as expected for the
DHCPv4 server. Make sure we build tests with both, probing enabled
(default) and disabled (enforced in testcase.yml) to make sure the
server is functional regardless of the probing feature.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-02-02 12:42:44 +01:00
Łukasz Duda 5273af6ba8 net: ipv6: nbr: Add IPv6 reachability confirmation API
This commit introduces a new IPv6 API for positive reachability
confirmation, as specified in RFC 4861, Section 7.3.1. This feature aims
to enhance the effectiveness of the Neighbor Discovery mechanism, by
enabling upper-layer protocols to signal that the connection makes a
"forward progress".

The implementation within TCP serves as a reference. Compliance with
RFC 4861, especially Appendix E.1, was ensured by focusing on reliable
handshake and acknowledgment of new data transmissions.

Though initially integrated with TCP, the API is designed for broader
applicability. For example, it might be used by some UDP-based protocols
that can indicate two-way communication progress.

Signed-off-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
2024-01-31 14:50:53 +01:00
Robert Lubos 5a08fea48e tests: net: dhcpv4_server: Add test to verify initialization
Add test that verifies that initialization fails if wrong arguments are
provided.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-31 12:06:23 +00:00
Robert Lubos cefc391db3 net: dhcpv6: Move DHCPv6 files to lib directory
For consistency with DHCPv4.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-29 13:47:05 +01:00
Robert Lubos 19722aa8e8 net: dhcpv4: Move DHCPv4 files to lib directory
As discussed during DHCPv4 server integration, group DHCPv4 client files
with DHCPv4 server in a single lib directory.

Renamed internal "dhcpv4.h" header to "dhcpv4_internal.h" so that it's
not confused with the public "dhcpv4.h" header.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-29 13:47:05 +01:00
Robert Lubos 154e415c36 tests: net: dhcpv4_server: Add test suite for DHCPv4 server library
Add test suite covering DHCPv4 server library functionality.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-26 15:55:36 +00:00
Robert Lubos 9f1e1b4c60 tests: net: dhcpv4: Move DHCPv4 client tests to subdirectory
Move DHCPv4 client tests to subdirectory, to make room for DHCPv4 server
tests.

Rename test project to dhcpv4_client to better reflect its purpose.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-26 15:55:36 +00:00
Alberto Escolar Piedras c9a1c25dcb tests/net coap_client: Define _POSIX_C_SOURCE
This test uses functions and types which are extensions to
the C library. Let's explicity select one of the extensions
which includes it instead of relaying on somebody having
set it for this file somewhere else.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-26 07:48:55 -05:00
Alberto Escolar Piedras 571b647825 subsys/net/lib/lwm2m: Change how we seed the random generator
Instead of seeding the random generator from the test
itself calling into a host API, let's use the
entropy generator option to be seeded from /dev/urandom

This avoids trouble with the srandom() and time() calls
not existing depending on the chosen C library.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-01-25 12:28:51 +01:00
Seppo Takalo ec3ec8cd2a net: lwm2m: Add LWM2M_ON_INIT() macro
Add macro that allows registration of initialization functions that
are called when LwM2M engine starts.

On LwM2M engine starts up, it first executes all initialization
functions in following priority order:
1. LWM2M_PRIO_ENGINE
2. LWM2M_PRIO_CORE, this is where all LwM2M core objects are initialized
3. LWM2M_PRIO_OBJ, this is where all other objects are initialized
4. LwM2M_PRIO_APP, application initialization.

Now on the initialization phase, we could rely that certain objects have
already been registered.
For example custom objects can register callbacks to core objects.
On application phase, we can initialize sensor objects and register
their callbacks because objects have already been initialized.

This LWM2M_ON_INIT() should replace all use of SYS_INIT()
with the default CONFIG_KERNEL_INIT_PRIORITY_DEFAULT.

Priority order is actually just alphabetical order of names, so
the order is set on a linkin phase, and we don't need any
runtime checking for it.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-01-24 10:44:28 +01:00
Seppo Takalo f96c766fd8 tests: lwm2m: Rename engine to observation
"engine" directory contained tests for observation
so rename it.
There is separate "lwm2m_engine" directory that contains
tests for the engine itself.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-01-22 18:22:43 +01:00
Henrik Brix Andersen 3436c93387 drivers: can: remove run-time RTR filtering, add build-time RTR filter
A growing number of CAN controllers do not have support for individual RX
hardware filters based on the Remote Transmission Request (RTR) bit. This
leads to various work-arounds on the driver level mixing hardware and
software filtering.

As the use of RTR frames is discouraged by CAN in Automation (CiA) - and
not even supported by newer standards, e.g. CAN FD - this often leads to
unnecessary overhead, added complexity, and worst-case to non-portable
behavior between various CAN controller drivers.

Instead, move to a simpler approach where the ability to accept/reject RTR
frames is globally configured via Kconfig. By default, all incoming RTR
frames are rejected at the driver level, a setting which can be supported
in hardware by most in-tree CAN controllers drivers.

Legacy applications or protocol implementations, where RTR reception is
required, can now select CONFIG_CAN_ACCEPT_RTR to accept incoming RTR
frames matching added CAN filters. These applications or protocols will
need to distinguish between RTR and data frames in their respective CAN RX
frame handling routines.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-01-21 11:00:31 +01:00
Juha Ylinen c84dc7ee2e tests: lwm2m: Update lwm2m_engine tests
Fix lwm2m_message initialization. Pending struct was NULL.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2024-01-19 09:48:46 +01:00
Seppo Takalo a1d33f62ff tests: net: lwm2m: Increase stack on all, not just X86
Increase stack size on all test platforms, not just
qemu_x86.

Stack overflow was seen on HW tests as well, so
it might happen on many platforms.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-01-18 20:18:21 +01:00
Gerhard Jörges 13740696c7 tests: net: hostname: add test for net_hostname_set
Add test that sets the hostname.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2024-01-17 14:42:58 +01:00
Jukka Rissanen 4c88169d03 tests: net: sockets: Add tests for SO_DOMAIN socket option
Make sure that the SO_DOMAIN is a read only value and it
returns correct socket domain (AF_INET or AF_INET6) in the
tests.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-17 09:55:40 +01:00
Konrad Derda 982fc416f8 tests: net: buf: add tests for data matching
Add new test case for veryfing matching between net_bufs' contents and
a given data buffer.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-01-16 09:40:04 -06:00
Jukka Rissanen eb22110365 tests: net: socket: Add correct path to socket.h for POSIX_API
If CONFIG_POSIX_API is enabled, then the socket.h is found under
zephyr/posix/sys/socket.h etc. This allows one to compile the
socket test applications without error prints.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-16 10:00:45 +01:00
Jukka Rissanen 6ea6326e79 tests: net: socket: service: Add tests for socket service API
Simple tests that verify that the socket service API works
as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-16 10:00:45 +01:00
Daniel Leung 78790a85aa tests: net: lwm2m_engine: workaround stack overflow on qemu_x86
When running on qemu_x86, the test test_socket_state failed on
stack overflow. Setting CONFIG_TEST_EXTRA_STACK_SIZE to 1024
seems to fix the issue. So add a board specific config for
qemu_x86 so this test would pass.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2024-01-10 10:09:18 -05:00
Jukka Rissanen 59a7915d11 tests: net: tcp: Add tests for last FIN handling
Make sure the connection is closed by the timer if the final
fin is lost.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-09 10:03:08 +01:00
Jukka Rissanen d94914d315 tests: net: tcp: Shorten the test execution
Make the retransmission timer much shorter so that the test
is run faster (about 50% faster test run in qemu_x86).

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-09 10:03:08 +01:00
Jukka Rissanen 9b11fbd54c tests: net: tcp: Verify termination at closing state
Make sure the connection is closed by the timer if the final
ack is lost in closing state.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-09 10:03:08 +01:00
Robert Lubos 312e000a5f tests: net: socket: tls: Fix race on TCP socket close
One of the tests closed the underlying TCP connection right after
establishing one. This caused a certain race between incoming TLS
handshake data and entering FIN1 state (experienced on nrF52840), where
the TLS handshake data could be received after the FIN1 state was
entered, causing the server side to send RST packet. This disrupted the
test flow, as graceful TCP connection teardown was expected.

Fix this, by adding a small delay for such case to avoid the race.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-04 17:10:15 -06:00
Jukka Rissanen fa0e04e2ed tests: net: dhcpv6: Adjust the source address of test pkt
We would drop the received packet if the source address is our
address so tweak the test and make source address different.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-03 19:00:33 +00:00
Jukka Rissanen 155e2149f2 tests: net: ipv6: Adjust the source address of test pkt
We would drop the received packet if the source address is our
address so tweak the test and make source address different.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-01-03 19:00:33 +00:00
Robert Lubos 48601fde96 tests: net: socket: tls: Make sure sockets are closed on test failure
Add after() function for the test suite, which does cleanup on still
open sockets. Otherwise, an individual test case failure affects all
other test cases, blurring the test suite results.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-03 19:00:15 +00:00
Robert Lubos f70715eeb3 tests: net: socket: tls: Add more tests covering poll()
Add new test cases, covering TLS/DTLS socket poll() functionality.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-01-03 19:00:15 +00:00
Seppo Takalo 071cad2e76 net: lwm2m: Deprecate lwm2m_get/set_u64
Deprecate lwm2m_set_u64() and lwm2m_get_u64 as only
LWM2M_RES_TYPE_S64 exist. Unsigned variant is not defined.

Technically these might have worked OK, but it is undefined
what happens to large unsigned values when those are
converted to various payload formats (like CBOR) that might
decode numbers differently depending of their signedness.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-22 09:54:07 +01:00
Jukka Rissanen 6d41e68352 net: ipv4: Check localhost for incoming packet
If we receive a packet from non localhost interface, then
drop it if either source or destination address is a localhost
address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-21 09:18:24 +01:00
Seppo Takalo 6161fbdf21 net: lwm2m: Transmission state indications
Allow engine to give hints about ongoing CoAP transmissions.
This information can be used to control various power saving
modes for network interfaces. For example cellular networks might
support release assist indicator.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-20 11:57:48 +00:00
Robert Lubos 0bc8de8444 tests: net: socket: tls: Disable vmu_rt1170 platform
Due to unresolved bug (see #61129 for details) building TLS tests fails
on vmu_rt1170 platform. Therefore disable this platform for this test
suite.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-20 11:10:57 +01:00
Robert Lubos a416553dba tests: net: socket: tls: Add more tests covering socket behaviors
A first batch of tests for TLS sockets, covering expected socket
behaviors:
  * Verify that blocking/non-blocking tx/rx work as expected
  * Verify that timeouts on tx/rx are calculated properly
  * Verify proper behaviors when interacting with a socket from
    different threads (close/shutodown/send).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-20 11:10:57 +01:00
Robert Lubos be4400e80d tests: net: socket: tls: Add helper for TLS connection establishment
Move the code responsible for TLS connection establishment to a helper
function, as it'll be needed as well in other test cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-20 11:10:57 +01:00
Robert Lubos 833d565c36 tests: net: socket: tls: Remove unnecessary delay from test cases
SO_TYPE and SO_PROTOCOL test cases does not really establish connection,
so teardown delay at the end is not needed.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-20 11:10:57 +01:00
Joakim Andersson cb13e21eae tests: net: socket: tcp: Fix build for nrf5340dk_nrf5340_cpuapp_ns
Fix build for nrf5340dk_nrf5340_cpuapp_ns.
Test takes up almost all of the flash, leaving no room for the image
to be signed. Disable the bootloader to free up flash-usage.

Fixes: #66469

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-12-15 14:05:55 +01:00
Juha Ylinen f9fa2ae77c tests: net: coap: Add test case for transmission parameters
Add new test case.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2023-12-15 11:41:27 +00:00
Juha Ylinen d09d3d82ef net: lib: coap: Change coap_pending_init()
Replace function parameter 'retries' with pointer to structure
holding coap transmission parameters. This allows setting the
retransmission parameters individually for each pending request.

Add coap transmission parameters to coap_pending structure.

Update migration guide and release notes.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2023-12-15 11:41:27 +00:00
Jukka Rissanen 67d21c8b1d tests: net: if: Add test to check device readiness
Add tests that check if device is ready or not, and
then verify the functionality of net_if_up() in that case.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-14 14:21:31 +01:00
Juha Ylinen 69e28939dd net: lib: coap: Add new API to configure retransmission settings
Add new functions to the public CoAP API to configure CoAP packet
retransmission settings. Application may need to re-configure the
settings for example when cellular modem changes connection from
LTE-M to NB-IoT or vice versa.

Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
2023-12-12 10:56:29 +01:00
Robert Lubos 504d927483 tests: net: socket: tcp: Add tests for TCP keep alive feature
Verify that TCP keep alive options can be set properly and that TCP
connections time out correctly when keep-alive probes fail to get
replies.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-11 10:11:10 +01:00
Seppo Takalo b4bdbfd76b test: lwm2m: Run interop tests in tickless mode
Tickless mode is important to be tested against real server.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-11 09:57:09 +01:00
Seppo Takalo 725ceb72b7 test: lwm2m: Implement missing test case 103
Testcase 103 required "Disabled" functionality.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-08 20:18:37 +00:00
Seppo Takalo 51869b3e45 test: lwm2m: Implement bootstrap tests 4 - 7
* LightweightM2M-1.1-int-4 - Bootstrap Delete
* LightweightM2M-1.1-int-5 - Server Initiated Bootstrap
* LightweightM2M-1.1-int-6 - Bootstrap Sequence
* LightweightM2M-1.1-int-7 - Fallback to bootstrap

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-08 20:18:37 +00:00
Pieter De Gendt 8084a1c908 tests: net: mgmt: Add test cases new worker options
Run the Network event tests also on the system work queue and
synchronous.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-07 16:15:53 +00:00
Robert Lubos 429798c141 tests: net: socket: udp: Increase ztest stack size
The default ztest stack size was too small to run new UDP tests on
certain platforms (nrf52840 in this particular case), therefore increase
teh stack size in prj.conf.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-12-07 05:22:58 -05:00
Seppo Takalo 30dcf1b309 test: lwm2m: Refactor tests to work with fallback changes
In fallback refactoring to the LwM2M engine, some changes
to the server object are visible in hard-coded test
values.

Also, add Endpoint wrapper class that ensures the registration
state of the returned endpoint.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-05 16:40:06 -06:00
Seppo Takalo dc8f6da53c net: lwm2m: Implement fallback mechanism and support for diable
If server registration fails, allow fallback to secondary server,
or fallback to bootstrap.
Also allow fallback to different bootstrap server.

Add API to tell RD client when server have been disabled by
executable command.

Changes to RD state machine:
* All retry logic should be handled in NETWORK_ERROR state.
* New state SERVER_DISABLED.
* Internally disable servers that reject registration
* Temporary disable server on network error.
* Clean up all "disable timers" on start.
* Select server first, then find security object for it.
* State functions return void, error handling is done using states.
* DISCONNECT event will only come when client is requested to stop.
* NETWORK_ERROR will stop engine. This is generic error for all kinds
  of registration or network failures.
* BOOTSTRAP_REG_FAILURE also stops engine. This is fatal, and we cannot
  recover.

Refactoring:
* Server selection logic is inside server object.
* sm_handle_timeout_state() does not require msg parameter. Unused.
* When bootstrap fail, we should NOT back off to registration.
  This is a fatal error, and it stops the engine and informs application.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-12-05 16:40:06 -06:00
Pieter De Gendt b31d73f69c tests: net: mgmt: Add test for static event handlers
Add a testcase for event handlers in the iterable section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-05 09:17:42 -05:00
Jukka Rissanen 0bc1423335 tests: net: mld: Add socket based join/leave tests
Make sure the IPV6_ADD_MEMBERSHIP and IPV4_DROP_MEMBERSHIP
work as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 16:38:49 +00:00
Jukka Rissanen 36f5cfae2c tests: net: igmp: Add socket based join/leave tests
Make sure the IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP
work as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 16:38:49 +00:00
Jukka Rissanen f8c88a3fa6 tests: net: dns-sd: Fix IPv4 TTL and IPv6 hop limit checking
We need to use multicast TTL/hoplimit instead of unicast one
in the test.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen 921c945dab tests: net: udp: Verify that packet is dropped from stats
Make sure that statistics is properly update for dropped
packets when IPv4 TTL is 0 or IPv6 hop limit is 0.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen c32e06fcb5 tests: net: udp: Add IPv6 hop limit 0 test
Make sure packet is dropped if IPv6 hop limit 0 packet is
tried to send.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen 28a8c6c00d tests: net: udp: Add IPv4 TTL 0 test
Make sure packet is dropped if TTL 0 packet is tried to
send.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen 27d4c5d491 tests: net: udp: Add IPv4 unicast TTL tests
Make sure that setting IPv4 unicast TTL works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen 7474007e64 tests: net: udp: Add IPv6 unicast hop limit tests
Make sure that setting IPv6 unicast hop limit works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen 8bd612c522 tests: net: udp: Add IPv6 multicast hop limit tests
Make sure that setting IPv6 multicast hop limit works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen cee2b3ae26 tests: net: udp: Add IPv4 time-to-live multicast tests
Make sure that setting IPv4 multicast TTL works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen de0268def0 net: context: Add support for adjusting IPv4 multicast ttl
Add option support for adjusting the IPv4 multicast
time-to-live value.

Fixes #60299

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 15:07:43 +01:00
Jukka Rissanen af610bb207 tests: net: shell: Increase number of IP address structs
A warning is printed in start of the test about this.
Increase CONFIG_NET_IF_MAX_IPV6_COUNT=2 and
CONFIG_NET_IF_MAX_IPV4_COUNT=2 so that the tests pass
in frdm_k64f and some other boards.

Fixes #66020

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 09:57:35 +01:00
Jukka Rissanen 3783a7eccd tests: net: dns_sd: Increase the number of contexts
Issue seen in frdm-k64f + some other boards.

Fixes #66033

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-04 09:57:35 +01:00
Pieter De Gendt b500f7216e tests: net: lib: coap_server: Do not autostart service B with port 0
A race condition for the test occurs as the service might have started
when booting.
Do not autostart the service to verify the port stays 0.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-12-01 10:56:47 +00:00
Jukka Rissanen 5d915398a4 net: sockets: Add additional checks to recvmsg()
Add extra checks that make sure that msg_iov is set
as we cannot receive anything if receive buffers are
not set.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-01 10:56:34 +00:00
Robert Lubos 5bbf898905 tests: net: socket: tcp: Fix FD leak in fionread tests
Socket close was missing in fionread tests, causing file descriptor
leak.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-11-30 10:06:50 +01:00
Robert Lubos 95155c1fae tests: net: tcp: Add small delay when checking context dereference
Since the TCP context (and thus net_context) is not dereferenced
directly from the test thread anymore, add a small delay so that TCP
work queue have a chance to run, before checking net_context count or
reusing the port on new allocation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-11-30 10:06:50 +01:00
Andreas Chmielewski 72f7a05a8b tests: lwm2m_rd_client: Added more fff tests
If the rdclient is suspended or deregistered any network errors caused
by lwm2m_engine and forwarded by socket_fault handler should not change
the rd client state.

Signed-off-by: Andreas Chmielewski <andreas.chmielewski@grandcentrix.net>
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-11-30 10:05:30 +01:00
Jukka Rissanen 55958d851f net: context: Refactor option getters
Set separate option getters for bool, uint8_t and uint16_t
values. Use those generic getters when fetching the desired
option value.

Noticed mixed usage (bool vs int) for txtime option. Changed
the code to use int type like in other options.

The uint16_t option getter gets the value from uint16_t variable
but returns int value to the caller, and also expects that user
supplies int value.

For uint8_t value, it is expected that uint8_t value is supplied
instead of int.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-11-30 10:05:06 +01:00
Konrad Derda f9c4ae6cf6 tests: net: hostname: test hostname related events
Add test case to ensure that NET_EVENT_IF_HOSTNAME_CHANGED event is
triggered properly when the hostname changes.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2023-11-29 13:16:16 -06:00
Jukka Rissanen 5539a47eb6 tests: net: socket: Add recv pktinfo ancillary tests for recvmsg
Make sure recvmsg() is able to return IPv4 IP_PKTINFO and
IPv6 IPV6_RECVPKTINFO ancillary data to the caller.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-11-27 19:58:47 +01:00
Jukka Rissanen bb880c6457 tests: net: udp: Make receive timeout shorter
No need to wait 2.5 seconds for the test to pass, 400ms wait
is enough.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-11-27 19:58:47 +01:00
Jukka Rissanen 34929a57e0 tests: net: socket: Add TCP tests for recvmsg()
Make sure recvmsg() works as expected for TCP data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-11-27 19:58:47 +01:00
Jukka Rissanen 0b71043f6a tests: net: socket: Add UDP tests for recvmsg()
Make sure recvmsg() works as expected for UDP data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-11-27 19:58:47 +01:00
Seppo Takalo a8d56c4f1f net: scripts: Use native_sim instead of native_posix
Sample tests should also be using native_sim board.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-11-27 19:55:30 +01:00
Seppo Takalo 31e9a56742 test: lwm2m: Test cancellation using observe parameter
Implement test cases:
LightweightM2M-1.1-int-303 - Cancel observations using Observe with
Cancel parameter

LightweightM2M-1.1-int-305 - Cancel Observation-Composite Operation

Modify existing Leshan API to passive_cancel().

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-11-22 09:54:13 +01:00
Seppo Takalo 2135e009e4 test: lwm2m: Implement Read-Composite Operation on root path
Test case:
LightweightM2M-1.1-int-235 - Read-Composite Operation on root path
is now working as Leshan added a support for reading the root path.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-11-22 09:54:13 +01:00
Seppo Takalo 92ceaab491 test: lwm2m: Implement write_attributes()
Implement write and remove attributes command for Leshan.
Remove all written attributes at the end of test, so it won't
affect the next test case.

Remove skip marks from testcase that is fixed on Leshan side.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-11-22 09:54:13 +01:00
Seppo Takalo eb127538b1 test: lwm2m: Mark some tests as slow
This allows quick filtering with
pytest_args: ['-k not slow']

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2023-11-22 09:54:13 +01:00
Ibe Van de Veire 1d0f47b005 net: ip: igmp: add igmpv3 support
Added igmpv3 support based on the already existing structure for igmpv2.
The already existing api is not modified to prevent breaking exisiting
applications.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2023-11-21 15:50:31 +01:00
Alberto Escolar Piedras c5e0f6c0ff tests/net/lib/http_server: Switch from native_posix to native_sim
Switch from native_posix to native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Alberto Escolar Piedras 8991e0176c tests/net/lib/coap_server: Switch from native_posix to native_sim
Switch from native_posix to native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Alberto Escolar Piedras 0a81ea5406 tests/net/socket/can: Switch from native_posix to native_sim
Switch from native_posix to native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Alberto Escolar Piedras a86e0a8da9 tests/net/lib/lwm2m/*: Switch integation_platforms to native_sim
Switch integation_platforms from native_posix to native_sim

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Alberto Escolar Piedras 640b926b0a tests/net/lib lwm2m_engine: Switch from native_posix to native_sim
Switch support of native_posix to native_sim

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Alberto Escolar Piedras 0de923e2b0 tests/net/lib/lwm2m/interop: Switch from native_posix to native_sim
Switch support of native_posix to native_sim

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Alberto Escolar Piedras f7b8ded41a tests/net/lib/coap_client/: Enable for native_sim
Enable this test for native_sim

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Alberto Escolar Piedras c64f33a648 tests/net lwm2m_rd_client: Switch from native_posix to native_sim
Switch these tests from native_posix to native_sim

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Alberto Escolar Piedras eae99c1035 tests net/ptp/clock: Enable for native_sim
Enable these tests for native_sim and switch from
native_posix to native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Alberto Escolar Piedras 18d27f0a29 tests ieee802154: Enable for native_sim
Enable these tests for native_sim and switch from
native_posix to native_sim as default test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Alberto Escolar Piedras 6bba2d955b tests/net/traffic_class: Enable for native_sim
Enable these tests in native_sim
and switch from native_posix to native_sim as default
test platform

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-20 09:21:13 +01:00
Anas Nashif f25e2201a4 tests: fix various test identifiers
Fix a few inconsistent test identifiers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-17 09:27:40 +01:00
Pieter De Gendt 74db066941 tests: net: lib: Add CoAP service tests
Add a test for CoAP macro usage.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-11-09 11:21:42 +01:00
Robert Lubos f505dc528e tests: net: checksum_offload: Add tests involving IP fragmentation
Add test cases verifying proper checksum calculation involving
IPv4/IPv6 fragmentation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-11-08 15:09:37 +00:00