Skip to content

Commit d536ee5

Browse files
authored
Initial configuration-skeleton + test-runner implementation. (#1)
1 parent 2836fde commit d536ee5

22 files changed

+3417
-1
lines changed

.github/workflows/main.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- '*'
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
10+
env:
11+
CARGO_INCREMENTAL: 0
12+
13+
jobs:
14+
tests:
15+
runs-on: ubuntu-latest
16+
steps:
17+
-
18+
name: Checkout
19+
uses: actions/checkout@v4
20+
-
21+
name: Install Nix
22+
uses: cachix/install-nix-action@v27
23+
with:
24+
nix_path: nixpkgs=channel:nixos-24.05
25+
-
26+
name: Cargo cache
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
~/.cargo/bin/
31+
~/.cargo/registry/index/
32+
~/.cargo/registry/cache/
33+
~/.cargo/git/db/
34+
test-runner/target/
35+
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
36+
-
37+
name: Run tests
38+
run: nix-shell --command "cd test-runner && cargo run"

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM nixos/nix
2+
3+
ENV PROJECT_PATH=/lorawan-device-profiles
4+
WORKDIR $PROJECT_PATH
5+
6+
ENTRYPOINT ["nix-shell"]
7+

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.PHONY: test
2+
3+
test:
4+
docker compose run --rm lorawan-device-profiles --run 'cd test-runner && cargo run'
5+

README.md

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,80 @@
1-
# LoRaWAN(R) device-profiles repository
1+
# LoRaWAN(R) device-profiles
22

3+
This repository contains device-profiles for LoRaWAN devices grouped by
4+
vendor. A device-profile contains important information about the capabilities
5+
of the device. For example which LoRaWAN mac-version has been implemented,
6+
which regions are supported, if the device supports Class-B or Class-C, etc...
7+
The aim is to build a complete list of LoRaWAN device-profiles that then can
8+
be imported by ChirpStack or potentially any other LNS.
9+
10+
## Why not use the TTN lorawan-devices repository?
11+
12+
Unfortuantely the [https://github.com/thethingsnetwork/lorawan-devices](https://github.com/thethingsnetwork/lorawan-devices)
13+
repository can no longer be used as a whole. The open-source license has been
14+
removed and users are not allowed to _extract and/or reuse the Device Repositoryas
15+
as a whole or a substantial part of its content_.
16+
This prevents ChirpStack users (and other LNS providers) from importing this
17+
repository into their database.
18+
19+
The goal of this repository is to provide an open-source database of LoRaWAN
20+
device-profiles that can be freely imported.
21+
22+
## Structure
23+
24+
Example structure for an `example-vendor` with an `example` device:
25+
26+
```
27+
vendors/
28+
└── example-vendor
29+
├── codecs
30+
│   ├── example.js
31+
│   ├── test_decode_example.json
32+
│   └── test_encode_example.json
33+
├── devices
34+
│   └── example.toml
35+
├── profiles
36+
│   └── example-EU868.toml
37+
└── vendor.toml
38+
```
39+
40+
Please take a look at the `vendors/example-vendor` example documented
41+
configuration files.
42+
43+
### `vendors/example-vendor`
44+
45+
This is the root of the example vendor. It must contain a `vendor.toml`
46+
file. This `vendor.toml`.
47+
48+
### `vendors/example-vendor/codecs`
49+
50+
This directory contains the payload codecs. Codecs can be used by one or
51+
multiple devices. E.g. some vendors have a generic payload codec.
52+
53+
Each codec is expected to have tests for encoding and decoding. If the
54+
codec filename is `example.js`, then you should create two test-files
55+
called `test_decode_example.json` (thus + `test_decode_` prefix and `.json`
56+
extension) and `test_encode_example.json`.
57+
58+
### `vendors/example-vendor/devices`
59+
60+
This directory contains the devices. Each device will have its own `.toml`
61+
configuration.
62+
63+
### `vendors/example-vendor/profiles`
64+
65+
This directory contains the profiles. These profiles can be used by one
66+
or multiple devices. The profile also defines the region.
67+
68+
## Running the test
69+
70+
To run the test-runner, execute:
71+
72+
```
73+
make test
74+
```
75+
76+
This will run all tests within a Docker Compose environment.
77+
78+
## License
79+
80+
This repository is distributed under the MIT license. See also `LICENSE`.

docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
lorawan-device-profiles:
3+
build:
4+
context: .
5+
volumes:
6+
- ./:/lorawan-device-profiles

rust-toolchain.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "1.80.1"
3+
components = ["rustfmt", "clippy"]
4+
profile = "default"

shell.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-24.05.tar.gz") {} }:
2+
3+
pkgs.mkShell {
4+
buildInputs = [
5+
pkgs.rustup
6+
];
7+
}

test-runner/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

0 commit comments

Comments
 (0)