1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +01:00

examples/lorawan: add automatic test

This commit is contained in:
Francisco Molina 2019-07-18 17:10:38 +02:00
parent 414e17b437
commit 9e130be8a8
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8
3 changed files with 88 additions and 0 deletions

View File

@ -34,4 +34,16 @@ DEVELHELP ?= 1
# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1
# Default IotLab Config to run the test
ifneq (,$(filter iotlab%,$(MAKECMDGOALS)))
IOTLAB_NODES ?= 1
IOTLAB_TYPE ?= st-lrwan1:sx1276
IOTLAB_SITE ?= saclay
include $(RIOTBASE)/dist/testbed-support/Makefile.iotlab
endif
ifneq (,$(filter test,$(MAKECMDGOALS)))
DEFAULT_MODULE += test_utils_interactive_sync
endif
include $(RIOTBASE)/Makefile.include

View File

@ -36,3 +36,51 @@ Finally, to join a LoRaWAN network using OTAA activation, edit the application
DEVEUI ?= 0000000000000000
APPEUI ?= 0000000000000000
APPKEY ?= 00000000000000000000000000000000
## Automatic test
The automatic test replicates 11-lorawan release specs test:
- [11-lorawan](https://github.com/RIOT-OS/Release-Specs/blob/ba236c4a1d1258ab63d21b0a860d0f5a5935bbd4/11-lorawan/11-lorawan.md)
- [Task #01 - LoRaWAN example](https://github.com/RIOT-OS/Release-Specs/blob/ba236c4a1d1258ab63d21b0a860d0f5a5935bbd4/11-lorawan/11-lorawan.md#task-01---lorawan-example)
It is recommended to test using iotlab-nodes. The default configuration is already
set on the application Makefile.
### Requirements
- The tests assumes that there is a gateway in all DR distance to the device and the
device was flashed with the correct keys.
- To use iotlab it is required to have a valid account for the FIT IoT-LAB
(registration there is open for everyone) and the [iot-lab/cli-tools](https://github.com/iot-lab/cli-tools) need to be installed.
- iotlab uses TTN lorawan gateways, to run the test you will need to create an
[account](https://account.thethingsnetwork.org/) add an [application](https://www.thethingsnetwork.org/docs/applications/add.html) and [register](https://www.thethingsnetwork.org/docs/devices/registration.html) a device. For this
test you need to take note of the Device EUI, Application EUI & Application Key
for that device.
### Usage
1. flash device with appropriate keys and test
$ DEVEUI=<device eui> APPEUI=<application eui> APPKEY=<application key> make -C examples/lorawan/ flash test
#### With iotlab
1. setup the iotlab experiment:
$ make -C examples/lorawan/ iotlab-exp
2. flash device, set appropriate keys and test
$ DEVEUI=<device eui> APPEUI=<application eui> APPKEY=<application key> IOTLAB_NODE=auto-ssh make -C examples/lorawan/ flash test
3. stop the iotlab experiment:
$ make -C examples/lorawan/ iotlab-stop
_note_: if you have multiple running experiments you will need to set `IOTLAB_EXP_ID`
to the appropriate experiment, when using the `iotlab-exp` you will see a:
`Waiting that experiment 175694 gets in state Running`. That number matches
the experiment id you started.

View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
# Copyright (C) 2019 Inria
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
import time
from testrunner import run
def testfunc(child):
child.expect_exact("LoRaWAN Class A low-power application")
child.expect_exact("Starting join procedure")
child.expect_exact("Join procedure succeeded")
for _ in range(0, 5):
child.expect_exact("Sending: This is RIOT!")
time.sleep(20)
print("TESST PASSED")
if __name__ == "__main__":
sys.exit(run(testfunc))