1# Copyright (c) 2023 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4if [ -z "$RUNNING_FROM_MAIN_SCRIPT" ]; then
5    echo "Do not run this script directly!"
6    echo "Run $ZEPHYR_BASE/scripts/net/run-sample-tests.sh instead."
7    exit 1
8fi
9
10IP="--ip=192.0.2.2 --ip6=2001:db8::2"
11FWD="-p 8080:8080 -p 8081:8081 -p 5683:5683/udp"
12
13start_configuration "$IP $FWD" || return $?
14start_docker "/net-tools/start-leshan.sh" || return $?
15
16start_zephyr
17
18sleep 5
19curl -s -X GET 'http://localhost:8080/api/clients/native_posix/3/0/0' | grep Zephyr 2>&1 >/dev/null
20result=$?
21
22stop_zephyr
23stop_docker
24
25if [ $result -eq 0 ]; then
26        return 0
27else
28        return 1
29fi
30