zephyr/tests/net/lib/lwm2m/interop
Seppo Takalo 4a7ef5c010 net: lwm2m: Convert tickeless to use eventfd()
For waking up the poll() use eventfd() instead of socketpair()
so we save some buffer space and one file descriptor.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-12-24 13:54:39 +01:00
..
boards net: lwm2m: Need heap for native_sim 2024-12-20 16:09:13 +01:00
pytest python: Format and sort imports 2024-11-25 10:07:13 +01:00
src tests: fix zephyr/drivers/gpio.h usage 2024-12-20 03:17:25 +01:00
CMakeLists.txt
docker-test.sh net: scripts: Use native_sim instead of native_posix 2023-11-27 19:55:30 +01:00
prj.conf net: lwm2m: Convert tickeless to use eventfd() 2024-12-24 13:54:39 +01:00
README.md tests/net/lib/lwm2m: Switch description to native_sim 2024-08-16 11:20:34 +01:00
requirements.txt
testcase.yaml tests: lwm2m: Remove qemu-cortex-m3 2024-10-03 17:08:55 +01:00

LwM2M Interoperability tests using Leshan demo server

This directory contains list of testcases that use the Twister's Pytest integration to run testcases against Leshan demo server. These tests use emulated hardware (native_sim).

These tests require setup that is not done in Twister run, so follow this documentation to set up the test environment.

Network setup

As with typical network samples, host machine uses IP address 192.0.2.2 and the emulated device running Zephyr is using address 192.0.2.1.

Follow Networking with the host system from Zephyr's documentation how to set it up, or follow Create NAT and routing for Zephyr native network on Linux.

Run Lehan server from net-tools Docker container

Zephyr's net-tools Docker container already contains Leshan, so if you don't want to set the environment up manually, use the pre-made docker.

First, build the docker container. You only need to do this one, or when you update the container.

cd tools/net-tools/docker
docker build -t net-tools .

Start the docker networking

cd tools/net-tools/
sudo ./net-setup.sh --config docker.conf start

Start the docker container and run leshan

docker run --hostname=net-tools --name=net-tools --ip=192.0.2.2 --ip6=2001:db8::2 -p 8080:8080 -p 8081:8081 -p 5683:5683/udp --rm -dit --network=net-tools0 net-tools
docker container exec net-tools /net-tools/start-leshan.sh

Stop Leshan, docker and networking

cd tools/net-tools/
docker kill net-tools
sudo ./net-setup.sh --config docker.conf stop
docker network rm net-tools0

Leshan server setup (manual)

Both server can be started like this:

java -jar ./leshan-server-demo.jar -wp 8080 -vv
java -jar ./leshan-bsserver-demo.jar -lp=5783 -slp=5784 -wp 8081

Or create a helper script that does everything, including download:

#!/bin/sh -eu

# Download Leshan if needed
if [ ! -f leshan-server-demo.jar ]; then
        wget https://ci.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-server-demo.jar
fi

if [ ! -f leshan-bsserver-demo.jar ]; then
	wget 'https://ci.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-bsserver-demo.jar'
fi

mkdir -p log

start-stop-daemon --make-pidfile --pidfile log/leshan.pid --chdir $(pwd) --background --start \
        --startas /bin/bash -- -c "exec java -jar ./leshan-server-demo.jar -wp 8080 -vv --models-folder objects >log/leshan.log 2>&1"

start-stop-daemon --make-pidfile --pidfile log/leshan_bs.pid --chdir $(pwd) --background --start \
        --startas /bin/bash -- -c "exec java -jar ./leshan-bsserver-demo.jar -lp=5783 -slp=5784 -wp 8081 -vv >log/leshan_bs.log 2>&1"

Then stopping would require similar script:

#!/bin/sh -eu

start-stop-daemon --remove-pidfile --pidfile log/leshan.pid --stop
start-stop-daemon --remove-pidfile --pidfile log/leshan_bs.pid --stop

Python package requirements

These tests require extra package that is not installed when you follow the Zephyr's setup. Install with pip install CoAPthon3

Running tests

twister -p native_sim -vv --enable-slow -T tests/net/lib/lwm2m/interop

Or use the Docker based testing

./scripts/net/run-sample-tests.sh tests/net/lib/lwm2m/interop

Test specification

Tests are written from test spec; OMA Enabler Test Specification (Interoperability) for Lightweight M2M

Current status

