Skip to content

Commit

Permalink
Split up definitions, extend validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yorick Smilda committed Jan 27, 2023
1 parent 56bfbf3 commit 623316b
Show file tree
Hide file tree
Showing 20 changed files with 999 additions and 716 deletions.
10 changes: 5 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"yaml.schemas": {
"schema.json": "./frequency-plans.yml",
"end-devices/schema.json": "end-devices/*.yml",
"end-devices/modifiers/schema.json": "end-devices/modifiers/*.yml",
"gateways/schema.json": "gateways/*.yml",
"gateways/modifies/schema.json": "gateways/modifiers/*.yml"
"schema.json": "frequency-plans.yml",
"end-device/schema.json": "end-device/*.yml",
"end-device/modifiers/schema.json": "end-device/modifiers/*.yml",
"gateway/schema.json": "gateway/*.yml",
"gateway/modifiers/schema.json": "gateway/modifiers/*.yml"
}
}
20 changes: 3 additions & 17 deletions end-device/modifiers/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,12 @@
"type": "object",
"additionalProperties": false,
"properties": {
"band-id": {
"type": "string",
"description": "ID of the band (needs to match band-id in the index)",
"enum": ["CN_470_510","CN_470_510_20_A","EU_863_870","IN_865_867","RU_864_870","AS_923_3","KR_920_923","AS_923","ISM_2400","AS_923_4","AU_915_928","MA_869_870_DRAFT","CN_779_787","CN_470_510_26_B","US_902_928","EU_433","CN_470_510_20_B","AS_923_2","CN_470_510_26_A"]
},
"sub-bands": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"index": {
"type": "integer",
"description": "Index to override. If set to -1 all indexes will be overridden"
},
"min-frequency": {
"type": "integer",
"description": "Minimum frequency [Hz] (inclusive)"
Expand All @@ -36,7 +27,7 @@
"description": "Maximum EIRP for this sub-band (optional; takes precedence over frequency plan's max-eirp)"
}
},
"required": ["index", "min-frequency", "max-frequency"]
"required": ["min-frequency", "max-frequency"]
}
},
"channels": {
Expand All @@ -46,10 +37,6 @@
"type": "object",
"additionalProperties": false,
"properties": {
"index": {
"type": "integer",
"description": "Index to override. If set to -1 all indexes will be overridden"
},
"uplink-frequency": {
"type": "integer",
"description": "Uplink frequency [Hz]"
Expand All @@ -71,7 +58,7 @@
"description": "Channel is defined by RP"
}
},
"required": ["index", "uplink-frequency", "min-data-rate", "max-data-rate"]
"required": ["uplink-frequency", "min-data-rate", "max-data-rate"]
}
},
"lora-standard-channel": {
Expand Down Expand Up @@ -213,6 +200,5 @@
"type": "number",
"description": "Maximum EIRP (optional; used when sub-bands do not have max-eirp, takes precedence over band's default)"
}
},
"required": ["band-id", "sub-bands", "channels"]
}
}
2 changes: 1 addition & 1 deletion end-device/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"band-id": {
"type": "string",
"description": "ID of the band (needs to match band-id in the index)",
"enum": ["CN_470_510","CN_470_510_20_A","EU_863_870","IN_865_867","RU_864_870","AS_923_3","KR_920_923","AS_923","ISM_2400","AS_923_4","AU_915_928","MA_869_870_DRAFT","CN_779_787","CN_470_510_26_B","US_902_928","EU_433","CN_470_510_20_B","AS_923_2","CN_470_510_26_A"]
"enum": ["AS_923","AS_923_2","AS_923_3","AS_923_4","AU_915_928","CN_470_510","CN_470_510_20_A","CN_470_510_20_B","CN_470_510_26_A","CN_470_510_26_B","CN_779_787","EU_433","EU_863_870","IN_865_867","ISM_2400","KR_920_923","MA_869_870_DRAFT","RU_864_870","US_902_928"]
},
"sub-bands": {
"type": "array",
Expand Down
17 changes: 13 additions & 4 deletions frequency-plans.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
end-device-descriptions:
- id: EU_863_870
band-id: EU_863_870
name: Europe 863-870 MHz
description: Default frequency plan for Europe
base-frequency: 868
country-codes: [al, ad, ao, at, bh, be, ba, bw, bg, cg, hr, cy, cz, dk, ee, sz, fi, fr, gr, hu, is, ie, it, lv, ls, li, lt, lu, mg, mw, mt, mu, md, me, mz, na, nl, mk, ph, pl, pt, ro, ru, sa, rs, sc, sk, si, za, es, se, ch, tz, tr, ae, gb, va, zm, zw]
end-device-file: EU_863_870.yml
gateway-file: EU_863_870.yml
file: EU_863_870.yml
endorsed: false

- id: EU_863_870_TTN
Expand All @@ -15,6 +15,15 @@
description: TTN Community Network frequency plan for Europe, using SF9 for RX2
base-frequency: 868
country-codes: [al, ad, ao, at, bh, be, ba, bw, bg, cg, hr, cy, cz, dk, ee, sz, fi, fr, gr, hu, is, ie, it, lv, ls, li, lt, lu, mg, mw, mt, mu, md, me, mz, na, nl, mk, ph, pl, pt, ro, ru, sa, rs, sc, sk, si, za, es, se, ch, tz, tr, ae, gb, va, zm, zw]
end-device-modifiers: [rx2_default_data_rata_3.yml]
gateway-modifiers: []
modifiers: [rx2_default_data_rata_3.yml]
endorsed: true

gateway-descriptions:
- id: EU_863_870
band-id: EU_863_870
name: Europe 863-870 MHz
description: Default frequency plan for Europe
base-frequency: 868
country-codes: [al, ad, ao, at, bh, be, ba, bw, bg, cg, hr, cy, cz, dk, ee, sz, fi, fr, gr, hu, is, ie, it, lv, ls, li, lt, lu, mg, mw, mt, mu, md, me, mz, na, nl, mk, ph, pl, pt, ro, ru, sa, rs, sc, sk, si, za, es, se, ch, tz, tr, ae, gb, va, zm, zw]
file: EU_863_870.yml
endorsed: false
26 changes: 4 additions & 22 deletions gateway/modifiers/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,12 @@
"type": "object",
"additionalProperties": false,
"properties": {
"band-id": {
"type": "string",
"description": "ID of the band (needs to match band-id in the index)",
"enum": ["CN_470_510","CN_470_510_20_A","EU_863_870","IN_865_867","RU_864_870","AS_923_3","KR_920_923","AS_923","ISM_2400","AS_923_4","AU_915_928","MA_869_870_DRAFT","CN_779_787","CN_470_510_26_B","US_902_928","EU_433","CN_470_510_20_B","AS_923_2","CN_470_510_26_A"]
},
"sub-bands": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"index": {
"type": "integer",
"description": "Index to override. If set to -1 all indexes will be overridden"
},
"min-frequency": {
"type": "integer",
"description": "Minimum frequency [Hz] (inclusive)"
Expand All @@ -36,7 +27,7 @@
"description": "Maximum EIRP for this sub-band (optional; takes precedence over frequency plan's max-eirp)"
}
},
"required": ["index", "min-frequency", "max-frequency"]
"required": ["min-frequency", "max-frequency"]
}
},
"channels": {
Expand All @@ -46,10 +37,6 @@
"type": "object",
"additionalProperties": false,
"properties": {
"index": {
"type": "integer",
"description": "Index to override. If set to -1 all indexes will be overridden"
},
"uplink-frequency": {
"type": "integer",
"description": "Uplink frequency [Hz]"
Expand Down Expand Up @@ -77,7 +64,7 @@
"description": "Channel is defined by RP"
}
},
"required": ["index", "uplink-frequency", "min-data-rate", "max-data-rate", "radio"]
"required": ["uplink-frequency", "min-data-rate", "max-data-rate", "radio"]
}
},
"lora-standard-channel": {
Expand Down Expand Up @@ -183,10 +170,6 @@
"type": "object",
"additionalProperties": false,
"properties": {
"index": {
"type": "integer",
"description": "Index to override. If set to -1 all indexes will be overridden"
},
"enable": {
"type": "boolean",
"description": "Enable the radio"
Expand Down Expand Up @@ -227,7 +210,7 @@
"required": ["min-frequency", "max-frequency"]
}
},
"required": ["index", "enable", "chip-type", "frequency", "rssi-offset"]
"required": ["enable", "chip-type", "frequency", "rssi-offset"]
}
},
"clock-source": {
Expand All @@ -238,6 +221,5 @@
"type": "number",
"description": "Maximum EIRP (optional; used when sub-bands do not have max-eirp, takes precedence over band's default)"
}
},
"required": ["band-id", "sub-bands", "channels"]
}
}
2 changes: 1 addition & 1 deletion gateway/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"band-id": {
"type": "string",
"description": "ID of the band (needs to match band-id in the index)",
"enum": ["CN_470_510","CN_470_510_20_A","EU_863_870","IN_865_867","RU_864_870","AS_923_3","KR_920_923","AS_923","ISM_2400","AS_923_4","AU_915_928","MA_869_870_DRAFT","CN_779_787","CN_470_510_26_B","US_902_928","EU_433","CN_470_510_20_B","AS_923_2","CN_470_510_26_A"]
"enum": ["AS_923","AS_923_2","AS_923_3","AS_923_4","AU_915_928","CN_470_510","CN_470_510_20_A","CN_470_510_20_B","CN_470_510_26_A","CN_470_510_26_B","CN_779_787","EU_433","EU_863_870","IN_865_867","ISM_2400","KR_920_923","MA_869_870_DRAFT","RU_864_870","US_902_928"]
},
"sub-bands": {
"type": "array",
Expand Down
22 changes: 1 addition & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,31 @@ require (
)

require (
contrib.go.opencensus.io/exporter/prometheus v0.4.0 // indirect
github.com/TheThingsIndustries/protoc-gen-go-flags v1.0.0 // indirect
github.com/TheThingsIndustries/protoc-gen-go-json v1.4.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/envoyproxy/protoc-gen-validate v0.6.3 // indirect
github.com/go-kit/log v0.2.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/googleapis/gax-go v2.0.2+incompatible // indirect
github.com/gotnospirit/makeplural v0.0.0-20180622080156-a5f48d94d976 // indirect
github.com/gotnospirit/messageformat v0.0.0-20190719172517-c1d0bdacdea2 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.0.0-00010101000000-000000000000 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/prometheus/statsd_exporter v0.22.4 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.21.0 // indirect
gocloud.dev v0.20.0 // indirect
golang.org/x/exp v0.0.0-20220706164943-b4a6d9510983 // indirect
golang.org/x/image v0.1.0 // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
google.golang.org/grpc v1.46.2 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
)
Loading

0 comments on commit 623316b

Please sign in to comment.