Test case Status Notes
LightweightM2M-1.1-int-0 - Client Initiated Bootstrap
LightweightM2M-1.1-int-1 - Client Initiated Bootstrap Full (PSK)
LightweightM2M-1.1-int-2 - Client Initiated Bootstrap Full (Cert) testcase not implemented
LightweightM2M-1.1-int-3 Simple Bootstrap from Smartcard 🔶 We don't have any smartcard support.
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
LightweightM2M-1.1-int-8 - Bootstrap Read Test cannot be implemented from client side.
LightweightM2M-1.1-int-9 - Bootstrap and Configuration Consistency testcase not implemented
LightweightM2M-1.1-int-101 - Initial Registration
LightweightM2M-1.1-int-102 - Registration Update
LightweightM2M-1.1-int-103 - Deregistration
LightweightM2M-1.1-int-104 - Registration Update Trigge
LightweightM2M-1.1-int-105 - Discarded Register Update
LightweightM2M-1.1-int-107 - Extending the lifetime of a registration
LightweightM2M-1.1-int-108 - Turn on Queue Mode
LightweightM2M-1.1-int-109 - Behavior in Queue Mode
LightweightM2M-1.1-int-201 - Querying basic information in Plain Text
LightweightM2M-1.1-int-203 - Querying basic information in TLV format
LightweightM2M-1.1-int-204 - Querying basic information in JSON format
LightweightM2M-1.1-int-205 - Setting basic information in Plain Text
LightweightM2M-1.1-int-211 - Querying basic information in CBOR format
LightweightM2M-1.1-int-212 - Setting basic information in CBOR format
LightweightM2M-1.1-int-215 - Setting basic information in TLV format
LightweightM2M-1.1-int-220 - Setting basic information in JSON format
LightweightM2M-1.1-int-221 - Attempt to perform operations on Security
LightweightM2M-1.1-int-222 - Read on Object
LightweightM2M-1.1-int-223 - Read on Object Instance
LightweightM2M-1.1-int-224 - Read on Resource
LightweightM2M-1.1-int-225 - Read on Resource Instance
LightweightM2M-1.1-int-226 - Write (Partial Update) on Object Instance
LightweightM2M-1.1-int-222 - Read on Object
LightweightM2M-1.1-int-223 - Read on Object Instance
LightweightM2M-1.1-int-224 - Read on Resource
LightweightM2M-1.1-int-225 - Read on Resource Instance
LightweightM2M-1.1-int-226 - Write (Partial Update) on Object Instance
LightweightM2M-1.1-int-227 - Write (replace) on Resource
LightweightM2M-1.1-int-228 - Write on Resource Instance #64011
LightweightM2M-1.1-int-229 - Read-Composite Operation #64012 #64189
LightweightM2M-1.1-int-230 - Write-Composite Operation
LightweightM2M-1.1-int-231 - Querying basic information in SenML JSON format
LightweightM2M-1.1-int-232 - Querying basic information in SenML CBOR format
LightweightM2M-1.1-int-233 - Setting basic information in SenML CBOR format
LightweightM2M-1.1-int-234 - Setting basic information in SenML JSON format
LightweightM2M-1.1-int-235 - Read-Composite Operation on root path
LightweightM2M-1.1-int-236 - Read-Composite - Partial Presence
LightweightM2M-1.1-int-237 - Read on Object without specifying Content-Type
LightweightM2M-1.1-int-241 - Executable Resource: Rebooting the device
LightweightM2M-1.1-int-256 - Write Operation Failure
LightweightM2M-1.1-int-257 - Write-Composite Operation
LightweightM2M-1.1-int-260 - Discover Command
LightweightM2M-1.1-int-261 - Write-Attribute Operation on a multiple resource
LightweightM2M-1.1-int-280 - Successful Read-Composite Operation
LightweightM2M-1.1-int-281 - Partially Successful Read-Composite Operation
LightweightM2M-1.1-int-301 - Observation and Notification of parameter values
LightweightM2M-1.1-int-302 - Cancel Observations using Reset Operation
LightweightM2M-1.1-int-303 - Cancel observations using Observe with Cancel parameter
LightweightM2M-1.1-int-304 - Observe-Composite Operation
LightweightM2M-1.1-int-305 - Cancel Observation-Composite Operation
LightweightM2M-1.1-int-306 Send Operation #64290
LightweightM2M-1.1-int-307 Muting Send
LightweightM2M-1.1-int-308 - Observe-Composite and Creating Object Instance #64634
LightweightM2M-1.1-int-309 - Observe-Composite and Deleting Object Instance #64634
LightweightM2M-1.1-int-310 - Observe-Composite and modification of parameter values
LightweightM2M-1.1-int-311 - Send command
LightweightM2M-1.1-int-401 - UDP Channel Security - PSK Mode
LightweightM2M-1.1-int-1630 - Create Portfolio Object Instance
LightweightM2M-1.1-int-1635 - Delete Portfolio Object Instance
  • Working OK.
  • 🔶 Feature or operation not implemented.
  • 🔴 Broken